mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-22 09:15:33 +03:00
Resolve account URLs too
This commit is contained in:
parent
be5fcc35ac
commit
e43f2283dd
1 changed files with 6 additions and 2 deletions
|
@ -37,16 +37,20 @@ export default function HttpRoute() {
|
||||||
const { masto: currentMasto, instance: currentInstance } = api();
|
const { masto: currentMasto, instance: currentInstance } = api();
|
||||||
const result = await currentMasto.v2.search.fetch({
|
const result = await currentMasto.v2.search.fetch({
|
||||||
q: url,
|
q: url,
|
||||||
type: 'statuses',
|
|
||||||
limit: 1,
|
limit: 1,
|
||||||
resolve: true,
|
resolve: true,
|
||||||
});
|
});
|
||||||
if (result.statuses.length) {
|
if (result.statuses.length) {
|
||||||
const status = result.statuses[0];
|
const status = result.statuses[0];
|
||||||
window.location.hash = `/${currentInstance}/s/${status.id}?view=full`;
|
window.location.hash = `/${currentInstance}/s/${status.id}?view=full`;
|
||||||
} else {
|
} else if (result.accounts.length) {
|
||||||
|
const account = result.accounts[0];
|
||||||
|
window.location.hash = `/${currentInstance}/a/${account.id}`;
|
||||||
|
} else if (statusURL) {
|
||||||
// Fallback to original URL, which will probably show error
|
// Fallback to original URL, which will probably show error
|
||||||
window.location.hash = statusURL + '?view=full';
|
window.location.hash = statusURL + '?view=full';
|
||||||
|
} else {
|
||||||
|
setUIState('error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue