mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 03:11:46 +00:00
20
plugins/adblocker/back.ts
Normal file
20
plugins/adblocker/back.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { BrowserWindow } from 'electron';
|
||||
|
||||
import { loadAdBlockerEngine } from './blocker';
|
||||
import config from './config';
|
||||
|
||||
import pluginConfig from '../../config';
|
||||
|
||||
const AdBlockOptionsObj = pluginConfig.get('plugins.adblocker');
|
||||
type AdBlockOptions = typeof AdBlockOptionsObj;
|
||||
|
||||
export default async (win: BrowserWindow, options: AdBlockOptions) => {
|
||||
if (await config.shouldUseBlocklists()) {
|
||||
loadAdBlockerEngine(
|
||||
win.webContents.session,
|
||||
options.cache,
|
||||
options.additionalBlockLists,
|
||||
options.disableDefaultLists,
|
||||
);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user