From ff9b87bb48130f638249412848c69b2d4a2a770a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 27 Aug 2026 23:05:21 -0700 Subject: 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 Claude-Session: https://claude.ai/code/session_019eA8JRq9Wr7z2fRQk99HLi --- names/server.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'names/server.js') 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('@'); -- cgit v1.2.3