From 7de3bb9346fc79f603f641cecb726eba62d626ab Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Tue, 21 Sep 2021 11:16:07 +0200 Subject: [PATCH] refactor(core): compatibility with electron/remote 2.x --- src/main/index.js | 5 ++++- src/main/libs/ClientsFactory.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index f9b7721f..5f1a805d 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -3,9 +3,11 @@ import { app, BrowserWindow, /* session, */ nativeImage, Menu } from 'electron'; import * as path from 'path'; import Store from 'electron-store'; +import * as remoteMain from '@electron/remote/main'; import ipcHandlers from './ipc-handlers'; +// remoteMain.initialize(); Store.initRenderer(); const isDevelopment = process.env.NODE_ENV !== 'production'; @@ -30,13 +32,14 @@ async function createMainWindow () { nodeIntegration: true, contextIsolation: false, 'web-security': false, - enableRemoteModule: true, spellcheck: false }, frame: false, backgroundColor: '#1d1d1d' }); + remoteMain.enable(window.webContents); + try { if (isDevelopment) { // await window.loadURL(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`); diff --git a/src/main/libs/ClientsFactory.js b/src/main/libs/ClientsFactory.js index 779955fa..54211908 100644 --- a/src/main/libs/ClientsFactory.js +++ b/src/main/libs/ClientsFactory.js @@ -4,7 +4,7 @@ import { PostgreSQLClient } from './clients/PostgreSQLClient'; const queryLogger = sql => { // Remove comments, newlines and multiple spaces - const escapedSql = sql.replace(/(\/\*(.|[\r\n|\n|\r])*?\*\/)|(--(.*|[\r\n|\n|\r]))/gm, '').replace(/\s\s+/g, ' '); + const escapedSql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '').replace(/\s\s+/g, ' '); console.log(escapedSql); };