Skip to content

Commit

Permalink
fix join/leave relay
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Apr 11, 2024
1 parent 8874add commit 35b7072
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/lib/components/layout/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@

<div class="relative">
{#if url}
<h1 class="scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl mb-6 transition-colors duration-200">
<h1 class="scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl mb-6">
<span class="flex items-center space-x-4">
{#if $relay?.info?.icon}
<img src={ $relay?.info.icon } class="max-w-20 max-h-20"/>
{/if}
<span class="truncate text-ellipsis overflow-hidden max-w-full inline-block pb-3">{ url }</span>
<span class="truncate text-ellipsis overflow-hidden max-w-full inline-block pb-3">
{ url }
</span>
<ToggleRelay />
<PayRelay />
</span>
Expand All @@ -56,6 +58,6 @@
<Software />
<div class="absolute -top-12 -right-10 items-center text-right min-w-40">
<Login />
<ThemeMode class="inline-block relative top-3" />
<ThemeMode class="inline-block" />
</div>
</div>
2 changes: 1 addition & 1 deletion src/lib/components/partials/login.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
{#if browser && window?.nostr}
<div class="inline-block">
{#if mrp?.ndk && (typeof mrp?.ndk?.user === 'undefined' || mrp?.ndk?.user === null)}
<Button variant="outline" on:click={login}>login</Button>
<Button variant="outline" class="relative -top-3" on:click={login}>login</Button>
{:else if mrp?.ndk?.user?.profile}
<div class="flex items-center space-x-4">
{#if userIsOperator}
Expand Down
6 changes: 4 additions & 2 deletions src/lib/core/MRPNostr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ export class MRPNostr {
this.user.relayList.created_at = undefined
this.user.relayList.id = ""
this.user.relayList.tags.push([ 'r', relay ])
const publishToRelays = NDKRelaySet.fromRelayUrls([...(this.user.relayList.writeRelayUrls|| []), relay], this.$)
console.log('joinRelay', this.user.relayList.writeRelayUrls)
const publishToRelays = NDKRelaySet.fromRelayUrls([...(this.user.relayList.writeRelayUrls|| []), relay], this?.$?.ndk as NDK)
await this.user.relayList.publish(publishToRelays)
//console.log('joined relay')
}
Expand All @@ -85,7 +86,8 @@ export class MRPNostr {
this.user.relayList.created_at = undefined
this.user.relayList.id = ""
this.user.relayList.tags = this.user.relayList.tags.filter( tag => tag[1] !== relay )
const publishToRelays = NDKRelaySet.fromRelayUrls([...(this.user.relayList.writeRelayUrls|| []), relay], this.$)
console.log('leaveRelay', this.user.relayList.writeRelayUrls)
const publishToRelays = NDKRelaySet.fromRelayUrls([...(this.user.relayList.writeRelayUrls|| []), relay], this?.$?.ndk as NDK)
await this.user.relayList.publish(publishToRelays)
//console.log('left relay')
}
Expand Down

0 comments on commit 35b7072

Please sign in to comment.