Files
kestrove-desktop/src-tauri/windows/hooks.nsh
T
samiandClaude Opus 5.5 9dd43b76e9
ci / build (ubuntu-22.04) (push) Canceled after 0s
ci / build (windows-2025) (push) Canceled after 0s
ci / deny (push) Canceled after 0s
Windows installer: fix the Windows build and register the browser host
- main.rs: the Windows clipboard branch dropped the copy's Result (only the non-Windows branch was
  checked), which failed to compile for Windows; both now report a failed copy.
- windows/hooks.nsh: the NSIS installer writes the native messaging manifests next to kestrove-nmh.exe
  and registers them under HKCU for Chrome, Chromium, Edge, Brave, Vivaldi and Firefox; uninstall
  removes them. Per-user install.
- scripts/windows.sh: cross-build with cargo-xwin, compile the installer with NSIS 3.11 in a Debian 13
  container (Homebrew's makensis 3.13 crashes on macOS).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 19:32:06 +09:00

36 lines
2.3 KiB
NSIS

; Kestrove NSIS installer hooks (tauri.conf.json → bundle.windows.nsis.installerHooks).
; Registers the browser extension's native messaging host for the current user (HKCU, no admin), like
; native-messaging/install.ps1: a manifest next to kestrove-nmh.exe ("path" relative to the manifest, which
; Chrome and Firefox allow on Windows) and one registry key per browser.
; Extension ids: keep in sync with kestrove-apple/App/BrowserIntegration.swift (NativeHostRegistration).
!define KV_HOST "app.kestrove.nmh"
!define KV_CHROME_ORIGINS '"chrome-extension://kogapfibnnpeapfcjkkpgjddbhnjfein/"'
!define KV_FIREFOX_IDS '"[email protected]"'
!macro NSIS_HOOK_POSTINSTALL
FileOpen $0 "$INSTDIR\${KV_HOST}.chrome.json" w
FileWrite $0 '{"name": "${KV_HOST}", "description": "Kestrove", "path": "kestrove-nmh.exe", "type": "stdio", "allowed_origins": [${KV_CHROME_ORIGINS}]}'
FileClose $0
FileOpen $0 "$INSTDIR\${KV_HOST}.firefox.json" w
FileWrite $0 '{"name": "${KV_HOST}", "description": "Kestrove", "path": "kestrove-nmh.exe", "type": "stdio", "allowed_extensions": [${KV_FIREFOX_IDS}]}'
FileClose $0
WriteRegStr HKCU "Software\Google\Chrome\NativeMessagingHosts\${KV_HOST}" "" "$INSTDIR\${KV_HOST}.chrome.json"
WriteRegStr HKCU "Software\Chromium\NativeMessagingHosts\${KV_HOST}" "" "$INSTDIR\${KV_HOST}.chrome.json"
WriteRegStr HKCU "Software\Microsoft\Edge\NativeMessagingHosts\${KV_HOST}" "" "$INSTDIR\${KV_HOST}.chrome.json"
WriteRegStr HKCU "Software\BraveSoftware\Brave-Browser\NativeMessagingHosts\${KV_HOST}" "" "$INSTDIR\${KV_HOST}.chrome.json"
WriteRegStr HKCU "Software\Vivaldi\NativeMessagingHosts\${KV_HOST}" "" "$INSTDIR\${KV_HOST}.chrome.json"
WriteRegStr HKCU "Software\Mozilla\NativeMessagingHosts\${KV_HOST}" "" "$INSTDIR\${KV_HOST}.firefox.json"
!macroend
!macro NSIS_HOOK_PREUNINSTALL
DeleteRegKey HKCU "Software\Google\Chrome\NativeMessagingHosts\${KV_HOST}"
DeleteRegKey HKCU "Software\Chromium\NativeMessagingHosts\${KV_HOST}"
DeleteRegKey HKCU "Software\Microsoft\Edge\NativeMessagingHosts\${KV_HOST}"
DeleteRegKey HKCU "Software\BraveSoftware\Brave-Browser\NativeMessagingHosts\${KV_HOST}"
DeleteRegKey HKCU "Software\Vivaldi\NativeMessagingHosts\${KV_HOST}"
DeleteRegKey HKCU "Software\Mozilla\NativeMessagingHosts\${KV_HOST}"
Delete "$INSTDIR\${KV_HOST}.chrome.json"
Delete "$INSTDIR\${KV_HOST}.firefox.json"
!macroend