Updated reddit targets, actually fixed peertube redirects
This commit is contained in:
parent
5ec2dca381
commit
2e1534e579
|
@ -46,12 +46,14 @@ function all(service, frontend, options, config, redirects) {
|
|||
}
|
||||
|
||||
function regexArray(service, url, config) {
|
||||
let targetList
|
||||
if (config.services[service].targets == "datajson") targetList = targets[service]
|
||||
else targetList = config.services[service].targets
|
||||
for (const targetString in targetList) {
|
||||
const target = new RegExp(targetList[targetString])
|
||||
if (target.test(url.href)) return true
|
||||
if (config.services[service].targets == "datajson") {
|
||||
if (targets[service].includes(utils.protocolHost(url))) return true
|
||||
} else {
|
||||
const targetList = config.services[service].targets
|
||||
for (const targetString in targetList) {
|
||||
const target = new RegExp(targetList[targetString])
|
||||
if (target.test(url.href)) return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -398,9 +400,7 @@ function redirect(url, type, initiator, forceRedirection) {
|
|||
if (url.href.search(/^https?:\/{2}(?:[im]\.)?stack\./) > -1) return `${randomInstance}/stack${url.pathname}${url.search}`
|
||||
else return `${randomInstance}${url.pathname}${url.search}`
|
||||
case "libreddit":
|
||||
if (url.hostname.match(/^(i|preview)\.redd\.it/)) {
|
||||
return `${randomInstance}/img${url.pathname}`
|
||||
}
|
||||
if (url.hostname.match(/^(i|preview)\.redd\.it/)) return `${randomInstance}/img${url.pathname}`
|
||||
return `${randomInstance}${url.pathname}${url.search}`
|
||||
default:
|
||||
return `${randomInstance}${url.pathname}${url.search}`
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
}
|
||||
},
|
||||
"targets": [
|
||||
"^https?:\\/{2}(?:www\\.|m\\.|)youtube.com(?!(?:iframe_api\\/.*)|(?:\/redirect))",
|
||||
"^https?:\\/{2}(?:www\\.|m\\.|)youtube.com(?!(?:iframe_api\\/.*)|(?:\\/redirect))",
|
||||
"^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*",
|
||||
"^https?:\\/{2}(?:i|s)\\.ytimg.com\\/vi\\/.*\\/..*",
|
||||
"^https?:\\/{2}(?:www\\.|music\\.|)youtube.com\\/watch?v=..*",
|
||||
|
@ -293,7 +293,7 @@
|
|||
}
|
||||
},
|
||||
"targets": [
|
||||
"^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com",
|
||||
"^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com(?!\\/(gallery)|(rpan)|(settings)|(topics)|(dev))",
|
||||
"^https?:\\/{2}(i\\.|preview\\.)redd\\.it"
|
||||
],
|
||||
"name": "Reddit",
|
||||
|
|
Loading…
Reference in New Issue