From 97d116ff7b1a0a61b16b682befacd130cb29db18 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 27 Sep 2026 11:42:16 -0500 Subject: [PATCH] Skip client tag on localhost, *.localhost, and IP addresses --- src/hooks/useNostrPublish.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hooks/useNostrPublish.ts b/src/hooks/useNostrPublish.ts index f5d9c02..6d80c4b 100644 --- a/src/hooks/useNostrPublish.ts +++ b/src/hooks/useNostrPublish.ts @@ -21,8 +21,12 @@ export function useNostrPublish(): UseMutationResult< if (user) { const tags = t.tags ?? []; + const { hostname } = location; + const isLocalhost = hostname === "localhost" || hostname.endsWith(".localhost"); + const isIpAddress = /^\d{1,3}(\.\d{1,3}){3}$/.test(hostname) || hostname.startsWith("["); + // Add the client tag if it doesn't exist - if (location.protocol === "https:" && !tags.some(([name]) => name === "client")) { + if (location.protocol === "https:" && !isLocalhost && !isIpAddress && !tags.some(([name]) => name === "client")) { tags.push(["client", location.hostname]); }