Linux: browser helper for snap Firefox; packages register it
Snap Firefox starts the helper through the desktop portal, which reads the manifest from ~/.mozilla or /usr/lib/mozilla. The .deb and .rpm now install the manifests system-wide, and install.sh detects snap Firefox. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -27,5 +27,9 @@ native-messaging/install.sh --uninstall
|
||||
| Firefox | `~/.mozilla/native-messaging-hosts/app.kestrove.nmh.json` | `HKCU\Software\Mozilla\NativeMessagingHosts\app.kestrove.nmh` |
|
||||
| Brave | `~/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts/` | same key as Chrome |
|
||||
|
||||
The Linux `.deb` and `.rpm` install these manifests system-wide (`src-tauri/linux/`), so they need no script. That
|
||||
covers snap Firefox too: it can't start the host itself, so the desktop portal does, after asking the user once.
|
||||
AppImage users run `install.sh`.
|
||||
|
||||
`allowed_origins` / `allowed_extensions` pin the host to **your** extension id.
|
||||
That is the first line of defense against other extensions (docs/04 A8).
|
||||
|
||||
@@ -84,6 +84,10 @@ esac
|
||||
eval "d=\$dir_$b"
|
||||
[ -d "$d" ] && BROWSERS="$BROWSERS $b"
|
||||
done
|
||||
# Snap Firefox keeps its profile in ~/snap, but its portal reads the host from ~/.mozilla like any other Firefox.
|
||||
case " $BROWSERS " in *" firefox "*) ;; *)
|
||||
[ -n "$USER_DATA_DIR" ] || { [ -d /snap/firefox ] && BROWSERS="$BROWSERS firefox"; } || true ;;
|
||||
esac
|
||||
|
||||
render() { # template → stdout
|
||||
sed -e "s|__NMH_PATH__|$NMH|" -e "s|chrome-extension://__CHROME_EXTENSION_ID__/|$CHROME_ORIGINS|" -e "s|__FIREFOX_EXTENSION_ID__|$FIREFOX_ID|" "$HERE/$HOST.$1.json"
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "app.kestrove.nmh",
|
||||
"description": "Kestrove native messaging host",
|
||||
"path": "/usr/bin/kestrove-nmh",
|
||||
"type": "stdio",
|
||||
"allowed_origins": ["chrome-extension://pmhfoafjoogobhfadaicklhkldgnafmk/", "chrome-extension://kogapfibnnpeapfcjkkpgjddbhnjfein/"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "app.kestrove.nmh",
|
||||
"description": "Kestrove native messaging host",
|
||||
"path": "/usr/bin/kestrove-nmh",
|
||||
"type": "stdio",
|
||||
"allowed_extensions": ["[email protected]"]
|
||||
}
|
||||
@@ -41,6 +41,24 @@
|
||||
"icons/icon.ico",
|
||||
"icons/icon.png"
|
||||
],
|
||||
"linux": {
|
||||
"deb": {
|
||||
"files": {
|
||||
"/usr/lib/mozilla/native-messaging-hosts/app.kestrove.nmh.json": "linux/app.kestrove.nmh.firefox.json",
|
||||
"/etc/opt/chrome/native-messaging-hosts/app.kestrove.nmh.json": "linux/app.kestrove.nmh.chrome.json",
|
||||
"/etc/chromium/native-messaging-hosts/app.kestrove.nmh.json": "linux/app.kestrove.nmh.chrome.json",
|
||||
"/etc/opt/edge/native-messaging-hosts/app.kestrove.nmh.json": "linux/app.kestrove.nmh.chrome.json"
|
||||
}
|
||||
},
|
||||
"rpm": {
|
||||
"files": {
|
||||
"/usr/lib/mozilla/native-messaging-hosts/app.kestrove.nmh.json": "linux/app.kestrove.nmh.firefox.json",
|
||||
"/etc/opt/chrome/native-messaging-hosts/app.kestrove.nmh.json": "linux/app.kestrove.nmh.chrome.json",
|
||||
"/etc/chromium/native-messaging-hosts/app.kestrove.nmh.json": "linux/app.kestrove.nmh.chrome.json",
|
||||
"/etc/opt/edge/native-messaging-hosts/app.kestrove.nmh.json": "linux/app.kestrove.nmh.chrome.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"windows": {
|
||||
"nsis": {
|
||||
"installerHooks": "windows/hooks.nsh",
|
||||
|
||||
Reference in New Issue
Block a user