feat: improve highlight source display and navigation

This commit is contained in:
codytseng
2025-08-16 22:33:19 +08:00
parent 06adcdb2a8
commit 6350ddc224
4 changed files with 41 additions and 22 deletions

View File

@@ -18,7 +18,13 @@ export function tagNameEquals(tagName: string) {
export function generateBech32IdFromETag(tag: string[]) {
try {
const [, id, relay, , author] = tag
const [, id, relay, markerOrPubkey, pubkey] = tag
let author: string | undefined
if (markerOrPubkey && isValidPubkey(markerOrPubkey)) {
author = markerOrPubkey
} else if (pubkey && isValidPubkey(pubkey)) {
author = pubkey
}
return nip19.neventEncode({ id, relays: relay ? [relay] : undefined, author })
} catch {
return undefined