Publish to preset relays

This commit is contained in:
Alex Gleason committed 2025-06-04 11:32:12 -05:00
1 parent 696c5ba963
commit cd87b6e430
1 file changed
+14 -2
+14 -2
View File
@@ -10,7 +10,7 @@ interface NostrProviderProps {
const NostrProvider: React.FC<NostrProviderProps> = (props) => {
const { children } = props;
const { config } = useAppContext();
const { config, presetRelays } = useAppContext();
const queryClient = useQueryClient();
@@ -36,7 +36,19 @@ const NostrProvider: React.FC<NostrProviderProps> = (props) => {
return new Map([[relayUrl.current, filters]]);
},
eventRouter(_event: NostrEvent) {
return [relayUrl.current];
// Publish to the selected relay
const allRelays = new Set<string>([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];
},
});
}