Add per-url aliases

This commit is contained in:
Jon Staab
2025-04-15 11:03:27 -07:00
parent 91689e5b90
commit 374ca7f265
37 changed files with 321 additions and 162 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
import {bytesToHex, hexToBytes} from "@noble/hashes/utils"
import {identity, memoize, sleep, defer, ago, WEEK, TaskQueue} from "@welshman/lib"
import type {TrustedEvent, StampedEvent} from "@welshman/util"
import {WRAP} from "@welshman/util"
import {WRAP, PROFILE, getTag} from "@welshman/util"
import {Nip46Broker, makeSecret} from "@welshman/signer"
import type {Socket} from "@welshman/net"
import {request, defaultSocketPolicies, makeSocketPolicyAuth} from "@welshman/net"
+8 -8
View File
@@ -2,7 +2,7 @@
import * as nip19 from "nostr-tools/nip19"
import {hexToBytes} from "@noble/hashes/utils"
import {displayPubkey, displayProfile} from "@welshman/util"
import {pubkey, session, displayNip05, deriveProfile} from "@welshman/app"
import {pubkey, session, displayNip05} from "@welshman/app"
import {slideAndFade} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte"
import FieldInline from "@lib/components/FieldInline.svelte"
@@ -13,11 +13,11 @@
import ProfileDelete from "@app/components/ProfileDelete.svelte"
import InfoKeys from "@app/components/InfoKeys.svelte"
import Alerts from "@app/components/Alerts.svelte"
import {PLATFORM_NAME} from "@app/state"
import {PLATFORM_NAME, deriveAlias} from "@app/state"
import {pushModal} from "@app/modal"
import {clip} from "@app/toast"
const profile = deriveProfile($pubkey!)
const alias = deriveAlias($pubkey!)
const pubkeyDisplay = displayPubkey($pubkey!)
@@ -39,16 +39,16 @@
<div class="flex justify-between gap-2">
<div class="flex max-w-full gap-3">
<div class="py-1">
<Avatar src={$profile?.picture} size={10} />
<Avatar src={$alias?.profile?.picture} size={10} />
</div>
<div class="flex min-w-0 flex-col">
<div class="flex items-center gap-2">
<div class="text-bold overflow-hidden text-ellipsis">
{displayProfile($profile, pubkeyDisplay)}
{displayProfile($alias?.profile, pubkeyDisplay)}
</div>
</div>
<div class="overflow-hidden text-ellipsis text-sm opacity-75">
{$profile?.nip05 ? displayNip05($profile.nip05) : pubkeyDisplay}
{$alias?.profile?.nip05 ? displayNip05($alias?.profile.nip05) : pubkeyDisplay}
</div>
</div>
</div>
@@ -56,8 +56,8 @@
<Icon icon="pen-new-square" />
</Button>
</div>
{#key $profile?.about}
<Content event={{content: $profile?.about || "", tags: []}} hideMediaAtDepth={0} />
{#key $alias?.profile?.about}
<Content event={{content: $alias?.profile?.about || "", tags: []}} hideMediaAtDepth={0} />
{/key}
</div>
{#if $session?.email}
@@ -311,7 +311,7 @@
<ChannelComposeParent event={share} clear={clearShare} verb="Sharing" />
{/if}
</div>
<ChannelCompose bind:this={compose} {onSubmit} />
<ChannelCompose bind:this={compose} {onSubmit} {url} />
</div>
{#if showScrollButton}
@@ -81,11 +81,11 @@
<CalendarEventDate event={$event} />
<div class="flex min-w-0 flex-grow flex-col gap-1">
<CalendarEventHeader event={$event} />
<CalendarEventMeta event={$event} />
<CalendarEventMeta event={$event} {url} />
<div class="flex py-2 opacity-50">
<div class="h-px flex-grow bg-base-content opacity-25"></div>
</div>
<Content showEntire event={$event} relays={[url]} />
<Content showEntire event={$event} {url} />
</div>
</div>
<div class="flex w-full flex-col justify-end sm:flex-row">
@@ -101,9 +101,9 @@
</div>
{/if}
{#each sortBy(e => e.created_at, $replies).slice(0, showAll ? undefined : 4) as reply (reply.id)}
<NoteCard event={reply} class="card2 bg-alt z-feature w-full">
<NoteCard event={reply} {url} class="card2 bg-alt z-feature w-full">
<div class="col-3 ml-12">
<Content showEntire event={reply} />
<Content showEntire event={reply} {url} />
<CalendarEventActions event={reply} {url} />
</div>
</NoteCard>
@@ -76,9 +76,9 @@
<PageContent class="flex flex-col p-2 pt-4">
{#if $event}
<div class="flex flex-col gap-3">
<NoteCard event={$event} class="card2 bg-alt z-feature w-full">
<NoteCard event={$event} {url} class="card2 bg-alt z-feature w-full">
<div class="col-3 ml-12">
<Content showEntire event={$event} relays={[url]} />
<Content showEntire event={$event} {url} />
<ThreadActions event={$event} {url} />
</div>
</NoteCard>
@@ -91,9 +91,9 @@
</div>
{/if}
{#each sortBy(e => -e.created_at, $replies).slice(0, showAll ? undefined : 4) as reply (reply.id)}
<NoteCard event={reply} class="card2 bg-alt z-feature w-full">
<NoteCard event={reply} {url} class="card2 bg-alt z-feature w-full">
<div class="col-3 ml-12">
<Content showEntire event={reply} />
<Content showEntire event={reply} {url} />
<ThreadActions event={reply} {url} />
</div>
</NoteCard>