SHD Desktop public download instructions
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$windowsRoot = Split-Path -Parent $PSScriptRoot
|
||||
$project = Join-Path $windowsRoot 'SHD.Windows\SHD.Windows.csproj'
|
||||
$publishDir = Join-Path $windowsRoot 'publish'
|
||||
$distDir = Join-Path $windowsRoot 'dist'
|
||||
$bundleDir = Join-Path $distDir 'SHD-Windows-x64'
|
||||
$zipPath = Join-Path $distDir 'SHD-Windows-x64.zip'
|
||||
|
||||
if (Test-Path $publishDir) { Remove-Item $publishDir -Recurse -Force }
|
||||
if (Test-Path $bundleDir) { Remove-Item $bundleDir -Recurse -Force }
|
||||
New-Item -ItemType Directory -Path $publishDir -Force | Out-Null
|
||||
New-Item -ItemType Directory -Path $bundleDir -Force | Out-Null
|
||||
|
||||
dotnet publish $project -c Release -r win-x64 --self-contained true -p:PublishSingleFile=false -o $publishDir
|
||||
if ($LASTEXITCODE -ne 0) { throw 'dotnet publish failed.' }
|
||||
|
||||
Copy-Item (Join-Path $publishDir '*') $bundleDir -Recurse -Force
|
||||
Copy-Item (Join-Path $PSScriptRoot 'install.ps1') $bundleDir -Force
|
||||
Copy-Item (Join-Path $PSScriptRoot 'uninstall.ps1') $bundleDir -Force
|
||||
Copy-Item (Join-Path $windowsRoot 'README.md') $bundleDir -Force
|
||||
if (Test-Path $zipPath) { Remove-Item $zipPath -Force }
|
||||
Compress-Archive -Path (Join-Path $bundleDir '*') -DestinationPath $zipPath -CompressionLevel Optimal
|
||||
Write-Host "Created $zipPath"
|
||||
@@ -0,0 +1,43 @@
|
||||
param(
|
||||
[switch]$NoLaunch
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$bundleDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$sourceExe = Join-Path $bundleDir 'SHD.Windows.exe'
|
||||
if (-not (Test-Path $sourceExe)) {
|
||||
throw 'SHD.Windows.exe is missing. Extract the complete SHD-Windows-x64.zip before installing.'
|
||||
}
|
||||
|
||||
$installDir = Join-Path $env:LOCALAPPDATA 'Programs\SHD'
|
||||
New-Item -ItemType Directory -Path $installDir -Force | Out-Null
|
||||
$bundleFullPath = [System.IO.Path]::GetFullPath($bundleDir).TrimEnd('\')
|
||||
$installFullPath = [System.IO.Path]::GetFullPath($installDir).TrimEnd('\')
|
||||
if (-not $bundleFullPath.Equals($installFullPath, [System.StringComparison]::OrdinalIgnoreCase)) {
|
||||
Get-ChildItem -LiteralPath $bundleDir -Force | ForEach-Object {
|
||||
Copy-Item -LiteralPath $_.FullName -Destination $installDir -Recurse -Force
|
||||
}
|
||||
}
|
||||
|
||||
$installedExe = Join-Path $installDir 'SHD.Windows.exe'
|
||||
$protocolKey = 'HKCU:\Software\Classes\shd-auth'
|
||||
New-Item -Path $protocolKey -Force | Out-Null
|
||||
Set-Item -Path $protocolKey -Value 'URL:SHD Desktop authentication'
|
||||
New-ItemProperty -Path $protocolKey -Name 'URL Protocol' -Value '' -PropertyType String -Force | Out-Null
|
||||
$commandKey = Join-Path $protocolKey 'shell\open\command'
|
||||
New-Item -Path $commandKey -Force | Out-Null
|
||||
Set-Item -Path $commandKey -Value ('"{0}" "%1"' -f $installedExe)
|
||||
|
||||
$startMenuDir = Join-Path $env:APPDATA 'Microsoft\Windows\Start Menu\Programs\SHD'
|
||||
New-Item -ItemType Directory -Path $startMenuDir -Force | Out-Null
|
||||
$shortcutPath = Join-Path $startMenuDir 'SHD.lnk'
|
||||
$shell = New-Object -ComObject WScript.Shell
|
||||
$shortcut = $shell.CreateShortcut($shortcutPath)
|
||||
$shortcut.TargetPath = $installedExe
|
||||
$shortcut.WorkingDirectory = $installDir
|
||||
$shortcut.IconLocation = "$installedExe,0"
|
||||
$shortcut.Save()
|
||||
|
||||
Write-Host "SHD installed to $installDir"
|
||||
Write-Host 'The shd-auth:// callback is registered for passkey sign-in.'
|
||||
if (-not $NoLaunch) { Start-Process -FilePath $installedExe }
|
||||
@@ -0,0 +1,16 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$installDir = Join-Path $env:LOCALAPPDATA 'Programs\SHD'
|
||||
$startMenuDir = Join-Path $env:APPDATA 'Microsoft\Windows\Start Menu\Programs\SHD'
|
||||
$protocolKey = 'HKCU:\Software\Classes\shd-auth'
|
||||
|
||||
if (Test-Path $protocolKey) {
|
||||
$commandKey = Join-Path $protocolKey 'shell\open\command'
|
||||
$registeredCommand = if (Test-Path $commandKey) { (Get-Item -Path $commandKey).GetValue('') } else { '' }
|
||||
if ($registeredCommand -like '*\Programs\SHD\SHD.Windows.exe*') {
|
||||
Remove-Item -Path $protocolKey -Recurse -Force
|
||||
}
|
||||
}
|
||||
if (Test-Path $startMenuDir) { Remove-Item -Path $startMenuDir -Recurse -Force }
|
||||
if (Test-Path $installDir) { Remove-Item -Path $installDir -Recurse -Force -ErrorAction SilentlyContinue }
|
||||
|
||||
Write-Host 'SHD has been uninstalled. Your WebView profile and site data remain under %LOCALAPPDATA%\SHDDesktop.'
|
||||
Reference in New Issue
Block a user