From 13a28d2dbd7256ebdf8a799a2451df82c3080546 Mon Sep 17 00:00:00 2001 From: Gigi Date: Mon, 13 Oct 2025 00:07:46 +0200 Subject: [PATCH] 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 --- src/config/nostrGateways.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/config/nostrGateways.ts b/src/config/nostrGateways.ts index d52721da..5316a6fd 100644 --- a/src/config/nostrGateways.ts +++ b/src/config/nostrGateways.ts @@ -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}` }