From 35fc72229ba9440acf5e669a1fb0d4ac017bba0e Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Fri, 5 Dec 2025 18:53:52 +0100 Subject: [PATCH] Add Thunderbird native messaging host support Register native messaging host for Thunderbird in addition to Firefox. --- Makefile | 44 ++++++++++++++++++++++++++++++--- browser-files/firefox-host.json | 2 +- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9805025..58aec43 100644 --- a/Makefile +++ b/Makefile @@ -131,9 +131,9 @@ install: $(INSTALL) -Dm644 -t "$(SHARE_DIR)/licenses/browserpass/" LICENSE $(INSTALL) -Dm644 -t "$(SHARE_DIR)/doc/browserpass/" README.md - $(INSTALL) -Dm644 browser-files/chromium-host.json "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" - $(INSTALL) -Dm644 browser-files/chromium-policy.json "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" - $(INSTALL) -Dm644 browser-files/firefox-host.json "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" + $(INSTALL) -Dm644 browser-files/chromium-host.json "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" + $(INSTALL) -Dm644 browser-files/chromium-policy.json "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" + $(INSTALL) -Dm644 browser-files/firefox-host.json "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" # Browser-specific hosts targets @@ -545,6 +545,44 @@ hosts-librewolf-user: ;; \ esac +.PHONY: hosts-thunderbird +hosts-thunderbird: + @case $(OS) in \ + Linux) \ + mkdir -p "$(LIB_DIR)/mozilla/native-messaging-hosts/"; \ + ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "/usr/lib/mozilla/native-messaging-hosts/$(APP_ID).json"; \ + [ -e "/usr/lib/mozilla/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \ + ;; \ + Darwin) \ + mkdir -p "/Library/Application Support/Mozilla/NativeMessagingHosts/"; \ + ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "/Library/Application Support/Mozilla/NativeMessagingHosts/$(APP_ID).json"; \ + [ -e "/Library/Application Support/Mozilla/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \ + ;; \ + *) \ + echo "The operating system $(OS) is not supported"; \ + exit 1; \ + ;; \ + esac + +.PHONY: hosts-thunderbird-user +hosts-thunderbird-user: + @case $(OS) in \ + Linux|*BSD|DragonFly) \ + mkdir -p "${HOME}/.thunderbird/native-messaging-hosts/"; \ + ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "${HOME}/.thunderbird/native-messaging-hosts/$(APP_ID).json"; \ + [ -e "${HOME}/.thunderbird/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \ + ;; \ + Darwin) \ + mkdir -p "${HOME}/Library/Application Support/Thunderbird/NativeMessagingHosts/"; \ + ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "${HOME}/Library/Application Support/Thunderbird/NativeMessagingHosts/$(APP_ID).json"; \ + [ -e "${HOME}/Library/Application Support/Thunderbird/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \ + ;; \ + *) \ + echo "The operating system $(OS) is not supported"; \ + exit 1; \ + ;; \ + esac + .PHONY: hosts-waterfox hosts-waterfox: @case $(OS) in \ diff --git a/browser-files/firefox-host.json b/browser-files/firefox-host.json index 571344a..9cf585b 100644 --- a/browser-files/firefox-host.json +++ b/browser-files/firefox-host.json @@ -1,6 +1,6 @@ { "name": "com.github.browserpass.native", - "description": "Browserpass native component for the Firefox extension", + "description": "Browserpass native component for the Firefox and Thunderbird extension", "path": "%%replace%%", "type": "stdio", "allowed_extensions": ["browserpass@maximbaz.com"]