diff options
| author | Adam Soltys <[email protected]> | 2026-08-26 17:34:47 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-26 17:34:47 -0700 |
| commit | 181cf4d5d0ffb7ae3ccd337745a16619a35eaae1 (patch) | |
| tree | 695cac1d701bca656712d0b1504bdd6d2690d905 | |
| parent | eb0fefa647c989ff6174d6b38014b0471fe49ec6 (diff) | |
| download | coinosv3-181cf4d5d0ffb7ae3ccd337745a16619a35eaae1.tar.gz coinosv3-181cf4d5d0ffb7ae3ccd337745a16619a35eaae1.zip | |
The address stops waiting for the mail: your own claimed name prints instantly, a deep link's URL already spells the address so it paints with the first frame, and the light cache now remembers nip05 and lightning address between sessions instead of shedding them at the door
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019eA8JRq9Wr7z2fRQk99HLi
| -rw-r--r-- | src/features/messages.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index 708b40a..c3ca466 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -195,7 +195,7 @@ export function messagesFeature(ctx) { } function persistProfile(pk, p) { const s = wallet.loadFeatureState('profiles', {}); - s[pk] = { name: p.name || null, picture: p.picture || null, t: Date.now() }; + s[pk] = { name: p.name || null, picture: p.picture || null, nip05: p.nip05 || null, lud16: p.lud16 || null, t: Date.now() }; const keys = Object.keys(s); if (keys.length > 150) { for (const k of keys.sort((a, b) => (s[a].t || 0) - (s[b].t || 0)).slice(0, keys.length - 150)) delete s[k]; @@ -651,7 +651,7 @@ export function messagesFeature(ctx) { // one loads. if (pk && /^[0-9a-f]{64}$/.test(pk)) { warmProfiles(); - if (!profiles.has(pk)) profiles.set(pk, { name, t: 0, loading: true }); + if (!profiles.has(pk)) profiles.set(pk, { name, addr: `${name}@${domain}`, t: 0, loading: true }); } } if (pk && /^[0-9a-f]{64}$/.test(pk)) { @@ -1200,7 +1200,11 @@ export function messagesFeature(ctx) { // light cache (and persist) so a picture changed elsewhere replaces the // stale one everywhere within a session, not after the 24h TTL. The // repaint covers the header/chat avatars, not just an open profile page. - const entry = { name: m.display_name || m.name || null, picture: m.picture || null, t: Date.now() }; + const entry = { + name: m.display_name || m.name || null, picture: m.picture || null, + nip05: m.nip05 || null, lud16: typeof m.lud16 === 'string' ? m.lud16.trim() : null, + t: Date.now(), + }; profiles.set(pk, entry); persistProfile(pk, entry); if (ui.profilePk === pk) render(); @@ -1649,8 +1653,13 @@ export function messagesFeature(ctx) { // A lightning address worth showing: not an npub-shaped machine address // (npub1…@some.relay duplicates the npub below) and not the same string // as the nip05 already on screen. - const nip05 = full && full.nip05 ? String(full.nip05).replace(/^_@/, '') : null; - const lud16 = full && full.lud16 ? String(full.lud16) : null; + // The address must not wait for the kind 0: our own claimed name is + // authoritative locally, a deep link carries the address in the URL + // (seeded as `addr`), and the light cache remembers it from last time. + const lp = profileOf(pk) || {}; + const rawNip05 = (full && full.nip05) || (mine && myAddr) || lp.nip05 || lp.addr || null; + const nip05 = rawNip05 ? String(rawNip05).replace(/^_@/, '') : null; + const lud16 = (full && full.lud16 ? String(full.lud16) : null) || lp.lud16 || null; const showLud = lud16 && !/^npub1/i.test(lud16) && lud16 !== nip05; // an about of "~" or a lone character is noise, not a bio const about = full && typeof full.about === 'string' ? full.about.trim() : ''; |
