Unfurl castopod links

This commit is contained in:
Lim Chee Aun 2025-02-04 17:22:05 +08:00
parent 4b0f523667
commit a3fc396738

View file

@ -3,7 +3,9 @@ export default function isMastodonLinkMaybe(url) {
const { pathname, hash, hostname } = URL.parse(url);
return (
/^\/.*\/\d+$/i.test(pathname) ||
/^\/(@[^/]+|users\/[^/]+)\/(statuses|posts)\/\w+\/?$/i.test(pathname) || // GoToSocial, Takahe
/^\/(@[^/]+|users\/[^/]+)\/(statuses|posts)\/[\w-]+\/?$/i.test(
pathname,
) || // GoToSocial, Takahe, Castopod
/^\/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