Include fields in account.source

This commit is contained in:
Alex Gleason 2024-11-20 09:45:52 -06:00
parent 154056f8d6
commit 281f57d88e
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -43,7 +43,7 @@ async function renderAccount(
lud06, lud06,
lud16, lud16,
website, website,
fields, fields: _fields,
} = n.json().pipe(metadataSchema).catch({}).parse(event.content); } = n.json().pipe(metadataSchema).catch({}).parse(event.content);
const npub = nip19.npubEncode(pubkey); const npub = nip19.npubEncode(pubkey);
@ -60,6 +60,7 @@ async function renderAccount(
} }
} }
const { html } = parseNoteContent(about || '', []); const { html } = parseNoteContent(about || '', []);
const fields = _fields?.map(([name, value]) => ({ name, value, verified_at: null })) ?? [];
return { return {
id: pubkey, id: pubkey,
@ -71,7 +72,7 @@ async function renderAccount(
discoverable: true, discoverable: true,
display_name: name ?? '', display_name: name ?? '',
emojis: renderEmojis(event), emojis: renderEmojis(event),
fields: fields?.map(([name, value]) => ({ name, value, verified_at: null })) ?? [], fields,
follow_requests_count: 0, follow_requests_count: 0,
followers_count: event.author_stats?.followers_count ?? 0, followers_count: event.author_stats?.followers_count ?? 0,
following_count: event.author_stats?.following_count ?? 0, following_count: event.author_stats?.following_count ?? 0,
@ -84,7 +85,7 @@ async function renderAccount(
roles: [], roles: [],
source: opts.withSource source: opts.withSource
? { ? {
fields: [], fields,
language: '', language: '',
note: about || '', note: about || '',
privacy: 'public', privacy: 'public',