From 8540403a9fe196500ef8425995d84a4d03f0294b Mon Sep 17 00:00:00 2001 From: Nikita Savchenko Date: Fri, 25 Sep 2020 01:31:31 +0300 Subject: [PATCH] Fix masking domain names; fix Docker container --- Dockerfile | 4 ++-- config.js | 1 + src/modules/mask.js | 2 +- src/modules/proxy.js | 2 +- static-test/index.html | 14 +++++++++----- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 067cc7b..75b85bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ FROM alpine AS stage WORKDIR /app COPY . /app -RUN apk add --update npm=12.15.0-r1 +RUN apk add --update 'npm<13.0.0' RUN npm install # Build aclual container @@ -16,7 +16,7 @@ COPY . /app COPY --from=stage /app/node_modules /app/node_modules WORKDIR /app -RUN apk add --update nodejs=12.15.0-r1 +RUN apk add --update 'nodejs<13.0.0' EXPOSE 80 diff --git a/config.js b/config.js index 3c27c9c..a53cd76 100644 --- a/config.js +++ b/config.js @@ -88,6 +88,7 @@ export default { "/google-analytics", "/www.google-analytics.com", "/adsbygoogle", + "/gtag/js", "/googleads", "/log_event\\?", "/r/collect", diff --git a/src/modules/mask.js b/src/modules/mask.js index 1cea0e1..1f3def8 100644 --- a/src/modules/mask.js +++ b/src/modules/mask.js @@ -4,4 +4,4 @@ export const mask = (matchedString) => matchedString.replace( ); export const unmask = (string) => string.replace(/\*\(([^\)]+)\)\*/g, (_, masked) => Buffer.from(decodeURIComponent(masked), "base64").toString() -) \ No newline at end of file +); \ No newline at end of file diff --git a/src/modules/proxy.js b/src/modules/proxy.js index 8aef67d..bd4c808 100644 --- a/src/modules/proxy.js +++ b/src/modules/proxy.js @@ -21,7 +21,7 @@ const replaceDomainsForHost = (host) => (match, pos, str) => { escapedSlashes ? (config.proxyDomain || host).replace(/\//g, "\\/") + "\\" : (config.proxyDomain || host) - }${ config.strippedPath }/${ match }`; + }${ config.strippedPath }/${ mask(match) }`; return r; }; diff --git a/static-test/index.html b/static-test/index.html index 9a34c63..13dcb0b 100644 --- a/static-test/index.html +++ b/static-test/index.html @@ -5,11 +5,15 @@ - + + +