Add wot to discover

This commit is contained in:
Jon Staab
2024-10-17 13:56:53 -07:00
parent 7cf8fac9b6
commit 9c31b12d48
7 changed files with 119 additions and 65 deletions
+13 -1
View File
@@ -17,8 +17,9 @@ import {
removeFromListByPredicate,
getListTags,
getRelayTags,
isShareableRelayUrl,
} from "@welshman/util"
import type {TrustedEvent, EventTemplate} from "@welshman/util"
import type {TrustedEvent, EventTemplate, List} from "@welshman/util"
import type {SubscribeRequestWithHandlers} from "@welshman/net"
import {PublishStatus, AuthStatus, ConnectionStatus} from "@welshman/net"
import {Nip59, stamp} from "@welshman/signer"
@@ -96,6 +97,7 @@ export const loadUserData = (
await sleep(300)
for (const pubkey of pubkeys) {
loadMembership(pubkey),
loadProfile(pubkey)
loadFollows(pubkey)
loadMutes(pubkey)
@@ -106,6 +108,16 @@ export const loadUserData = (
return promise
}
export const discoverRelays = (lists: List[]) => {
const urls = uniq(lists.flatMap(getRelayUrls))
for (const url of urls) {
if (isShareableRelayUrl(url)) {
loadRelay(url)
}
}
}
// Synchronization
export const broadcastUserData = async (relays: string[]) => {