Skip to content

Commit 422c3fc

Browse files
committed
Migrate from adblock-rs to cliqz
1 parent 6fb251f commit 422c3fc

File tree

8 files changed

+136
-418
lines changed

8 files changed

+136
-418
lines changed

package.json

+4-6
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
"build": "yarn run clean && build --win --mac --linux",
3636
"build:mac": "yarn run clean && build --mac",
3737
"build:win": "yarn run clean && build --win",
38-
"plugins": "yarn run plugin:autoconfirm && yarn run plugin:adblock",
39-
"plugin:adblock": "node plugins/adblocker/downloader.js && electron-build-env neon build adblock-rs",
38+
"plugins": "yarn run plugin:autoconfirm",
4039
"plugin:autoconfirm": "yarn run generate:package YoutubeNonStop",
4140
"release:linux": "yarn run clean && build --linux -p always",
4241
"release:mac": "yarn run clean && build --mac -p always",
@@ -46,22 +45,21 @@
4645
"npm": "Please use yarn and not npm"
4746
},
4847
"dependencies": {
48+
"@cliqz/adblocker-electron": "^1.14.1",
4949
"YoutubeNonStop": "git://github.com/lawfx/YoutubeNonStop.git#v0.7.1",
50-
"adblock-rs": "^0.2.7",
5150
"electron-debug": "^2.2.0",
5251
"electron-is": "^3.0.0",
5352
"electron-localshortcut": "^3.2.1",
5453
"electron-store": "^3.1.0",
55-
"electron-updater": "^4.2.2"
54+
"electron-updater": "^4.2.2",
55+
"node-fetch": "^2.6.0"
5656
},
5757
"devDependencies": {
5858
"devtron": "^1.4.0",
5959
"electron": "^8.2.1",
60-
"electron-build-env": "^0.2",
6160
"electron-builder": "^20.40.2",
6261
"electron-devtools-installer": "^2.2.4",
6362
"electron-icon-maker": "0.0.4",
64-
"neon-cli": "^0.1.17",
6563
"rimraf": "^2.6.3",
6664
"xo": "^0.24.0"
6765
},

plugins/adblocker/.gitignore

-2
This file was deleted.

plugins/adblocker/back.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
const { blockWindowAds } = require("./blocker");
1+
const { ElectronBlocker } = require("@cliqz/adblocker-electron");
2+
const { session } = require("electron");
3+
const fetch = require("node-fetch");
24

3-
module.exports = win => blockWindowAds(win.webContents);
5+
const SOURCES = [
6+
"https://raw.githubusercontent.com/kbinani/adblock-youtube-ads/master/signed.txt"
7+
];
8+
9+
module.exports = () =>
10+
ElectronBlocker.fromLists(fetch, SOURCES)
11+
.then(blocker => blocker.enableBlockingInSession(session.defaultSession))
12+
.catch(err => console.log("Error loading adBlocker", err));

plugins/adblocker/blocker.js

-8
This file was deleted.

plugins/adblocker/contains-ads.js

-32
This file was deleted.

plugins/adblocker/downloader.js

-37
This file was deleted.

plugins/adblocker/filter-lists/.keep

Whitespace-only changes.

0 commit comments

Comments
 (0)