From 65e9a18f331f1fab5ef214546a19d765cd9e6a0b Mon Sep 17 00:00:00 2001 From: Local Dev Date: Sun, 2 Aug 2026 19:26:47 +0200 Subject: [PATCH] Theseus: https:// scheme for BCDN + segmented-toggle registry switcher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BCDN pages now show https:// in the address bar (was bare 'host/', briefly bns://). Rationale: BCNR replaces DNS (name resolution), NOT HTTP. Under the hood the delivery IS HTTPS for s3/ip/p records; the on-chain h record has no transport at all, but https:// is the least-surprising display. BCDN/ICANN badge is the sole source-of-truth for which registry served us; scheme stays a convention. Registry chip is now a proper segmented control: - Two-chip toggle (collision candidates): single rounded pill, split in half with a divider — active side filled (acid green for BCDN, blue for ICANN), inactive side transparent + clickable. Feels like an on/off toggle. - Single chip (pure ICANN or BCNR-unique TLD): standalone pill in the registry's colour. No toggle affordance since there's no alternative. Same acid-glow-green (#d6ff3d) and blue (#4c9eff) as the collision.html prompt so the whole registry palette is consistent across chrome + interstitial. --- chrome.html | 37 +++++++++++++++++++++++-------------- main.js | 11 +++++++++-- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/chrome.html b/chrome.html index f913b3c..12be37e 100644 --- a/chrome.html +++ b/chrome.html @@ -72,17 +72,26 @@ .secbadge.warn { color: #f6ad55; } /* kept for legacy call sites */ input { padding: 7px 6px; border-radius: 999px; border: none; background: transparent; color: inherit; font-size: 13.5px; outline: none; } #url { flex: 1; } - /* registry toggle at the END of the address bar — one or two chips */ - #reg { display: inline-flex; gap: 4px; align-items: center; } - .reg { font-size: 10.5px; letter-spacing: .03em; padding: 2px 9px; border-radius: 999px; white-space: nowrap; - cursor: default; user-select: none; transition: opacity .15s, background .15s, color .15s, border-color .15s; } - /* Active BCDN — acid glow green */ - .reg.bcdn.active { background: rgba(214,255,61,.15); color: #d6ff3d; border: 1px solid #d6ff3d55; } - /* Active ICANN — blue */ - .reg.icann.active { background: rgba(76,158,255,.15); color: #4c9eff; border: 1px solid #4c9eff55; } - /* Inactive chip in the toggle — greyed, clickable to switch */ - .reg.switch { background: transparent; color: #6b7280; border: 1px solid #ffffff1c; cursor: pointer; } - .reg.switch:hover { color: #b9c2d0; border-color: #ffffff33; } + /* Registry indicator at the END of the address bar. Two shapes: + - Toggle (segmented control) when this host could be served by EITHER + registry — a single pill split in half, active side filled, inactive + side transparent and clickable to switch. + - Single pill when there's no alternative (pure ICANN or a BCNR-unique TLD).*/ + #reg { display: inline-flex; align-items: center; } + .reg { font-size: 10.5px; letter-spacing: .03em; padding: 2px 10px; white-space: nowrap; + cursor: default; user-select: none; transition: background .12s, color .12s, border-color .12s; } + /* Single-chip form (non-collision hosts) */ + .reg.single { border-radius: 999px; border: 1px solid; } + .reg.single.bcdn.active { background: rgba(214,255,61,.15); color: #d6ff3d; border-color: #d6ff3d55; } + .reg.single.icann.active { background: rgba(76,158,255,.15); color: #4c9eff; border-color: #4c9eff55; } + /* Toggle (segmented control) form for collision candidates */ + .tog { display: inline-flex; border-radius: 999px; overflow: hidden; border: 1px solid #ffffff26; } + .tog .reg { border: 0; } + .tog .reg + .reg { border-left: 1px solid #ffffff26; } + .tog .reg.active.bcdn { background: rgba(214,255,61,.18); color: #d6ff3d; } + .tog .reg.active.icann { background: rgba(76,158,255,.18); color: #4c9eff; } + .tog .reg.switch { background: transparent; color: #7b8494; cursor: pointer; } + .tog .reg.switch:hover { color: #e5e7eb; background: rgba(255,255,255,.05); } .star { border: none; background: transparent; cursor: pointer; color: var(--dim); font-size: 15px; padding: 2px 4px; border-radius: 6px; } .star:hover { background: var(--line2); color: var(--ink); } .star.on { color: #ffd23d; } /* search box: engine icon (click = pick engine) + a wide typing area */ @@ -296,14 +305,14 @@ if (isCand) { const bcdn = `BCDN`; const icann = `ICANN`; - r.innerHTML = bcdn + icann; + r.innerHTML = `${bcdn}${icann}`; for (const chip of r.querySelectorAll(".reg.switch")) { chip.onclick = () => T.collisionSwitch({ choice: chip.dataset.c, remember: "no" }); } } else if (d.kind === "web") { - r.innerHTML = `ICANN`; + r.innerHTML = `ICANN`; } else { - r.innerHTML = `BCDN`; + r.innerHTML = `BCDN`; } } diff --git a/main.js b/main.js index fcca960..613448d 100644 --- a/main.js +++ b/main.js @@ -954,7 +954,14 @@ async function loadBns(t, id, host, rest, tld) { let entry; try { entry = await resolveHost(host); } catch { setLoading(t, false); return fallbackToWeb("BCNR unreachable"); } - t.url = host + (rest === "/" ? "" : rest); + // Address-bar display: show https:// even for BCDN sites. Rationale — BCNR + // replaces DNS (name resolution), NOT HTTP (transport). For s3/ip/p records + // the actual delivery IS HTTPS under the hood; for h records the content is + // on-chain (no HTTP at all, but https:// is the least surprising display). + // The BCDN/ICANN badge is the source-of-truth for which registry served us; + // the URL scheme is a convention, kept consistent so users' muscle memory + // holds. (bns:// is an internal Electron protocol implementation detail.) + t.url = "https://" + host + (rest === "/" ? "" : rest); if (!entry) { setLoading(t, false); return fallbackToWeb("no BCNR record"); } // ---- Collision policy (BCNR ↔ ICANN) -------------------------------------- @@ -1038,7 +1045,7 @@ ipcMain.handle("collision-switch", async (_e, arg) => { await t.view.webContents.loadURL(t.url); t.prov = { host, kind: "web", note: "switched to ICANN", tld, registry }; } else { - t.url = host + "/"; + t.url = "https://" + host + "/"; // display: https://; internal fetch: bns:// await t.view.webContents.loadURL(`bns://${host}/`); const rec = entries.get(host); const r = rec?.entry?.records || {};