From d1aa46c8d2a0d4a4a166ad9b589c238cc70a5d1c Mon Sep 17 00:00:00 2001 From: Local Dev Date: Sun, 2 Aug 2026 18:40:38 +0200 Subject: [PATCH] Theseus: switcher is direct-load (no more soft-mode re-prompt); blur URL on submit Chip switcher now bypasses navigateTab/loadBns entirely and calls loadURL directly. Rationale: the user explicitly clicked a registry chip; that IS the choice. Routing through navigateTab -> loadBns was reaching the collision decision path in some races and could re-show the soft-mode 'Open with...' prompt as an unwanted extra step. Direct load guarantees the switch is atomic. Prov is updated inline using entries.get(host) for the BCDN case (source/records/ category), same shape loadBns would have produced. internalNav flag guards the programmatic load from the will-navigate handler (redirect chains stay clean). Also: address bar blurs on Enter so the tabs-event handler can update it to the actual loaded URL (search keyword no longer sticks in the address bar after search results load). --- main.js | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index 77b91a9..1ac035d 100644 --- a/main.js +++ b/main.js @@ -1006,12 +1006,31 @@ ipcMain.handle("collision-switch", async (_e, arg) => { const choice = (raw === "bcdn" || raw === "bcnr") ? "bcnr" : (raw === "icann") ? "icann" : (t.prov.kind === "ok" ? "icann" : "bcnr"); // flip the current one - // Transient per-tab override consumed once by loadBns — no soft-mode re-prompt - // for this specific chip-triggered switch. - t.collisionOverride = choice; // Optional persistent memory ("Always use…" from the popover switcher). rememberCollision(host, tld, choice, arg?.remember || "no"); - return navigateTab(t.id, host + (t.prov.path || "/")); + const registry = registryOf(tld); + // DIRECT navigation — bypass navigateTab/loadBns entirely so nothing in the + // collision-decision path can trigger a re-prompt on an explicit user switch. + // The user clicked the switcher; they've made their choice. Just load it. + setLoading(t, true); + t.internalNav = true; + try { + if (choice === "icann") { + t.url = "https://" + host + "/"; + await t.view.webContents.loadURL(t.url); + t.prov = { host, kind: "web", note: "switched to ICANN", tld, registry }; + } else { + t.url = host + "/"; + await t.view.webContents.loadURL(`bns://${host}/`); + const rec = entries.get(host); + const r = rec?.entry?.records || {}; + const src = r.h ? "on-chain (chain)" : r.s3 ? "Sia network" : r.ip ? "direct server" : r.u ? "redirect" : "record"; + t.prov = { host, kind: "ok", source: src, category: rec?.entry?.category, records: Object.keys(r), tld, registry }; + } + } catch (e) { console.warn("collision-switch load failed:", e?.message); } + finally { t.internalNav = false; setLoading(t, false); } + if (t.id === activeId) pushNav(t.prov); + emitTabs(); }); ipcMain.handle("collision-state", () => ({ policy: settings.collisionPolicy,