diff --git a/package.json b/package.json index a3fadcba1f..7fd4d01943 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "youtube-music", "productName": "YouTube Music", - "version": "1.7.1", + "version": "1.7.2", "description": "YouTube Music Desktop App - including custom plugins", "license": "MIT", "repository": "th-ch/youtube-music", diff --git a/plugins/adblocker/blocker.js b/plugins/adblocker/blocker.js index 7a236c95ad..870147a212 100644 --- a/plugins/adblocker/blocker.js +++ b/plugins/adblocker/blocker.js @@ -1,4 +1,4 @@ -const { existsSync, promises, unlinkSync } = require("fs"); // used for caching +const { promises } = require("fs"); // used for caching const path = require("path"); const { ElectronBlocker } = require("@cliqz/adblocker-electron"); @@ -13,17 +13,15 @@ const loadAdBlockerEngine = ( cache = true, additionalBlockLists = [] ) => { - const adBlockerCache = path.resolve(__dirname, "ad-blocker-engine.bin"); - if (!cache && existsSync(adBlockerCache)) { - unlinkSync(adBlockerCache); - } - const cachingOptions = cache - ? { - path: adBlockerCache, - read: promises.readFile, - write: promises.writeFile, - } - : undefined; + // Only use cache if no additional blocklists are passed + const cachingOptions = + cache && additionalBlockLists.length === 0 + ? { + path: path.resolve(__dirname, "ad-blocker-engine.bin"), + read: promises.readFile, + write: promises.writeFile, + } + : undefined; ElectronBlocker.fromLists( fetch,