PrintToVeraeTimeStamp/platform/windows/scripts/install-tray-startup.ps1
George Lambert 48da24a661 feat: 2026 brand UI — statuslang, tray/menubar, CERT pdf, site kit
- Brand receipt status strings (statuslang) for notify/queue
- Windows tray + Start Menu/Startup install; macOS menubar helper
- CERT-01 plum/gold PDF + multihash/blake3 when present
- printit.verae.ai brand kit, queue page, customer-auth helper
- verae-print pending/tray-status/menubar commands
2026-10-13 21:11:32 -04:00

91 lines
3.3 KiB
PowerShell

#Requires -Version 5.1
<#
.SYNOPSIS
Install or remove a Startup-folder shortcut for the Verae tray (PT-W3).
Package version stamped from internal/job.HelperVersion (no elevated MSI).
.DESCRIPTION
Creates %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\Verae Tray.lnk
that runs verae-tray.ps1 (NotifyIcon + GET /status). Not a full MSI product —
user-level login presence only. IPP POST is untouched.
.PARAMETER Uninstall
Remove the Startup shortcut instead of creating it.
.PARAMETER Addr
Helper loopback host:port passed to the tray (default 127.0.0.1:8631).
.PARAMETER TrayScript
Path to verae-tray.ps1. Default: same folder as this script.
.EXAMPLE
powershell -NoProfile -ExecutionPolicy Bypass -File install-tray-startup.ps1
powershell -NoProfile -ExecutionPolicy Bypass -File install-tray-startup.ps1 -Uninstall
verae-print menubar --install
#>
param(
[switch]$Uninstall,
[string]$Addr = $(if ($env:VERAE_IPP_ADDR) { $env:VERAE_IPP_ADDR } else { "127.0.0.1:8631" }),
[string]$TrayScript = ""
)
$ErrorActionPreference = "Stop"
# Package version = internal/job.HelperVersion (A4). No elevated MSI required.
$common = Join-Path $PSScriptRoot "common.ps1"
if (Test-Path -LiteralPath $common) { . $common }
if (Get-Command Get-VeraePackageVersion -ErrorAction SilentlyContinue) {
$PackageVersion = Get-VeraePackageVersion
} elseif ($env:VERSION -and $env:VERSION.Trim()) {
$PackageVersion = $env:VERSION.Trim()
} else {
$PackageVersion = "0.3.6"
}
$ShortcutName = "Verae Tray.lnk"
$StartupDir = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\Startup"
$ShortcutPath = Join-Path $StartupDir $ShortcutName
if ($Uninstall) {
if (Test-Path -LiteralPath $ShortcutPath) {
Remove-Item -LiteralPath $ShortcutPath -Force
Write-Host "Removed Startup shortcut: $ShortcutPath"
} else {
Write-Host "No Startup shortcut at: $ShortcutPath"
}
exit 0
}
if (-not $TrayScript) {
$TrayScript = Join-Path $PSScriptRoot "verae-tray.ps1"
}
if (-not (Test-Path -LiteralPath $TrayScript)) {
Write-Error "verae-tray.ps1 not found: $TrayScript"
}
$TrayScript = (Resolve-Path -LiteralPath $TrayScript).Path
New-Item -ItemType Directory -Force -Path $StartupDir | Out-Null
$psExe = Join-Path $env:WINDIR "System32\WindowsPowerShell\v1.0\powershell.exe"
if (-not (Test-Path $psExe)) { $psExe = "powershell.exe" }
$args = "-NoProfile -ExecutionPolicy Bypass -STA -WindowStyle Hidden -File `"$TrayScript`" -Addr $Addr"
$wsh = New-Object -ComObject WScript.Shell
$sc = $wsh.CreateShortcut($ShortcutPath)
$sc.TargetPath = $psExe
$sc.Arguments = $args
$sc.WorkingDirectory = Split-Path -Parent $TrayScript
$sc.WindowStyle = 7 # minimized
$sc.Description = "Verae Timestamping tray v$PackageVersion — polls GET /status; Open queue → /queue. Hold id ≠ evidence."
$sc.Save()
[System.Runtime.InteropServices.Marshal]::ReleaseComObject($wsh) | Out-Null
Write-Host "Installed Startup shortcut: $ShortcutPath"
Write-Host " Target: $psExe"
Write-Host " Script: $TrayScript"
Write-Host " Addr: $Addr"
Write-Host " Version: $PackageVersion (HelperVersion / package metadata)"
Write-Host "Tray starts at next login. Run now: verae-print menubar"
Write-Host "User-level Startup only — no elevated MSI. IPP POST untouched."
Write-Host "Only a final receipt is evidence — hold ids are local queue handles, not proof."