refactor(core): compatibility with electron/remote 2.x

This commit is contained in:
Fabio Di Stasio 2021-09-21 11:16:07 +02:00
parent e43a0ba0b4
commit 7de3bb9346
2 changed files with 5 additions and 2 deletions

View File

@ -3,9 +3,11 @@
import { app, BrowserWindow, /* session, */ nativeImage, Menu } from 'electron'; import { app, BrowserWindow, /* session, */ nativeImage, Menu } from 'electron';
import * as path from 'path'; import * as path from 'path';
import Store from 'electron-store'; import Store from 'electron-store';
import * as remoteMain from '@electron/remote/main';
import ipcHandlers from './ipc-handlers'; import ipcHandlers from './ipc-handlers';
// remoteMain.initialize();
Store.initRenderer(); Store.initRenderer();
const isDevelopment = process.env.NODE_ENV !== 'production'; const isDevelopment = process.env.NODE_ENV !== 'production';
@ -30,13 +32,14 @@ async function createMainWindow () {
nodeIntegration: true, nodeIntegration: true,
contextIsolation: false, contextIsolation: false,
'web-security': false, 'web-security': false,
enableRemoteModule: true,
spellcheck: false spellcheck: false
}, },
frame: false, frame: false,
backgroundColor: '#1d1d1d' backgroundColor: '#1d1d1d'
}); });
remoteMain.enable(window.webContents);
try { try {
if (isDevelopment) { // if (isDevelopment) { //
await window.loadURL(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`); await window.loadURL(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`);

View File

@ -4,7 +4,7 @@ import { PostgreSQLClient } from './clients/PostgreSQLClient';
const queryLogger = sql => { const queryLogger = sql => {
// Remove comments, newlines and multiple spaces // 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); console.log(escapedSql);
}; };