import { Page } from 'brave-real-puppeteer-core'; /** * Filter Updater - Auto-fetch and cache uBlock Origin filter lists * Automatically patches custom filters when uBlock Origin updates */ declare const UBLOCK_FILTER_LISTS: { ublock_filters: string; ublock_badware: string; ublock_privacy: string; ublock_resource_abuse: string; ublock_unbreak: string; ublock_quick_fixes: string; ublock_annoyances: string; ublock_annoyances_cookies: string; ublock_annoyances_others: string; easylist: string; easyprivacy: string; easylist_cookie: string; easylist_annoyances: string; easylist_social: string; easylist_antiadblock: string; adguard_base: string; adguard_mobile: string; adguard_tracking: string; adguard_social: string; adguard_annoyances: string; adguard_popup: string; adguard_dns: string; anti_adblock_killer: string; reeks_anti_adblock: string; fuckfuckadblock: string; anti_popup: string; anti_redirect: string; anti_overlay: string; poper_blocker: string; peter_lowes: string; disconnect_me: string; disconnect_tracking: string; disconnect_malware: string; malware_domains: string; phishing_domains: string; spam_404: string; i_dont_care_cookies: string; easylist_cookie_general: string; easylist_india: string; easylist_germany: string; easylist_france: string; easylist_china: string; easylist_russia: string; adguard_japanese: string; easylist_arabic: string; easylist_spanish: string; easylist_dutch: string; easylist_italian: string; }; declare const BACKUP_FILTER_LISTS: { easylist: string; easyprivacy: string; adguard_base: string; peter_lowes: string; }; interface FilterCache { version: string; lastUpdated: number; expiresAt: number; filters: { [key: string]: string; }; combinedFilters: string; } interface FilterUpdaterOptions { /** Cache directory path */ cacheDir?: string; /** Cache expiry in milliseconds (default: 7 days) */ cacheExpiry?: number; /** Which filter lists to use */ enabledLists?: (keyof typeof UBLOCK_FILTER_LISTS)[]; /** Custom filter file path */ customFiltersPath?: string; /** Force update even if cache is valid */ forceUpdate?: boolean; /** Timeout for fetch requests (default: 30000ms) */ fetchTimeout?: number; } declare class FilterUpdater { private options; private cacheFilePath; private cache; constructor(options?: FilterUpdaterOptions); private ensureCacheDir; /** * Load cache from disk */ private loadCache; /** * Save cache to disk */ private saveCache; /** * Check if cache is valid (not expired) */ private isCacheValid; /** * Fetch a single filter list with timeout and retry */ private fetchFilterList; /** * Load custom filters from file */ private loadCustomFilters; /** * Fetch all enabled filter lists and combine them */ updateFilters(): Promise; /** * Combine multiple filter lists into one */ private combineFilters; /** * Get combined filters (from cache or fetch new) */ getFilters(): Promise; /** * Force refresh filters (ignore cache) */ forceRefresh(): Promise; /** * Get cache info */ getCacheInfo(): { valid: boolean; expiresAt: Date | null; lastUpdated: Date | null; }; /** * Clear cache */ clearCache(): void; } declare function getFilterUpdater(options?: FilterUpdaterOptions): FilterUpdater; declare function fetchLatestFilters(options?: FilterUpdaterOptions): Promise; interface BraveBlockerOptions { /** Enable standard network request blocking (Ads/Trackers) */ enableAdBlocking?: boolean; /** Enable stealth evasions (Navigator, WebGL, etc.) */ enableStealth?: boolean; /** Enable cosmetic filtering (Element hiding) */ enableCosmeticFiltering?: boolean; /** Enable advanced redirect and popup blocking */ enableRedirectBlocking?: boolean; /** Enable scriptlet injection for anti-adblock evasion */ enableScriptlets?: boolean; /** Enable video ad blocking (VAST/VPAID, pre-roll, mid-roll) */ enableVideoAdBlocking?: boolean; /** Enable native/content ad blocking (Taboola, Outbrain, sponsored content) */ enableNativeAdBlocking?: boolean; /** Enable CDP early injection (runs BEFORE page scripts for better ad blocking) */ enableCDPEarlyInjection?: boolean; /** Path to custom filter list file */ customFiltersPath?: string; /** Enable auto-update of uBlock Origin filters */ enableFilterAutoUpdate?: boolean; /** Filter updater options */ filterUpdaterOptions?: FilterUpdaterOptions; } declare class BraveBlocker { private blocker; private options; private initialized; private filterUpdater; constructor(options?: BraveBlockerOptions); /** * Initialize the blocker engine by downloading lists */ init(): Promise; /** * Load local custom filters as string */ private loadLocalCustomFiltersString; /** * Enable blocking on a Puppeteer page */ enable(page: Page): Promise; /** * Check if a URL should be blocked */ shouldBlock(url: string): boolean; /** * Setup page for ad blocking BEFORE navigation * This is critical for early injection - MUST be called BEFORE page.goto() * * Usage: * const blocker = new BraveBlocker(); * await blocker.setupPage(page); // Setup CDP hooks * await page.goto('https://...'); // Now navigate * await blocker.enable(page); // Enable remaining protections */ setupPage(page: Page): Promise; } /** * Singleton Manager for BraveBlocker * * Ensures only one instance of BraveBlocker is created across the entire * workspace ecosystem. This prevents duplicate initialization, reduces * memory usage, and maintains consistent blocking rules. */ /** * Get or create the singleton BraveBlocker instance * @param options - Configuration options (only used on first call) * @returns The singleton BraveBlocker instance */ declare function getBraveBlockerSingleton(options?: BraveBlockerOptions): BraveBlocker; /** * Initialize the singleton BraveBlocker instance * This should be called once during application startup * @param options - Configuration options * @returns Promise - The initialized singleton instance */ declare function initBraveBlockerSingleton(options?: BraveBlockerOptions): Promise; /** * Check if singleton is already initialized * @returns boolean - True if singleton is initialized */ declare function isBraveBlockerInitialized(): boolean; /** * Reset the singleton instance (mainly for testing) * WARNING: Use with caution in production! */ declare function resetBraveBlockerSingleton(): void; /** * Get singleton configuration info * @returns Object with singleton status and options */ declare function getBraveBlockerInfo(): { isCreated: boolean; isInitialized: boolean; options: BraveBlockerOptions | null; }; export { BACKUP_FILTER_LISTS as B, type FilterCache as F, UBLOCK_FILTER_LISTS as U, BraveBlocker as a, type BraveBlockerOptions as b, FilterUpdater as c, type FilterUpdaterOptions as d, getBraveBlockerSingleton as e, fetchLatestFilters as f, getBraveBlockerInfo as g, getFilterUpdater as h, initBraveBlockerSingleton as i, isBraveBlockerInitialized as j, resetBraveBlockerSingleton as r };