refactor(desktop-shell-window): extract webPreferences into a typed local
This commit is contained in:
1 parent
9e6aa61e09
commit
df418a874b
1 file changed
+11
-10
@@ -246,6 +246,16 @@ export function createDesktopShellWindow(deps: DesktopShellWindowDependencies) {
|
|||||||
const savedWindowState = loadWindowState(windowStatePath);
|
const savedWindowState = loadWindowState(windowStatePath);
|
||||||
const isWindows = process.platform === "win32";
|
const isWindows = process.platform === "win32";
|
||||||
const isLinux = process.platform === "linux";
|
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({
|
mainWindow = new BrowserWindow({
|
||||||
title: "AgentCompany",
|
title: "AgentCompany",
|
||||||
icon: windowIcon.isEmpty() ? undefined : windowIcon,
|
icon: windowIcon.isEmpty() ? undefined : windowIcon,
|
||||||
@@ -259,16 +269,7 @@ export function createDesktopShellWindow(deps: DesktopShellWindowDependencies) {
|
|||||||
frame: process.platform === "darwin",
|
frame: process.platform === "darwin",
|
||||||
titleBarStyle: process.platform === "darwin" ? "hiddenInset" : "default",
|
titleBarStyle: process.platform === "darwin" ? "hiddenInset" : "default",
|
||||||
...(isWindows || isLinux ? { titleBarOverlay: false } : {}),
|
...(isWindows || isLinux ? { titleBarOverlay: false } : {}),
|
||||||
webPreferences: {
|
webPreferences,
|
||||||
preload: preloadPath,
|
|
||||||
contextIsolation: true,
|
|
||||||
nodeIntegration: false,
|
|
||||||
sandbox: true,
|
|
||||||
webviewTag: false,
|
|
||||||
devTools: isDev,
|
|
||||||
webSecurity: true,
|
|
||||||
allowRunningInsecureContent: false,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isDev && devServerUrl) {
|
if (isDev && devServerUrl) {
|
||||||
|
|||||||
Reference in new issue
Block a user