Updated express-handlebars & changed confirmation on page exit.

Ylian Saint-Hilaire committed Feb 14, 2022 at 16:33 UTC 47ff8ab14e683616a103a4c26e4ec702c1432a96
4 files changed +18 -7
package.json
+14 -3
@@ -36,20 +36,31 @@
36 "sample-config-advanced.json"
37 ],
38 "dependencies": {
39 + "@yetzt/nedb": "^1.8.0",
40 + "archiver": "^4.0.2",
41 "body-parser": "^1.19.0",
42 "cbor": "~5.2.0",
43 "compression": "^1.7.4",
44 "cookie-session": "^1.4.0",
45 "express": "^4.17.0",
44 - "express-handlebars": "^3.1.0",
46 + "express-handlebars": "^5.3.5",
47 "express-ws": "^4.0.0",
48 + "image-size": "^1.0.1",
49 "ipcheck": "^0.1.0",
50 + "loadavg-windows": "^1.1.1",
51 "minimist": "^1.2.5",
52 "multiparty": "^4.2.1",
49 - "@yetzt/nedb": "^1.8.0",
53 "node-forge": "^1.0.0",
54 + "node-rdpjs-2": "^0.3.5",
55 + "node-windows": "^0.1.4",
56 + "otplib": "^10.2.3",
57 + "pg": "^8.7.1",
58 + "pgtools": "^0.3.2",
59 + "ssh2": "^1.6.0",
60 + "web-push": "^3.4.5",
61 "ws": "^5.2.3",
52 - "yauzl": "^2.10.0"
62 + "yauzl": "^2.10.0",
63 + "yubikeyotp": "^0.2.0"
64 },
65 "engines": {
66 "node": ">=10.0.0"
views/default.handlebars
+2 -3
@@ -17216,10 +17216,9 @@
17216 }
17217 }
17218
17219 - // Quick fix for #3362 - Request Confirmation if MeshCentral-Browser-Tab is closed. - Maybe needs an option per User or Config.JSON-Setting
17219 + // Request Confirmation if closing while a desktop, terminal session is active
17220 window.addEventListener('beforeunload', function (e) {
17221 - e.preventDefault();
17222 - e.returnValue = '';
17221 + if (((desktop != null) && (xxcurrentView == 11)) || ((terminal != null) && (xxcurrentView = 12))) { e.preventDefault(); e.returnValue = ''; }
17222 });
17223
17224 </script>
views/layouts/empty.handlebars new
+1
@@ -0,0 +1 @@
1 +{{{body}}}
\ No newline at end of file
webserver.js
+1 -1
@@ -5587,7 +5587,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
5587 }
5588
5589 // Setup middleware
5590 - obj.app.engine('handlebars', obj.exphbs({ defaultLayout: null })); // defaultLayout: 'main'
5590 + obj.app.engine('handlebars', obj.exphbs({ defaultLayout: 'empty' }));
5591 obj.app.set('view engine', 'handlebars');
5592 if (obj.args.trustedproxy) {
5593 // Reverse proxy should add the "X-Forwarded-*" headers