Linux + iPhone Continuity / iMessage / SMS
feat: add appimage packaging and release
Zack Bartel11a88f5130fc
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex e653205..9969525 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -64,8 +64,38 @@ jobs:build/release/*.tar.gzif-no-files-found: error+ appimage:+ runs-on: ubuntu-latest+ # oldest glibc tether supports+ container: ubuntu:24.04+ steps:+ - name: bootstrap git+ run: |+ apt-get update+ apt-get install -y --no-install-recommends git ca-certificates curl file++ - uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - run: git config --global --add safe.directory "$GITHUB_WORKSPACE"++ - name: dependencies+ run: |+ ./scripts/ci-deps.sh+ apt-get install -y --no-install-recommends bluez patchelf librsvg2-common desktop-file-utils++ - name: build+ run: ./packaging/appimage/build.sh++ - uses: actions/upload-artifact@v4+ with:+ name: appimage+ path: build/appimage/*.AppImage+ if-no-files-found: error+release:- needs: package+ needs: [package, appimage]runs-on: ubuntu-lateststeps:- uses: actions/download-artifact@v4diff --git a/CMakeLists.txt b/CMakeLists.txtindex 6e22d12..c0e0477 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -97,6 +97,16 @@ configure_file(install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/tether-native-host"DESTINATION ${CMAKE_INSTALL_BINDIR})+# embed files only the distro packages can install, so portable build can write them out at runtime.+file(READ "${CMAKE_CURRENT_SOURCE_DIR}/packaging/systemd/[email protected]" BTCLASS_UNIT)+file(READ "${CMAKE_CURRENT_BINARY_DIR}/com.tether.extension.chrome.json" CHROME_MANIFEST)+file(READ "${CMAKE_CURRENT_BINARY_DIR}/com.tether.extension.mozilla.json" MOZILLA_MANIFEST)+configure_file(+ "${CMAKE_CURRENT_SOURCE_DIR}/src/core/include/tether/packaging.hpp.in"+ "${CMAKE_CURRENT_BINARY_DIR}/generated/tether/packaging.hpp"+ @ONLY+)+# native messaging manifestsset(CHROME_MESSAGING_DIR "/etc/chromium/native-messaging-hosts" CACHE PATH "Chrome native messaging hosts directory")set(GOOGLE_CHROME_MESSAGING_DIR "/etc/opt/chrome/native-messaging-hosts" CACHE PATH "Google Chrome native messaging hosts directory")diff --git a/README.md b/README.mdindex e291bf7..690a086 100644--- a/README.md+++ b/README.md@@ -78,6 +78,22 @@ The extension communicates with `tetherd` via native messaging. This allows user### Mail Extension- Thunderbird: [Tether Mail Extension](https://addons.thunderbird.net/en-US/thunderbird/addon/tether-mail-extension/)+### AppImage++One file, no install, for distros without a package and for immutable systems.+Download `tether-<version>-x86_64.AppImage` from the+[releases page](https://github.com/zackb/tether/releases), then:++```bash+chmod +x tether-*-x86_64.AppImage+./tether-*-x86_64.AppImage # the GTK app+./tether-*-x86_64.AppImage --bt-setup # the CLI, same binary+./tether-*-x86_64.AppImage --install-extension-host # if you use the browser or mail extension+```++Requires glibc 2.39 or newer (Fedora 40+, Ubuntu 24.04+, Arch, not Debian 12).+`--install-extension-host` writes the native messaging manifests into your browser and mail client directories+### Arch Linux```bashdiff --git a/docs/BLUETOOTH.md b/docs/BLUETOOTH.mdindex 1c9df65..f7732f0 100644--- a/docs/BLUETOOTH.md+++ b/docs/BLUETOOTH.md@@ -68,6 +68,10 @@ It is shipped to `/usr/share` rather than installed intothe package lands, and changing how `bluetoothd` runs for the whole machine isthe user's decision.+A portable build (the AppImage) installs neither the drop-in nor the unit, since+its files live on a mount that goes away with the process. `--bt-setup` prints+commands that write both out inline instead.+Without it `bluetoothd` still registers `org.bluez.Bearer.LE1`, but as an emptymarker: no properties, no `Connect()`. So the interface being present is notevidence the API is available, and code that reads it that way sees an LE bearerdiff --git a/docs/man/man1/tether.1.in b/docs/man/man1/tether.1.inindex f9f636e..a558c64 100644--- a/docs/man/man1/tether.1.in+++ b/docs/man/man1/tether.1.in@@ -49,6 +49,12 @@ Accept a pending pairing request locally for the specified device fingerprint..TP\fB\-\-pair\fRSend a pairing request over TCP to the daemon.+.TP+\fB\-\-install-extension-host\fR+Install the browser and mail extension's native messaging manifests into this+user's Firefox, Thunderbird, and Chromium directories, pointing at a wrapper in+\fB~/.local/bin\fR. Needed only for a portable build such as the AppImage; the+distro packages install the manifests system\-wide..SH BLUETOOTH OPTIONSBluetooth carries iPhone messages (MAP), contacts (PBAP), and notificationmirroring (ANCS). It is independent of the Wi-Fi pairing above.@@ -58,7 +64,8 @@ Show the one-time system setup Bluetooth still needs, with the command for eachstep. Nothing is applied: the steps change how the machine behaves overBluetooth outside Tether, so running them is left to the user. One step enables\fBtether-btclass@\fR\fIADAPTER\fR\fB.service\fR, which is installed by the-package but never enabled for you.+package but never enabled for you. A portable build installs neither file, so+the printed commands write them out instead..TP\fB\-\-bt-status\fRShow Bluetooth adapter capability and delivery mode.diff --git a/packaging/appimage/AppRun b/packaging/appimage/AppRunnew file mode 100755index 0000000..1bf9e15--- /dev/null+++ b/packaging/appimage/AppRun@@ -0,0 +1,30 @@+#!/bin/sh++# One AppImage has all of the binaries: GTK app, CLI, daemon and the pairing dialog.++HERE=$(dirname "$(readlink -f "$0")")+export APPDIR="${APPDIR:-$HERE}"++# linuxdeploy plugins environment here (GTK_PATH, pixbuf modules).+for hook in "$APPDIR"/apprun-hooks/*.sh; do+ if [ -r "$hook" ]; then+ . "$hook"+ fi+done++# tetherd and tether-dialog are found as siblings of the running binary+export PATH="$APPDIR/usr/bin:$PATH"+export TETHER_LOCALEDIR="$APPDIR/usr/share/locale"++case "${1-}" in+ --daemon)+ shift+ exec "$APPDIR/usr/bin/tetherd" "$@"+ ;;+ "" | --tray | --devices | --messages | --notifications | --thread | --thread=*)+ exec "$APPDIR/usr/bin/tether-gtk" "$@"+ ;;+ *)+ exec "$APPDIR/usr/bin/tether" "$@"+ ;;+esacdiff --git a/packaging/appimage/build.sh b/packaging/appimage/build.shnew file mode 100755index 0000000..e25463e--- /dev/null+++ b/packaging/appimage/build.sh@@ -0,0 +1,60 @@+#!/bin/bash+# Build a portable AppImage of tether: GTK app, CLI, daemon and pairing dialog+# in one file.+#+# ./packaging/appimage/build.sh+#+# Build it on the oldest glibc we can++set -euo pipefail++ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)+BUILD_DIR=${BUILD_DIR:-$ROOT/build/appimage}+APPDIR=$BUILD_DIR/AppDir+ARCH=${ARCH:-$(uname -m)}+TOOLS=${TOOLS:-$BUILD_DIR/tools}++# AppImages cannot mount themselves inside a container without FUSE.+export APPIMAGE_EXTRACT_AND_RUN=1++cmake -B "$BUILD_DIR" -S "$ROOT" -G Ninja \+ -DCMAKE_BUILD_TYPE=Release \+ -DCMAKE_INSTALL_PREFIX=/usr+cmake --build "$BUILD_DIR"++rm -rf "$APPDIR"+DESTDIR="$APPDIR" cmake --install "$BUILD_DIR"++VERSION=$("$APPDIR/usr/bin/tether" --version | awk '{print $2}')++# --bt-status reads Secure Connections through btmgmt, and a host without+# bluez-utils has none.+if BTMGMT=$(command -v btmgmt); then+ cp "$BTMGMT" "$APPDIR/usr/bin/"+else+ echo "warning: btmgmt not found, Secure Connections will report as unknown" >&2+fi++mkdir -p "$TOOLS"+fetch() {+ [ -x "$TOOLS/$1" ] && return 0+ curl -fsSL -o "$TOOLS/$1" "$2"+ chmod +x "$TOOLS/$1"+}+fetch linuxdeploy \+ "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${ARCH}.AppImage"+fetch linuxdeploy-plugin-gtk.sh \+ "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh"++export PATH="$TOOLS:$PATH"+export OUTPUT="tether-${VERSION}-${ARCH}.AppImage"++cd "$BUILD_DIR"+linuxdeploy --appdir "$APPDIR" \+ --plugin gtk \+ --custom-apprun "$ROOT/packaging/appimage/AppRun" \+ --desktop-file "$APPDIR/usr/share/applications/tether-gtk.desktop" \+ --icon-file "$APPDIR/usr/share/icons/hicolor/256x256/apps/tether.png" \+ --output appimage++echo "==> $BUILD_DIR/$OUTPUT"diff --git a/po/cs.po b/po/cs.poindex f40e356..e4697a4 100644--- a/po/cs.po+++ b/po/cs.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Czech\n"@@ -143,6 +143,16 @@ msgstr "Vypsat zrcadlená oznámení z iPhonu."msgid "Print a redacted Bluetooth report for a bug report."msgstr "Vypsat očištěnou zprávu o Bluetooth pro hlášení chyby."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"Nainstaluje manifesty nativního zasílání zpráv rozšíření pro prohlížeč a "+"poštu pro tohoto uživatele. Potřeba jen u přenosných sestavení; distribuční "+"balíčky je instalují pro celý systém."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "Přijmout čekající žádost o spárování místně."@@ -163,6 +173,30 @@ msgstr "Volby:"msgid "Examples:"msgstr "Příklady:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "Nainstalováno %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"Pro tohoto uživatele nebyl nalezen žádný profil prohlížeče ani poštovního "+"klienta, takže se nic nenainstalovalo. Spusťte jednou Firefox, Thunderbird "+"nebo Chromium a zkuste to znovu.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"Restartujte prohlížeč nebo poštovního klienta, aby se změna projevila.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "Nepodařilo se načíst stav Bluetooth od démona.\n"diff --git a/po/de.po b/po/de.poindex 08446fc..8b55cb1 100644--- a/po/de.po+++ b/po/de.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-22\n""Last-Translator: Tether project\n""Language-Team: German\n"@@ -144,6 +144,16 @@ msgstr "Gespiegelte iPhone-Mitteilungen auflisten."msgid "Print a redacted Bluetooth report for a bug report."msgstr "Einen bereinigten Bluetooth-Bericht für Fehlermeldungen ausgeben."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"Installiert die Native-Messaging-Manifeste der Browser- und Mail-Erweiterung "+"für diesen Benutzer. Nur für portable Builds nötig; die Distributionspakete "+"installieren sie systemweit."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "Eine ausstehende Kopplungsanfrage lokal annehmen."@@ -164,6 +174,30 @@ msgstr "Optionen:"msgid "Examples:"msgstr "Beispiele:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "Installiert: %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"Für diesen Benutzer wurde kein Browser- oder Mail-Profil gefunden, daher "+"wurde nichts installiert. Starte Firefox, Thunderbird oder Chromium einmal "+"und führe dies erneut aus.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"Starte den Browser oder das Mail-Programm neu, damit es übernommen wird.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "Der Bluetooth-Status konnte nicht vom Daemon gelesen werden.\n"diff --git a/po/es.po b/po/es.poindex 83e91c9..74fd606 100644--- a/po/es.po+++ b/po/es.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-22\n""Last-Translator: Tether project\n""Language-Team: Spanish\n"@@ -144,6 +144,16 @@ msgstr "Listar las notificaciones duplicadas del iPhone."msgid "Print a redacted Bluetooth report for a bug report."msgstr "Imprimir un informe Bluetooth redactado para un informe de error."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"Instala los manifiestos de mensajería nativa de la extensión de navegador y "+"de correo para este usuario. Solo es necesario en compilaciones portables; "+"los paquetes de la distribución los instalan para todo el sistema."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "Aceptar localmente una solicitud de emparejamiento pendiente."@@ -164,6 +174,30 @@ msgstr "Opciones:"msgid "Examples:"msgstr "Ejemplos:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "Instalado %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"No se encontró ningún perfil de navegador ni de cliente de correo para este "+"usuario, así que no se instaló nada. Abre Firefox, Thunderbird o Chromium "+"una vez y vuelve a ejecutar esto.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"Reinicia el navegador o el cliente de correo para que lo detecte.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "No se pudo leer el estado de Bluetooth del daemon.\n"diff --git a/po/fr.po b/po/fr.poindex ec86f1b..7c8ebe1 100644--- a/po/fr.po+++ b/po/fr.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-22\n""Last-Translator: Tether project\n""Language-Team: French\n"@@ -147,6 +147,17 @@ msgstr "Lister les notifications dupliquées de l'iPhone."msgid "Print a redacted Bluetooth report for a bug report."msgstr "Afficher un rapport Bluetooth expurgé pour un rapport de bogue."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"Installe les manifestes de messagerie native de l'extension navigateur et "+"courrier pour cet utilisateur. Nécessaire uniquement pour les versions "+"portables ; les paquets de la distribution les installent pour tout le "+"système."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "Accepter localement une demande d'appairage en attente."@@ -167,6 +178,31 @@ msgstr "Options :"msgid "Examples:"msgstr "Exemples :"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "Installé %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"Aucun profil de navigateur ou de client de messagerie n'a été trouvé pour "+"cet utilisateur, rien n'a donc été installé. Lancez Firefox, Thunderbird ou "+"Chromium une fois, puis relancez cette commande.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"Redémarrez le navigateur ou le client de messagerie pour qu'il en tienne "+"compte.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "Impossible de lire l'état Bluetooth depuis le démon.\n"diff --git a/po/it.po b/po/it.poindex fb501ab..6d5dab0 100644--- a/po/it.po+++ b/po/it.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Italian\n"@@ -145,6 +145,16 @@ msgstr "Elenca le notifiche dell'iPhone rispecchiate."msgid "Print a redacted Bluetooth report for a bug report."msgstr "Stampa un rapporto Bluetooth epurato per una segnalazione di errore."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"Installa i manifest di messaggistica nativa dell'estensione per browser e "+"posta per questo utente. Serve solo alle build portabili; i pacchetti della "+"distribuzione li installano a livello di sistema."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "Accetta localmente una richiesta di accoppiamento in sospeso."@@ -165,6 +175,30 @@ msgstr "Opzioni:"msgid "Examples:"msgstr "Esempi:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "Installato %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"Non è stato trovato alcun profilo di browser o client di posta per questo "+"utente, quindi non è stato installato nulla. Avvia una volta Firefox, "+"Thunderbird o Chromium e riprova.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"Riavvia il browser o il client di posta per applicare la modifica.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "Impossibile leggere lo stato Bluetooth dal daemon.\n"diff --git a/po/ja.po b/po/ja.poindex 97e5ba9..ce11e68 100644--- a/po/ja.po+++ b/po/ja.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Japanese\n"@@ -143,6 +143,16 @@ msgstr "ミラーリングされた iPhone の通知を一覧表示します。"msgid "Print a redacted Bluetooth report for a bug report."msgstr "バグ報告用に情報を伏せた Bluetooth レポートを出力します。"+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"ブラウザーおよびメール拡張機能のネイティブメッセージングマニフェストをこの"+"ユーザー用にインストールします。ポータブルビルドでのみ必要です。ディストリ"+"ビューションのパッケージはシステム全体にインストールします。"+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "保留中のペアリング要求をローカルで承認します。"@@ -163,6 +173,30 @@ msgstr "オプション:"msgid "Examples:"msgstr "例:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "インストールしました: %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"このユーザーのブラウザーまたはメールクライアントのプロファイルが見つからな"+"かったため、何もインストールされませんでした。Firefox、Thunderbird、または "+"Chromium を一度起動してから、もう一度実行してください。\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"反映するにはブラウザーまたはメールクライアントを再起動してください。\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "デーモンから Bluetooth の状態を読み取れませんでした。\n"diff --git a/po/ko.po b/po/ko.poindex 94f1488..f99fc19 100644--- a/po/ko.po+++ b/po/ko.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Korean\n"@@ -142,6 +142,16 @@ msgstr "미러링된 iPhone 알림을 나열합니다."msgid "Print a redacted Bluetooth report for a bug report."msgstr "버그 리포트용으로 민감 정보를 가린 Bluetooth 보고서를 출력합니다."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"브라우저 및 메일 확장 프로그램의 네이티브 메시징 매니페스트를 이 사용자에게 "+"설치합니다. 휴대용 빌드에만 필요하며, 배포판 패키지는 시스템 전체에 설치합니"+"다."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "대기 중인 페어링 요청을 로컬에서 수락합니다."@@ -162,6 +172,30 @@ msgstr "옵션:"msgid "Examples:"msgstr "예제:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "설치함: %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"이 사용자의 브라우저나 메일 클라이언트 프로필을 찾지 못해 아무것도 설치하지 "+"않았습니다. Firefox, Thunderbird 또는 Chromium을 한 번 실행한 뒤 다시 실행하"+"세요.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"적용하려면 브라우저나 메일 클라이언트를 다시 시작하세요.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "데몬에서 Bluetooth 상태를 읽지 못했습니다.\n"diff --git a/po/nl.po b/po/nl.poindex bc2bec2..0953176 100644--- a/po/nl.po+++ b/po/nl.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Dutch\n"@@ -144,6 +144,16 @@ msgstr "Gespiegelde iPhone-meldingen tonen."msgid "Print a redacted Bluetooth report for a bug report."msgstr "Een geschoond Bluetooth-rapport voor een foutmelding afdrukken."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"Installeert de native messaging-manifests van de browser- en mailextensie "+"voor deze gebruiker. Alleen nodig bij draagbare builds; de "+"distributiepakketten installeren ze systeembreed."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "Een openstaand koppelverzoek lokaal accepteren."@@ -164,6 +174,30 @@ msgstr "Opties:"msgid "Examples:"msgstr "Voorbeelden:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "Geïnstalleerd: %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"Er is geen browser- of mailprofiel voor deze gebruiker gevonden, dus er is "+"niets geïnstalleerd. Start Firefox, Thunderbird of Chromium één keer en voer "+"dit opnieuw uit.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"Herstart de browser of het mailprogramma om dit te laten werken.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "Kon de Bluetooth-status niet van de daemon lezen.\n"diff --git a/po/pl.po b/po/pl.poindex cf51407..a0ffa45 100644--- a/po/pl.po+++ b/po/pl.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Polish\n"@@ -144,6 +144,16 @@ msgstr "Wypisz skopiowane powiadomienia z iPhone'a."msgid "Print a redacted Bluetooth report for a bug report."msgstr "Wypisz oczyszczony raport Bluetooth do zgłoszenia błędu."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"Instaluje manifesty natywnej komunikacji rozszerzenia przeglądarki i poczty "+"dla tego użytkownika. Potrzebne tylko w wersjach przenośnych; pakiety "+"dystrybucji instalują je systemowo."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "Zaakceptuj lokalnie oczekujące żądanie parowania."@@ -164,6 +174,30 @@ msgstr "Opcje:"msgid "Examples:"msgstr "Przykłady:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "Zainstalowano %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"Nie znaleziono profilu przeglądarki ani klienta poczty dla tego użytkownika, "+"więc nic nie zainstalowano. Uruchom raz przeglądarkę Firefox, program "+"Thunderbird lub Chromium i wykonaj to ponownie.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"Uruchom ponownie przeglądarkę lub klienta poczty, aby to zadziałało.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "Nie udało się odczytać stanu Bluetooth od demona.\n"diff --git a/po/pt_BR.po b/po/pt_BR.poindex 7b94fd7..f234893 100644--- a/po/pt_BR.po+++ b/po/pt_BR.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Brazilian Portuguese\n"@@ -144,6 +144,16 @@ msgstr "Listar as notificações espelhadas do iPhone."msgid "Print a redacted Bluetooth report for a bug report."msgstr "Imprimir um relatório Bluetooth sanitizado para um relato de erro."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"Instala os manifestos de mensagens nativas da extensão de navegador e de e-"+"mail para este usuário. Necessário apenas em builds portáteis; os pacotes da "+"distribuição os instalam para todo o sistema."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "Aceitar localmente uma solicitação de pareamento pendente."@@ -164,6 +174,31 @@ msgstr "Opções:"msgid "Examples:"msgstr "Exemplos:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "Instalado %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"Nenhum perfil de navegador ou cliente de e-mail foi encontrado para este "+"usuário, então nada foi instalado. Abra o Firefox, o Thunderbird ou o "+"Chromium uma vez e execute isto novamente.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"Reinicie o navegador ou o cliente de e-mail para que a alteração tenha "+"efeito.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "Não foi possível ler o estado do Bluetooth no daemon.\n"diff --git a/po/ru.po b/po/ru.poindex a92b6cd..6f85638 100644--- a/po/ru.po+++ b/po/ru.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Russian\n"@@ -144,6 +144,16 @@ msgstr "Показать продублированные уведомленияmsgid "Print a redacted Bluetooth report for a bug report."msgstr "Вывести очищенный отчёт Bluetooth для сообщения об ошибке."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"Устанавливает манифесты нативного обмена сообщениями для расширения браузера "+"и почты для этого пользователя. Нужно только для переносимых сборок; пакеты "+"дистрибутивов ставят их для всей системы."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "Принять ожидающий запрос на сопряжение локально."@@ -164,6 +174,30 @@ msgstr "Параметры:"msgid "Examples:"msgstr "Примеры:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "Установлено: %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"Профиль браузера или почтового клиента для этого пользователя не найден, "+"поэтому ничего не установлено. Запустите один раз Firefox, Thunderbird или "+"Chromium и повторите команду.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"Перезапустите браузер или почтовый клиент, чтобы изменения вступили в силу.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "Не удалось прочитать состояние Bluetooth у демона.\n"diff --git a/po/sv.po b/po/sv.poindex d70162b..a1941d1 100644--- a/po/sv.po+++ b/po/sv.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Swedish\n"@@ -144,6 +144,16 @@ msgstr "Lista speglade iPhone-aviseringar."msgid "Print a redacted Bluetooth report for a bug report."msgstr "Skriv ut en rensad Bluetooth-rapport för en felrapport."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"Installerar webbläsar- och e-posttilläggets manifest för native messaging "+"för den här användaren. Behövs bara för portabla byggen; "+"distributionspaketen installerar dem systemomfattande."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "Godkänn en väntande parkopplingsförfrågan lokalt."@@ -164,6 +174,30 @@ msgstr "Flaggor:"msgid "Examples:"msgstr "Exempel:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "Installerade %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"Ingen webbläsar- eller e-postprofil hittades för den här användaren, så "+"ingenting installerades. Starta Firefox, Thunderbird eller Chromium en gång "+"och kör det här igen.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"Starta om webbläsaren eller e-postklienten för att det ska börja gälla.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "Kunde inte läsa Bluetooth-statusen från demonen.\n"diff --git a/po/tether.pot b/po/tether.potindex 4afc9f8..cb13ba6 100644--- a/po/tether.pot+++ b/po/tether.pot@@ -6,9 +6,9 @@#, fuzzymsgid ""msgstr ""-"Project-Id-Version: tether 0.2.18\n"+"Project-Id-Version: tether 0.2.19\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <[email protected]>\n"@@ -138,6 +138,13 @@ msgstr ""msgid "Print a redacted Bluetooth report for a bug report."msgstr ""+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr ""@@ -158,6 +165,25 @@ msgstr ""msgid "Examples:"msgstr ""+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr ""++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr ""diff --git a/po/tr.po b/po/tr.poindex 0e21737..2d7ba33 100644--- a/po/tr.po+++ b/po/tr.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Turkish\n"@@ -143,6 +143,16 @@ msgstr "Yansıtılan iPhone bildirimlerini listele."msgid "Print a redacted Bluetooth report for a bug report."msgstr "Hata bildirimi için arındırılmış bir Bluetooth raporu yazdır."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"Tarayıcı ve posta uzantısının yerel mesajlaşma bildirimlerini bu kullanıcı "+"için kurar. Yalnızca taşınabilir yapılar için gereklidir; dağıtım paketleri "+"bunları sistem genelinde kurar."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "Bekleyen bir eşleşme isteğini yerel olarak kabul et."@@ -163,6 +173,30 @@ msgstr "Seçenekler:"msgid "Examples:"msgstr "Örnekler:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "Kuruldu: %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"Bu kullanıcı için tarayıcı veya posta istemcisi profili bulunamadı, bu "+"yüzden hiçbir şey kurulmadı. Firefox, Thunderbird ya da Chromium'u bir kez "+"çalıştırıp bunu yeniden deneyin.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"Etkili olması için tarayıcıyı veya posta istemcisini yeniden başlatın.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "Bluetooth durumu arka plan hizmetinden okunamadı.\n"diff --git a/po/uk.po b/po/uk.poindex c4fc407..55e1626 100644--- a/po/uk.po+++ b/po/uk.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Ukrainian\n"@@ -145,6 +145,16 @@ msgstr "Показати продубльовані сповіщення з iPhomsgid "Print a redacted Bluetooth report for a bug report."msgstr "Вивести очищений звіт Bluetooth для повідомлення про помилку."+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"Встановлює маніфести нативного обміну повідомленнями для розширення браузера "+"та пошти для цього користувача. Потрібно лише для переносних збірок; пакунки "+"дистрибутивів встановлюють їх для всієї системи."+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "Прийняти локально запит на створення пари, що очікує."@@ -165,6 +175,30 @@ msgstr "Параметри:"msgid "Examples:"msgstr "Приклади:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "Встановлено: %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"Профіль браузера або поштового клієнта для цього користувача не знайдено, "+"тож нічого не встановлено. Запустіть один раз Firefox, Thunderbird або "+"Chromium і повторіть команду.\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"Перезапустіть браузер або поштовий клієнт, щоб зміни набули чинності.\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "Не вдалося прочитати стан Bluetooth у демона.\n"diff --git a/po/zh_CN.po b/po/zh_CN.poindex b8318fa..1286b20 100644--- a/po/zh_CN.po+++ b/po/zh_CN.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-08-30 11:33-0700\n"+"POT-Creation-Date: 2026-08-31 19:17-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Simplified Chinese\n"@@ -140,6 +140,15 @@ msgstr "列出已镜像的 iPhone 通知。"msgid "Print a redacted Bluetooth report for a bug report."msgstr "输出用于错误报告的脱敏蓝牙报告。"+#: src/cli/main.cpp+msgid ""+"Install the browser and mail extension's native messaging manifests for this "+"user. Needed only for portable builds; the distro packages install them "+"system-wide."+msgstr ""+"为当前用户安装浏览器和邮件扩展的原生消息清单。仅便携版需要;发行版软件包会安"+"装到系统范围。"+#: src/cli/main.cppmsgid "Accept a pending pairing request locally."msgstr "在本地接受待处理的配对请求。"@@ -160,6 +169,29 @@ msgstr "选项:"msgid "Examples:"msgstr "示例:"+#: src/cli/main.cpp+#, c-format+msgid "Installed %s\n"+msgstr "已安装 %s\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"No browser or mail client profile was found for this user, so nothing was "+"installed. Start Firefox, Thunderbird, or Chromium once and run this again.\n"+msgstr ""+"未找到当前用户的浏览器或邮件客户端配置文件,因此未安装任何内容。请先运行一次 "+"Firefox、Thunderbird 或 Chromium,然后重新执行。\n"++#: src/cli/main.cpp+#, c-format+msgid ""+"\n"+"Restart the browser or mail client to pick this up.\n"+msgstr ""+"\n"+"请重启浏览器或邮件客户端以使其生效。\n"+#: src/cli/main.cppmsgid "Could not read Bluetooth status from the daemon.\n"msgstr "无法从守护进程读取蓝牙状态。\n"diff --git a/src/cli/main.cpp b/src/cli/main.cppindex 4266246..4e37cd8 100644--- a/src/cli/main.cpp+++ b/src/cli/main.cpp@@ -13,6 +13,7 @@#include <tether/core.hpp>#include <tether/crypto.hpp>#include <tether/discovery.hpp>+#include <tether/extension_host.hpp>#include <tether/i18n.hpp>#include <tether/log.hpp>#include <thread>@@ -201,6 +202,9 @@ static const Opt kOptions[] = {{"--bt-ancs-content <on|off>", N_("Mirror notification titles and bodies, not just the app.")},{"--bt-notifications", N_("List mirrored iPhone notifications.")},{"--bt-diagnostics", N_("Print a redacted Bluetooth report for a bug report.")},+ {"--install-extension-host",+ N_("Install the browser and mail extension's native messaging manifests for this user. Needed only for "+ "portable builds; the distro packages install them system-wide.")},{"--accept <fingerprint>", N_("Accept a pending pairing request locally.")},{"--pair", N_("Send a pair_request over TCP to the daemon.")},};@@ -236,6 +240,29 @@ void print_help() {_("Examples:"));}+static int print_extension_host_install() {+ const auto result = tether::install_extension_host();++ for (const auto& path : result.written)+ fprintf(stdout, _("Installed %s\n"), path.c_str());++ for (const auto& err : result.errors)+ debug::log(ERR, "{}\n", err);++ if (!result.errors.empty())+ return 1;++ if (result.written.empty()) {+ fprintf(stdout,+ _("No browser or mail client profile was found for this user, so nothing was installed. Start "+ "Firefox, Thunderbird, or Chromium once and run this again.\n"));+ return 1;+ }++ fprintf(stdout, _("\nRestart the browser or mail client to pick this up.\n"));+ return 0;+}+// The two known gaps (adapter class, experimental API) change the machine// outside Tether, so they are printed for the user to run, never applied here.static int print_bt_setup(tether::Client& client) {@@ -696,6 +723,8 @@ int main(int argc, char* argv[]) {action = "discover";} else if (arg == "--list-devices") {action = "list";+ } else if (arg == "--install-extension-host") {+ action = "install_extension_host";} else if (arg == "--bt-setup") {action = "bt_setup";} else if (arg == "--bt-status") {@@ -781,6 +810,9 @@ int main(int argc, char* argv[]) {return 1;}+ if (action == "install_extension_host")+ return print_extension_host_install();+tether::Client client;// Fast-path local operations that don't need active daemon connection fundamentallydiff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex 9a47b95..5faca00 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -8,6 +8,7 @@ add_library(tether STATICsrc/file_transfer.cppsrc/crypto.cppsrc/client.cpp+ src/extension_host.cppsrc/discovery.cppsrc/bluetooth/objects.cppsrc/bluetooth/monitor.cppdiff --git a/src/core/include/tether/client.hpp b/src/core/include/tether/client.hppindex 5133cb7..2fe6583 100644--- a/src/core/include/tether/client.hpp+++ b/src/core/include/tether/client.hpp@@ -5,6 +5,9 @@namespace tether {+ // Starts tetherd detached, and returns once it has been launched+ void spawn_daemon();+class Client {public:Client();diff --git a/src/core/include/tether/extension_host.hpp b/src/core/include/tether/extension_host.hppnew file mode 100644index 0000000..3af5c5b--- /dev/null+++ b/src/core/include/tether/extension_host.hpp@@ -0,0 +1,21 @@+#pragma once++#include <filesystem>+#include <string>+#include <vector>++namespace tether {++ struct ExtensionHostInstall {+ std::string wrapper; // script the browsers execute+ std::vector<std::string> written; // manifest paths written+ std::vector<std::string> skipped; // browsers not installed for this user+ std::vector<std::string> errors;+ };++ // Installs the native messaging manifests into the per-user browser directories. For portable builds, which cannot+ // write the system directories the distro packages use.+ ExtensionHostInstall install_extension_host(const std::filesystem::path& home);+ ExtensionHostInstall install_extension_host();++} // namespace tetherdiff --git a/src/core/include/tether/packaging.hpp.in b/src/core/include/tether/packaging.hpp.innew file mode 100644index 0000000..5404199--- /dev/null+++ b/src/core/include/tether/packaging.hpp.in@@ -0,0 +1,11 @@+#pragma once++// Files the distro packages install into system directories. A portable build+// (AppImage) cannot, so they are embedded here and written out at runtime.+namespace tether::packaging {++ inline constexpr const char* BTCLASS_UNIT = R"TETHER(@BTCLASS_UNIT@)TETHER";+ inline constexpr const char* NATIVE_HOST_MANIFEST_CHROME = R"TETHER(@CHROME_MANIFEST@)TETHER";+ inline constexpr const char* NATIVE_HOST_MANIFEST_MOZILLA = R"TETHER(@MOZILLA_MANIFEST@)TETHER";++} // namespace tether::packagingdiff --git a/src/core/src/bluetooth/objects.cpp b/src/core/src/bluetooth/objects.cppindex be6683c..6c7acb3 100644--- a/src/core/src/bluetooth/objects.cpp+++ b/src/core/src/bluetooth/objects.cpp@@ -1,5 +1,6 @@#include "tether/bluetooth/objects.hpp"#include <tether/i18n.hpp>+#include <tether/packaging.hpp>#include <algorithm>#include <cstdio>@@ -332,6 +333,25 @@ namespace tether::bluetooth {"sudo systemctl daemon-reload && sudo systemctl restart bluetooth";}+ // Distro packages install the unit. A portable build writes it out.+ std::string set_class_command(const std::string& adapter_id) {+ const std::string enable = "sudo systemctl enable --now tether-btclass@" + adapter_id;+ std::error_code ec;+ for (const char* dir : {"/etc/systemd/system",+ "/usr/lib/systemd/system",+ "/lib/systemd/system",+ "/usr/local/lib/systemd/system"}) {+ if (std::filesystem::exists(std::string(dir) + "/[email protected]", ec))+ return enable;+ }++ return "sudo tee /etc/systemd/system/[email protected] >/dev/null <<'EOF'\n" ++ std::string(packaging::BTCLASS_UNIT) ++ "EOF\n"+ "sudo systemctl daemon-reload\n" ++ enable;+ }+} // namespaceCapability resolve_capability(const BluezObjects& objects) {@@ -429,7 +449,7 @@ namespace tether::bluetooth {if (!cap.class_ok) {cap.setup.push_back({_("The iPhone will not offer its Messages and Contacts permissions until this ""adapter presents itself as A/V Hands-Free (major 4, minor 8)."),- "sudo systemctl enable --now tether-btclass@" + cap.adapter_id});+ set_class_command(cap.adapter_id)});}return cap;diff --git a/src/core/src/client.cpp b/src/core/src/client.cppindex 302bd37..4b5b916 100644--- a/src/core/src/client.cpp+++ b/src/core/src/client.cpp@@ -58,6 +58,42 @@ namespace tether {return Crypto::get_peer_fingerprint(ssl_);}+ void spawn_daemon() {+ // everything the child needs is resolved before the fork+ std::filesystem::path self_path = std::filesystem::read_symlink("/proc/self/exe");+ const std::string sibling = (self_path.parent_path() / "tetherd").string();++ // appimage binaries live on a mount that only lives for the life of the parent, so the daemon has to run from a+ // mount of its own.+ const char* appimage = std::getenv("APPIMAGE");++ pid_t pid = fork();+ if (pid < 0)+ return;++ if (pid == 0) {+ if (fork() == 0) {+ // tetherd reopens these onto its own log file.+ if (freopen("/dev/null", "w", stdout) == nullptr) {+ }+ if (freopen("/dev/null", "w", stderr) == nullptr) {+ }+ if (freopen("/dev/null", "r", stdin) == nullptr) {+ }++ if (appimage && *appimage)+ execl(appimage, "tetherd", "--daemon", nullptr);+ execl(sibling.c_str(), "tetherd", nullptr);+ execlp("tetherd", "tetherd", nullptr);+ _exit(1);+ }+ _exit(0);+ }++ int status;+ waitpid(pid, &status, 0);+ }+int Client::connect_unix(bool retry) {int sock = socket(AF_UNIX, SOCK_STREAM, 0);if (sock < 0)@@ -78,31 +114,9 @@ namespace tether {if (!retry)return -1;- pid_t pid = fork();- if (pid == 0) {- std::filesystem::path self_path = std::filesystem::read_symlink("/proc/self/exe");- std::string daemon_path = (self_path.parent_path() / "tetherd").string();-- if (fork() == 0) {- if (freopen("/dev/null", "w", stdout) == nullptr) {- }- if (freopen("/dev/null", "w", stderr) == nullptr) {- }- if (freopen("/dev/null", "r", stdin) == nullptr) {- }-- execl(daemon_path.c_str(), "tetherd", nullptr);- execlp("tetherd", "tetherd", nullptr);- exit(1);- }- exit(0);- } else if (pid > 0) {- int status;- waitpid(pid, &status, 0);- usleep(300000);- return connect_unix(false);- }- return -1;+ spawn_daemon();+ usleep(300000);+ return connect_unix(false);}return sock;}diff --git a/src/core/src/extension_host.cpp b/src/core/src/extension_host.cppnew file mode 100644index 0000000..cdab2af--- /dev/null+++ b/src/core/src/extension_host.cpp@@ -0,0 +1,150 @@+#include "tether/extension_host.hpp"+#include "tether/packaging.hpp"++#include <cstdlib>+#include <fstream>+#include <nlohmann/json.hpp>++namespace tether {++ namespace {++ namespace fs = std::filesystem;++ struct Target {+ const char* profile; // browser's own directory, relative to $HOME+ const char* dir; // where its native messaging manifests live+ bool chrome; // chrome manifest schema rather than mozilla's+ };++ // Flatpak browsers keep a private $HOME in ~/.var/app, each one needs its own copy of the manifest.+ constexpr Target kTargets[] = {+ {".mozilla", ".mozilla/native-messaging-hosts", false},+ {".thunderbird", ".thunderbird/native-messaging-hosts", false},+ {".betterbird", ".betterbird/native-messaging-hosts", false},+ {".var/app/org.mozilla.firefox", ".var/app/org.mozilla.firefox/.mozilla/native-messaging-hosts", false},+ {".var/app/org.mozilla.Thunderbird",+ ".var/app/org.mozilla.Thunderbird/.thunderbird/native-messaging-hosts",+ false},+ {".var/app/eu.betterbird.Betterbird",+ ".var/app/eu.betterbird.Betterbird/.betterbird/native-messaging-hosts",+ false},+ {".config/chromium", ".config/chromium/NativeMessagingHosts", true},+ {".config/google-chrome", ".config/google-chrome/NativeMessagingHosts", true},+ {".var/app/org.chromium.Chromium",+ ".var/app/org.chromium.Chromium/config/chromium/NativeMessagingHosts",+ true},+ {".var/app/com.google.Chrome",+ ".var/app/com.google.Chrome/config/google-chrome/NativeMessagingHosts",+ true},+ };++ // AppImage's binaries live on a mount that dies with the process, so the wrapper has to name the AppImage file+ // itself.+ std::string self_command() {+ if (const char* appimage = std::getenv("APPIMAGE"); appimage && *appimage)+ return appimage;++ std::error_code ec;+ const fs::path self = fs::read_symlink("/proc/self/exe", ec);+ return ec ? "tether" : self.string();+ }++ bool write_file(const fs::path& path, const std::string& content, std::string& err) {+ std::error_code ec;+ fs::create_directories(path.parent_path(), ec);+ if (ec) {+ err = path.parent_path().string() + ": " + ec.message();+ return false;+ }++ std::ofstream out(path, std::ios::trunc);+ if (!out.is_open()) {+ err = path.string() + ": cannot open for writing";+ return false;+ }+ out << content;+ out.close();+ if (!out) {+ err = path.string() + ": write failed";+ return false;+ }+ return true;+ }++ // The packaged manifest names the packaged host, repoint it at ours.+ std::string manifest_for(bool chrome, const std::string& wrapper, std::string& err) {+ try {+ auto manifest = nlohmann::json::parse(chrome ? packaging::NATIVE_HOST_MANIFEST_CHROME+ : packaging::NATIVE_HOST_MANIFEST_MOZILLA);+ manifest["path"] = wrapper;+ return manifest.dump(2) + "\n";+ } catch (const std::exception& e) {+ err = e.what();+ return {};+ }+ }++ } // namespace++ ExtensionHostInstall install_extension_host(const fs::path& home) {+ ExtensionHostInstall result;++ const fs::path wrapper = home / ".local/bin/tether-native-host";+ result.wrapper = wrapper.string();++ const std::string script = "#!/bin/sh\n"+ "exec \"" ++ self_command() + "\" --native-host 2>> /tmp/tether-native.log\n";++ std::string err;+ if (!write_file(wrapper, script, err)) {+ result.errors.push_back(err);+ return result;+ }+ std::error_code ec;+ fs::permissions(wrapper,+ fs::perms::owner_all | fs::perms::group_read | fs::perms::group_exec | fs::perms::others_read |+ fs::perms::others_exec,+ fs::perm_options::replace,+ ec);+ if (ec) {+ result.errors.push_back(result.wrapper + ": " + ec.message());+ return result;+ }++ std::string chrome_manifest = manifest_for(true, result.wrapper, err);+ std::string mozilla_manifest = manifest_for(false, result.wrapper, err);+ if (chrome_manifest.empty() || mozilla_manifest.empty()) {+ result.errors.push_back("built-in native messaging manifest is unreadable: " + err);+ return result;+ }++ for (const auto& target : kTargets) {+ std::error_code exists_ec;+ if (!fs::exists(home / target.profile, exists_ec)) {+ result.skipped.push_back((home / target.profile).string());+ continue;+ }++ const fs::path path = home / target.dir / "com.tether.extension.json";+ if (write_file(path, target.chrome ? chrome_manifest : mozilla_manifest, err))+ result.written.push_back(path.string());+ else+ result.errors.push_back(err);+ }++ return result;+ }++ ExtensionHostInstall install_extension_host() {+ const char* home = std::getenv("HOME");+ if (!home || !*home) {+ ExtensionHostInstall result;+ result.errors.emplace_back("HOME is not set, so there is nowhere to install the manifests.");+ return result;+ }+ return install_extension_host(fs::path(home));+ }++} // namespace tetherdiff --git a/src/gtk/daemon_client.cpp b/src/gtk/daemon_client.cppindex aedf1fc..a0db8e5 100644--- a/src/gtk/daemon_client.cpp+++ b/src/gtk/daemon_client.cpp@@ -7,12 +7,11 @@#include <cstdio>#include <cstdlib>#include <cstring>-#include <filesystem>#include <gtk/gtk.h>#include <string_view>#include <sys/socket.h>#include <sys/un.h>-#include <sys/wait.h>+#include <tether/client.hpp>#include <tether/core.hpp>#include <tether/log.hpp>#include <tether/net.hpp>@@ -130,27 +129,7 @@ namespace tether::ui {static bool autostart_attempted = false;if (!autostart_attempted) {autostart_attempted = true;- pid_t pid = fork();- if (pid == 0) {- std::filesystem::path self_path = std::filesystem::read_symlink("/proc/self/exe");- std::string daemon_path = (self_path.parent_path() / "tetherd").string();- if (fork() == 0) {- // tetherd reopens these onto its own log file.- if (freopen("/dev/null", "w", stdout) == nullptr) {- }- if (freopen("/dev/null", "w", stderr) == nullptr) {- }- if (freopen("/dev/null", "r", stdin) == nullptr) {- }- execl(daemon_path.c_str(), "tetherd", nullptr);- execlp("tetherd", "tetherd", nullptr);- exit(1);- }- exit(0);- } else if (pid > 0) {- int status;- waitpid(pid, &status, 0);- }+ tether::spawn_daemon();}schedule_event_retry();set_status_main(_("Daemon Offline"));diff --git a/test/CMakeLists.txt b/test/CMakeLists.txtindex f855b41..72dc645 100644--- a/test/CMakeLists.txt+++ b/test/CMakeLists.txt@@ -16,6 +16,7 @@ add_executable(tether_testtest_discovery.cpptest_event_loop.cpptest_display_width.cpp+ test_extension_host.cpptest_file_transfer.cpptest_log.cpptest_net.cppdiff --git a/test/test_extension_host.cpp b/test/test_extension_host.cppnew file mode 100644index 0000000..94c0df1--- /dev/null+++ b/test/test_extension_host.cpp@@ -0,0 +1,50 @@+#include <gtest/gtest.h>+#include <tether/extension_host.hpp>++#include <filesystem>+#include <fstream>+#include <nlohmann/json.hpp>++namespace fs = std::filesystem;++namespace {++ std::string read(const fs::path& path) {+ std::ifstream in(path);+ return std::string((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());+ }++} // namespace++TEST(ExtensionHost, WritesManifestsOnlyWhereTheBrowserIs) {+ const fs::path home = fs::temp_directory_path() / "tether-extension-host-test";+ fs::remove_all(home);+ fs::create_directories(home / ".mozilla");+ fs::create_directories(home / ".config/google-chrome");++ const auto result = tether::install_extension_host(home);+ ASSERT_TRUE(result.errors.empty()) << result.errors.front();++ const fs::path mozilla = home / ".mozilla/native-messaging-hosts/com.tether.extension.json";+ const fs::path chrome = home / ".config/google-chrome/NativeMessagingHosts/com.tether.extension.json";+ EXPECT_TRUE(fs::exists(mozilla));+ EXPECT_TRUE(fs::exists(chrome));++ // thunderbird not installed skipped, not created+ EXPECT_FALSE(fs::exists(home / ".thunderbird"));+ EXPECT_EQ(result.written.size(), 2u);++ // manifest keeps its own schema and points at the wrapper+ const auto moz = nlohmann::json::parse(read(mozilla));+ const auto chr = nlohmann::json::parse(read(chrome));+ EXPECT_EQ(moz["path"], result.wrapper);+ EXPECT_EQ(chr["path"], result.wrapper);+ EXPECT_TRUE(moz.contains("allowed_extensions"));+ EXPECT_TRUE(chr.contains("allowed_origins"));++ // wrapper has to be executable, or the browser cannot start the host+ ASSERT_TRUE(fs::exists(result.wrapper));+ EXPECT_TRUE((fs::status(result.wrapper).permissions() & fs::perms::owner_exec) != fs::perms::none);++ fs::remove_all(home);+}