Terms of Service
{/if}
- {#if $relay.profile.privacy_policy}
-
Privacy Policy
diff --git a/src/app/components/SpaceRelayStatus.svelte b/src/app/components/SpaceRelayStatus.svelte
index 5636308b..686520ac 100644
--- a/src/app/components/SpaceRelayStatus.svelte
+++ b/src/app/components/SpaceRelayStatus.svelte
@@ -12,7 +12,6 @@
const {url}: Props = $props()
const relay = deriveRelay(url)
- const owner = $derived($relay?.profile?.pubkey)
- {#if $relay?.profile}
- {@const {software, version, supported_nips, limitation} = $relay.profile}
+ {#if $relay}
+ {@const {pubkey, software, version, supported_nips, limitation} = $relay}
- {#if owner}
+ {#if pubkey}
-
Administrator:
+
Administrator:
{/if}
- {#if $relay?.profile?.contact}
+ {#if $relay?.contact}
- Contact: {$relay.profile.contact}
+ Contact: {$relay.contact}
{/if}
{#if software}
diff --git a/src/app/core/commands.ts b/src/app/core/commands.ts
index 35c1296f..82e907a4 100644
--- a/src/app/core/commands.ts
+++ b/src/app/core/commands.ts
@@ -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."
}
}
diff --git a/src/app/core/state.ts b/src/app/core/state.ts
index 7ccaf1ae..11c47686 100644
--- a/src/app/core/state.ts
+++ b/src/app/core/state.ts
@@ -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]}]})
diff --git a/src/app/util/storage.ts b/src/app/util/storage.ts
index 2c34f7ca..a77b7079 100644
--- a/src/app/util/storage.ts
+++ b/src/app/util/storage.ts
@@ -21,13 +21,14 @@ import {
DIRECT_MESSAGE_FILE,
verifiedSymbol,
} from "@welshman/util"
-import type {Zapper, TrustedEvent} from "@welshman/util"
+import type {Zapper, TrustedEvent, RelayProfile} from "@welshman/util"
import type {RepositoryUpdate, WrapItem} from "@welshman/net"
-import type {Handle, Relay} from "@welshman/app"
+import type {Handle, RelayStats} from "@welshman/app"
import {
plaintext,
tracker,
relays,
+ relayStats,
repository,
handles,
zappers,
@@ -157,13 +158,21 @@ const syncTracker = async () => {
}
const syncRelays = async () => {
- const collection = new Collection
({table: "relays", getId: prop("url")})
+ const collection = new Collection({table: "relays", getId: prop("url")})
relays.set(await collection.get())
return throttled(3000, relays).subscribe(collection.set)
}
+const syncRelayStats = async () => {
+ const collection = new Collection({table: "relayStats", getId: prop("url")})
+
+ relayStats.set(await collection.get())
+
+ return throttled(3000, relayStats).subscribe(collection.set)
+}
+
const syncHandles = async () => {
const collection = new Collection({table: "handles", getId: prop("nip05")})
@@ -233,6 +242,7 @@ export const syncDataStores = async () => {
syncEvents(),
syncTracker(),
syncRelays(),
+ syncRelayStats(),
syncHandles(),
syncZappers(),
syncFreshness(),
diff --git a/src/routes/discover/+page.svelte b/src/routes/discover/+page.svelte
index 34040d2b..a1bfb703 100644
--- a/src/routes/discover/+page.svelte
+++ b/src/routes/discover/+page.svelte
@@ -2,10 +2,10 @@
import {onMount} from "svelte"
import {debounce} from "throttle-debounce"
import {dec, tryCatch} from "@welshman/lib"
+ import type {RelayProfile} from "@welshman/util"
import {ROOMS, normalizeRelayUrl, isRelayUrl} from "@welshman/util"
import {Router} from "@welshman/router"
import {load} from "@welshman/net"
- import type {Relay} from "@welshman/app"
import {relays, createSearch, loadRelay} from "@welshman/app"
import {createScroller} from "@lib/html"
import {fly} from "@lib/transition"
@@ -62,7 +62,7 @@
createSearch(
$relays.filter(r => $groupSelectionsPubkeysByUrl.has(r.url) && r.url !== termUrl),
{
- getValue: (relay: Relay) => relay.url,
+ getValue: (relay: RelayProfile) => relay.url,
sortFn: ({score, item}) => {
if (score && score > 0.1) return -score!