Compare commits

...

2 Commits

Author SHA1 Message Date
gaodeng
9082953ede fix error event 2023-02-07 06:03:41 -03:00
Luis Miguel
61f397463d nip05 supports uppercase
nip05 says `NIP-05 assumes the <local-part> part will be restricted to the characters a-z0-9-_., case insensitive`

So a lot of people is starting the names with uppercase. See here:

`https://nostr-check.com/.well-known/nostr.json`

So I think we should change the regex to accept lowercase or uppercase.

Another way to do it would be to do a `.toLowerCase` at the beginning, but then we would need to do this search ignoring the case:

```
if (!res?.names?.[name])
```

So maybe for now this is enough?
2023-01-31 10:22:11 -03:00
2 changed files with 5 additions and 5 deletions

View File

@@ -36,7 +36,7 @@ export async function queryProfile(
name = '_' name = '_'
} }
if (!name.match(/^[a-z0-9-_]+$/)) return null if (!name.match(/^[A-Za-z0-9-_]+$/)) return null
let res = await ( let res = await (
await _fetch(`https://${domain}/.well-known/nostr.json?name=${name}`) await _fetch(`https://${domain}/.well-known/nostr.json?name=${name}`)

View File

@@ -46,7 +46,7 @@ export function relayInit(
var listeners: { var listeners: {
connect: Array<() => void> connect: Array<() => void>
disconnect: Array<() => void> disconnect: Array<() => void>
error: Array<() => void> error: Array<(e: globalThis.Event) => void>
notice: Array<(msg: string) => void> notice: Array<(msg: string) => void>
} = { } = {
connect: [], connect: [],
@@ -77,9 +77,9 @@ export function relayInit(
setOpen() setOpen()
resolve() resolve()
} }
ws.onerror = () => { ws.onerror = (e: globalThis.Event) => {
listeners.error.forEach(cb => cb()) listeners.error.forEach(cb => cb(e))
reject() reject(e)
} }
ws.onclose = async () => { ws.onclose = async () => {
listeners.disconnect.forEach(cb => cb()) listeners.disconnect.forEach(cb => cb())