From 0ef593be1ae131bde9ace5fadd1724ba6b4afae5 Mon Sep 17 00:00:00 2001
From: AlphaX-Projects <77661270+AlphaX-Projects@users.noreply.github.com>
Date: Mon, 19 Dec 2022 18:33:45 +0100
Subject: [PATCH] Update deps and electron
---
README.md | 2 +-
electron.js | 62 +++++++++++++++++-----------------
package.json | 4 +--
qortal-ui-core/package.json | 23 ++++++-------
qortal-ui-crypto/package.json | 4 +--
qortal-ui-plugins/package.json | 19 ++++++-----
6 files changed, 58 insertions(+), 56 deletions(-)
diff --git a/README.md b/README.md
index c6b220a0..02a93a20 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@ Easiest way to install the lastest required packages on Linux is via nvm.
``` source ~/.profile ``` (For Debian based distro)
``` source ~/.bashrc ``` (For Fedora / CentOS)
``` nvm ls-remote ``` (Fetch list of available versions)
-``` nvm install v16.16.0 ``` (LTS: Gallium supported by Electron)
+``` nvm install v16.17.1 ``` (LTS: Gallium supported by Electron)
``` npm --location=global install yarn@1.22.19 ```
``` npm --location=global install npm@9.2.0 ```
diff --git a/electron.js b/electron.js
index ec24c46c..a11997ee 100644
--- a/electron.js
+++ b/electron.js
@@ -1,11 +1,12 @@
-const { app, BrowserWindow, ipcMain, Menu, Notification, Tray, nativeImage, dialog, webContents } = require('electron')
+const { app, BrowserWindow, ipcMain, Menu, Notification, Tray, nativeImage, dialog, webContents, nativeTheme } = require('electron')
const { autoUpdater } = require('electron-updater')
const server = require('./server.js')
const log = require('electron-log')
const path = require('path')
const i18n = require("./lib/i18n.js")
-app.commandLine.appendSwitch('js-flags', '--max-old-space-size=512')
+app.disableHardwareAcceleration()
+app.enableSandbox()
process.env['APP_PATH'] = app.getAppPath()
@@ -41,14 +42,6 @@ const editMenu = Menu.buildFromTemplate([
Menu.setApplicationMenu(editMenu)
-let myWindow = null;
-
-const APP_ICON = path.join(__dirname, 'img', 'icons')
-
-const iconPath = () => {
- return APP_ICON + (process.platform === 'win32' ? '/ico/256x256.ico' : '/png/256x256.png')
-}
-
function createWindow() {
myWindow = new BrowserWindow({
backgroundColor: '#eee',
@@ -56,15 +49,14 @@ function createWindow() {
height: 720,
minWidth: 700,
minHeight: 640,
- icon: iconPath(),
+ icon: path.join(__dirname + '/img/icons/png/256x256.png'),
title: "Qortal UI",
autoHideMenuBar: true,
webPreferences: {
nodeIntegration: false,
+ nodeIntegrationInWorker: true,
partition: 'persist:webviewsession',
- enableRemoteModule: false,
- nativeWindowOpen: false,
- sandbox: true
+ enableRemoteModule: false
},
show: false
})
@@ -74,14 +66,26 @@ function createWindow() {
myWindow.on('closed', function () {
myWindow = null
})
- myWindow.on('minimize',function(event) {
+ myWindow.on('minimize', function (event) {
event.preventDefault()
myWindow.hide()
})
+ ipcMain.handle('dark-mode:toggle', () => {
+ if (nativeTheme.shouldUseDarkColors) {
+ nativeTheme.themeSource = 'light'
+ } else {
+ nativeTheme.themeSource = 'dark'
+ }
+ return nativeTheme.shouldUseDarkColors
+ })
+
+ ipcMain.handle('dark-mode:system', () => {
+ nativeTheme.themeSource = 'system'
+ })
}
const createTray = () => {
- let myTray = new Tray(__dirname + '/img/icons/png/tray/tray.png')
+ let myTray = new Tray(path.join(__dirname + '/img/icons/png/tray/tray.png'))
const contextMenu = Menu.buildFromTemplate([
{
label: `Qortal UI v${app.getVersion()}`,
@@ -99,7 +103,7 @@ const createTray = () => {
},
{
label: i18n.__("electron_translate_2"),
- click() {
+ click: function () {
myTray.destroy()
app.quit()
},
@@ -116,14 +120,7 @@ const isLock = app.requestSingleInstanceLock()
if (!isLock) {
app.quit()
} else {
- app.on('second-instance', (event, cmd, dir) => {
- if (myWindow) {
- if (myWindow.isMinimized()) myWindow.restore()
- myWindow.focus()
- }
- })
- app.allowRendererProcessReuse = true
- app.on('ready', () => {
+ app.whenReady().then(() => {
createWindow();
createTray();
if (process.platform === 'win32') {
@@ -133,18 +130,18 @@ if (!isLock) {
setInterval(() => {
autoUpdater.checkForUpdatesAndNotify()
}, 1000 * 60 * 720)
+ app.on('activate', function () {
+ if (BrowserWindow.getAllWindows().length === 0) {
+ createWindow()
+ createTray()
+ }
+ })
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit();
}
})
- app.on('activate', function () {
- if (myWindow === null) {
- createWindow()
- createTray()
- }
- })
ipcMain.on('app_version', (event) => {
log.info(app.getVersion());
mainWindow.webContents.send('app_version', { version: app.getVersion() })
@@ -195,4 +192,7 @@ if (!isLock) {
})
n.show()
})
+ process.on('uncaughtException', function (err) {
+ log.info("***WHOOPS TIME****"+err)
+ })
}
diff --git a/package.json b/package.json
index 25a0ef7c..4b7cc8ca 100644
--- a/package.json
+++ b/package.json
@@ -37,13 +37,13 @@
"os-locale": "3.0.0"
},
"devDependencies": {
- "electron": "21.3.3",
+ "electron": "22.0.0",
"electron-builder": "23.6.0",
"electron-packager": "17.1.1",
"@electron/notarize": "1.2.3",
"shelljs": "0.8.5"
},
"engines": {
- "node": ">=16.16.0"
+ "node": ">=16.17.1"
}
}
\ No newline at end of file
diff --git a/qortal-ui-core/package.json b/qortal-ui-core/package.json
index 386258d2..4adfba68 100644
--- a/qortal-ui-core/package.json
+++ b/qortal-ui-core/package.json
@@ -1,7 +1,7 @@
{
"name": "qortal-ui-core",
"version": "2.2.5",
- "description": "QORTAL-UI Core",
+ "description": "Qortal Project - decentralize the world - Data storage, communications, web hosting, decentralized trading, complete infrastructure for the future blockchain-based Internet",
"keywords": [
"QORT",
"QORTAL",
@@ -17,9 +17,9 @@
"author": "QORTAL ",
"license": "GPL-3.0",
"dependencies": {
- "@hapi/hapi": "21.0.0",
+ "@hapi/hapi": "21.1.0",
"@hapi/inert": "7.0.0",
- "sass": "1.56.2"
+ "sass": "1.57.0"
},
"devDependencies": {
"@babel/core": "7.20.5",
@@ -55,31 +55,30 @@
"@polymer/paper-tooltip": "3.0.1",
"@rollup/plugin-alias": "4.0.2",
"@rollup/plugin-babel": "6.0.3",
- "@rollup/plugin-commonjs": "23.0.4",
+ "@rollup/plugin-commonjs": "23.0.7",
"@rollup/plugin-node-resolve": "15.0.1",
- "@rollup/plugin-replace": "5.0.1",
+ "@rollup/plugin-replace": "5.0.2",
"@rollup/plugin-terser": "0.2.0",
- "@vaadin/grid": "23.2.11",
- "@vaadin/icons": "23.2.11",
- "@vaadin/password-field": "23.2.11",
+ "@vaadin/grid": "23.3.1",
+ "@vaadin/icons": "23.3.1",
+ "@vaadin/password-field": "23.3.1",
"asmcrypto.js": "2.3.2",
"bcryptjs": "2.4.3",
"epml": "0.3.3",
"file-saver": "2.0.5",
"lit": "2.5.0",
"lit-translate": "2.0.1",
- "postcss": "8.4.19",
+ "postcss": "8.4.20",
"pwa-helpers": "0.9.1",
"random-sentence-generator": "0.0.8",
"redux": "4.2.0",
"redux-thunk": "2.4.2",
- "rollup": "3.7.2",
+ "rollup": "3.7.5",
"rollup-plugin-node-globals": "1.4.0",
- "rollup-plugin-postcss": "4.0.2",
"rollup-plugin-progress": "1.1.2",
"rollup-plugin-scss": "3.0.0"
},
"engines": {
- "node": ">=16.16.0"
+ "node": ">=16.17.1"
}
}
\ No newline at end of file
diff --git a/qortal-ui-crypto/package.json b/qortal-ui-crypto/package.json
index 7d64b18a..5d9362c0 100644
--- a/qortal-ui-crypto/package.json
+++ b/qortal-ui-crypto/package.json
@@ -1,7 +1,7 @@
{
"name": "qortal-ui-crypto",
"version": "2.2.5",
- "description": "QORTAL-UI Crypto",
+ "description": "Qortal Project - decentralize the world - Data storage, communications, web hosting, decentralized trading, complete infrastructure for the future blockchain-based Internet",
"keywords": [
"QORT",
"QORTAL",
@@ -23,6 +23,6 @@
"lodash": "4.17.21"
},
"engines": {
- "node": ">=16.16.0"
+ "node": ">=16.17.1"
}
}
diff --git a/qortal-ui-plugins/package.json b/qortal-ui-plugins/package.json
index d28651b7..3cbca06b 100644
--- a/qortal-ui-plugins/package.json
+++ b/qortal-ui-plugins/package.json
@@ -1,7 +1,7 @@
{
"name": "qortal-ui-plugins",
"version": "2.2.5",
- "description": "QORTAL-UI Plugins",
+ "description": "Qortal Project - decentralize the world - Data storage, communications, web hosting, decentralized trading, complete infrastructure for the future blockchain-based Internet",
"keywords": [
"QORT",
"QORTAL",
@@ -36,6 +36,7 @@
"@material/mwc-tab-bar": "0.27.0",
"@material/mwc-textfield": "0.27.0",
"@polymer/iron-icons": "3.0.1",
+ "@polymer/paper-dialog": "3.0.1",
"@polymer/paper-icon-button": "3.0.2",
"@polymer/paper-progress": "3.0.1",
"@polymer/paper-slider": "3.0.1",
@@ -43,23 +44,25 @@
"@polymer/paper-tooltip": "3.0.1",
"@rollup/plugin-alias": "4.0.2",
"@rollup/plugin-babel": "6.0.3",
- "@rollup/plugin-commonjs": "23.0.4",
+ "@rollup/plugin-commonjs": "23.0.7",
"@rollup/plugin-node-resolve": "15.0.1",
- "@rollup/plugin-replace": "5.0.1",
+ "@rollup/plugin-replace": "5.0.2",
"@rollup/plugin-terser": "0.2.0",
- "@vaadin/button": "23.2.11",
- "@vaadin/grid": "23.2.11",
- "@vaadin/icons": "23.2.11",
+ "@vaadin/avatar": "23.3.1",
+ "@vaadin/button": "23.3.1",
+ "@vaadin/grid": "23.3.1",
+ "@vaadin/icons": "23.3.1",
"epml": "0.3.3",
"file-saver": "2.0.5",
+ "highcharts": "10.3.2",
"html-escaper": "3.0.3",
"lit": "2.5.0",
"lit-translate": "2.0.1",
- "rollup": "3.7.2",
+ "rollup": "3.7.5",
"rollup-plugin-node-globals": "1.4.0",
"rollup-plugin-progress": "1.1.2"
},
"engines": {
- "node": ">=16.16.0"
+ "node": ">=16.17.1"
}
}