mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 19:31:46 +00:00
Bugfix: only use cache with no additional blocklists
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "youtube-music",
|
"name": "youtube-music",
|
||||||
"productName": "YouTube Music",
|
"productName": "YouTube Music",
|
||||||
"version": "1.7.1",
|
"version": "1.7.2",
|
||||||
"description": "YouTube Music Desktop App - including custom plugins",
|
"description": "YouTube Music Desktop App - including custom plugins",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "th-ch/youtube-music",
|
"repository": "th-ch/youtube-music",
|
||||||
|
|||||||
@ -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 path = require("path");
|
||||||
|
|
||||||
const { ElectronBlocker } = require("@cliqz/adblocker-electron");
|
const { ElectronBlocker } = require("@cliqz/adblocker-electron");
|
||||||
@ -13,17 +13,15 @@ const loadAdBlockerEngine = (
|
|||||||
cache = true,
|
cache = true,
|
||||||
additionalBlockLists = []
|
additionalBlockLists = []
|
||||||
) => {
|
) => {
|
||||||
const adBlockerCache = path.resolve(__dirname, "ad-blocker-engine.bin");
|
// Only use cache if no additional blocklists are passed
|
||||||
if (!cache && existsSync(adBlockerCache)) {
|
const cachingOptions =
|
||||||
unlinkSync(adBlockerCache);
|
cache && additionalBlockLists.length === 0
|
||||||
}
|
? {
|
||||||
const cachingOptions = cache
|
path: path.resolve(__dirname, "ad-blocker-engine.bin"),
|
||||||
? {
|
read: promises.readFile,
|
||||||
path: adBlockerCache,
|
write: promises.writeFile,
|
||||||
read: promises.readFile,
|
}
|
||||||
write: promises.writeFile,
|
: undefined;
|
||||||
}
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
ElectronBlocker.fromLists(
|
ElectronBlocker.fromLists(
|
||||||
fetch,
|
fetch,
|
||||||
|
|||||||
Reference in New Issue
Block a user