winsmux 0.36.15 → 0.36.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/install.ps1 +32 -34
  2. package/package.json +1 -1
package/install.ps1 CHANGED
@@ -12,7 +12,7 @@ param(
12
12
  $ErrorActionPreference = 'Stop'
13
13
  [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
14
14
 
15
- $VERSION = "0.36.15"
15
+ $VERSION = "0.36.17"
16
16
  $WINSMUX_DIR = Join-Path $HOME ".winsmux"
17
17
  $BIN_DIR = Join-Path $WINSMUX_DIR "bin"
18
18
  $BACKUP_DIR = Join-Path $WINSMUX_DIR "backups"
@@ -325,45 +325,43 @@ function Install-WinsmuxBinary {
325
325
  throw "$assetName asset not found in release $($release.tag_name)"
326
326
  }
327
327
 
328
- Write-Status "Downloading $($asset.name) from $($release.tag_name)..."
329
- Invoke-RestMethod -Uri $asset.browser_download_url -Headers $headers -OutFile $winsmuxExe -ErrorAction Stop
330
-
331
328
  $sha256Asset = $release.assets | Where-Object { $_.name -eq "SHA256SUMS" } | Select-Object -First 1
332
329
  if (-not $sha256Asset) {
333
- Write-Warning "[winsmux] SHA256SUMS asset not found in release $($release.tag_name). Skipping checksum verification."
334
- } else {
335
- $checksumsPath = Join-Path ([System.IO.Path]::GetTempPath()) ("winsmux-" + [System.Guid]::NewGuid().ToString() + "-SHA256SUMS")
336
- try {
337
- Write-Status "Downloading $($sha256Asset.name) from $($release.tag_name)..."
338
- Invoke-RestMethod -Uri $sha256Asset.browser_download_url -Headers $headers -OutFile $checksumsPath -ErrorAction Stop
339
-
340
- $expectedHash = $null
341
- foreach ($line in Get-Content $checksumsPath) {
342
- if ($line -match '^(?<hash>[A-Fa-f0-9]{64})\s+\*?(?<name>.+)$') {
343
- if ($Matches.name -eq $asset.name) {
344
- $expectedHash = $Matches.hash.ToUpperInvariant()
345
- break
346
- }
347
- }
348
- }
330
+ throw "SHA256SUMS asset not found in release $($release.tag_name). Cannot verify $($asset.name)."
331
+ }
349
332
 
350
- if (-not $expectedHash) {
351
- Write-Warning "[winsmux] SHA256SUMS does not contain an entry for $($asset.name). Skipping checksum verification."
352
- } else {
353
- $actualHash = (Get-FileHash $winsmuxExe -Algorithm SHA256).Hash.ToUpperInvariant()
354
- if ($actualHash -ne $expectedHash) {
355
- throw "Checksum verification failed for $($asset.name)."
333
+ $downloadPath = Join-Path ([System.IO.Path]::GetTempPath()) ("winsmux-" + [System.Guid]::NewGuid().ToString() + "-" + $asset.name)
334
+ $checksumsPath = Join-Path ([System.IO.Path]::GetTempPath()) ("winsmux-" + [System.Guid]::NewGuid().ToString() + "-SHA256SUMS")
335
+ try {
336
+ Write-Status "Downloading $($asset.name) from $($release.tag_name)..."
337
+ Invoke-RestMethod -Uri $asset.browser_download_url -Headers $headers -OutFile $downloadPath -ErrorAction Stop
338
+
339
+ Write-Status "Downloading $($sha256Asset.name) from $($release.tag_name)..."
340
+ Invoke-RestMethod -Uri $sha256Asset.browser_download_url -Headers $headers -OutFile $checksumsPath -ErrorAction Stop
341
+
342
+ $expectedHash = $null
343
+ foreach ($line in Get-Content $checksumsPath) {
344
+ if ($line -match '^(?<hash>[A-Fa-f0-9]{64})\s+\*?(?<name>.+)$') {
345
+ if ($Matches.name -eq $asset.name) {
346
+ $expectedHash = $Matches.hash.ToUpperInvariant()
347
+ break
356
348
  }
357
- Write-Status "Checksum verified"
358
349
  }
359
- } catch {
360
- if ($_.Exception.Message -like "Checksum verification failed*") {
361
- throw
362
- }
363
- Write-Warning "[winsmux] Failed to verify checksum for $($asset.name): $_. Skipping checksum verification."
364
- } finally {
365
- Remove-Item $checksumsPath -Force -ErrorAction SilentlyContinue
366
350
  }
351
+
352
+ if (-not $expectedHash) {
353
+ throw "SHA256SUMS does not contain an entry for $($asset.name). Cannot verify release asset."
354
+ }
355
+
356
+ $actualHash = (Get-FileHash $downloadPath -Algorithm SHA256).Hash.ToUpperInvariant()
357
+ if ($actualHash -ne $expectedHash) {
358
+ throw "Checksum verification failed for $($asset.name)."
359
+ }
360
+ Write-Status "Checksum verified"
361
+ Move-Item -LiteralPath $downloadPath -Destination $winsmuxExe -Force
362
+ } finally {
363
+ Remove-Item $downloadPath -Force -ErrorAction SilentlyContinue
364
+ Remove-Item $checksumsPath -Force -ErrorAction SilentlyContinue
367
365
  }
368
366
 
369
367
  $userPath = [Environment]::GetEnvironmentVariable("Path", "User")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "winsmux",
3
- "version": "0.36.15",
3
+ "version": "0.36.17",
4
4
  "description": "Windows npm install surface for winsmux.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",