From bc4b349771d9b400b5c11eb29dbe17e809609526 Mon Sep 17 00:00:00 2001 From: yu <1919727607@qq.com> Date: Tue, 3 Nov 2026 13:55:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20overlay=E7=AA=97=E5=8F=A3=20require?= =?UTF-8?q?=E6=94=B9ESM=20import,=20nodeIntegration=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E4=BD=BFipcRenderer=E5=8F=AF=E7=94=A8,=20script=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=A8=A1=E6=9D=BF=E8=BD=AC=E4=B9=89=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/overlay.ts | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/src/main/overlay.ts b/src/main/overlay.ts index f021e24..c29d094 100644 --- a/src/main/overlay.ts +++ b/src/main/overlay.ts @@ -1,8 +1,6 @@ -import { BrowserWindow, ipcMain } from "electron"; -import path from "node:path"; +import { BrowserWindow, ipcMain, screen } from "electron"; let overlayWindow: BrowserWindow | null = null; -let cachedProgress = { current: "", done: 0, total: 0 }; export function showRunOverlay(mainWindow: BrowserWindow | null): void { if (mainWindow && !mainWindow.isDestroyed()) mainWindow.minimize(); @@ -14,9 +12,6 @@ export function showRunOverlay(mainWindow: BrowserWindow | null): void { const w = 320; const h = 56; - const { - screen - } = require("electron") as typeof import("electron"); const workArea = screen.getPrimaryDisplay().workArea; const x = workArea.x + workArea.width - w - 16; const y = workArea.y + workArea.height - h - 16; @@ -40,9 +35,8 @@ export function showRunOverlay(mainWindow: BrowserWindow | null): void { transparent: false, backgroundColor: "#1E2530", webPreferences: { - preload: path.join(__dirname, "../preload/index.js"), - contextIsolation: true, - nodeIntegration: false, + contextIsolation: false, + nodeIntegration: true, sandbox: false } }); @@ -64,34 +58,33 @@ body{width:320px;height:56px;background:#1E2530;color:#E8ECF2;font-family:-apple