claude-chrome-android 1.5.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1108,6 +1108,25 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
1108
1108
  return true;
1109
1109
  }
1110
1110
 
1111
+ if (msg.type === "start_zapper") {
1112
+ // Element zapper: inject content.js into the active tab and enter
1113
+ // tap-to-remove mode (for dismissing overlays/paywalls by hand)
1114
+ chrome.tabs.query({ active: true, currentWindow: true }, (activeTabs) => {
1115
+ const tid = activeTabs[0]?.id;
1116
+ if (!tid) {
1117
+ sendResponse({ ok: false, error: "No active tab" });
1118
+ return;
1119
+ }
1120
+ executeViaContentScript(tid, "zapper_start", {})
1121
+ .then((result) => {
1122
+ addLog("info", `Zapper started on tab ${tid}`);
1123
+ sendResponse({ ok: !result?.error, ...result });
1124
+ })
1125
+ .catch((err) => sendResponse({ ok: false, error: err.message }));
1126
+ });
1127
+ return true;
1128
+ }
1129
+
1111
1130
  // --- Dev tool panel handlers -------------------------------------------------
1112
1131
 
1113
1132
  if (msg.type === "get_network") {
@@ -1373,6 +1392,20 @@ async function stopBridge() {
1373
1392
  return { ok: true, detail: "Bridge stopped" };
1374
1393
  }
1375
1394
 
1395
+ /**
1396
+ * Read the operad daemon token from storage. The daemon's /api/* endpoints
1397
+ * require Authorization: Bearer <token> (operad commit c3e71ce6); without it
1398
+ * they return 401 and every launch falls back to the share sheet.
1399
+ * @returns {Promise<Record<string, string>>} headers to spread into fetch opts
1400
+ */
1401
+ function operadAuthHeaders() {
1402
+ return new Promise((resolve) => {
1403
+ chrome.storage.local.get("operadToken", (data) => {
1404
+ resolve(data.operadToken ? { Authorization: `Bearer ${data.operadToken}` } : {});
1405
+ });
1406
+ });
1407
+ }
1408
+
1376
1409
  async function launchBridge() {
1377
1410
  addLog("info", "Attempting to launch bridge");
1378
1411
 
@@ -1396,14 +1429,19 @@ async function launchBridge() {
1396
1429
  }
1397
1430
 
1398
1431
  // Try starting bridge via tmx daemon HTTP API (always-on, no share sheet needed)
1432
+ const authHeaders = await operadAuthHeaders();
1399
1433
  try {
1400
1434
  const daemonCtrl = new AbortController();
1401
1435
  const daemonTimer = setTimeout(() => daemonCtrl.abort(), 3000);
1402
1436
  const daemonResp = await fetch("http://127.0.0.1:18970/api/bridge", {
1403
1437
  method: "POST",
1438
+ headers: authHeaders,
1404
1439
  signal: daemonCtrl.signal,
1405
1440
  });
1406
1441
  clearTimeout(daemonTimer);
1442
+ if (daemonResp.status === 401) {
1443
+ addLog("warn", "Daemon rejected request (401) — paste `operad token` output into the popup's Daemon Token field");
1444
+ }
1407
1445
  if (daemonResp.ok) {
1408
1446
  const data = await daemonResp.json();
1409
1447
  addLog("info", `Bridge start via daemon: ${data.status}`, data);
@@ -1422,6 +1460,7 @@ async function launchBridge() {
1422
1460
  const tsTimer = setTimeout(() => tsCtrl.abort(), 5000);
1423
1461
  const tsResp = await fetch("http://127.0.0.1:18970/api/bridge/termux-service", {
1424
1462
  method: "POST",
1463
+ headers: authHeaders,
1425
1464
  signal: tsCtrl.signal,
1426
1465
  });
1427
1466
  clearTimeout(tsTimer);
@@ -169,6 +169,10 @@ async function handleAction(action, params) {
169
169
  return { width: window.innerWidth, height: window.innerHeight };
170
170
  case "upload_image":
171
171
  return uploadImage(params);
172
+ case "zapper_start":
173
+ return zapperStart();
174
+ case "zapper_stop":
175
+ return zapperStop();
172
176
  default:
173
177
  return { error: `Unknown action: ${action}` };
174
178
  }
@@ -1042,3 +1046,294 @@ function uploadImage(params) {
1042
1046
  return { error: `Upload failed: ${err.message}` };
1043
1047
  }
1044
1048
  }
1049
+
1050
+ // --- Element Zapper ------------------------------------------------------------
1051
+ // Tap-to-fix mode for client-side overlays, popups, and paywalls where the
1052
+ // content exists in the DOM but is visually blocked. Started from the popup
1053
+ // ("Zap Element") via the background's start_zapper handler. Tapping an element
1054
+ // selects it (with a smart climb to the enclosing fixed-position overlay root
1055
+ // when one covers most of the viewport). Toolbar: Wider / Remove / Reveal /
1056
+ // Undo / Done. Two paywall archetypes are handled:
1057
+ // • Overlay covers content → Remove deletes the selected overlay element.
1058
+ // • Content obscured in place → Reveal strips blur/opacity/pointer-events
1059
+ // locks page-wide (e.g. mlive applies filter:blur() directly to the article
1060
+ // paragraphs, so removing them would delete the content — un-blur instead).
1061
+ // Removing or revealing also unlocks page scroll (sites set overflow:hidden on
1062
+ // html/body while gated). Removed nodes stay on an undo stack so a mis-tap is
1063
+ // recoverable until Done; Reveal is non-destructive.
1064
+
1065
+ let zapperState = null;
1066
+
1067
+ function zapperStart() {
1068
+ if (zapperState) return { result: "Zapper already active" };
1069
+
1070
+ const MAX_Z = 2147483647;
1071
+ const state = {
1072
+ selected: null,
1073
+ undoStack: [],
1074
+ unlockStyle: null,
1075
+ listeners: [],
1076
+ };
1077
+
1078
+ // Highlight box tracking the selected element (pointer-events:none so it
1079
+ // never interferes with elementFromPoint or taps)
1080
+ const highlight = document.createElement("div");
1081
+ highlight.setAttribute("data-cfc-zapper", "");
1082
+ highlight.style.cssText =
1083
+ "position:fixed;pointer-events:none;z-index:" + MAX_Z + ";display:none;" +
1084
+ "background:rgba(248,81,73,0.25);border:2px solid #f85149;border-radius:4px;" +
1085
+ "box-sizing:border-box;transition:top 0.08s,left 0.08s,width 0.08s,height 0.08s";
1086
+
1087
+ // Floating toolbar — touch-friendly, fixed to bottom of viewport
1088
+ const bar = document.createElement("div");
1089
+ bar.setAttribute("data-cfc-zapper", "");
1090
+ bar.style.cssText =
1091
+ "position:fixed;left:8px;right:8px;bottom:12px;z-index:" + MAX_Z + ";" +
1092
+ "background:#161b22;color:#c9d1d9;border:1px solid #30363d;border-radius:12px;" +
1093
+ "box-shadow:0 4px 24px rgba(0,0,0,0.6);padding:10px 12px;" +
1094
+ "font:13px -apple-system,system-ui,sans-serif;box-sizing:border-box";
1095
+
1096
+ const label = document.createElement("div");
1097
+ label.style.cssText =
1098
+ "font-family:monospace;font-size:11px;color:#8b949e;margin-bottom:8px;" +
1099
+ "white-space:nowrap;overflow:hidden;text-overflow:ellipsis";
1100
+ const DEFAULT_HINT = "Tap an overlay to Remove, or Reveal to un-blur content";
1101
+ label.textContent = DEFAULT_HINT;
1102
+
1103
+ const row = document.createElement("div");
1104
+ row.style.cssText = "display:flex;gap:8px";
1105
+
1106
+ function mkBtn(text, bg) {
1107
+ const b = document.createElement("button");
1108
+ b.setAttribute("data-cfc-zapper", "");
1109
+ b.textContent = text;
1110
+ b.style.cssText =
1111
+ "flex:1;min-height:40px;border:1px solid #30363d;border-radius:8px;" +
1112
+ "background:" + (bg || "#21262d") + ";color:#fff;font:600 13px -apple-system,system-ui,sans-serif";
1113
+ row.appendChild(b);
1114
+ return b;
1115
+ }
1116
+
1117
+ const widerBtn = mkBtn("Wider");
1118
+ const removeBtn = mkBtn("Remove", "#da3633");
1119
+ const revealBtn = mkBtn("Reveal", "#1f6feb");
1120
+ const undoBtn = mkBtn("Undo");
1121
+ const doneBtn = mkBtn("Done", "#238636");
1122
+
1123
+ bar.appendChild(label);
1124
+ bar.appendChild(row);
1125
+ document.documentElement.appendChild(highlight);
1126
+ document.documentElement.appendChild(bar);
1127
+ state.highlight = highlight;
1128
+ state.bar = bar;
1129
+
1130
+ function describe(el) {
1131
+ let s = "<" + el.tagName.toLowerCase();
1132
+ if (el.id) s += " id=" + el.id;
1133
+ else if (typeof el.className === "string" && el.className.trim()) {
1134
+ s += " ." + el.className.trim().split(/\s+/).slice(0, 2).join(".");
1135
+ }
1136
+ const r = el.getBoundingClientRect();
1137
+ return s + "> " + Math.round(r.width) + "×" + Math.round(r.height);
1138
+ }
1139
+
1140
+ function refreshUi() {
1141
+ if (state.selected && state.selected.isConnected) {
1142
+ const r = state.selected.getBoundingClientRect();
1143
+ highlight.style.display = "block";
1144
+ highlight.style.top = r.top + "px";
1145
+ highlight.style.left = r.left + "px";
1146
+ highlight.style.width = r.width + "px";
1147
+ highlight.style.height = r.height + "px";
1148
+ label.textContent = describe(state.selected);
1149
+ } else {
1150
+ state.selected = null;
1151
+ highlight.style.display = "none";
1152
+ label.textContent = DEFAULT_HINT;
1153
+ }
1154
+ removeBtn.style.opacity = state.selected ? "1" : "0.4";
1155
+ widerBtn.style.opacity = state.selected ? "1" : "0.4";
1156
+ undoBtn.style.opacity = state.undoStack.length ? "1" : "0.4";
1157
+ }
1158
+
1159
+ // Prefer the outermost fixed/sticky (or positioned high-z absolute) ancestor
1160
+ // when it covers most of the viewport — that's the overlay root sites mount
1161
+ // paywalls/modals on. Otherwise keep the exact tapped element.
1162
+ function pickOverlayRoot(el) {
1163
+ let best = el;
1164
+ let cur = el;
1165
+ const viewArea = window.innerWidth * window.innerHeight;
1166
+ while (cur && cur !== document.body && cur !== document.documentElement) {
1167
+ const cs = getComputedStyle(cur);
1168
+ const positioned =
1169
+ cs.position === "fixed" || cs.position === "sticky" ||
1170
+ (cs.position === "absolute" && (parseInt(cs.zIndex, 10) || 0) >= 1);
1171
+ if (positioned) {
1172
+ const r = cur.getBoundingClientRect();
1173
+ if (r.width * r.height >= 0.5 * viewArea) best = cur;
1174
+ }
1175
+ cur = cur.parentElement;
1176
+ }
1177
+ return best;
1178
+ }
1179
+
1180
+ // While an overlay is up, sites lock scroll with overflow:hidden (and
1181
+ // sometimes position:fixed) on html/body — undo that once we zap something.
1182
+ function applyScrollUnlock() {
1183
+ if (state.unlockStyle) return;
1184
+ const st = document.createElement("style");
1185
+ st.setAttribute("data-cfc-zapper", "");
1186
+ st.textContent =
1187
+ "html,body{overflow:auto !important;position:static !important;height:auto !important;}";
1188
+ document.documentElement.appendChild(st);
1189
+ state.unlockStyle = st;
1190
+ }
1191
+
1192
+ function onPointerDown(e) {
1193
+ if (e.target && e.target.closest && e.target.closest("[data-cfc-zapper]")) return;
1194
+ e.preventDefault();
1195
+ e.stopPropagation();
1196
+ e.stopImmediatePropagation();
1197
+ const el = document.elementFromPoint(e.clientX, e.clientY);
1198
+ if (!el || el === document.documentElement || el === document.body) {
1199
+ state.selected = null;
1200
+ } else {
1201
+ state.selected = pickOverlayRoot(el);
1202
+ }
1203
+ refreshUi();
1204
+ }
1205
+
1206
+ // Swallow the rest of the tap gesture so the page never reacts to zap taps
1207
+ function swallow(e) {
1208
+ if (e.target && e.target.closest && e.target.closest("[data-cfc-zapper]")) return;
1209
+ e.preventDefault();
1210
+ e.stopPropagation();
1211
+ e.stopImmediatePropagation();
1212
+ }
1213
+
1214
+ function listen(type, fn, opts) {
1215
+ document.addEventListener(type, fn, opts);
1216
+ state.listeners.push([type, fn, opts]);
1217
+ }
1218
+
1219
+ listen("pointerdown", onPointerDown, { capture: true, passive: false });
1220
+ for (const t of ["pointerup", "mousedown", "mouseup", "click", "touchstart", "touchend", "touchmove"]) {
1221
+ listen(t, swallow, { capture: true, passive: false });
1222
+ }
1223
+ const reposition = () => refreshUi();
1224
+ listen("scroll", reposition, { capture: true, passive: true });
1225
+ window.addEventListener("resize", reposition, { passive: true });
1226
+ state.listeners.push(["__window_resize", reposition, null]);
1227
+
1228
+ widerBtn.addEventListener("click", () => {
1229
+ const p = state.selected && state.selected.parentElement;
1230
+ if (p && p !== document.body && p !== document.documentElement) {
1231
+ state.selected = p;
1232
+ refreshUi();
1233
+ }
1234
+ });
1235
+
1236
+ removeBtn.addEventListener("click", () => {
1237
+ const el = state.selected;
1238
+ if (!el || !el.isConnected) return;
1239
+ state.undoStack.push({ el, parent: el.parentNode, next: el.nextSibling });
1240
+ el.remove();
1241
+ applyScrollUnlock();
1242
+ state.selected = null;
1243
+ refreshUi();
1244
+ });
1245
+
1246
+ // Reveal: for paywalls that obscure the real content in place (blur filter,
1247
+ // low opacity, pointer-events/user-select locks) rather than covering it with
1248
+ // a removable overlay — the content is in the DOM, so we un-hide it instead of
1249
+ // deleting it. Scoped to the selection subtree when one is picked, else the
1250
+ // whole page. Non-destructive; a persistent override style prevents re-hiding.
1251
+ function revealObscured(scope) {
1252
+ const root = scope && scope.isConnected ? scope : document.body;
1253
+ // Include the scope itself plus every descendant.
1254
+ const els = [root, ...root.querySelectorAll("*")];
1255
+ let count = 0;
1256
+ for (const el of els) {
1257
+ if (el.closest && el.closest("[data-cfc-zapper]")) continue;
1258
+ const cs = getComputedStyle(el);
1259
+ let changed = false;
1260
+ if (cs.filter && cs.filter !== "none" && /blur|grayscale/i.test(cs.filter)) {
1261
+ el.style.setProperty("filter", "none", "important");
1262
+ el.style.setProperty("-webkit-filter", "none", "important");
1263
+ changed = true;
1264
+ }
1265
+ // Faded-out content (not fully hidden — opacity:0 is usually a real hide).
1266
+ const op = parseFloat(cs.opacity);
1267
+ if (!isNaN(op) && op > 0 && op < 0.6 && (el.textContent || "").trim().length > 20) {
1268
+ el.style.setProperty("opacity", "1", "important");
1269
+ changed = true;
1270
+ }
1271
+ // Reading/selection locks used to discourage copying gated text.
1272
+ if (cs.pointerEvents === "none") { el.style.setProperty("pointer-events", "auto", "important"); changed = true; }
1273
+ if (cs.userSelect === "none") { el.style.setProperty("user-select", "text", "important"); changed = true; }
1274
+ if (el.classList && el.classList.length) {
1275
+ for (const c of [...el.classList]) {
1276
+ if (/blur|obfuscat|paywall|gated|faded/i.test(c)) { el.classList.remove(c); changed = true; }
1277
+ }
1278
+ }
1279
+ if (changed) count++;
1280
+ }
1281
+ // Persistent override so classes re-applied by the site's JS can't re-blur.
1282
+ if (!state.revealStyle) {
1283
+ const st = document.createElement("style");
1284
+ st.setAttribute("data-cfc-zapper", "");
1285
+ st.textContent =
1286
+ '[class*="blur" i],[class*="obfuscat" i],[class*="gated" i],[class*="paywall" i]' +
1287
+ "{filter:none !important;-webkit-filter:none !important;opacity:1 !important;}";
1288
+ document.documentElement.appendChild(st);
1289
+ state.revealStyle = st;
1290
+ }
1291
+ applyScrollUnlock();
1292
+ return count;
1293
+ }
1294
+
1295
+ revealBtn.addEventListener("click", () => {
1296
+ // These paywalls blur many elements across the article, so default to the
1297
+ // whole page. A picked container narrows it only when the user selected one
1298
+ // bigger than a single inline/text node.
1299
+ const sel = state.selected;
1300
+ const scope = sel && sel.querySelectorAll && sel.querySelectorAll("*").length > 3 ? sel : document.body;
1301
+ const n = revealObscured(scope);
1302
+ label.textContent = "Revealed " + n + " element(s) — content un-blurred";
1303
+ });
1304
+
1305
+ undoBtn.addEventListener("click", () => {
1306
+ const entry = state.undoStack.pop();
1307
+ if (entry && entry.parent) {
1308
+ try {
1309
+ entry.parent.insertBefore(entry.el, entry.next && entry.next.parentNode === entry.parent ? entry.next : null);
1310
+ } catch {}
1311
+ }
1312
+ if (!state.undoStack.length && state.unlockStyle) {
1313
+ state.unlockStyle.remove();
1314
+ state.unlockStyle = null;
1315
+ }
1316
+ refreshUi();
1317
+ });
1318
+
1319
+ doneBtn.addEventListener("click", () => zapperStop());
1320
+
1321
+ zapperState = state;
1322
+ refreshUi();
1323
+ return { result: "Zapper started — Remove overlays, or Reveal to un-blur in-place content" };
1324
+ }
1325
+
1326
+ function zapperStop() {
1327
+ const state = zapperState;
1328
+ if (!state) return { result: "Zapper not active" };
1329
+ for (const [type, fn, opts] of state.listeners) {
1330
+ if (type === "__window_resize") window.removeEventListener("resize", fn);
1331
+ else document.removeEventListener(type, fn, opts);
1332
+ }
1333
+ state.bar.remove();
1334
+ state.highlight.remove();
1335
+ // Removed elements stay removed and the scroll unlock persists — that's the
1336
+ // point of zapping. Only the mode UI is torn down.
1337
+ zapperState = null;
1338
+ return { result: `Zapper stopped (${state.undoStack.length} element(s) removed)` };
1339
+ }
@@ -1,98 +1,79 @@
1
- // Launch bridge — tries daemon API first, falls back to navigator.share() → Termux.
2
- // Browser intent: URIs add CATEGORY_BROWSABLE which Termux doesn't declare,
3
- // so navigator.share() (native OS share, no BROWSABLE) is the only path
4
- // when the daemon isn't running.
5
-
1
+ // The background owns daemon startup and connection polling. Sharing stays in
2
+ // this tab's click handler so Android receives a fresh user activation.
6
3
  const btn = document.getElementById("share-btn");
7
4
  const status = document.getElementById("status");
8
- const setupHint = document.getElementById("setup-hint");
5
+ let connected = false;
6
+ let waitingTimer;
7
+
8
+ /** Mark a confirmed connection; late startup callbacks must not overwrite it. */
9
+ function showConnected() {
10
+ if (connected) return;
11
+ connected = true;
12
+ clearTimeout(waitingTimer);
13
+ status.textContent = "Bridge connected";
14
+ btn.textContent = "Already Running";
15
+ btn.disabled = true;
16
+ setTimeout(() => window.close(), 1000);
17
+ }
18
+
19
+ /** Keep manual recovery available if startup never establishes a connection. */
20
+ function waitForConnection() {
21
+ if (connected) return;
22
+ clearTimeout(waitingTimer);
23
+ status.textContent = "Waiting for bridge to connect...";
24
+ btn.textContent = "Starting...";
25
+ btn.disabled = true;
26
+ waitingTimer = setTimeout(() => {
27
+ if (connected) return;
28
+ status.textContent = "Bridge didn't respond — share to Termux or use the command below";
29
+ btn.textContent = "Share to Termux";
30
+ btn.disabled = false;
31
+ }, 15000);
32
+ }
9
33
 
10
- // Listen for state updates from background.js (single source of truth for polling)
11
34
  chrome.runtime.onMessage.addListener((msg) => {
12
- if (msg.type === "state_update") {
13
- if (msg.state === "connected") {
14
- status.textContent = "Bridge connected";
15
- // Auto-close launcher tab after successful connection
16
- setTimeout(() => window.close(), 1000);
17
- }
18
- }
35
+ if (msg.type === "state_update" && msg.state === "connected") showConnected();
19
36
  });
20
37
 
21
- // On load: try daemon API first — may start bridge without share sheet
22
- (async () => {
23
- // Check if already connected
24
- chrome.runtime.sendMessage({ type: "get_state" }, (resp) => {
25
- if (resp?.state === "connected") {
26
- status.textContent = "Bridge is already connected";
27
- btn.textContent = "Already Running";
28
- btn.disabled = true;
29
- }
30
- });
31
-
32
- // Try starting via daemon HTTP API (works when Termux is running)
38
+ btn.disabled = true;
39
+ status.textContent = "Checking bridge...";
40
+ chrome.runtime.sendMessage({ type: "get_state" }, (state) => {
41
+ const stateError = chrome.runtime.lastError;
42
+ if (!stateError && state?.state === "connected") {
43
+ showConnected();
44
+ return;
45
+ }
46
+ if (connected) return;
33
47
  status.textContent = "Trying daemon...";
34
- try {
35
- const ctrl = new AbortController();
36
- const timer = setTimeout(() => ctrl.abort(), 3000);
37
- const resp = await fetch("http://127.0.0.1:18970/api/bridge", {
38
- method: "POST",
39
- signal: ctrl.signal,
40
- });
41
- clearTimeout(timer);
42
- if (resp.ok) {
43
- const data = await resp.json();
44
- if (data.status === "starting" || data.status === "already_running") {
45
- status.textContent = `Bridge ${data.status} via daemon — waiting for connection...`;
46
- btn.textContent = "Starting...";
47
- btn.disabled = true;
48
- // Tell background to start polling
49
- chrome.runtime.sendMessage({ type: "bridge_launch_initiated" });
50
- // Auto-close timeout
51
- setTimeout(() => {
52
- if (status.textContent.includes("waiting")) {
53
- status.textContent = "Bridge didn't respond — try share button below";
54
- btn.textContent = "Share to Termux";
55
- btn.disabled = false;
56
- }
57
- }, 12000);
58
- return; // Daemon handled it
59
- }
48
+ chrome.runtime.sendMessage({ type: "launch_bridge" }, (response) => {
49
+ const launchError = chrome.runtime.lastError;
50
+ if (connected) return;
51
+ if (!launchError && response?.ok) {
52
+ waitForConnection();
53
+ return;
60
54
  }
61
- } catch {
62
- // Daemon not reachable — Termux may not be running
63
- }
64
-
65
- // Daemon didn't work — show share button
66
- status.textContent = "Tap below to share to Termux and start the bridge";
67
- })();
55
+ status.textContent = "Choose Share to Termux, then select Termux in the share sheet";
56
+ btn.disabled = false;
57
+ });
58
+ });
68
59
 
69
60
  btn.addEventListener("click", async () => {
70
61
  btn.textContent = "Opening share sheet...";
71
62
  btn.disabled = true;
72
-
63
+ clearTimeout(waitingTimer);
73
64
  try {
65
+ // This exact URL matches both installed and generated termux-url-opener
66
+ // handlers (*cfcbridge*/start*). Share only text to avoid merged payloads.
74
67
  await navigator.share({ text: "https://cfcbridge.example.com/start" });
75
- // User picked a target (hopefully Termux)
76
- status.textContent = "Shared — waiting for bridge to start...";
77
- btn.textContent = "Share to Termux";
78
- btn.disabled = false;
79
-
80
- // Notify background.js to start polling (it's the single source of truth)
68
+ if (connected) return;
69
+ waitForConnection();
81
70
  chrome.runtime.sendMessage({ type: "bridge_launch_initiated" });
82
-
83
- // Simple local timeout — background handles the actual polling
84
- setTimeout(() => {
85
- if (status.textContent.includes("waiting")) {
86
- status.textContent = "Bridge didn't start — try again or start manually in Termux";
87
- }
88
- }, 15000);
89
- } catch (e) {
71
+ } catch (error) {
72
+ if (connected) return;
90
73
  btn.textContent = "Share to Termux";
91
74
  btn.disabled = false;
92
- if (e.name === "AbortError") {
93
- status.textContent = "Cancelled — tap to try again";
94
- } else {
95
- status.textContent = "Error: " + e.message;
96
- }
75
+ status.textContent = error.name === "AbortError"
76
+ ? "Cancelled — tap to try again"
77
+ : "Sharing unavailable — use the command below: " + error.message;
97
78
  }
98
79
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 2,
3
3
  "name": "Claude Code Browser Bridge",
4
- "version": "1.11.1",
4
+ "version": "1.12.1",
5
5
  "description": "Bridges Claude Code CLI to Edge Android via WebSocket",
6
6
  "permissions": [
7
7
  "activeTab",
@@ -380,6 +380,9 @@
380
380
  <span id="btn-update-text">Check for Update</span>
381
381
  </button>
382
382
  </div>
383
+ <div class="btn-row" style="margin-top:6px">
384
+ <button class="btn" id="btn-zap" style="flex:1" title="Tap an element on the page to remove it (overlays, popups, paywalls)">&#9889; Zap Element</button>
385
+ </div>
383
386
  <div class="section-title" style="margin-top:12px">Memory</div>
384
387
  <label style="display:flex;align-items:center;gap:8px;padding:8px 10px;background:#161b22;border:1px solid #21262d;border-radius:6px;cursor:pointer;font-size:12px">
385
388
  <input type="checkbox" id="chk-inject-all" style="accent-color:#58a6ff">
@@ -387,6 +390,16 @@
387
390
  <span style="flex:1"></span>
388
391
  <span style="font-size:10px;color:#8b949e" id="inject-mode-label">on-demand</span>
389
392
  </label>
393
+ <div class="section-title" style="margin-top:12px">Daemon Token</div>
394
+ <div style="padding:8px 10px;background:#161b22;border:1px solid #21262d;border-radius:6px">
395
+ <input type="password" id="operad-token" class="panel-filter" style="width:100%"
396
+ placeholder="Paste output of: operad token" autocomplete="off">
397
+ <div style="font-size:10px;color:#8b949e;margin-top:6px">
398
+ Needed to auto-start the bridge via the operad daemon (its API requires
399
+ <span style="font-family:monospace">Authorization: Bearer</span> since operad added auth).
400
+ <span id="operad-token-status" style="font-family:monospace"></span>
401
+ </div>
402
+ </div>
390
403
  </div>
391
404
 
392
405
  <!-- Tests panel -->