Make nip 05 parsing more permissive
This commit is contained in:
@@ -11,14 +11,10 @@ export type Handle = {
|
|||||||
relays?: string[]
|
relays?: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const NIP05_REGEX = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/
|
|
||||||
|
|
||||||
export async function queryProfile(nip05: string) {
|
export async function queryProfile(nip05: string) {
|
||||||
const match = nip05.match(NIP05_REGEX)
|
const parts = nip05.split("@")
|
||||||
|
const name = parts.length > 1 ? parts[0] : "_"
|
||||||
if (!match) return undefined
|
const domain = last(parts)
|
||||||
|
|
||||||
const [_, name = "_", domain] = match
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export enum ManagementMethod {
|
|||||||
SupportedMethods = "supportedmethods",
|
SupportedMethods = "supportedmethods",
|
||||||
BanPubkey = "banpubkey",
|
BanPubkey = "banpubkey",
|
||||||
AllowPubkey = "allowpubkey",
|
AllowPubkey = "allowpubkey",
|
||||||
|
DisallowPubkey = "disallowpubkey",
|
||||||
ListBannedPubkeys = "listbannedpubkeys",
|
ListBannedPubkeys = "listbannedpubkeys",
|
||||||
ListAllowedPubkeys = "listallowedpubkeys",
|
ListAllowedPubkeys = "listallowedpubkeys",
|
||||||
ListEventsNeedingModeration = "listeventsneedingmoderation",
|
ListEventsNeedingModeration = "listeventsneedingmoderation",
|
||||||
|
|||||||
Reference in New Issue
Block a user