acct can be a bare pubkey

This commit is contained in:
Siddharth Singh 2024-08-06 00:20:05 +05:30
parent f6bd7fc3a5
commit aa0727a96d
No known key found for this signature in database

View file

@ -39,7 +39,8 @@ async function buildTemplateOpts(params: PathParams, url: string): Promise<OpenG
}; };
try { try {
if (params.acct && !params.statusId) { if (params.acct && !params.statusId) {
const profile = await fetchProfile({ handle: params.acct }); const key = /[a-z0-9]/.test(params.acct) ? 'pubkey' : 'handle';
const profile = await fetchProfile({ [key]: params.acct });
const handle = await getHandle(params.acct, profile); const handle = await getHandle(params.acct, profile);
res.type = 'profile'; res.type = 'profile';
res.title = `View @${handle}'s profile on Ditto`; res.title = `View @${handle}'s profile on Ditto`;