From d80d7a5284eea39a80a738302b8202861a4f172d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 20 Sep 2026 23:31:02 -0700 Subject: Deep links: /note1… and /nevent1… open the thread; nostr:note intents route there; posts name the NIP-89 handler. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A NIP-89 handler event (kind 31990, d=coinos) under the coinos key points njump and other pickers at / for people and / for notes. The client tag on public posts now carries that coordinate. Co-Authored-By: Claude Fable 5.1 --- src/features/messages.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/features') diff --git a/src/features/messages.js b/src/features/messages.js index beae756..5d22ea2 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -51,7 +51,7 @@ const CACHE_MAX = 50; // messages kept per channel / per DM thread in feature st // kind-31990 handler coordinate, which we haven't published. Deliberately // absent from anything encrypted (DMs, community wraps) — those are private // and need no billboard. -const CLIENT_TAG = ['client', 'coinos']; +const CLIENT_TAG = ['client', 'coinos', '31990:72bdbc57bdd6dfc4e62685051de8041d148c3c68fe42bf301f71aa6cf53e52fb:coinos']; // A view the URL asks to open (a notification tap): read once, then taken // off the address so a reload doesn't repeat it. @@ -1767,11 +1767,25 @@ export function messagesFeature(ctx) { const m = location.pathname.match(/^\/([A-Za-z0-9._-]{1,64})\/?$/); // reserved app routes are never usernames — /chat is the public // community page (app.js routes it), and eating it here rewrote the URL - // to / before that route ever saw it - if (m && ['chat'].includes(m[1])) return null; + // to / before that route ever saw it; a note reference is its own link + if (m && (['chat'].includes(m[1]) || /^(note|nevent|naddr)1/i.test(m[1]))) return null; return m ? m[1] : null; })(); if (urlProfile) { try { history.replaceState(null, '', '/'); } catch {} } + // /note1… and /nevent1… open the thread the same way — the NIP-89 handler + // event for coinos points njump and friends here for notes, / for + // people. Public content: shown over the front door without a wallet. + const urlNote = (() => { + if (typeof location === 'undefined' || urlInvite || urlProfile) return null; + const m = location.pathname.match(/^\/((?:note|nevent)1[a-z0-9]+)\/?$/i); + const ref = m ? parseNostrRef(m[1].toLowerCase()) : null; + return ref && ref.type === 'event' ? ref : null; + })(); + if (urlNote) { + try { history.replaceState(null, '', '/'); } catch {} + ui.pubProf = true; + setTimeout(() => { openNoteRef(urlNote).catch(() => {}); }, 0); + } // Resolve and open right away — not in init(), which only runs once a // wallet opens (and would replay on every wallet born in this tab). For a -- cgit v1.2.3