aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/features')
-rw-r--r--src/features/names.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/features/names.js b/src/features/names.js
index 5b2f856..0291b40 100644
--- a/src/features/names.js
+++ b/src/features/names.js
@@ -183,6 +183,21 @@ export function namesFeature(ctx) {
} catch {}
}
}
+ // A name the registrar no longer grants us is a costume, not an
+ // address: verify ownership and drop stale local state (a record can
+ // be evicted server-side — a squatted legacy name once lingered in
+ // the squatter's UI this way). Registrar outages keep the benefit of
+ // the doubt.
+ if (st.name) {
+ try {
+ const r = await withTimeout(
+ fetch(`${REGISTRAR}/name/${encodeURIComponent(st.name)}?domain=${encodeURIComponent(st.domain || DOMAIN())}`).then((x) => x.json()),
+ 8000, 'registrar');
+ const mine = new Set([wallet.nostrPubkey && wallet.nostrPubkey(), (hook('nostrLoginIdentity') || {}).pubkey].filter(Boolean));
+ const ours = r && r.taken && (mine.has(r.pubkey) || mine.has(r.manager));
+ if (r && !ours) { save({}); st = load(); render(); }
+ } catch {}
+ }
if (!st.name) {
// The address people see should be the identity they know the user
// by: their real npub when a nostr account is linked, else the