Detect Pleroma and Pixelfed profile links

- Re-introduce the server blacklist unchanged
- Incorporate it into the Fediverse profile regex

These two platforms sadly have a non-unique URL scheme,
so it may be better to keep the blacklist in place to filter out
all the github and codeberg URLs.
This commit is contained in:
Ulf Rompe 2025-08-06 17:59:35 +02:00
parent 0ed685baa0
commit 057a2d2f84
2 changed files with 4 additions and 1 deletions

View file

@ -186,10 +186,12 @@ ${text.split("\n").map(txt => " > " + txt).join("\n")}`)
return overview.length + rest.join("\n").length + 1
}
private static notMastodon = ["wiki.openstreetmap.org", "hdyc.neis-one.org", "matrix.to","facebook.com","github", "tasks.hotosm.org","community.openstreetmap.org","mapillary.com","wikimedia.org","wikipedia.org","wikidata.org"]
// Fediverse profiles look like this:
// Mastodon, Akkoma, etc.: https://foo.bar/@user
// Friendica: https://foo.bar/profile/user
private static isProbablyMastodon = new RegExp("^https?://[^/]+/(profile/|@)[^/]+/?$")
// Pixelfed, Pleroma: https://foo.bar/user
private static isProbablyMastodon = new RegExp(`^https?://(?!.*(?:${MastodonPoster.notMastodon.join('|')}))[a-zA-Z0-9.-]+/(profile/|@?)[a-zA-Z0-9_.-]+/?$`)
static isProbablyMastodonLink(link: string) {
return this.isProbablyMastodon.test(link)

View file

@ -9,6 +9,7 @@ const uids = [
8404193, // queerthoughts
153277, // rompe
393359, // hector
14124839, // ilja has a Pleroma link
]
for (const uid of uids) {