mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-17 05:02:06 +00:00
fix: fix #29
This commit is contained in:
@ -74,7 +74,7 @@ const defaultConfig = {
|
|||||||
cache: true,
|
cache: true,
|
||||||
blocker: 'With blocklists',
|
blocker: 'With blocklists',
|
||||||
additionalBlockLists: [], // Additional list of filters, e.g "https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt"
|
additionalBlockLists: [], // Additional list of filters, e.g "https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt"
|
||||||
disableDefaultLists: [],
|
disableDefaultLists: false,
|
||||||
},
|
},
|
||||||
'album-color-theme': {},
|
'album-color-theme': {},
|
||||||
'audio-compressor': {},
|
'audio-compressor': {},
|
||||||
|
|||||||
@ -21,14 +21,14 @@ export const loadAdBlockerEngine = (
|
|||||||
session: Electron.Session | undefined = undefined,
|
session: Electron.Session | undefined = undefined,
|
||||||
cache = true,
|
cache = true,
|
||||||
additionalBlockLists = [],
|
additionalBlockLists = [],
|
||||||
disableDefaultLists: boolean | string[] = false,
|
disableDefaultLists: boolean | unknown[] = false,
|
||||||
) => {
|
) => {
|
||||||
// Only use cache if no additional blocklists are passed
|
// Only use cache if no additional blocklists are passed
|
||||||
let cacheDirectory: string;
|
let cacheDirectory: string;
|
||||||
if (app.isPackaged) {
|
if (app.isPackaged) {
|
||||||
cacheDirectory = path.join(app.getPath('userData'), 'cache');
|
cacheDirectory = path.join(app.getPath('userData'), 'adblock_cache');
|
||||||
} else {
|
} else {
|
||||||
cacheDirectory = path.resolve(__dirname, 'cache');
|
cacheDirectory = path.resolve(__dirname, 'adblock_cache');
|
||||||
}
|
}
|
||||||
if (!fs.existsSync(cacheDirectory)) {
|
if (!fs.existsSync(cacheDirectory)) {
|
||||||
fs.mkdirSync(cacheDirectory);
|
fs.mkdirSync(cacheDirectory);
|
||||||
@ -42,7 +42,10 @@ export const loadAdBlockerEngine = (
|
|||||||
}
|
}
|
||||||
: undefined;
|
: undefined;
|
||||||
const lists = [
|
const lists = [
|
||||||
...(disableDefaultLists ? [] : SOURCES),
|
...(
|
||||||
|
(disableDefaultLists && !Array.isArray(disableDefaultLists)) ||
|
||||||
|
(Array.isArray(disableDefaultLists) && disableDefaultLists.length > 0) ? [] : SOURCES
|
||||||
|
),
|
||||||
...additionalBlockLists,
|
...additionalBlockLists,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user