Detect nip29 support for create room button

This commit is contained in:
Jon Staab
2025-05-27 16:22:20 -07:00
parent 4ba6c72459
commit e57b5721f6
5 changed files with 67 additions and 40 deletions
+11 -4
View File
@@ -1,6 +1,9 @@
<script lang="ts">
import {onMount} from "svelte"
import {addToMapKey, dec, gt} from "@welshman/lib"
import {GROUPS} from "@welshman/util"
import {Router} from "@welshman/router"
import {load} from "@welshman/net"
import type {Relay} from "@welshman/app"
import {relays, createSearch, loadRelay, loadRelaySelections} from "@welshman/app"
import {createScroller} from "@lib/html"
@@ -24,8 +27,12 @@
import {pushModal} from "@app/modal"
const discoverRelays = () =>
Promise.all(
getDefaultPubkeys().map(async pubkey => {
Promise.all([
load({
filters: [{kinds: [GROUPS]}],
relays: Router.get().Index().getUrls(),
}),
...getDefaultPubkeys().map(async pubkey => {
await loadRelaySelections(pubkey)
const membership = await loadMembership(pubkey)
@@ -33,7 +40,7 @@
await Promise.all(urls.map(url => loadRelay(url)))
}),
)
])
const wotGraph = $derived.by(() => {
const scores = new Map<string, Set<string>>()
@@ -87,7 +94,7 @@
})
</script>
<Page>
<Page class="cw-full">
<div class="content column gap-4" bind:this={element}>
<PageHeader>
{#snippet title()}
+7 -4
View File
@@ -18,6 +18,7 @@
import RoomCreate from "@app/components/RoomCreate.svelte"
import RelayDescription from "@app/components/RelayDescription.svelte"
import {
hasNip29,
decodeRelay,
channelIsLocked,
makeChannelId,
@@ -183,10 +184,12 @@
</div>
</Link>
{/each}
<Button onclick={addRoom} class="btn btn-neutral whitespace-nowrap">
<Icon icon="add-circle" />
Create
</Button>
{#if hasNip29($relay)}
<Button onclick={addRoom} class="btn btn-neutral whitespace-nowrap">
<Icon icon="add-circle" />
Create
</Button>
{/if}
</div>
{#if pubkey}
<Divider>Recent posts from the relay admin</Divider>