Created
January 19, 2023 14:53
-
-
Save berkekbgz/58b86c496111e5cbbff7980a922758bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module BitsTransfer | |
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor [System.Net.SecurityProtocolType]::Tls12 | |
$repo = "nocab-transfer/nocab-desktop" | |
$signature = "signature-*.crt" | |
$msix = "nocab_desktop-win64-selfsigned_package.msix" | |
$releasesUrl = "https://api.github.com/repos/$repo/releases" | |
try { | |
Write-Host Determining latest release | |
$latestRelease = (Invoke-WebRequest -Uri $releasesUrl | ConvertFrom-Json)[0] | |
Write-Host Latest release is $latestRelease.tag_name | |
Write-Host Downloading Certificate | |
$certUrl = $latestRelease.assets | Where-Object { $_.name -Like $signature } | Select-Object -ExpandProperty browser_download_url | |
Start-BitsTransfer -Source $certUrl -Destination "$env:TEMP\nocab_cert.crt" | |
Write-Host Installing Certificate | |
Import-Certificate -FilePath "$env:TEMP\nocab_cert.crt" -CertStoreLocation cert:\LocalMachine\Root | |
Write-Host Downloading Msix | |
$msixUrl = $latestRelease.assets | Where-Object { $_.name -eq $msix } | Select-Object -ExpandProperty browser_download_url | |
Start-BitsTransfer -Source $msixUrl -Destination "$env:TEMP\nocab.msix" | |
Write-Host Installing Msix | |
Add-AppxPackage -Path "$env:TEMP\nocab.msix" | |
Write-Host Starting Nocab | |
start nocab | |
Write-Host Cleaning up | |
Remove-Item "$env:TEMP\nocab_cert.crt" | |
Remove-Item "$env:TEMP\nocab.msix" | |
} catch { | |
Write-Error $_ | |
Return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment