mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 02:31:45 +00:00
Generate the adblocker engine only once (by using built-in caching)
This commit is contained in:
@ -1,12 +1,2 @@
|
||||
const { ElectronBlocker } = require("@cliqz/adblocker-electron");
|
||||
const { session } = require("electron");
|
||||
const fetch = require("node-fetch");
|
||||
|
||||
const SOURCES = [
|
||||
"https://raw.githubusercontent.com/kbinani/adblock-youtube-ads/master/signed.txt"
|
||||
];
|
||||
|
||||
module.exports = () =>
|
||||
ElectronBlocker.fromLists(fetch, SOURCES)
|
||||
.then(blocker => blocker.enableBlockingInSession(session.defaultSession))
|
||||
.catch(err => console.log("Error loading adBlocker", err));
|
||||
const { loadAdBlockerEngine } = require("./blocker");
|
||||
module.exports = () => loadAdBlockerEngine(true);
|
||||
|
||||
Reference in New Issue
Block a user