mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2025-08-27 04:59:22 +00:00
Publish to preset relays
This commit is contained in:
parent
696c5ba963
commit
cd87b6e430
@ -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];
|
||||
},
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user