Files
flotilla/src/app/commands.ts
T
2024-08-06 15:46:37 -07:00

16 lines
428 B
TypeScript

import {batch, postJson} from "@welshman/lib"
import {normalizeRelayUrl} from "@welshman/util"
import {relayInfo} from "app/state"
export const loadRelay = batch(1000, async (urls: string[]) => {
const data = await postJson(`${DUFFLEPUD_URL}/relay/info`, {urls})
relayInfo.update($relayInfo => {
for (const {url, info} of data) {
$relayInfo.set(normalizeRelayUrl(url), info)
}
return $relayInfo
})
})