refactor(desktop-shell-window): extract webPreferences into a typed local

This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 23:05:24 -04:00
1 parent 9e6aa61e09
commit df418a874b
1 file changed
+11 -10
+11 -10
View File
@@ -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) {