Skip to content

Commit

Permalink
Merge pull request #1009 from DokterKaj/patch-1
Browse files Browse the repository at this point in the history
redirect *.meta.stackexchange.com
  • Loading branch information
ManeraKai authored Oct 14, 2024
2 parents 7a97146 + c2d12d4 commit 6f2ff60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/assets/javascripts/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,11 @@ function rewrite(url, originUrl, frontend, randomInstance) {
// https://stackexchange.com or https://superuser.com
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[2]) {
return `${randomInstance}/exchange/${url.hostname}${url.pathname}${url.search}`
}
const subdomain = regex[1]
return `${randomInstance}/exchange/${subdomain}${url.pathname}${url.search}`
}
Expand Down
2 changes: 1 addition & 1 deletion src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@
},
"targets": [
"^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)\\/"
],
"name": "Stack Overflow",
Expand Down

0 comments on commit 6f2ff60

Please sign in to comment.