diff --git a/src/components/NostrProvider.tsx b/src/components/NostrProvider.tsx index 978d3fa..6d74597 100644 --- a/src/components/NostrProvider.tsx +++ b/src/components/NostrProvider.tsx @@ -10,7 +10,7 @@ interface NostrProviderProps { const NostrProvider: React.FC = (props) => { const { children } = props; - const { config } = useAppContext(); + const { config, presetRelays } = useAppContext(); const queryClient = useQueryClient(); @@ -36,7 +36,19 @@ const NostrProvider: React.FC = (props) => { return new Map([[relayUrl.current, filters]]); }, eventRouter(_event: NostrEvent) { - return [relayUrl.current]; + // Publish to the selected relay + const allRelays = new Set([relayUrl.current]); + + // Also publish to the preset relays, capped to 5 + for (const { url } of (presetRelays ?? [])) { + allRelays.add(url); + + if (allRelays.size >= 5) { + break; + } + } + + return [...allRelays]; }, }); }