fix: make getNostrUrl detect identifier type for ants.sh

- ants.sh requires /p/ for profiles (npub/nprofile) and /e/ for events (note/nevent/naddr)
- Updated getNostrUrl to automatically detect identifier type and use correct path
This commit is contained in:
Gigi
2025-10-13 00:07:46 +02:00
parent f87a7da32e
commit 13a28d2dbd

View File

@@ -20,8 +20,15 @@ export function getEventUrl(nevent: string): string {
/**
* Get a general nostr link on the gateway
* Automatically detects if it's a profile (npub/nprofile) or event (note/nevent/naddr)
*/
export function getNostrUrl(identifier: string): string {
return `${NOSTR_GATEWAY}/${identifier}`
// Check the prefix to determine if it's a profile or event
if (identifier.startsWith('npub') || identifier.startsWith('nprofile')) {
return `${NOSTR_GATEWAY}/p/${identifier}`
}
// Everything else (note, nevent, naddr) goes to /e/
return `${NOSTR_GATEWAY}/e/${identifier}`
}