Skip to content

Commit ad48a68

Browse files
committed
feat: jdownloader auto
Signed-off-by: Mike Nguyen <[email protected]>
1 parent af85b7d commit ad48a68

File tree

7 files changed

+67
-17
lines changed

7 files changed

+67
-17
lines changed

.github/workflows/update.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ jobs:
3636
3737
- name: Install Chocolatey Core Extensions
3838
run: |
39-
choco install chocolatey-core.extension
39+
choco install -y chocolatey-core.extension
40+
41+
- name: Install Megatools
42+
run: |
43+
choco install -y megatools
4044
4145
- name: Install AU
4246
run: |
File renamed without changes.
File renamed without changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
VERIFICATION
2+
Verification is intended to assist the Chocolatey moderators and community
3+
in verifying that the contents of this package is trustworthy.
4+
5+
The installer has been downloaded from the official download link listed on <https://jdownloader.org/jdownloader2>
6+
and can be verified like this:
7+
8+
1. Download the following installers:
9+
url: EMPTY
10+
2. You can use one of the following methods to obtain the checksum
11+
- Use powershell function 'Get-Filehash'
12+
- Use chocolatey utility 'checksum.exe'
13+
14+
checksum type: sha256
15+
checksum64: EMPTY
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
$ErrorActionPreference = 'Stop'
2+
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
3+
4+
$packageArgs = @{
5+
packageName = $env:ChocolateyPackageName
6+
fileType = 'EXE'
7+
file = Get-Item "$toolsDir\*.exe"
8+
silentArgs = "-q"
9+
validExitCodes = @(0)
10+
}
11+
12+
Install-ChocolateyPackage @packageArgs

automatic/jdownloader/update.ps1

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
$ErrorActionPreference = 'Stop'
2+
Import-Module -Name 'au'
3+
4+
function global:au_SearchReplace {
5+
@{
6+
'.\tools\VERIFICATION.txt' = @{
7+
'(?i)(\s+url:).*' = "`${1} $($Latest.URL)"
8+
'(?i)(\s+checksum64:).*' = "`${1} $($Latest.Checksum64)"
9+
}
10+
}
11+
}
12+
13+
function global:au_AfterUpdate {
14+
Set-DescriptionFromReadme -SkipFirst 2
15+
}
16+
17+
function global:au_GetLatest {
18+
19+
$DownloadsPage = Invoke-WebRequest -UseBasicParsing -Uri 'https://jdownloader.org/jdownloader2'
20+
$MegaLink = ($DownloadsPage.Links | Where-Object -Property 'href' -Match 'https://mega.nz/file/')[0]
21+
22+
$InstallerPath = '.\tools\JDownloader2Setup.exe'
23+
$TempPath = $InstallerPath + '.tmp'
24+
megatools dl --no-progress --path="$TempPath" $MegaLink.href
25+
Move-Item -Path $TempPath -Destination $InstallerPath -Force
26+
$latestVersion = (Get-Item $InstallerPath).VersionInfo.ProductVersion
27+
$latestChecksum64 = (Get-FileHash -Path $InstallerPath -Algorithm 'SHA256').Hash
28+
29+
return @{
30+
Version = $latestVersion
31+
Checksum64 = $latestChecksum64
32+
}
33+
}
34+
35+
update -ChecksumFor none

manual/jdownloader/tools/chocolateyInstall.ps1

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)