diff options
author | DokterKaj <54882101+DokterKaj@users.noreply.github.com> | 2024-10-13 13:02:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-13 13:02:49 +0800 |
commit | 6e5a0f1f41112d4dd4b3931dbd3407a8c7dad286 (patch) | |
tree | 6e0097f2f2061a7a871cccd79c7f9c5f4aceaf3d | |
parent | Translated using Weblate (French) (diff) | |
download | libredirect-6e5a0f1f41112d4dd4b3931dbd3407a8c7dad286.zip |
redirect *.meta.stackexchange.com
-rw-r--r-- | src/assets/javascripts/services.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 3609d6c1..e85b5bf1 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -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}` } |