51 lines
2.0 KiB
PowerShell
Executable File
51 lines
2.0 KiB
PowerShell
Executable File
# Registers usher as a Firefox/LibreWolf native messaging host on Windows
|
|
# for the current user. No admin elevation required — installs to
|
|
# $env:LOCALAPPDATA\Vestibule and registers under HKCU.
|
|
#
|
|
# After running this script, restart LibreWolf and load the extension from
|
|
# about:debugging to verify usher connects (check the Browser Console:
|
|
# Ctrl+Shift+J).
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$hostName = "com.vestibule.usher"
|
|
$extId = "vestibule@vestibule.kiosk"
|
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$projectRoot = Split-Path -Parent $scriptDir
|
|
$helperBin = Join-Path $projectRoot "helper\target\release\usher.exe"
|
|
|
|
if (-not (Test-Path $helperBin)) {
|
|
Write-Error "usher.exe not found at $helperBin"
|
|
Write-Host " Build it first: cd helper; cargo build --release"
|
|
exit 1
|
|
}
|
|
|
|
# Install location: %LOCALAPPDATA%\Vestibule (no admin needed)
|
|
$installDir = Join-Path $env:LOCALAPPDATA "Vestibule"
|
|
New-Item -ItemType Directory -Force -Path $installDir | Out-Null
|
|
$destExe = Join-Path $installDir "usher.exe"
|
|
Copy-Item $helperBin $destExe -Force
|
|
Write-Host "installed binary: $destExe"
|
|
|
|
# Generate manifest JSON with the correct path
|
|
$manifest = @{
|
|
name = $hostName
|
|
description = "Vestibule native helper"
|
|
path = $destExe
|
|
type = "stdio"
|
|
allowed_extensions = @($extId)
|
|
}
|
|
$manifestPath = Join-Path $installDir "$hostName.json"
|
|
$manifest | ConvertTo-Json -Depth 5 | Set-Content $manifestPath -Encoding UTF8
|
|
Write-Host "manifest: $manifestPath"
|
|
|
|
# Register in registry under HKCU (no admin needed)
|
|
# LibreWolf reads from HKCU\Software\Mozilla\NativeMessagingHosts\<name>
|
|
$regKey = "HKCU:\Software\Mozilla\NativeMessagingHosts\$hostName"
|
|
if (-not (Test-Path $regKey)) { New-Item -Path $regKey -Force | Out-Null }
|
|
Set-ItemProperty -Path $regKey -Name "(default)" -Value $manifestPath
|
|
Write-Host "registry: $regKey -> $manifestPath"
|
|
|
|
Write-Host ""
|
|
Write-Host "Done. Restart LibreWolf, load the extension from about:debugging,"
|
|
Write-Host "and check the Browser Console (Ctrl+Shift+J) for '[vestibule] usher hello'."
|