Update deps and electron

This commit is contained in:
AlphaX-Projects 2022-12-19 18:33:45 +01:00
parent 2342ac5e59
commit 0ef593be1a
6 changed files with 58 additions and 56 deletions

View File

@ -27,7 +27,7 @@ Easiest way to install the lastest required packages on Linux is via nvm.
``` source ~/.profile ``` (For Debian based distro) <br/> ``` source ~/.profile ``` (For Debian based distro) <br/>
``` source ~/.bashrc ``` (For Fedora / CentOS) <br/> ``` source ~/.bashrc ``` (For Fedora / CentOS) <br/>
``` nvm ls-remote ``` (Fetch list of available versions) <br/> ``` nvm ls-remote ``` (Fetch list of available versions) <br/>
``` nvm install v16.16.0 ``` (LTS: Gallium supported by Electron) <br/> ``` nvm install v16.17.1 ``` (LTS: Gallium supported by Electron) <br/>
``` npm --location=global install yarn@1.22.19 ``` <br/> ``` npm --location=global install yarn@1.22.19 ``` <br/>
``` npm --location=global install npm@9.2.0 ``` <br/> ``` npm --location=global install npm@9.2.0 ``` <br/>

View File

@ -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 { autoUpdater } = require('electron-updater')
const server = require('./server.js') const server = require('./server.js')
const log = require('electron-log') const log = require('electron-log')
const path = require('path') const path = require('path')
const i18n = require("./lib/i18n.js") 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() process.env['APP_PATH'] = app.getAppPath()
@ -41,14 +42,6 @@ const editMenu = Menu.buildFromTemplate([
Menu.setApplicationMenu(editMenu) 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() { function createWindow() {
myWindow = new BrowserWindow({ myWindow = new BrowserWindow({
backgroundColor: '#eee', backgroundColor: '#eee',
@ -56,15 +49,14 @@ function createWindow() {
height: 720, height: 720,
minWidth: 700, minWidth: 700,
minHeight: 640, minHeight: 640,
icon: iconPath(), icon: path.join(__dirname + '/img/icons/png/256x256.png'),
title: "Qortal UI", title: "Qortal UI",
autoHideMenuBar: true, autoHideMenuBar: true,
webPreferences: { webPreferences: {
nodeIntegration: false, nodeIntegration: false,
nodeIntegrationInWorker: true,
partition: 'persist:webviewsession', partition: 'persist:webviewsession',
enableRemoteModule: false, enableRemoteModule: false
nativeWindowOpen: false,
sandbox: true
}, },
show: false show: false
}) })
@ -74,14 +66,26 @@ function createWindow() {
myWindow.on('closed', function () { myWindow.on('closed', function () {
myWindow = null myWindow = null
}) })
myWindow.on('minimize',function(event) { myWindow.on('minimize', function (event) {
event.preventDefault() event.preventDefault()
myWindow.hide() 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 = () => { 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([ const contextMenu = Menu.buildFromTemplate([
{ {
label: `Qortal UI v${app.getVersion()}`, label: `Qortal UI v${app.getVersion()}`,
@ -99,7 +103,7 @@ const createTray = () => {
}, },
{ {
label: i18n.__("electron_translate_2"), label: i18n.__("electron_translate_2"),
click() { click: function () {
myTray.destroy() myTray.destroy()
app.quit() app.quit()
}, },
@ -116,14 +120,7 @@ const isLock = app.requestSingleInstanceLock()
if (!isLock) { if (!isLock) {
app.quit() app.quit()
} else { } else {
app.on('second-instance', (event, cmd, dir) => { app.whenReady().then(() => {
if (myWindow) {
if (myWindow.isMinimized()) myWindow.restore()
myWindow.focus()
}
})
app.allowRendererProcessReuse = true
app.on('ready', () => {
createWindow(); createWindow();
createTray(); createTray();
if (process.platform === 'win32') { if (process.platform === 'win32') {
@ -133,18 +130,18 @@ if (!isLock) {
setInterval(() => { setInterval(() => {
autoUpdater.checkForUpdatesAndNotify() autoUpdater.checkForUpdatesAndNotify()
}, 1000 * 60 * 720) }, 1000 * 60 * 720)
app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
createTray()
}
})
}) })
app.on('window-all-closed', function () { app.on('window-all-closed', function () {
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
app.quit(); app.quit();
} }
}) })
app.on('activate', function () {
if (myWindow === null) {
createWindow()
createTray()
}
})
ipcMain.on('app_version', (event) => { ipcMain.on('app_version', (event) => {
log.info(app.getVersion()); log.info(app.getVersion());
mainWindow.webContents.send('app_version', { version: app.getVersion() }) mainWindow.webContents.send('app_version', { version: app.getVersion() })
@ -195,4 +192,7 @@ if (!isLock) {
}) })
n.show() n.show()
}) })
process.on('uncaughtException', function (err) {
log.info("***WHOOPS TIME****"+err)
})
} }

View File

@ -37,13 +37,13 @@
"os-locale": "3.0.0" "os-locale": "3.0.0"
}, },
"devDependencies": { "devDependencies": {
"electron": "21.3.3", "electron": "22.0.0",
"electron-builder": "23.6.0", "electron-builder": "23.6.0",
"electron-packager": "17.1.1", "electron-packager": "17.1.1",
"@electron/notarize": "1.2.3", "@electron/notarize": "1.2.3",
"shelljs": "0.8.5" "shelljs": "0.8.5"
}, },
"engines": { "engines": {
"node": ">=16.16.0" "node": ">=16.17.1"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "qortal-ui-core", "name": "qortal-ui-core",
"version": "2.2.5", "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": [ "keywords": [
"QORT", "QORT",
"QORTAL", "QORTAL",
@ -17,9 +17,9 @@
"author": "QORTAL <admin@qortal.org>", "author": "QORTAL <admin@qortal.org>",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@hapi/hapi": "21.0.0", "@hapi/hapi": "21.1.0",
"@hapi/inert": "7.0.0", "@hapi/inert": "7.0.0",
"sass": "1.56.2" "sass": "1.57.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "7.20.5", "@babel/core": "7.20.5",
@ -55,31 +55,30 @@
"@polymer/paper-tooltip": "3.0.1", "@polymer/paper-tooltip": "3.0.1",
"@rollup/plugin-alias": "4.0.2", "@rollup/plugin-alias": "4.0.2",
"@rollup/plugin-babel": "6.0.3", "@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-node-resolve": "15.0.1",
"@rollup/plugin-replace": "5.0.1", "@rollup/plugin-replace": "5.0.2",
"@rollup/plugin-terser": "0.2.0", "@rollup/plugin-terser": "0.2.0",
"@vaadin/grid": "23.2.11", "@vaadin/grid": "23.3.1",
"@vaadin/icons": "23.2.11", "@vaadin/icons": "23.3.1",
"@vaadin/password-field": "23.2.11", "@vaadin/password-field": "23.3.1",
"asmcrypto.js": "2.3.2", "asmcrypto.js": "2.3.2",
"bcryptjs": "2.4.3", "bcryptjs": "2.4.3",
"epml": "0.3.3", "epml": "0.3.3",
"file-saver": "2.0.5", "file-saver": "2.0.5",
"lit": "2.5.0", "lit": "2.5.0",
"lit-translate": "2.0.1", "lit-translate": "2.0.1",
"postcss": "8.4.19", "postcss": "8.4.20",
"pwa-helpers": "0.9.1", "pwa-helpers": "0.9.1",
"random-sentence-generator": "0.0.8", "random-sentence-generator": "0.0.8",
"redux": "4.2.0", "redux": "4.2.0",
"redux-thunk": "2.4.2", "redux-thunk": "2.4.2",
"rollup": "3.7.2", "rollup": "3.7.5",
"rollup-plugin-node-globals": "1.4.0", "rollup-plugin-node-globals": "1.4.0",
"rollup-plugin-postcss": "4.0.2",
"rollup-plugin-progress": "1.1.2", "rollup-plugin-progress": "1.1.2",
"rollup-plugin-scss": "3.0.0" "rollup-plugin-scss": "3.0.0"
}, },
"engines": { "engines": {
"node": ">=16.16.0" "node": ">=16.17.1"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "qortal-ui-crypto", "name": "qortal-ui-crypto",
"version": "2.2.5", "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": [ "keywords": [
"QORT", "QORT",
"QORTAL", "QORTAL",
@ -23,6 +23,6 @@
"lodash": "4.17.21" "lodash": "4.17.21"
}, },
"engines": { "engines": {
"node": ">=16.16.0" "node": ">=16.17.1"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "qortal-ui-plugins", "name": "qortal-ui-plugins",
"version": "2.2.5", "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": [ "keywords": [
"QORT", "QORT",
"QORTAL", "QORTAL",
@ -36,6 +36,7 @@
"@material/mwc-tab-bar": "0.27.0", "@material/mwc-tab-bar": "0.27.0",
"@material/mwc-textfield": "0.27.0", "@material/mwc-textfield": "0.27.0",
"@polymer/iron-icons": "3.0.1", "@polymer/iron-icons": "3.0.1",
"@polymer/paper-dialog": "3.0.1",
"@polymer/paper-icon-button": "3.0.2", "@polymer/paper-icon-button": "3.0.2",
"@polymer/paper-progress": "3.0.1", "@polymer/paper-progress": "3.0.1",
"@polymer/paper-slider": "3.0.1", "@polymer/paper-slider": "3.0.1",
@ -43,23 +44,25 @@
"@polymer/paper-tooltip": "3.0.1", "@polymer/paper-tooltip": "3.0.1",
"@rollup/plugin-alias": "4.0.2", "@rollup/plugin-alias": "4.0.2",
"@rollup/plugin-babel": "6.0.3", "@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-node-resolve": "15.0.1",
"@rollup/plugin-replace": "5.0.1", "@rollup/plugin-replace": "5.0.2",
"@rollup/plugin-terser": "0.2.0", "@rollup/plugin-terser": "0.2.0",
"@vaadin/button": "23.2.11", "@vaadin/avatar": "23.3.1",
"@vaadin/grid": "23.2.11", "@vaadin/button": "23.3.1",
"@vaadin/icons": "23.2.11", "@vaadin/grid": "23.3.1",
"@vaadin/icons": "23.3.1",
"epml": "0.3.3", "epml": "0.3.3",
"file-saver": "2.0.5", "file-saver": "2.0.5",
"highcharts": "10.3.2",
"html-escaper": "3.0.3", "html-escaper": "3.0.3",
"lit": "2.5.0", "lit": "2.5.0",
"lit-translate": "2.0.1", "lit-translate": "2.0.1",
"rollup": "3.7.2", "rollup": "3.7.5",
"rollup-plugin-node-globals": "1.4.0", "rollup-plugin-node-globals": "1.4.0",
"rollup-plugin-progress": "1.1.2" "rollup-plugin-progress": "1.1.2"
}, },
"engines": { "engines": {
"node": ">=16.16.0" "node": ">=16.17.1"
} }
} }