From df418a874bf16330c229e5edcb794fedacdd7a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 16 Apr 2026 23:05:24 -0400 Subject: [PATCH] refactor(desktop-shell-window): extract webPreferences into a typed local --- src/main/desktop-shell-window.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/desktop-shell-window.ts b/src/main/desktop-shell-window.ts index 06304d43..9aedcd6a 100644 --- a/src/main/desktop-shell-window.ts +++ b/src/main/desktop-shell-window.ts @@ -246,6 +246,16 @@ export function createDesktopShellWindow(deps: DesktopShellWindowDependencies) { const savedWindowState = loadWindowState(windowStatePath); const isWindows = process.platform === "win32"; const isLinux = process.platform === "linux"; + const webPreferences: Electron.WebPreferences = { + preload: preloadPath, + contextIsolation: true, + nodeIntegration: false, + sandbox: true, + webviewTag: false, + devTools: isDev, + webSecurity: true, + allowRunningInsecureContent: false, + }; mainWindow = new BrowserWindow({ title: "AgentCompany", icon: windowIcon.isEmpty() ? undefined : windowIcon, @@ -259,16 +269,7 @@ export function createDesktopShellWindow(deps: DesktopShellWindowDependencies) { frame: process.platform === "darwin", titleBarStyle: process.platform === "darwin" ? "hiddenInset" : "default", ...(isWindows || isLinux ? { titleBarOverlay: false } : {}), - webPreferences: { - preload: preloadPath, - contextIsolation: true, - nodeIntegration: false, - sandbox: true, - webviewTag: false, - devTools: isDev, - webSecurity: true, - allowRunningInsecureContent: false, - }, + webPreferences, }); if (isDev && devServerUrl) {