From 8c2255e1268f90b5fe018007cc18dcf9f1fd6b81 Mon Sep 17 00:00:00 2001 From: SeaHOH Date: Sat, 5 Mar 2022 21:26:51 +0800 Subject: Fix RegExp dot escape --- bootstrap.js | 6 +++--- make_glmask.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap.js b/bootstrap.js index 07ed02a..989b6af 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -181,10 +181,10 @@ f.push(d.textContent);return f.join("")},set:function(f){for(;this.firstChild;)u const hashCElements = "'sha256-rWWOwtKo7HU91YBF/nwZe2B2qiwVkRbtgbN0jJqfqXs='"; // Known GitLab instances based on https://gitlab.com/vednoc/dark-gitlab/-/blob/master/gitlab.user.css -const glmask = "^gitlab.|^((0xacab|framagit)\.org|code\.(briarproject\.org|foxkit\.us|videolan\.org)|dev\.gajim\.org|forge\.tedomum\.net|foss\.heptapod\.net|git\.(alchemyviewer\.org|callpipe\.com|cardiff\.ac\.uk|cit\.bcit\.ca|coop|drk\.sc|drupalcode\.org|empiresmod\.com|feneas\.org|fosscommunity\.in|gnu\.io|happy-dev\.fr|immc\.ucl\.ac\.be|jami\.net|ligo\.org|linux-kernel\.at|najer\.info|nzoss\.org\.nz|oeru\.org|pleroma\.social|pwmt\.org|rockylinux\.org|silence\.dev|synz\.io)|gitgud\.io|gitplac\.si|invent\.kde\.org|lab\.libreho\.st|mau\.dev|mpeg\.expert|opencode\.net|repo\.getmonero\.org|salsa\.debian\.org|skylab\.vc\.h-brs\.de|source\.(joinmastodon\.org|puri\.sm|small-tech\.org))$"; -const githost = new RegExp("^(gist\.)?github\.com$|" + glmask); +const glmask = "^gitlab\\.|^((0xacab|framagit)\\.org|code\\.(briarproject\\.org|foxkit\\.us|videolan\\.org)|dev\\.gajim\\.org|forge\\.tedomum\\.net|foss\\.heptapod\\.net|git\\.(alchemyviewer\\.org|callpipe\\.com|cardiff\\.ac\\.uk|cit\\.bcit\\.ca|coop|drk\\.sc|drupalcode\\.org|empiresmod\\.com|feneas\\.org|fosscommunity\\.in|gnu\\.io|happy-dev\\.fr|immc\\.ucl\\.ac\\.be|jami\\.net|ligo\\.org|linux-kernel\\.at|najer\\.info|nzoss\\.org\\.nz|oeru\\.org|pleroma\\.social|pwmt\\.org|rockylinux\\.org|silence\\.dev|synz\\.io)|gitgud\\.io|gitplac\\.si|invent\\.kde\\.org|lab\\.libreho\\.st|mau\\.dev|mpeg\\.expert|opencode\\.net|repo\\.getmonero\\.org|salsa\\.debian\\.org|skylab\\.vc\\.h-brs\\.de|source\\.(joinmastodon\\.org|puri\\.sm|small-tech\\.org))$"; +const githost = new RegExp("^(gist\\.)?github\\.(githubassets\\.)?com$|" + glmask); const gitlab = new RegExp(glmask); -const gitlabjs = new RegExp("^/assets/webpack/.+\.chunk\.js$"); +const gitlabjs = new RegExp("^/assets/webpack/.+\\.chunk\\.js$"); var cookie; diff --git a/make_glmask.js b/make_glmask.js index 10fbee6..976fafa 100644 --- a/make_glmask.js +++ b/make_glmask.js @@ -84,4 +84,4 @@ for (var r in res2) { } res1 = res1.concat(tld).sort(); -console.log('const glmask = "^gitlab\.|^(' + res1.join("|").replace(/\./g,"\\.") + ')$";'); +console.log('const glmask = "^gitlab\\\\.|^(' + res1.join("|").replace(/\./g,"\\\\.") + ')$";'); -- cgit v1.2.3