From 1522fa17ce89cc4a58452242bc0d1290cf16d30c Mon Sep 17 00:00:00 2001 From: Silberengel Date: Tue, 20 May 2025 06:57:09 +0200 Subject: [PATCH] remove nip33 and replace with naddr --- src/lib/components/util/CardActions.svelte | 10 +++++----- src/routes/events/+page.svelte | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib/components/util/CardActions.svelte b/src/lib/components/util/CardActions.svelte index eee1415..bbc2b73 100644 --- a/src/lib/components/util/CardActions.svelte +++ b/src/lib/components/util/CardActions.svelte @@ -82,19 +82,19 @@ detailsModalOpen = true; } - // --- Custom JSON pretty-printer with NIP-33 address hyperlinking --- + // --- Custom JSON pretty-printer with naddr hyperlinking --- /** - * Returns HTML for pretty-printed JSON, with NIP-33 addresses as links to /events?id=naddr1... + * Returns HTML for pretty-printed JSON, with naddrs as links to /events?id=naddr1... */ function jsonWithNaddrLinks(obj: any): string { - const NIP33_REGEX = /\b(\d{5}:[a-f0-9]{64}:[a-zA-Z0-9._-]+)\b/g; + const NADDR_REGEX = /\b(\d{5}:[a-f0-9]{64}:[a-zA-Z0-9._-]+)\b/g; function replacer(_key: string, value: any) { return value; } // Stringify with 2-space indent let json = JSON.stringify(obj, replacer, 2); - // Replace NIP-33 addresses with links - json = json.replace(NIP33_REGEX, (match) => { + // Replace naddr addresses with links + json = json.replace(NADDR_REGEX, (match) => { try { const [kind, pubkey, dtag] = match.split(":"); // Compose a fake event for naddrEncode diff --git a/src/routes/events/+page.svelte b/src/routes/events/+page.svelte index b471ae3..b24a96b 100644 --- a/src/routes/events/+page.svelte +++ b/src/routes/events/+page.svelte @@ -127,10 +127,10 @@ } /** - * Returns HTML for pretty-printed JSON, with NIP-33 addresses and event IDs as links + * Returns HTML for pretty-printed JSON, with naddr addresses and event IDs as links */ function jsonWithLinks(obj: any): string { - const NIP33_REGEX = /\b(\d{5}:[a-f0-9]{64}:[a-zA-Z0-9._-]+)\b/g; + const NADDR_REGEX = /\b(\d{5}:[a-f0-9]{64}:[a-zA-Z0-9._-]+)\b/g; const EVENT_ID_REGEX = /\b([0-9a-f]{64})\b/g; function replacer(_key: string, value: any) { @@ -139,8 +139,8 @@ // Stringify with 2-space indent let json = JSON.stringify(obj, replacer, 2); - // Replace NIP-33 addresses with links - json = json.replace(NIP33_REGEX, (match) => { + // Replace addresses with links + json = json.replace(NADDR_REGEX, (match) => { try { const [kind, pubkey, dtag] = match.split(":"); // Compose a fake event for naddrEncode