Skip to content

Commit 22c7f70

Browse files
committed
Adblocker: add option to disable default lists
1 parent 467171a commit 22c7f70

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "youtube-music",
33
"productName": "YouTube Music",
4-
"version": "1.7.2",
4+
"version": "1.7.3",
55
"description": "YouTube Music Desktop App - including custom plugins",
66
"license": "MIT",
77
"repository": "th-ch/youtube-music",

plugins/adblocker/back.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ module.exports = (win, options) =>
33
loadAdBlockerEngine(
44
win.webContents.session,
55
options.cache,
6-
options.additionalBlockLists
6+
options.additionalBlockLists,
7+
options.disableDefaultLists
78
);

plugins/adblocker/blocker.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const SOURCES = [
1111
const loadAdBlockerEngine = (
1212
session = undefined,
1313
cache = true,
14-
additionalBlockLists = []
14+
additionalBlockLists = [],
15+
disableDefaultLists = false
1516
) => {
1617
// Only use cache if no additional blocklists are passed
1718
const cachingOptions =
@@ -22,13 +23,12 @@ const loadAdBlockerEngine = (
2223
write: promises.writeFile,
2324
}
2425
: undefined;
26+
const lists = [
27+
...(disableDefaultLists ? [] : SOURCES),
28+
...additionalBlockLists,
29+
];
2530

26-
ElectronBlocker.fromLists(
27-
fetch,
28-
[...SOURCES, ...additionalBlockLists],
29-
{},
30-
cachingOptions
31-
)
31+
ElectronBlocker.fromLists(fetch, lists, {}, cachingOptions)
3232
.then((blocker) => {
3333
if (session) {
3434
blocker.enableBlockingInSession(session);

0 commit comments

Comments
 (0)