Simplify db:populate:nip05 script

This commit is contained in:
Alex Gleason 2025-02-07 17:49:39 -06:00
parent a4a26d7575
commit b0dc7faaff
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -11,7 +11,6 @@ for await (const msg of store.req([{ kinds: [0] }])) {
const signal = AbortSignal.timeout(30_000); // generous timeout const signal = AbortSignal.timeout(30_000); // generous timeout
const event = msg[2]; const event = msg[2];
try {
// Parse metadata. // Parse metadata.
const metadata = n.json().pipe(n.metadata()).catch({}).safeParse(event.content); const metadata = n.json().pipe(n.metadata()).catch({}).safeParse(event.content);
if (!metadata.success) continue; if (!metadata.success) continue;
@ -29,10 +28,11 @@ for await (const msg of store.req([{ kinds: [0] }])) {
// Update favicon. // Update favicon.
const domain = nip05?.split('@')[1].toLowerCase(); const domain = nip05?.split('@')[1].toLowerCase();
if (domain) { if (domain) {
try {
await faviconCache.fetch(domain, { signal }); await faviconCache.fetch(domain, { signal });
}
} catch { } catch {
continue; // Ignore.
}
} }
} }
} }