diff --git a/src/Electron/main.js b/src/Electron/main.js index 4092df7c..faa70f49 100644 --- a/src/Electron/main.js +++ b/src/Electron/main.js @@ -16,8 +16,6 @@ import { getPort, sendToPort } from "./lib/serialport"; // TODO @brown-ccv #192: Handle data writing to desktop in a utility process // TODO @brown-ccv #192: Handle video data writing to desktop in a utility process -console.log("MAIN", import.meta.dirname, import.meta.filename); - /************ GLOBALS ***********/ const IS_DEV = import.meta.env.DEV && !app.isPackaged; @@ -303,7 +301,14 @@ function createWindow() { const mainWindow = new BrowserWindow({ icon: "./favicon.ico", // webPreferences: { preload: path.join(__dirname, "preload.js") }, - webPreferences: { preload: path.join(import.meta.dirname, "preload.js") }, + webPreferences: { + // preload: path.join(import.meta.dirname, "preload.js"), + preload: path.join(import.meta.dirname, "preload.mjs"), + // TEST + sandbox: false, + contextIsolation: true, + // enableRemoteModule: false, + }, width: 1500, height: 900, // TODO @brown-ccv: Settings for preventing the menu bar from ever showing up diff --git a/src/Electron/preload.js b/src/Electron/preload.js index c0e9c37e..c3e53284 100644 --- a/src/Electron/preload.js +++ b/src/Electron/preload.js @@ -1,7 +1,12 @@ import { contextBridge, ipcRenderer } from "electron"; +import log from "electron-log"; +log.info("PRELOAD"); /** Load bridges between the main and renderer processes when the preload process is first loaded */ process.once("loaded", () => { + // TODO: The "loaded" state is never executed for some reason + console.log("PRELOAD LOADED"); + log.info("PRELOAD LOADED"); contextBridge.exposeInMainWorld("electronAPI", { setConfig: (config) => ipcRenderer.send("setConfig", config), setTrigger: (triggerCodes) => ipcRenderer.send("setTrigger", triggerCodes), diff --git a/src/config/env.js b/src/config/env.js index 45f31a0a..2c8953c4 100644 --- a/src/config/env.js +++ b/src/config/env.js @@ -18,4 +18,6 @@ const config = { USE_EEG, USE_CAMERA, }; + +console.log("CONFIG", window.electronAPI, config); export default config;