mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 11:21:46 +00:00
feat: migrate to new plugin api
Co-authored-by: Su-Yong <simssy2205@gmail.com>
This commit is contained in:
52
src/plugins/adblocker/index.ts
Normal file
52
src/plugins/adblocker/index.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import { blockers } from './types';
|
||||
|
||||
import { createPluginBuilder } from '../utils/builder';
|
||||
|
||||
interface AdblockerConfig {
|
||||
/**
|
||||
* Whether to enable the adblocker.
|
||||
* @default true
|
||||
*/
|
||||
enabled: boolean;
|
||||
/**
|
||||
* When enabled, the adblocker will cache the blocklists.
|
||||
* @default true
|
||||
*/
|
||||
cache: boolean;
|
||||
/**
|
||||
* Which adblocker to use.
|
||||
* @default blockers.InPlayer
|
||||
*/
|
||||
blocker: typeof blockers[keyof typeof blockers];
|
||||
/**
|
||||
* Additional list of filters to use.
|
||||
* @example ["https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt"]
|
||||
* @default []
|
||||
*/
|
||||
additionalBlockLists: string[];
|
||||
/**
|
||||
* Disable the default blocklists.
|
||||
* @default false
|
||||
*/
|
||||
disableDefaultLists: boolean;
|
||||
}
|
||||
|
||||
const builder = createPluginBuilder('adblocker', {
|
||||
name: 'Adblocker',
|
||||
restartNeeded: false,
|
||||
config: {
|
||||
enabled: true,
|
||||
cache: true,
|
||||
blocker: blockers.InPlayer,
|
||||
additionalBlockLists: [],
|
||||
disableDefaultLists: false,
|
||||
} as AdblockerConfig,
|
||||
});
|
||||
|
||||
export default builder;
|
||||
|
||||
declare global {
|
||||
interface PluginBuilderList {
|
||||
[builder.id]: typeof builder;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user