Rework the relay detail page and edit screen
This commit is contained in:
+15
-1
@@ -1,4 +1,5 @@
|
||||
import { accounts, API_URL } from "./nostr"
|
||||
import { Relay as NostrRelay, RelayManagement } from "applesauce-relay"
|
||||
|
||||
type NostrTag = string[]
|
||||
|
||||
@@ -146,7 +147,6 @@ export type UpdateRelayInput = {
|
||||
subdomain: string
|
||||
icon: string
|
||||
description: string
|
||||
plan: string
|
||||
config: RelayConfig
|
||||
}
|
||||
|
||||
@@ -245,3 +245,17 @@ export function adminDeactivateRelay(id: string) {
|
||||
method: "POST",
|
||||
})
|
||||
}
|
||||
|
||||
export async function getRelayMemberCount(relayUrl: string): Promise<number | undefined> {
|
||||
const signer = getActiveSigner()
|
||||
const management = new RelayManagement(new NostrRelay(relayUrl), signer)
|
||||
|
||||
try {
|
||||
const members = await management.listAllowedPubkeys()
|
||||
return members.length
|
||||
} catch {
|
||||
// ignore and fall back to unknown member count
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user