Skip to content

Commit 3b9cc5d

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

File tree

6 files changed

+54
-5
lines changed

6 files changed

+54
-5
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

manual/jdownloader/tools/chocolateyInstall.ps1 renamed to automatic/jdownloader/tools/chocolateyInstall.ps1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
$ErrorActionPreference = 'Stop'
2+
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
23

34
$packageArgs = @{
45
packageName = $env:ChocolateyPackageName
56
fileType = 'EXE'
6-
url = 'https://installer.jdownloader.org/JD2SilentSetup_x86.exe'
7-
checksum = '44a43ca37cffd3ee30f06dba4117e8b2a10682cf6ee7bd217cd0133c6d9806bb'
8-
checksumType = 'SHA256'
9-
url64 = 'https://installer.jdownloader.org/JD2SilentSetup_x64.exe'
7+
file = Get-Item "$toolsDir\*.exe"
108
checksum64 = 'd08732950ee05f0aa7c346bb3cbe04195374a2949c01588955e2128d544722b6'
119
checksumType64 = 'SHA256'
1210
silentArgs = "-q"

automatic/jdownloader/update.ps1

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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.MegaUrl)"
8+
'(?i)(\s+checksum64:).*' = "`${1} $($Latest.Checksum64)"
9+
}
10+
}
11+
}
12+
13+
function global:au_GetLatest {
14+
15+
16+
$InstallerPath = '.\tools\JDownloader2Setup.exe'
17+
$TempPath = $InstallerPath + '.tmp'
18+
megatools dl --no-progress --path="$TempPath" $Latest.MegaUrl
19+
Move-Item -Path $TempPath -Destination $InstallerPath -Force
20+
$Latest.Version = (Get-Item $InstallerPath).VersionInfo.ProductVersion
21+
$Latest.Checksum64 = (Get-FileHash -Path $InstallerPath -Algorithm 'SHA256').Hash
22+
23+
$DownloadsPage = Invoke-WebRequest -UseBasicParsing -Uri 'https://jdownloader.org/jdownloader2'
24+
$MegaLink = ($DownloadsPage.Links | Where-Object -Property 'href' -Match 'https://mega.nz/file/')[0]
25+
26+
@{
27+
Version = [regex]::Match($MegaLink.outerHTML, 'v((?:\d+.){1,3}\d+)').Groups[1].Value
28+
MegaUrl = $MegaLink.href
29+
}
30+
}
31+
32+
update -ChecksumFor none

0 commit comments

Comments
 (0)