diff --git a/ROADMAP.md b/ROADMAP.md index c380fb3e..3cfa3a8f 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,10 +1,13 @@ # Current - [ ] Fix notifications, separate into mentions/replies and other -- [ ] Render npubs properly http://localhost:5173/nevent1qqsqqr7r9w95lvj79zpsykup2d995jqhyxdntq98tu6tsvmjuh5ak9spz3mhxue69uhhyetvv9ujuerpd46hxtnfduyyc40u - [ ] Links/topics/mentions open modals - [ ] Render link previews inline rather than at bottom, check NostrReport for this - [ ] Wait for an auth challenge based on relay document to avoid missing first few REQs +- [ ] Extract libraries + - Cursor + - parseContent + - Tags - [ ] Image classification - https://github.com/bhky/opennsfw2 diff --git a/src/app/shared/NoteContent.svelte b/src/app/shared/NoteContent.svelte index 6a3a0876..987c50ce 100644 --- a/src/app/shared/NoteContent.svelte +++ b/src/app/shared/NoteContent.svelte @@ -122,18 +122,18 @@
{/each} {:else if type === "topic"} - openTopic(value)}>#{value} + openTopic(value)}>#{value} {:else if type === "link"} {value.replace(/https?:\/\/(www\.)?/, "")} {:else if type.startsWith("nostr:")} {#if value.pubkey} - @ goToPerson(value.pubkey)}> + @ goToPerson(value.pubkey)}> {displayPerson(getPersonWithFallback(value.pubkey))} {:else} - + {value.entity.slice(0, 16) + "..."} {/if} diff --git a/src/partials/Anchor.svelte b/src/partials/Anchor.svelte index 6c90f394..b861a885 100644 --- a/src/partials/Anchor.svelte +++ b/src/partials/Anchor.svelte @@ -2,9 +2,11 @@ import cx from "classnames" import {navigate} from "svelte-routing" import {switcher} from "hurdak/lib/hurdak" + import {killEvent as _killEvent} from "src/util/html" import {createEventDispatcher} from "svelte" export let stopPropagation = false + export let killEvent = false export let external = false export let loading = false export let type = "anchor" @@ -35,6 +37,10 @@ ) const onClick = e => { + if (killEvent) { + _killEvent(e) + } + if (stopPropagation) { e.stopPropagation() } diff --git a/src/util/nostr.ts b/src/util/nostr.ts index 68a57b63..a4d657d9 100644 --- a/src/util/nostr.ts +++ b/src/util/nostr.ts @@ -215,7 +215,13 @@ export const parseContent = ({content, tags = []}) => { try { const entity = bech32.replace("nostr:", "") const {type, data} = nip19.decode(entity) as {type: string; data: object} - const value = type === "note" ? {id: data} : data + + let value = data + if (type === "note") { + value = {id: data} + } else if (type === "npub") { + value = {pubkey: data} + } return [`nostr:${type}`, bech32, {...value, entity}] } catch (e) {