@@ -7,6 +7,7 @@
7# host manifest with that absolute path and the pinned extension ID, then installs the fm schemas
7# host manifest with that absolute path and the pinned extension ID, then installs the fm schemas
8# and runs the self-test. Safe to re-run.
8# and runs the self-test. Safe to re-run.
9set -euo pipefail
9set -euo pipefail
10+trap 'echo "Diagonal host install failed at line $LINENO: $BASH_COMMAND" >&2' ERR
10HERE="$(cd "$(dirname "$0")" && pwd)"
11HERE="$(cd "$(dirname "$0")" && pwd)"
11if [[ -d "$HERE/host" ]]; then cd "$HERE"; else cd "$HERE/.."; fi
12if [[ -d "$HERE/host" ]]; then cd "$HERE"; else cd "$HERE/.."; fi
@@ -45,10 +46,24 @@ xattr -dr com.apple.quarantine "$SHARE" 2>/dev/null || true
45ln -sf "$SHARE/diagonal-host.py" "$BIN"
46ln -sf "$SHARE/diagonal-host.py" "$BIN"
46echo "host: $BIN -> $SHARE/diagonal-host.py"
47echo "host: $BIN -> $SHARE/diagonal-host.py"
49+# Written here rather than by the host, so a python3 problem cannot leave an empty manifest behind,
50+# and moved into place so Brave never reads a half-written one.
53+ "name": "io.diagonal.host",
54+ "description": "Diagonal: names tab groups with Apple's on-device model",
57+ "allowed_origins": ["chrome-extension://$ID/"]
61+"$BIN" --version >/dev/null # the host must start with the python3 it was pinned to
48for ch in "${CHANNELS[@]}"; do
62for ch in "${CHANNELS[@]}"; do
49 DIR="$HOME/Library/Application Support/BraveSoftware/$ch/NativeMessagingHosts"
63 DIR="$HOME/Library/Application Support/BraveSoftware/$ch/NativeMessagingHosts"
50 mkdir -p "$DIR"
64 mkdir -p "$DIR"
51− "$BIN" --print-manifest "$BIN" > "$DIR/io.diagonal.host.json"
65+ printf '%s\n' "$MANIFEST" > "$DIR/io.diagonal.host.json.tmp"
66+ mv -f "$DIR/io.diagonal.host.json.tmp" "$DIR/io.diagonal.host.json"
52 echo "manifest: $DIR/io.diagonal.host.json"
67 echo "manifest: $DIR/io.diagonal.host.json"