Skip to content

Commit

Permalink
Test this out for bridgy fed links
Browse files Browse the repository at this point in the history
  • Loading branch information
cheeaun committed Jul 21, 2024
1 parent 00e2ba0 commit b883765
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/isMastodonLinkMaybe.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
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
/^\/notes\/[a-z0-9]+$/i.test(pathname) || // Misskey, Firefish
/^\/(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) {
Expand Down

0 comments on commit b883765

Please sign in to comment.