diff options
| author | Adam Soltys <[email protected]> | 2026-08-27 23:05:21 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-27 23:05:21 -0700 |
| commit | ff9b87bb48130f638249412848c69b2d4a2a770a (patch) | |
| tree | ffcf243f167883d62573c0f0120661de0bc40451 /names/server.js | |
| parent | 8008239b74ad7849f100fbd5324883525f5a514b (diff) | |
| download | coinosv3-ff9b87bb48130f638249412848c69b2d4a2a770a.tar.gz coinosv3-ff9b87bb48130f638249412848c69b2d4a2a770a.zip | |
The chosen name outranks the placeholder everywhere: a claim can no longer release a custom name to make room for an npub default (the race that deleted passkeyguy), sign-in asks the registrar about the login identity before reaching for a placeholder, and the registrar answers /pubkey with the name the user picked rather than whichever record is younger
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019eA8JRq9Wr7z2fRQk99HLi
Diffstat (limited to 'names/server.js')
| -rw-r--r-- | names/server.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/names/server.js b/names/server.js index f54864d..e49da51 100644 --- a/names/server.js +++ b/names/server.js @@ -764,7 +764,13 @@ Bun.serve({ const domFilter = (url.searchParams.get('domain') || '').toLowerCase(); const mine = Object.entries(state.names) .filter(([k, r]) => r.pubkey === pm[1] && (!domFilter || k.endsWith('@' + domFilter))) - .sort((a, b) => (b[1].updated || 0) - (a[1].updated || 0)); + // a custom name outranks the free npub placeholder regardless of + // which record is fresher — a placeholder re-claimed on a new device + // must not shadow the name the user actually chose + .sort((a, b) => { + const ph = ([k]) => (/^npub1/.test(k.split('@')[0]) ? 1 : 0); + return ph(a) - ph(b) || (b[1].updated || 0) - (a[1].updated || 0); + }); if (!mine.length) return json({}); const [key, r] = mine[0]; const [name, domain] = key.split('@'); |
