mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Add a signal to renderAccount
This commit is contained in:
parent
e539a29775
commit
8370b250a2
1 changed files with 3 additions and 2 deletions
|
|
@ -19,6 +19,7 @@ interface ToAccountOpts {
|
|||
async function renderAccount(
|
||||
event: Omit<DittoEvent, 'id' | 'sig'>,
|
||||
opts: ToAccountOpts = {},
|
||||
signal = AbortSignal.timeout(3000),
|
||||
): Promise<MastodonAccount> {
|
||||
const { withSource = false } = opts;
|
||||
const { pubkey } = event;
|
||||
|
|
@ -42,13 +43,13 @@ async function renderAccount(
|
|||
} = n.json().pipe(n.metadata()).catch({}).parse(event.content);
|
||||
|
||||
const npub = nip19.npubEncode(pubkey);
|
||||
const parsed05 = await parseAndVerifyNip05(nip05, pubkey);
|
||||
const parsed05 = await parseAndVerifyNip05(nip05, pubkey, signal);
|
||||
const acct = parsed05?.handle || npub;
|
||||
|
||||
let favicon: URL | undefined;
|
||||
if (parsed05?.domain) {
|
||||
try {
|
||||
favicon = await faviconCache.fetch(parsed05.domain);
|
||||
favicon = await faviconCache.fetch(parsed05.domain, { signal });
|
||||
} catch {
|
||||
favicon = new URL('/favicon.ico', `https://${parsed05.domain}/`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue