mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-15 04:11:47 +00:00
Initial commit - app + 4 plugins
This commit is contained in:
12
plugins/adblocker/blocker.js
Normal file
12
plugins/adblocker/blocker.js
Normal file
@ -0,0 +1,12 @@
|
||||
const { initialize, containsAds } = require("./contains-ads");
|
||||
|
||||
module.exports.blockWindowAds = webContents => {
|
||||
initialize();
|
||||
webContents.session.webRequest.onBeforeRequest(
|
||||
["*://*./*"],
|
||||
(details, cb) => {
|
||||
const shouldBeBlocked = containsAds(details.url);
|
||||
cb({ cancel: shouldBeBlocked });
|
||||
}
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user