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