mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
rework kind 0 handling
This commit is contained in:
parent
6aa49c12e1
commit
b95e31cd5d
1 changed files with 2 additions and 3 deletions
|
|
@ -68,16 +68,15 @@ export function getPathParams(path: string) {
|
||||||
} else if (params.npub) {
|
} else if (params.npub) {
|
||||||
params.acct = nip19.decode(`npub${params.npub}`).data as string;
|
params.acct = nip19.decode(`npub${params.npub}`).data as string;
|
||||||
}
|
}
|
||||||
console.log(params);
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function urlParamToPubkey(handle: string) {
|
async function urlParamToPubkey(handle: string) {
|
||||||
const id = `${handle}`;
|
const id = `${handle}`;
|
||||||
const parts = id.match(/(?:(.+))?@(.+)/);
|
const parts = id.match(/(?:(.+)@)?(.+)/);
|
||||||
if (parts) {
|
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);
|
return await nip05Cache.fetch(key, { signal: AbortSignal.timeout(1000) }).then((res) => res.pubkey);
|
||||||
} else if (id.startsWith('npub1')) {
|
} else if (id.startsWith('npub1')) {
|
||||||
return nip19.decode(id as `npub1${string}`).data;
|
return nip19.decode(id as `npub1${string}`).data;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue