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:
parent
0ed685baa0
commit
057a2d2f84
2 changed files with 4 additions and 1 deletions
|
@ -186,10 +186,12 @@ ${text.split("\n").map(txt => " > " + txt).join("\n")}`)
|
||||||
return overview.length + rest.join("\n").length + 1
|
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:
|
// Fediverse profiles look like this:
|
||||||
// Mastodon, Akkoma, etc.: https://foo.bar/@user
|
// Mastodon, Akkoma, etc.: https://foo.bar/@user
|
||||||
// Friendica: https://foo.bar/profile/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) {
|
static isProbablyMastodonLink(link: string) {
|
||||||
return this.isProbablyMastodon.test(link)
|
return this.isProbablyMastodon.test(link)
|
||||||
|
|
|
@ -9,6 +9,7 @@ const uids = [
|
||||||
8404193, // queerthoughts
|
8404193, // queerthoughts
|
||||||
153277, // rompe
|
153277, // rompe
|
||||||
393359, // hector
|
393359, // hector
|
||||||
|
14124839, // ilja has a Pleroma link
|
||||||
]
|
]
|
||||||
|
|
||||||
for (const uid of uids) {
|
for (const uid of uids) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue