This commit is contained in:
ManeraKai 2024-07-02 14:41:12 +03:00
parent 338069abba
commit ffcb0a8873
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
2 changed files with 56 additions and 1 deletions

View File

@ -431,6 +431,30 @@ function rewrite(url, frontend, randomInstance) {
case "skyview":
if (url.pathname == '/') return randomInstance
return `${randomInstance}?url=${encodeURIComponent(url.href)}`
case "nitter": {
let search = new URLSearchParams(url.search)
search.delete("ref_src")
search.delete("ref_url")
search.delete("s") // type of device that shared the link
search.delete("t") // some sort of tracking ID
search = search.toString()
if (search !== "") search = `?${search}`
if (url.host.split(".")[0] === "pbs" || url.host.split(".")[0] === "video") {
try {
const [, id, format, extra] = search.match(/(.*)\?format=(.*)&(.*)/)
const query = encodeURIComponent(`${id}.${format}?${extra}`)
return `${randomInstance}/pic${url.pathname}${query}`
} catch {
return `${randomInstance}/pic${url.pathname}${search}`
}
}
if (url.pathname.split("/").includes("tweets")) return `${randomInstance}${url.pathname.replace("/tweets", "")}${search}`
if (url.host == "t.co") return `${randomInstance}/t.co${url.pathname}`
return `${randomInstance}${url.pathname}${search}#m`
}
case "priviblur": {
if (url.hostname == "www.tumblr.com") return `${randomInstance}${url.pathname}${url.search}`
if (url.hostname.startsWith("assets")) return `${randomInstance}/tblr/assets${url.pathname}${url.search}`
@ -689,6 +713,7 @@ const defaultInstances = {
'tekstoLibre': ['https://davilarek.github.io/TekstoLibre'],
'skyview': ['https://skyview.social'],
'priviblur': ['https://pb.bloat.cat'],
'nitter': ['https://nitter.privacydev.net'],
}
function initDefaults() {

View File

@ -167,6 +167,36 @@
"imageType": "png",
"url": "https://music.youtube.com"
},
"twitter": {
"frontends": {
"nitter": {
"name": "Nitter",
"embeddable": true,
"instanceList": true,
"url": "https://github.com/zedeus/nitter",
"localhost": true
}
},
"targets": [
"^https?:\\/{2}(www\\.|mobile\\.)?twitter\\.com\\/",
"^https?:\\/{2}(www\\.|mobile\\.)?x\\.com\\/",
"^https?:\\/{2}(pbs\\.|video\\.)twimg\\.com\\/",
"^https?:\\/{2}platform\\.x\\.com/embed\\/",
"^https?:\\/{2}platform\\.twitter\\.com/embed\\/",
"^https?:\\/{2}t\\.co\\/"
],
"name": "Twitter",
"options": {
"enabled": false,
"redirectType": "main_frame",
"unsupportedUrls": "bypass",
"frontend": "nitter",
"instance": "public"
},
"imageType": "png",
"embeddable": true,
"url": "https://twitter.com"
},
"bluesky": {
"frontends": {
"skyview": {
@ -1073,4 +1103,4 @@
"url": "https://paste.libredirect.invalid"
}
}
}
}