mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
20 lines
517 B
TypeScript
20 lines
517 B
TypeScript
import { BrowserWindow } from 'electron';
|
|
|
|
import { loadAdBlockerEngine } from './blocker';
|
|
import { shouldUseBlocklists } from './config';
|
|
|
|
import type { ConfigType } from '../../config/dynamic';
|
|
|
|
type AdBlockOptions = ConfigType<'adblocker'>;
|
|
|
|
export default async (win: BrowserWindow, options: AdBlockOptions) => {
|
|
if (await shouldUseBlocklists()) {
|
|
loadAdBlockerEngine(
|
|
win.webContents.session,
|
|
options.cache,
|
|
options.additionalBlockLists,
|
|
options.disableDefaultLists,
|
|
);
|
|
}
|
|
};
|