From b88376569e2a874312e4d0e45af67c36a80dabcf Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 21 Jul 2024 19:06:38 +0800 Subject: [PATCH] Test this out for bridgy fed links --- src/utils/isMastodonLinkMaybe.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/isMastodonLinkMaybe.jsx b/src/utils/isMastodonLinkMaybe.jsx index c26624b8..ab18c6d4 100644 --- a/src/utils/isMastodonLinkMaybe.jsx +++ b/src/utils/isMastodonLinkMaybe.jsx @@ -1,6 +1,6 @@ export default function isMastodonLinkMaybe(url) { try { - const { pathname, hash } = URL.parse(url); + const { pathname, hash, hostname } = URL.parse(url); return ( /^\/.*\/\d+$/i.test(pathname) || /^\/(@[^/]+|users\/[^/]+)\/(statuses|posts)\/\w+\/?$/i.test(pathname) || // GoToSocial, Takahe @@ -8,6 +8,7 @@ export default function isMastodonLinkMaybe(url) { /^\/(notice|objects)\/[a-z0-9-]+$/i.test(pathname) || // Pleroma /^\/@[^/]+\/post\/[a-z0-9]+$/i.test(pathname) || // Threads /^\/@[^/]+\/[a-z0-9]+[a-z0-9\-]+[a-z0-9]+$/i.test(pathname) || // Hollo + (hostname === 'fed.brid.gy' && pathname.startsWith('/r/http')) || // Bridgy Fed /#\/[^\/]+\.[^\/]+\/s\/.+/i.test(hash) // Phanpy 🫣 ); } catch (e) {