Skip to content

Commit

Permalink
delete ad module
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiram committed Mar 8, 2024
1 parent 7844585 commit 2f8f76f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
7 changes: 0 additions & 7 deletions src/main/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ElectronBlocker } from '@cliqz/adblocker-electron';
import remote from '@electron/remote/main';
import { electronApp, is, optimizer } from '@electron-toolkit/utils';

Expand Down Expand Up @@ -240,9 +239,6 @@ app.whenReady().then(async() => {
tmpDir(join(app.getPath('userData'), 'thumbnail'));
}
createWindow();
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
blocker.enableBlockingInSession(mainWindow.webContents.session);
});
// 监听进入全屏事件
mainWindow.on('enter-full-screen', () => {
logger.info(`[main] mainwindow has entered full-screen mode ; send to vue app`);
Expand Down Expand Up @@ -369,9 +365,6 @@ ipcMain.on('openPlayWindow', (_, arg) => {

playWindow.on('ready-to-show', () => {
playWindow.show();
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
blocker.enableBlockingInSession(playWindow.webContents.session);
});
});

playWindow.on('closed', () => {
Expand Down
5 changes: 0 additions & 5 deletions src/main/utils/pie.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { ElectronBlocker } from '@cliqz/adblocker-electron';
import fetch from 'cross-fetch';
import { app, BrowserWindow } from 'electron';
import puppeteer from "puppeteer-core";
import pie from "puppeteer-in-electron";
Expand Down Expand Up @@ -55,9 +53,6 @@ const puppeteerInElectron = async (url: string, ua: string | null = null): Promi
const browser = await pie.connect(app, puppeteer as any); // 连接puppeteer
snifferWindow = new BrowserWindow({ show: false }); // 创建无界面窗口
snifferWindow.webContents.setAudioMuted(true); // 设置窗口静音
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
blocker.enableBlockingInSession(snifferWindow.webContents.session);
}); // 屏蔽广告
const page = await pie.getPage(browser, snifferWindow); // 获取页面

if (ua) await page.setUserAgent(ua); // 设置ua
Expand Down

0 comments on commit 2f8f76f

Please sign in to comment.