diff --git a/lib/main-app.js b/lib/main-app.js index 6151c1f0d..de457a07c 100644 --- a/lib/main-app.js +++ b/lib/main-app.js @@ -8,21 +8,20 @@ const { isPackaged } = app var ipcServer = null -var mainWindow = null +const gotTheLock = app.requestSingleInstanceLock() -var shouldQuit = app.makeSingleInstance(function (commandLine, workingDirectory) { - if (mainWindow) { - if (process.platform === 'win32') { - mainWindow.minimize() - mainWindow.restore() - } - mainWindow.focus() - } - return true -}) - -if (shouldQuit) { +if (!gotTheLock) { app.quit() +} else { + app.on('second-instance', (event, commandLine, workingDirectory) => { + if (mainWindow) { + if (process.platform === 'win32') { + mainWindow.minimize() + mainWindow.restore() + } + mainWindow.focus() + } + }) } var isUpdateReady = false diff --git a/lib/main-window.js b/lib/main-window.js index e650cb922..e3aaa7e92 100644 --- a/lib/main-window.js +++ b/lib/main-window.js @@ -50,7 +50,8 @@ const mainWindow = new BrowserWindow({ minHeight: 320, webPreferences: { zoomFactor: 1.0, - enableBlinkFeatures: 'OverlayScrollbars' + enableBlinkFeatures: 'OverlayScrollbars', + nodeIntegration: true }, icon: path.resolve(__dirname, '../resources/app.png') }) diff --git a/package.json b/package.json index 1f3278746..2e27e6aa2 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "watch": "webpack-dev-server --hot" }, "config": { - "electron-version": "3.0.8" + "electron-version": "5.0.6" }, "repository": { "type": "git", @@ -144,7 +144,7 @@ "css-loader": "^0.19.0", "devtron": "^1.1.0", "dom-storage": "^2.0.2", - "electron": "3.0.8", + "electron": "5.0.6", "electron-debug": "^2.2.0", "electron-devtools-installer": "^2.2.4", "electron-packager": "^12.2.0", @@ -212,4 +212,4 @@ "pre-commit": "npm run lint" } } -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index a10a0fc5a..c559ac789 100644 --- a/yarn.lock +++ b/yarn.lock @@ -109,9 +109,10 @@ dependencies: meaw "^2.0.0" -"@types/node@^8.0.24": - version "8.10.17" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.17.tgz#d48cf10f0dc6dcf59f827f5a3fc7a4a6004318d3" +"@types/node@^10.12.18": + version "10.14.12" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.12.tgz#0eec3155a46e6c4db1f27c3e588a205f767d622f" + integrity sha512-QcAKpaO6nhHLlxWBvpc4WeLrTvPqlHOvaj0s5GriKkA1zq+bsFBPpfYCvQhLqLgYlIko8A9YrPdaMHCo5mBcpg== "JSV@>= 4.0.x": version "4.0.2" @@ -3059,11 +3060,12 @@ electron-winstaller@^2.2.0: lodash.template "^4.2.2" temp "^0.8.3" -electron@3.0.8: - version "3.0.8" - resolved "https://registry.yarnpkg.com/electron/-/electron-3.0.8.tgz#7905806ebaead4c693531e11cda6568c32efa7bb" +electron@5.0.6: + version "5.0.6" + resolved "https://registry.yarnpkg.com/electron/-/electron-5.0.6.tgz#e3ca4a58b5716fceef3fb64e1fd2222dd9c51de0" + integrity sha512-0L53lv26eDhaaNxL6DqXGQrQOEAYbrQg40stRSb2pzrY06kwPbABzXEiaCvEsBuKUQ+9OQBbVyyvXRbLJlun/A== dependencies: - "@types/node" "^8.0.24" + "@types/node" "^10.12.18" electron-download "^4.1.0" extract-zip "^1.0.3"