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.
This commit is contained in:
parent
c30e4ba6c5
commit
d5e6b54c78
1 changed files with 4 additions and 8 deletions
|
|
@ -20,18 +20,14 @@ export interface NostrRelayConfig {
|
||||||
write?: boolean
|
write?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get relays from config or use defaults
|
// Get relays from config - requires VITE_NOSTR_RELAYS to be set
|
||||||
const getRelays = (): NostrRelayConfig[] => {
|
const getRelays = (): NostrRelayConfig[] => {
|
||||||
const configuredRelays = config.nostr.relays
|
const configuredRelays = config.nostr.relays
|
||||||
if (configuredRelays && configuredRelays.length > 0) {
|
if (!configuredRelays || configuredRelays.length === 0) {
|
||||||
return configuredRelays.map((url: string) => ({ url, read: true, write: true }))
|
throw new Error('VITE_NOSTR_RELAYS environment variable must be configured for chat functionality')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback relays if none configured
|
return configuredRelays.map((url: string) => ({ url, read: true, write: true }))
|
||||||
return [
|
|
||||||
{ url: 'wss://relay.damus.io', read: true, write: true },
|
|
||||||
{ url: 'wss://nos.lol', read: true, write: true }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useNostrChat() {
|
export function useNostrChat() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue