Choco missing hash fix

This commit is contained in:
Zarg 2025-01-16 06:39:05 +01:00
parent 79eac0c5ae
commit a51e29520c
5 changed files with 47 additions and 19 deletions

View file

@ -46,6 +46,8 @@
<li> <strong>Easy Addon Install</strong>: Just use the install Button like stremio v4, no need to copy paste urls</li>
<li>💼 <strong>Portable Version</strong>: Fully portable version including WebView2.</li>
<li>⚙️ <strong>App Settings</strong>: Customize options like CloseOnExit, PauseOnMinimize, and PauseOnLostFocus and more.</li>
<li>🔄 <strong>Built-in Autoupdate</strong>: Built-in autoupdater. No need to always download from GitHub.</li>
<li>📦 <strong>Scoop and Chocolatey</strong>: Support for Scoop and Choco for ease of use.</li>
</ul>
@ -67,7 +69,10 @@
scoop bucket add zarg https://github.com/zaarrg/scoop
scoop install stremio-desktop-v5
# Update
scoop update zarg
scoop update stremio-desktop-v5
# Uninstall
scoop uninstall stremio-desktop-v5
```
4. 🍫 **Chocolatey**
```shell
@ -75,6 +80,8 @@
choco install stremio-desktop-v5 -y
# Update
choco upgrade stremio-desktop-v5 -y
# Uninstall
choco uninstall stremio-desktop --yes
```

View file

@ -215,7 +215,7 @@ const [,, OPENSSL_BIN, GIT_TAG, SHELL_VERSION, SERVER_VERSION] = process.argv;
updateStremioNuspec(CHOCO_NUSPEC_PATH, SHELL_VERSION);
// 9) Update chocolateyinstall.ps1 URLs
updateChocolateyInstall(CHOCO_INSTALL_PS1_PATH, GIT_TAG, SHELL_VERSION);
updateChocolateyInstall(CHOCO_INSTALL_PS1_PATH, GIT_TAG, SHELL_VERSION, exeHash_x64, exeHash_x86);
// 10) Update the Scoop manifest (stremio-desktop-v5.json)
updateScoopManifest(SCOOP_MANIFEST_PATH, GIT_TAG, SHELL_VERSION, exeHash_x64, exeHash_x86);
@ -282,24 +282,33 @@ function updateStremioNuspec(nuspecPath, newVersion) {
}
// 9) Update chocolateyinstall.ps1 with new GIT_TAG + SHELL_VERSION in the URLs
function updateChocolateyInstall(ps1Path, gitTag, newVersion) {
function updateChocolateyInstall(ps1Path, gitTag, newVersion, hash64, hash86) {
checkFileExists(ps1Path, "chocolateyinstall.ps1");
let content = fs.readFileSync(ps1Path, "utf8");
// Regex for the 64-bit block:
const pattern64 = /(\[Environment\]::Is64BitOperatingSystem\)\s*\{\s*\$packageArgs\['url'\]\s*=\s*')([^']+)(')/m;
content = content.replace(pattern64,
`$1https://github.com/Zaarrg/stremio-desktop-v5/releases/download/${gitTag}/Stremio.${newVersion}-x64.exe$3`
);
// We'll build a single block that covers both if/else in one go.
const newBlock = `
if ([Environment]::Is64BitOperatingSystem) {
$packageArgs['url'] = 'https://github.com/Zaarrg/stremio-desktop-v5/releases/download/${gitTag}/Stremio.${newVersion}-x64.exe'
$packageArgs['checksum'] = '${hash64}'
$packageArgs['checksumType'] = 'sha256'
} else {
$packageArgs['url'] = 'https://github.com/Zaarrg/stremio-desktop-v5/releases/download/${gitTag}/Stremio.${newVersion}-x86.exe'
$packageArgs['checksum'] = '${hash86}'
$packageArgs['checksumType'] = 'sha256'
}
`;
// Regex for the 32-bit block:
const pattern86 = /(\}\s*else\s*\{\s*\$packageArgs\['url'\]\s*=\s*')([^']+)(')/m;
content = content.replace(pattern86,
`$1https://github.com/Zaarrg/stremio-desktop-v5/releases/download/${gitTag}/Stremio.${newVersion}-x86.exe$3`
);
// Regex to capture the entire if...else block (non-greedy):
// This should match from "if ([Environment]::Is64BitOperatingSystem) {"
// until the closing "}" of the else block.
const pattern = /if\s*\(\[Environment\]::Is64BitOperatingSystem\)\s*\{[\s\S]+?\}\s*else\s*\{[\s\S]+?\}/m;
// Replace the entire old block with newBlock
content = content.replace(pattern, newBlock.trim());
fs.writeFileSync(ps1Path, content, "utf8");
console.log(`Updated chocolateyinstall.ps1 URLs to version ${newVersion}`);
console.log(`Updated chocolateyinstall.ps1 with new version=${newVersion}, hash64=${hash64}, hash86=${hash86}`);
}
// 10) Update the Scoop manifest stremio-desktop-v5.json

View file

@ -9,6 +9,11 @@
<projectUrl>https://github.com/Zaarrg/stremio-desktop-v5</projectUrl>
<iconUrl>https://raw.githubusercontent.com/zaarrg/stremio-desktop-v5/webview-windows/images/stremio.png</iconUrl>
<description>Stremio Desktop v5 Community app with the latest Stremio web UI v5, built with WebView2</description>
<packageSourceUrl>https://github.com/Zaarrg/stremio-desktop-v5</packageSourceUrl>
<bugTrackerUrl>https://github.com/Zaarrg/stremio-desktop-v5/issues</bugTrackerUrl>
<docsUrl>https://github.com/Zaarrg/stremio-desktop-v5#-stremio-desktopcommunity</docsUrl>
<summary>Stremio Community build using WebView2. Supports latest features. Always up to date with Stremio web v5. Full MPV player support like local files, hdr, dolby atmos and dv content.</summary>
<releaseNotes>See https://github.com/Zaarrg/stremio-desktop-v5/releases for changes.</releaseNotes>
<tags>stremio video streaming media</tags>
<licenseUrl>https://github.com/Zaarrg/stremio-desktop-v5/blob/master/LICENSE</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>

View file

@ -1,16 +1,23 @@
$packageName = 'stremio-desktop-v5'
$toolsDir = Split-Path $MyInvocation.MyCommand.Definition
$packageArgs = @{
packageName = $packageName
fileType = 'exe'
silentArgs = '/S'
validExitCodes= @(0)
packageName = $packageName
fileType = 'exe'
silentArgs = '/S'
validExitCodes = @(0)
}
if ([Environment]::Is64BitOperatingSystem) {
$packageArgs['url'] = 'https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.8/Stremio.5.0.8-x64.exe'
$packageArgs['url'] = 'https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.8/Stremio.5.0.8-x64.exe'
$packageArgs['checksum'] = 'a8228526cbbbffa1265b437109f6d570f31705bae71eb2be11192b02a0bff1ba'
$packageArgs['checksumType'] = 'sha256'
} else {
$packageArgs['url'] = 'https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.8/Stremio.5.0.8-x86.exe'
$packageArgs['url'] = 'https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.8/Stremio.5.0.8-x86.exe'
$packageArgs['checksum'] = '84cca8fcc6635792e273af3220db505024c7f36aef4d8ae588ef895a5ff9fc3d'
$packageArgs['checksumType'] = 'sha256'
}
Install-ChocolateyPackage @packageArgs