From e43f2283ddd6b4dd2808d5914a3ac733f620d71a Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sat, 6 Jan 2024 01:03:30 +0800 Subject: [PATCH] Resolve account URLs too --- src/pages/http-route.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/http-route.jsx b/src/pages/http-route.jsx index 46290d07..c2cf1865 100644 --- a/src/pages/http-route.jsx +++ b/src/pages/http-route.jsx @@ -37,16 +37,20 @@ export default function HttpRoute() { const { masto: currentMasto, instance: currentInstance } = api(); const result = await currentMasto.v2.search.fetch({ q: url, - type: 'statuses', limit: 1, resolve: true, }); if (result.statuses.length) { const status = result.statuses[0]; 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 window.location.hash = statusURL + '?view=full'; + } else { + setUIState('error'); } } })();