mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Use nprofile and nevent links for external URLs in Account and Status
This commit is contained in:
parent
30d8cc4108
commit
d1635712cf
2 changed files with 9 additions and 3 deletions
|
|
@ -45,6 +45,7 @@ async function renderAccount(
|
||||||
} = n.json().pipe(n.metadata()).catch({}).parse(event.content);
|
} = n.json().pipe(n.metadata()).catch({}).parse(event.content);
|
||||||
|
|
||||||
const npub = nip19.npubEncode(pubkey);
|
const npub = nip19.npubEncode(pubkey);
|
||||||
|
const nprofile = nip19.nprofileEncode({ pubkey, relays: [Conf.relay] });
|
||||||
const parsed05 = await parseAndVerifyNip05(nip05, pubkey, signal);
|
const parsed05 = await parseAndVerifyNip05(nip05, pubkey, signal);
|
||||||
const acct = parsed05?.handle || npub;
|
const acct = parsed05?.handle || npub;
|
||||||
|
|
||||||
|
|
@ -100,7 +101,7 @@ async function renderAccount(
|
||||||
username: parsed05?.nickname || npub.substring(0, 8),
|
username: parsed05?.nickname || npub.substring(0, 8),
|
||||||
ditto: {
|
ditto: {
|
||||||
accepts_zaps: Boolean(getLnurl({ lud06, lud16 })),
|
accepts_zaps: Boolean(getLnurl({ lud06, lud16 })),
|
||||||
external_url: Conf.external(npub),
|
external_url: Conf.external(nprofile),
|
||||||
},
|
},
|
||||||
domain: parsed05?.domain,
|
domain: parsed05?.domain,
|
||||||
pleroma: {
|
pleroma: {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,12 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise<
|
||||||
|
|
||||||
if (depth > 2 || depth < 0) return;
|
if (depth > 2 || depth < 0) return;
|
||||||
|
|
||||||
const note = nip19.noteEncode(event.id);
|
const nevent = nip19.neventEncode({
|
||||||
|
id: event.id,
|
||||||
|
author: event.pubkey,
|
||||||
|
kind: event.kind,
|
||||||
|
relays: [Conf.relay],
|
||||||
|
});
|
||||||
|
|
||||||
const account = event.author
|
const account = event.author
|
||||||
? await renderAccount({ ...event.author, author_stats: event.author_stats })
|
? await renderAccount({ ...event.author, author_stats: event.author_stats })
|
||||||
|
|
@ -138,7 +143,7 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise<
|
||||||
url: Conf.local(`/@${account.acct}/${event.id}`),
|
url: Conf.local(`/@${account.acct}/${event.id}`),
|
||||||
zapped: Boolean(zapEvent),
|
zapped: Boolean(zapEvent),
|
||||||
ditto: {
|
ditto: {
|
||||||
external_url: Conf.external(note),
|
external_url: Conf.external(nevent),
|
||||||
},
|
},
|
||||||
pleroma: {
|
pleroma: {
|
||||||
emoji_reactions: reactions,
|
emoji_reactions: reactions,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue