# APE Viewer installer for Windows PowerShell. # irm https://apeviewer.com/install.ps1 | iex # Downloads the latest APEViewerSetup.exe from the official GitHub release, checks its # SHA-256 against the digest GitHub publishes for that file, then starts the installer. & { $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 $release = Invoke-RestMethod -Uri 'https://api.github.com/repos/m1keyc/apeviewer/releases/latest' -Headers @{ 'User-Agent' = 'APE-Viewer-Installer' } $asset = $release.assets | Where-Object { $_.name -eq 'APEViewerSetup.exe' } | Select-Object -First 1 if (-not $asset) { throw 'The latest APE Viewer release has no APEViewerSetup.exe.' } $url = [string]$asset.browser_download_url if (-not $url.StartsWith('https://github.com/m1keyc/apeviewer/releases/download/')) { throw "Unexpected download address: $url" } $expected = ([string]$asset.digest -replace '^sha256:', '').ToLowerInvariant() if ($expected -notmatch '^[0-9a-f]{64}$') { throw 'The release has no SHA-256 checksum to check the download against.' } $dir = Join-Path $env:TEMP ('APEViewer-' + [guid]::NewGuid().ToString('N')) New-Item -ItemType Directory -Path $dir | Out-Null $file = Join-Path $dir 'APEViewerSetup.exe' try { Write-Host "Downloading APE Viewer $($release.tag_name)..." Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing $actual = (Get-FileHash -Algorithm SHA256 -LiteralPath $file).Hash.ToLowerInvariant() if ($actual -ne $expected) { throw 'The download does not match the published checksum. Nothing was installed.' } Write-Host 'Checksum OK. Opening the installer...' Start-Process -FilePath $file -Wait } finally { Remove-Item -LiteralPath $dir -Recurse -Force -ErrorAction SilentlyContinue } }