mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Mimic Mastodon's uri/url fields exactly on Accounts and Statuses
This commit is contained in:
parent
8f704e4ea2
commit
dbd40357af
3 changed files with 7 additions and 4 deletions
|
|
@ -36,6 +36,7 @@ export interface MastodonAccount {
|
|||
};
|
||||
};
|
||||
statuses_count: number;
|
||||
uri: string;
|
||||
url: string;
|
||||
username: string;
|
||||
ditto: {
|
||||
|
|
|
|||
|
|
@ -42,10 +42,11 @@ async function renderAccount(
|
|||
|
||||
const npub = nip19.npubEncode(pubkey);
|
||||
const parsed05 = await parseAndVerifyNip05(nip05, pubkey);
|
||||
const acct = parsed05?.handle || npub;
|
||||
|
||||
return {
|
||||
id: pubkey,
|
||||
acct: parsed05?.handle || npub,
|
||||
acct,
|
||||
avatar: picture,
|
||||
avatar_static: picture,
|
||||
bot: false,
|
||||
|
|
@ -78,7 +79,8 @@ async function renderAccount(
|
|||
}
|
||||
: undefined,
|
||||
statuses_count: event.author_stats?.notes_count ?? 0,
|
||||
url: Conf.local(`/users/${pubkey}`),
|
||||
uri: Conf.local(`/users/${acct}`),
|
||||
url: Conf.local(`/@${acct}`),
|
||||
username: parsed05?.nickname || npub.substring(0, 8),
|
||||
ditto: {
|
||||
accepts_zaps: Boolean(getLnurl({ lud06, lud16 })),
|
||||
|
|
|
|||
|
|
@ -121,8 +121,8 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise<
|
|||
poll: null,
|
||||
quote: !event.quote ? null : await renderStatus(event.quote, { depth: depth + 1 }),
|
||||
quote_id: event.quote?.id ?? null,
|
||||
uri: Conf.local(`/${note}`),
|
||||
url: Conf.local(`/${note}`),
|
||||
uri: Conf.local(`/users/${account.acct}/statuses/${event.id}`),
|
||||
url: Conf.local(`/@${account.acct}/${event.id}`),
|
||||
zapped: Boolean(zapEvent),
|
||||
ditto: {
|
||||
external_url: Conf.external(note),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue