Move search to its own file, validate and search by nip05

This commit is contained in:
Jon Staab
2024-10-03 15:25:17 -07:00
parent 63761c91c8
commit d747424c28
6 changed files with 115 additions and 91 deletions
-10
View File
@@ -4,7 +4,6 @@ import {ctx, groupBy, indexBy, batch, now, uniq, batcher, postJson} from '@welsh
import type {RelayProfile} from "@welshman/util"
import {normalizeRelayUrl} from "@welshman/util"
import {AuthStatus, asMessage, type Connection, type SocketMessage} from '@welshman/net'
import {createSearch} from './util'
import {collection} from './collection'
export type RelayStats = {
@@ -89,15 +88,6 @@ export const {
}),
})
export const relaySearch = derived(relays, $relays =>
createSearch($relays, {
getValue: (relay: Relay) => relay.url,
fuseOptions: {
keys: ["url", "name", {name: "description", weight: 0.3}],
},
}),
)
// Utilities for syncing stats from connections to relays
type RelayStatsUpdate = [string, (stats: RelayStats) => void]