fedimbed: split mastodon regex

This commit is contained in:
Cynthia Foxwell 2022-12-05 19:54:25 -07:00
parent 3f39f840ff
commit 909bec67e1

View file

@ -9,7 +9,8 @@ const FRIENDLY_USERAGENT =
const URLS_REGEX = /(?:\s|^)(https?:\/\/[^\s<]+[^<.,:;"'\]\s])/g;
const PATH_REGEX = {
mastodon: /^\/@?(.+?)\/(statuses\/)?\d+\/?/,
mastodon: /^\/@(.+?)\/\d+\/?/,
mastodon2: /^\/(.+?)\/statuses\/\d+\/?/,
pleroma:
/^\/objects\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/?/,
pleroma2: /^\/notice\/[A-Za-z0-9]+\/?/,
@ -74,7 +75,6 @@ async function processUrl(msg, url) {
headers: {
"User-Agent": FRIENDLY_USERAGENT,
Accept: "application/activity+json",
"Content-Type": "application/activity+json",
},
})
.then((res) => res.json())
@ -154,7 +154,6 @@ async function processUrl(msg, url) {
headers: {
"User-Agent": FRIENDLY_USERAGENT,
Accept: "application/activity+json",
"Content-Type": "application/activity+json",
},
})
.then((res) => res.json())