From 6e5a0f1f41112d4dd4b3931dbd3407a8c7dad286 Mon Sep 17 00:00:00 2001 From: DokterKaj <54882101+DokterKaj@users.noreply.github.com> Date: Sun, 13 Oct 2024 13:02:49 +0800 Subject: [PATCH 1/2] redirect *.meta.stackexchange.com --- src/assets/javascripts/services.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 3609d6c..e85b5bf 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}` } From c2d12d4d2a1f27f07caf8518654cdab935072f1d Mon Sep 17 00:00:00 2001 From: DokterKaj <54882101+DokterKaj@users.noreply.github.com> Date: Sun, 13 Oct 2024 13:09:54 +0800 Subject: [PATCH 2/2] fix stackexchange.com, *.meta.stackexchange.com not redirecting --- src/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.json b/src/config.json index f25b860..897a0e2 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",