Merge pull request #1009 from DokterKaj/patch-1
redirect *.meta.stackexchange.com
This commit is contained in:
commit
6f2ff60733
|
@ -269,8 +269,11 @@ function rewrite(url, originUrl, frontend, randomInstance) {
|
||||||
// https://stackexchange.com or https://superuser.com
|
// https://stackexchange.com or https://superuser.com
|
||||||
return `${randomInstance}${url.pathname}${url.search}`
|
return `${randomInstance}${url.pathname}${url.search}`
|
||||||
}
|
}
|
||||||
const regex = url.href.match(/https?:\/{2}(?:([a-zA-Z0-9-]+)\.)?stackexchange\.com\//)
|
const regex = url.href.match(/https?:\/{2}(?:([a-zA-Z0-9-]+)\.(meta\.)?)?stackexchange\.com\//)
|
||||||
if (regex && regex.length > 1) {
|
if (regex && regex.length > 1) {
|
||||||
|
if (regex[2]) {
|
||||||
|
return `${randomInstance}/exchange/${url.hostname}${url.pathname}${url.search}`
|
||||||
|
}
|
||||||
const subdomain = regex[1]
|
const subdomain = regex[1]
|
||||||
return `${randomInstance}/exchange/${subdomain}${url.pathname}${url.search}`
|
return `${randomInstance}/exchange/${subdomain}${url.pathname}${url.search}`
|
||||||
}
|
}
|
||||||
|
|
|
@ -753,7 +753,7 @@
|
||||||
},
|
},
|
||||||
"targets": [
|
"targets": [
|
||||||
"^https?:\\/{2}(www\\.)?([a-zA-Z]+\\.)?stackoverflow\\.com\\/",
|
"^https?:\\/{2}(www\\.)?([a-zA-Z]+\\.)?stackoverflow\\.com\\/",
|
||||||
"(?!^https?:\\/{2}(api|data|blog)\\.)^https?:\\/{2}([a-zA-Z0-9-]+\\.)stackexchange\\.com\\/",
|
"^https?:\\/{2}((?!(api|data|blog)\\.)[a-zA-Z0-9-]+\\.(meta\\.)?)?stackexchange\\.com\\/",
|
||||||
"^https?:\\/{2}(www\\.)?([a-zA-Z]+\\.)?(askubuntu\\.com|mathoverflow\\.net|serverfault\\.com|stackapps\\.com|superuser\\.com)\\/"
|
"^https?:\\/{2}(www\\.)?([a-zA-Z]+\\.)?(askubuntu\\.com|mathoverflow\\.net|serverfault\\.com|stackapps\\.com|superuser\\.com)\\/"
|
||||||
],
|
],
|
||||||
"name": "Stack Overflow",
|
"name": "Stack Overflow",
|
||||||
|
|
Loading…
Reference in New Issue