diff --git a/server/electron/splash/splash.html b/server/electron/splash/splash.html index 824ab21ea..6a5c9cba2 100644 --- a/server/electron/splash/splash.html +++ b/server/electron/splash/splash.html @@ -36,6 +36,7 @@ animation-timing-function: cubic-bezier(0, 1, 1, 0); } .lds-ellipsis div:nth-child(1) { + left: 8px; animation: lds-ellipsis1 0.6s infinite; } .lds-ellipsis div:nth-child(2) { diff --git a/server/main.js b/server/main.js index 26edf2825..aad6390aa 100644 --- a/server/main.js +++ b/server/main.js @@ -10,11 +10,11 @@ const { Notification, } = require('electron'); const path = require('path'); -const { electron } = require('process'); const env = process.env.NODE_ENV || 'prod'; let loaded = 'Nothing loaded'; +let isQuitting = false; const nodePath = env != 'prod' @@ -173,9 +173,12 @@ app.whenReady().then(() => { // Hide on close win.on('close', function (event) { event.preventDefault(); - showNotification('App running in background'); - win.hide(); - return false; + if (!isQuitting) { + showNotification('App running in background'); + win.hide(); + return false; + } + return true; }); // create tray @@ -224,6 +227,7 @@ ipcMain.on('shutdown', (event, arg) => { await shutdown(); })(); + isQuitting = true; tray.destroy(); win.destroy(); app.quit(); diff --git a/server/package.json b/server/package.json index f6f16afdd..c77f03f65 100644 --- a/server/package.json +++ b/server/package.json @@ -4,12 +4,12 @@ "author": "Carlos Valente", "description": "Time keeping for live events", "repository": "https://github.com/cpvalente/ontime", - "keywords": ["lighdev", "ontime"], + "keywords": [ "lighdev", "ontime", "timer" ], "license": "MIT", "main": "main.js", "devDependencies": { "concurrently": "^6.1.0", - "electron": "^12.0.7", + "electron": "^13.1.2", "electron-builder": "^22.11.3", "eslint": "^7.26.0", "eslint-config-airbnb": "^18.2.1", @@ -19,7 +19,6 @@ "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-simple-import-sort": "^7.0.0" }, - "scripts": { "nodestart": "NODE_ENV=development node app.js", "start": "NODE_ENV=development electron .", @@ -35,12 +34,12 @@ "category": "your.app.category.type" }, "win": { - "target": "nsis" + "target": "nsis" }, "nsis": { - "createDesktopShortcut": true, - "createStartMenuShortcut": true, - "deleteAppDataOnUninstall": true, + "createDesktopShortcut": true, + "createStartMenuShortcut": true, + "deleteAppDataOnUninstall": true, "installerIcon": "icon.ico" }, "files": [ @@ -48,8 +47,8 @@ "assets/" ], "directories": { - "buildResources": "./assets/" - }, + "buildResources": "./assets/" + }, "extraResources": [ { "from": "../client/build", diff --git a/server/src/app.js b/server/src/app.js index 944903f2d..f42aba307 100644 --- a/server/src/app.js +++ b/server/src/app.js @@ -128,4 +128,7 @@ export const shutdown = () => { // shutdown OSC Server shutdownOSCServer(); // shutdown OSC Client + + // shutdown timer + global.timer.shutdown(); }; diff --git a/server/src/classes/EventTimer.js b/server/src/classes/EventTimer.js index e7bc9c0f5..1b23f58ed 100644 --- a/server/src/classes/EventTimer.js +++ b/server/src/classes/EventTimer.js @@ -81,6 +81,14 @@ export class EventTimer extends Timer { this._listenToConnections(); } + /** + * @description Shutdown process + */ + shutdown() { + console.log('Closing socket server'); + this.io.close(); + } + // send current timer broadcastTimer() { this.io.emit('timer', this.getObject()); diff --git a/server/yarn.lock b/server/yarn.lock index b24e9f961..ae080a582 100644 --- a/server/yarn.lock +++ b/server/yarn.lock @@ -920,10 +920,10 @@ electron-publish@22.11.5: lazy-val "^1.0.5" mime "^2.5.2" -electron@^12.0.7: - version "12.0.10" - resolved "https://registry.yarnpkg.com/electron/-/electron-12.0.10.tgz#d0879ff005a200d5b08dbfb3e5bbea744d38c71a" - integrity sha512-qaNvFG4AgeuT3PkSljQ9MlY7hz87wIwJ5cmSZ1453IVsUd0BV7pcaLViSpR1bRSqxetDDWxCLtCp0N9RXeDZww== +electron@^13.1.2: + version "13.1.2" + resolved "https://registry.yarnpkg.com/electron/-/electron-13.1.2.tgz#8c9abf9015766c9cbc16f10c99282d00d6ae1b90" + integrity sha512-aNT9t+LgdQaZ7FgN36pN7MjSEoj+EWc2T9yuOqBApbmR4HavGRadSz7u9N2Erw2ojdIXtei2RVIAvVm8mbDZ0g== dependencies: "@electron/get" "^1.0.1" "@types/node" "^14.6.2"