rework kind 0 handling

This commit is contained in:
Siddharth Singh 2024-08-04 12:07:24 +05:30
parent 6aa49c12e1
commit b95e31cd5d
No known key found for this signature in database

View file

@ -68,16 +68,15 @@ export function getPathParams(path: string) {
} else if (params.npub) {
params.acct = nip19.decode(`npub${params.npub}`).data as string;
}
console.log(params);
return params;
}
}
async function urlParamToPubkey(handle: string) {
const id = `${handle}`;
const parts = id.match(/(?:(.+))?@(.+)/);
const parts = id.match(/(?:(.+)@)?(.+)/);
if (parts) {
const key = `${parts[1] || ''}@${parts[2]}`;
const key = `${parts[1] ? (parts[1] + '@') : ''}${parts[2]}`;
return await nip05Cache.fetch(key, { signal: AbortSignal.timeout(1000) }).then((res) => res.pubkey);
} else if (id.startsWith('npub1')) {
return nip19.decode(id as `npub1${string}`).data;