mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-13 17:38:57 +01:00
Add one more account resolver fallback
This commit is contained in:
parent
f4ce2e8367
commit
33698c91cc
1 changed files with 12 additions and 0 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue