Skip to content

Commit 467171a

Browse files
committed
Bugfix: only use cache with no additional blocklists
1 parent 3022fac commit 467171a

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
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.1",
4+
"version": "1.7.2",
55
"description": "YouTube Music Desktop App - including custom plugins",
66
"license": "MIT",
77
"repository": "th-ch/youtube-music",

plugins/adblocker/blocker.js

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { existsSync, promises, unlinkSync } = require("fs"); // used for caching
1+
const { promises } = require("fs"); // used for caching
22
const path = require("path");
33

44
const { ElectronBlocker } = require("@cliqz/adblocker-electron");
@@ -13,17 +13,15 @@ const loadAdBlockerEngine = (
1313
cache = true,
1414
additionalBlockLists = []
1515
) => {
16-
const adBlockerCache = path.resolve(__dirname, "ad-blocker-engine.bin");
17-
if (!cache && existsSync(adBlockerCache)) {
18-
unlinkSync(adBlockerCache);
19-
}
20-
const cachingOptions = cache
21-
? {
22-
path: adBlockerCache,
23-
read: promises.readFile,
24-
write: promises.writeFile,
25-
}
26-
: undefined;
16+
// Only use cache if no additional blocklists are passed
17+
const cachingOptions =
18+
cache && additionalBlockLists.length === 0
19+
? {
20+
path: path.resolve(__dirname, "ad-blocker-engine.bin"),
21+
read: promises.readFile,
22+
write: promises.writeFile,
23+
}
24+
: undefined;
2725

2826
ElectronBlocker.fromLists(
2927
fetch,

0 commit comments

Comments
 (0)