Skip to content

Commit

Permalink
Merge pull request #389 from caorushizi/feat/package-version
Browse files Browse the repository at this point in the history
feat: ✨  update adblocker
  • Loading branch information
caorushizi authored Jan 1, 2025
2 parents f2a6383 + a57b4dd commit 1c6b181
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 135 deletions.
1 change: 1 addition & 0 deletions .cspell/custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DDTHH
deeplink
esmfile
execa
ghostery
idtype
immer
inversify
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"pnpm": {
"patchedDependencies": {
"@cliqz/adblocker@1.27.3": "patches/@[email protected].patch"
"@ghostery/adblocker@2.3.1": "patches/@[email protected].patch"
}
}
}
3 changes: 1 addition & 2 deletions packages/main/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"homepage": "https://downloader.caorushizi.cn/",
"license": "MIT",
"dependencies": {
"@cliqz/adblocker-electron": "1.27.3",
"@cliqz/adblocker-electron-preload": "1.27.3",
"@ghostery/adblocker-electron": "^2.3.1",
"node-pty": "^1.0.0"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
"typescript-eslint": "^7.10.0"
},
"dependencies": {
"@cliqz/adblocker-electron": "1.27.3",
"@cliqz/adblocker-electron-preload": "1.27.3",
"@ghostery/adblocker-electron": "^2.3.1",
"axios": "^1.7.2",
"better-sqlite3": "^9.6.0",
"cheerio": "1.0.0-rc.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/main/scripts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const external = [
"nock",
"aws-sdk",
"mock-aws-s3",
"@cliqz/adblocker-electron-preload",
"@ghostery/adblocker-electron",
"node-pty",
];

Expand Down
5 changes: 4 additions & 1 deletion packages/main/src/services/WebviewService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
pcUA,
pluginPath,
} from "../helper/index.ts";
import { ElectronBlocker } from "@cliqz/adblocker-electron";
import { ElectronBlocker } from "@ghostery/adblocker-electron";
import ElectronLogger from "../vendor/ElectronLogger.ts";
import ElectronStore from "../vendor/ElectronStore.ts";
import MainWindow from "../windows/MainWindow.ts";
Expand Down Expand Up @@ -294,6 +294,9 @@ export default class WebviewService {
this.logger.error(`[AdBlocker] enable failed(not initialized)`);
return;
}
if (this.blocker.isBlockingEnabled(this.session)) {
return;
}
this.blocker.enableBlockingInSession(this.session);
this.logger.info(`[AdBlocker] enable`);
}
Expand Down
26 changes: 0 additions & 26 deletions patches/@[email protected]

This file was deleted.

26 changes: 26 additions & 0 deletions patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/dist/commonjs/fetch.js b/dist/commonjs/fetch.js
index b610f9d3accead5b44693333598783e425f33ed9..ec538d5a0f15686d6983cd06c989e1ffd9cea987 100644
--- a/dist/commonjs/fetch.js
+++ b/dist/commonjs/fetch.js
@@ -41,7 +41,7 @@ function fetchWithRetry(fetch, url) {
function fetchResource(fetch, url) {
return fetchWithRetry(fetch, url).then((response) => response.text());
}
-const PREFIX = 'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets';
+const PREFIX = 'https://static.ziying.site/adblocker';
exports.adsLists = [
`${PREFIX}/easylist/easylist.txt`,
`${PREFIX}/peter-lowe/serverlist.txt`,
diff --git a/dist/esm/fetch.js b/dist/esm/fetch.js
index 2bc86ba508144053bda8d27fa663fdbe7846eed8..7a35c0d34945832dc09f0fc1b7429121ae2434eb 100644
--- a/dist/esm/fetch.js
+++ b/dist/esm/fetch.js
@@ -35,7 +35,7 @@ export function fetchWithRetry(fetch, url) {
function fetchResource(fetch, url) {
return fetchWithRetry(fetch, url).then((response) => response.text());
}
-const PREFIX = 'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets';
+const PREFIX = 'https://static.ziying.site/adblocker';
export const adsLists = [
`${PREFIX}/easylist/easylist.txt`,
`${PREFIX}/peter-lowe/serverlist.txt`,
Loading

0 comments on commit 1c6b181

Please sign in to comment.