From 398bb77165e3ff454f1401b3c114a976aae5216c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 15 Sep 2026 22:47:26 -0700 Subject: A bare @npub in a message resolves to the person's name. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vector writes a mention as @npub1… with no nostr: prefix; ours only resolved the prefixed form, so the raw key sat in the bubble. Bare npubs and nprofiles, with or without the @, now render as @name and open the profile, like the prefixed ones. Keys inside URLs are left alone. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01JuwQqNWtDJcxPWtEm9134z --- src/features/messages.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/features') diff --git a/src/features/messages.js b/src/features/messages.js index 0a87e15..3c48a17 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -3766,7 +3766,10 @@ export function messagesFeature(ctx) { // nip05 (a word character sits before those), and never inside a URL // (the URL token starts earlier and swallows it). const MENTION = '(?)]+)>?[^)\\n]{0,300}\\)$', 'i'); // A YouTube link is a video, so show the video. All three shapes it comes @@ -4135,10 +4138,11 @@ export function messagesFeature(ctx) { } else if (/^https?:\/\//i.test(part)) { const pack = PACK_LINK_RE.exec(part); out.push(pack ? packLinkNode(part, pack[1]) : urlNode(part)); - } else if (/^nostr:(npub|nprofile)1/i.test(part)) { - const ref = parseNostrRef(part.slice(6)); + } else if (/^(nostr:|@?)(npub|nprofile)1/i.test(part)) { + const bare = part.replace(/^(nostr:|@)/i, ''); + const ref = parseNostrRef(bare); if (ref && ref.type === 'pubkey') out.push(h('a', { href: '#', onClick: (e) => { e.preventDefault(); openProfile(ref.pk); } }, '@' + displayName(ref.pk))); - else out.push(h('span', { class: 'faint' }, part.slice(6, 18) + '…')); + else out.push(h('span', { class: 'faint' }, bare.slice(0, 12) + '…')); } else if (/^nostr:(note|nevent)1/i.test(part)) { const ref = parseNostrRef(part.slice(6)); if (ref && ref.type === 'event') { -- cgit v1.2.3