From 916f45c843e95a93577e54b5130f056934509140 Mon Sep 17 00:00:00 2001 From: ikrong Date: Sat, 29 Jun 2024 21:31:22 +0800 Subject: [PATCH] fix --- tools/index.js | 5 ++++- vue/Dockerfile.vue2 | 2 ++ vue/replace-2.js | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 vue/replace-2.js diff --git a/tools/index.js b/tools/index.js index 1630e08..62d36f5 100644 --- a/tools/index.js +++ b/tools/index.js @@ -119,7 +119,10 @@ async function replaceHTML(file) { delete el.attribs.nonce if (!el.attribs.src) { const content = $(el).text(); - if (String(content).includes("www.googletagmanager.com")) { + if ([ + 'www.googletagmanager.com', + ].some(u => content.includes(u)) + ) { $(el).remove(); } continue; diff --git a/vue/Dockerfile.vue2 b/vue/Dockerfile.vue2 index ed6c779..a98d0cd 100644 --- a/vue/Dockerfile.vue2 +++ b/vue/Dockerfile.vue2 @@ -17,6 +17,8 @@ COPY . /app RUN /app/tools/install.sh +RUN NODE_PATH=$(npm root --quiet -g) node /app/replace-2.js /app/source/ + RUN cd /app/source/ && \ npm i -g pnpm && \ pnpm i && \ diff --git a/vue/replace-2.js b/vue/replace-2.js new file mode 100644 index 0000000..e0bdf11 --- /dev/null +++ b/vue/replace-2.js @@ -0,0 +1,6 @@ +const fs = require("fs"); +const path = require("path"); + + +const adTextEjs = path.join(HOST_DIR, "themes/vue/layout/partials/ad-text.ejs"); +fs.writeFileSync(adTextEjs, "") \ No newline at end of file