Skip client tag on localhost, *.localhost, and IP addresses

This commit is contained in:
Alex Gleason committed 2026-09-27 11:42:45 -05:00
1 parent c2556b9b2d
commit 97d116ff7b
1 file changed
+5 -1
+5 -1
View File
@@ -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]);
}