batch process nip5/zapper queue
This commit is contained in:
@ -6,12 +6,14 @@ interface NostrJson {
|
||||
names: Record<string, string>;
|
||||
}
|
||||
|
||||
export async function fetchNip05Pubkey(name: string, domain: string) {
|
||||
export async function fetchNip05Pubkey(name: string, domain: string, timeout = 2_000) {
|
||||
if (!name || !domain) {
|
||||
return undefined;
|
||||
}
|
||||
try {
|
||||
const res = await fetch(`https://${domain}/.well-known/nostr.json?name=${encodeURIComponent(name)}`);
|
||||
const res = await fetch(`https://${domain}/.well-known/nostr.json?name=${encodeURIComponent(name)}`, {
|
||||
signal: AbortSignal.timeout(timeout),
|
||||
});
|
||||
const data: NostrJson = await res.json();
|
||||
const match = Object.keys(data.names).find(n => {
|
||||
return n.toLowerCase() === name.toLowerCase();
|
||||
|
Reference in New Issue
Block a user