Switch to new relays store

This commit is contained in:
Jon Staab
2025-10-24 09:38:57 -07:00
parent e163286dd4
commit 3dff1fcb4d
11 changed files with 53 additions and 45 deletions
+1 -1
View File
@@ -294,7 +294,7 @@ export const checkRelayAccess = async (url: string, claim = "") => {
export const checkRelayProfile = async (url: string) => {
const relay = await loadRelay(url)
if (!relay?.profile) {
if (!relay) {
return "Sorry, we weren't able to find that relay."
}
}
+5 -5
View File
@@ -96,7 +96,7 @@ import {
RelayMode,
verifyEvent,
} from "@welshman/util"
import type {TrustedEvent, PublishedList, List, Filter} from "@welshman/util"
import type {TrustedEvent, RelayProfile, PublishedList, List, Filter} from "@welshman/util"
import {decrypt} from "@welshman/signer"
import {routerContext, Router} from "@welshman/router"
import {
@@ -121,7 +121,7 @@ import {
makeUserData,
makeUserLoader,
} from "@welshman/app"
import type {Thunk, Relay} from "@welshman/app"
import type {Thunk} from "@welshman/app"
export const fromCsv = (s: string) => (s || "").split(",").filter(identity)
@@ -279,7 +279,7 @@ export const deriveEventsForUrl = (url: string, filters: Filter[]) =>
export const deriveSignedEventsForUrl = (url: string, filters: Filter[]) =>
derived([deriveEventsForUrl(url, filters), deriveRelay(url)], ([$events, $relay]) =>
$relay?.profile ? $events.filter(spec({pubkey: $relay.profile.self})) : [],
$relay?.self ? $events.filter(spec({pubkey: $relay.self})) : [],
)
// Context
@@ -556,8 +556,8 @@ export const makeChannelId = (url: string, room: string) => `${url}'${room}`
export const splitChannelId = (id: string) => id.split("'")
export const hasNip29 = (relay?: Relay) =>
relay?.profile?.supported_nips?.map?.(String)?.includes?.("29")
export const hasNip29 = (relay?: RelayProfile) =>
relay?.supported_nips?.map?.(String)?.includes?.("29")
export const channelEvents = deriveEvents(repository, {filters: [{kinds: [ROOM_META]}]})