From d5e6b54c78a917bbf89b60de8cff1d57f9946926 Mon Sep 17 00:00:00 2001 From: padreug Date: Tue, 5 Aug 2025 23:36:04 +0200 Subject: [PATCH] fix: Require VITE_NOSTR_RELAYS for chat functionality - Update getRelays function to throw an error if VITE_NOSTR_RELAYS is not configured, ensuring proper relay setup for chat. - Remove fallback relays to enforce the use of configured relays only, improving reliability in chat connections. --- src/composables/useNostrChat.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/composables/useNostrChat.ts b/src/composables/useNostrChat.ts index d84856d..22d221e 100644 --- a/src/composables/useNostrChat.ts +++ b/src/composables/useNostrChat.ts @@ -20,18 +20,14 @@ export interface NostrRelayConfig { write?: boolean } -// Get relays from config or use defaults +// Get relays from config - requires VITE_NOSTR_RELAYS to be set const getRelays = (): NostrRelayConfig[] => { const configuredRelays = config.nostr.relays - if (configuredRelays && configuredRelays.length > 0) { - return configuredRelays.map((url: string) => ({ url, read: true, write: true })) + if (!configuredRelays || configuredRelays.length === 0) { + throw new Error('VITE_NOSTR_RELAYS environment variable must be configured for chat functionality') } - // Fallback relays if none configured - return [ - { url: 'wss://relay.damus.io', read: true, write: true }, - { url: 'wss://nos.lol', read: true, write: true } - ] + return configuredRelays.map((url: string) => ({ url, read: true, write: true })) } export function useNostrChat() {