mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-22 16:46:28 +01:00
Test this out for bridgy fed links
This commit is contained in:
parent
00e2ba0b34
commit
b88376569e
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
export default function isMastodonLinkMaybe(url) {
|
export default function isMastodonLinkMaybe(url) {
|
||||||
try {
|
try {
|
||||||
const { pathname, hash } = URL.parse(url);
|
const { pathname, hash, hostname } = URL.parse(url);
|
||||||
return (
|
return (
|
||||||
/^\/.*\/\d+$/i.test(pathname) ||
|
/^\/.*\/\d+$/i.test(pathname) ||
|
||||||
/^\/(@[^/]+|users\/[^/]+)\/(statuses|posts)\/\w+\/?$/i.test(pathname) || // GoToSocial, Takahe
|
/^\/(@[^/]+|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
|
/^\/(notice|objects)\/[a-z0-9-]+$/i.test(pathname) || // Pleroma
|
||||||
/^\/@[^/]+\/post\/[a-z0-9]+$/i.test(pathname) || // Threads
|
/^\/@[^/]+\/post\/[a-z0-9]+$/i.test(pathname) || // Threads
|
||||||
/^\/@[^/]+\/[a-z0-9]+[a-z0-9\-]+[a-z0-9]+$/i.test(pathname) || // Hollo
|
/^\/@[^/]+\/[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 🫣
|
/#\/[^\/]+\.[^\/]+\/s\/.+/i.test(hash) // Phanpy 🫣
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue