about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2024-10-14 23:07:00 +0300
committerGitHub <noreply@github.com>2024-10-14 23:07:00 +0300
commit6f2ff607336940c3847cd0bd408dcbc33a63862a (patch)
tree5dd4eddb12b3ba46aa9af13b011cfbd462c59ef6 /src
parentTranslated using Weblate (Russian) (diff)
parentfix stackexchange.com, *.meta.stackexchange.com not redirecting (diff)
downloadlibredirect-6f2ff607336940c3847cd0bd408dcbc33a63862a.zip
Merge pull request #1009 from DokterKaj/patch-1
redirect *.meta.stackexchange.com
Diffstat (limited to 'src')
-rw-r--r--src/assets/javascripts/services.js5
-rw-r--r--src/config.json2
2 files changed, 5 insertions, 2 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}`
       }
diff --git a/src/config.json b/src/config.json
index f25b8601..897a0e2c 100644
--- a/src/config.json
+++ b/src/config.json
@@ -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",