From 8c78649d5ce3b6423a8a526d1f69d7be7037a309 Mon Sep 17 00:00:00 2001 From: Shusui MOYATANI Date: Fri, 9 Feb 2024 21:50:07 +0900 Subject: [PATCH] ignore HTTP redirect in nip05 --- nip05.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nip05.ts b/nip05.ts index b95c9c0..7a7b76e 100644 --- a/nip05.ts +++ b/nip05.ts @@ -21,9 +21,10 @@ export function useFetchImplementation(fetchImplementation: any) { export async function searchDomain(domain: string, query = ''): Promise<{ [name: string]: string }> { try { - let res = await (await _fetch(`https://${domain}/.well-known/nostr.json?name=${query}`)).json() - - return res.names + const url = `https://${domain}/.well-known/nostr.json?name=${query}` + const res = await _fetch(url, { redirect: 'error' }) + const json = await res.json() + return json.names } catch (_) { return {} } @@ -36,7 +37,8 @@ export async function queryProfile(fullname: string): Promise