use client relays along with users relays

This commit is contained in:
hzrd149 2023-03-10 14:17:20 -06:00
parent dbfcf14cbd
commit 9cb2e8a5d8
2 changed files with 11 additions and 4 deletions

View File

@ -61,6 +61,7 @@ I would recomend you use a browser extension like [Alby](https://getalby.com/) o
- [x] [NIP-25](https://github.com/nostr-protocol/nips/blob/master/25.md): Reactions
- [ ] [NIP-26](https://github.com/nostr-protocol/nips/blob/master/26.md): Delegated Event Signing
- [ ] [NIP-33](https://github.com/nostr-protocol/nips/blob/master/33.md): Parameterized Replaceable Events
- [ ] [NIP-39](https://github.com/nostr-protocol/nips/blob/master/39.md): External Identities in Profiles
- [ ] [NIP-36](https://github.com/nostr-protocol/nips/blob/master/36.md): Sensitive Content
- [ ] [NIP-40](https://github.com/nostr-protocol/nips/blob/master/40.md): Expiration Timestamp
- [ ] [NIP-42](https://github.com/nostr-protocol/nips/blob/master/42.md): Authentication of clients to relays

View File

@ -22,15 +22,21 @@ import { RelayMode } from "../../classes/relay";
import { RelayIcon } from "../../components/icons";
import { Note } from "../../components/note";
import { isNote } from "../../helpers/nostr-event";
import { useReadRelayUrls } from "../../hooks/use-client-relays";
import useFallbackUserRelays from "../../hooks/use-fallback-user-relays";
import useRankedRelayConfigs from "../../hooks/use-ranked-relay-configs";
import { useTimelineLoader } from "../../hooks/use-timeline-loader";
import relayScoreboardService from "../../services/relay-scoreboard";
const UserNotesTab = () => {
const { pubkey } = useOutletContext() as { pubkey: string };
const userRelays = useFallbackUserRelays(pubkey).filter((r) => r.mode & RelayMode.WRITE);
const ranked = useRankedRelayConfigs(userRelays);
const relays = ranked.map((r) => r.url).slice(0, 4) as string[];
// get user relays
const userRelays = useFallbackUserRelays(pubkey)
.filter((r) => r.mode & RelayMode.WRITE)
.map((r) => r.url);
// merge the users relays with client relays
const mergedRelays = useReadRelayUrls(userRelays);
// find the top 4
const relays = relayScoreboardService.getRankedRelays(mergedRelays).slice(0, 4);
const { isOpen: showReplies, onToggle: toggleReplies } = useDisclosure();