mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
catch fetch error on nip05.
This commit is contained in:
11
nip05.ts
11
nip05.ts
@@ -38,9 +38,14 @@ export async function queryProfile(
|
|||||||
|
|
||||||
if (!name.match(/^[A-Za-z0-9-_]+$/)) return null
|
if (!name.match(/^[A-Za-z0-9-_]+$/)) return null
|
||||||
|
|
||||||
let res = await (
|
let res
|
||||||
await _fetch(`https://${domain}/.well-known/nostr.json?name=${name}`)
|
try {
|
||||||
).json()
|
res = await (
|
||||||
|
await _fetch(`https://${domain}/.well-known/nostr.json?name=${name}`)
|
||||||
|
).json()
|
||||||
|
} catch (err) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
if (!res?.names?.[name]) return null
|
if (!res?.names?.[name]) return null
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nostr-tools",
|
"name": "nostr-tools",
|
||||||
"version": "1.7.1",
|
"version": "1.7.2",
|
||||||
"description": "Tools for making a Nostr client.",
|
"description": "Tools for making a Nostr client.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
Reference in New Issue
Block a user