Add one more account resolver fallback

This commit is contained in:
Lim Chee Aun 2023-09-10 09:13:00 +08:00
parent f4ce2e8367
commit 33698c91cc

View file

@ -58,6 +58,18 @@ function AccountSheet({ account, instance: propInstance, onClose }) {
}); });
if (result.accounts.length) { if (result.accounts.length) {
return result.accounts[0]; return result.accounts[0];
} else if (/https?:\/\/[^/]+\/@/.test(account)) {
const accountURL = new URL(account);
const acct = accountURL.pathname.replace(/^\//, '');
const result = await masto.v2.search({
q: acct,
type: 'accounts',
limit: 1,
resolve: authenticated,
});
if (result.accounts.length) {
return result.accounts[0];
}
} }
} }
} else { } else {