Fix /domain.com routes 404ing for _@domain.com NIP-05 users

isNip05Like in NIP19Page only checked for '@', so bare domain identifiers
like 'fiatjaf.com' fell through to NIP-19 decoding and returned NotFound.
Extend the check to match the same dot-based heuristic already used in
ProfilePage.
This commit is contained in:
Alex Gleason
2026-02-23 19:43:34 -06:00
parent bc9fd431b8
commit 5cbae842e0
+7 -2
View File
@@ -10,10 +10,15 @@ import type { AddressPointer } from 'nostr-tools/nip19';
const HEX_64_RE = /^[0-9a-f]{64}$/;
/**
* Returns true if the identifier looks like a NIP-05 username (contains @).
* Returns true if the identifier looks like a NIP-05 identifier.
* Covers both `user@domain.com` and bare domains like `fiatjaf.com`
* (which represent `_@domain.com` root users).
*/
function isNip05Like(id: string): boolean {
return id.includes('@');
if (id.includes('@')) return true;
// Bare domain (e.g. "fiatjaf.com") — has a dot but is not a NIP-19 bech32 prefix
if (id.includes('.') && !id.startsWith('npub1') && !id.startsWith('nprofile1')) return true;
return false;
}
/**