From d7529e93fd24eaf6ea1fb8f8c273120956c0c1d2 Mon Sep 17 00:00:00 2001 From: ziajka Date: Fri, 4 Jan 2019 10:58:35 +0100 Subject: [PATCH] Fix base href for electron env --- main.js | 5 +++-- sentry.js | 5 +++-- src/index.html | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/main.js b/main.js index e1ca16e3..0ef14cea 100644 --- a/main.js +++ b/main.js @@ -76,6 +76,7 @@ function createWindow () { width: 800, height: 600, webPreferences: { + nodeIntegration: false, preload: path.join(__dirname, 'sentry.js') } }); @@ -117,8 +118,8 @@ function createWindow () { // Some APIs can only be used after this event occurs. app.on('ready', createWindow); -app.on('ready', createServerProc); -app.on('will-quit', exitServerProc); +// app.on('ready', createServerProc); +// app.on('will-quit', exitServerProc); // Quit when all windows are closed. app.on('window-all-closed', function () { diff --git a/sentry.js b/sentry.js index 14df2c57..dbf7059d 100644 --- a/sentry.js +++ b/sentry.js @@ -1,6 +1,7 @@ const { init } = require('@sentry/electron'); const fs = require('fs'); -const { ipcMain } = require('electron'); + +const { ipcRenderer } = require('electron') let crashReportsEnabled = true; const DSN = @@ -15,7 +16,7 @@ const shouldSendCallback = () => { }; -ipcMain.on('settings.changed', function (event, settings) { +ipcRenderer.on('settings.changed', function (event, settings) { crashReportsEnabled = settings.crash_reports; }); diff --git a/src/index.html b/src/index.html index 72379fa1..cdeb1b62 100644 --- a/src/index.html +++ b/src/index.html @@ -13,7 +13,7 @@ if (userAgent.indexOf(' electron/') > -1) { var base = document.getElementsByTagName('base'); if(base.length > 0) { - base.href ='./'; + base[0].href ='./'; } else { document.write('');