From ad0a0bbba5897a82d57f2007e63e81102da20c95 Mon Sep 17 00:00:00 2001 From: Kendall Garner <17521368+kgarner7@users.noreply.github.com> Date: Wed, 20 May 2026 22:21:22 -0700 Subject: [PATCH] enable sandbox --- src/main/env.ts | 15 +++++++++++++++ src/main/index.ts | 13 +++---------- src/preload/utils.ts | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 src/main/env.ts diff --git a/src/main/env.ts b/src/main/env.ts new file mode 100644 index 000000000..1a65e61a2 --- /dev/null +++ b/src/main/env.ts @@ -0,0 +1,15 @@ +export const disableAutoUpdates = () => { + return process.env['DISABLE_AUTO_UPDATES']; +}; + +export const isMacOS = () => { + return process.platform === 'darwin'; +}; + +export const isWindows = () => { + return process.platform === 'win32'; +}; + +export const isLinux = () => { + return process.platform === 'linux'; +}; diff --git a/src/main/index.ts b/src/main/index.ts index faffc31a0..94e720a69 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -33,16 +33,9 @@ import { store } from './features/core/settings'; import { canHandleVisualizerDisplayMedia } from './features/core/visualizer'; import MenuBuilder, { MenuPlaybackState } from './menu'; import './features'; -import { - autoUpdaterLogInterface, - createLog, - disableAutoUpdates, - hotkeyToElectronAccelerator, - isLinux, - isMacOS, - isWindows, -} from './utils'; +import { autoUpdaterLogInterface, createLog, hotkeyToElectronAccelerator } from './utils'; +import { disableAutoUpdates, isLinux, isMacOS, isWindows } from '/@/main/env'; import { PlayerRepeat, PlayerStatus, PlayerType, TitleTheme } from '/@/shared/types/types'; const ALPHA_UPDATER_CONFIG: { @@ -518,7 +511,7 @@ async function createWindow(first = true): Promise { devTools: true, nodeIntegration: false, preload: join(__dirname, '../preload/index.js'), - sandbox: false, + sandbox: true, webSecurity: !store.get('ignore_cors'), }, width: 1440, diff --git a/src/preload/utils.ts b/src/preload/utils.ts index 4ca9970af..20bd7ed47 100644 --- a/src/preload/utils.ts +++ b/src/preload/utils.ts @@ -1,6 +1,6 @@ import { ipcRenderer, IpcRendererEvent, webFrame } from 'electron'; -import { disableAutoUpdates, isLinux, isMacOS, isWindows } from '../main/utils'; +import { disableAutoUpdates, isLinux, isMacOS, isWindows } from '../main/env'; const openItem = async (path: string) => { return ipcRenderer.invoke('open-item', path);