1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

All JavaScript code is now 'strict'

This commit is contained in:
Ylian Saint-Hilaire 2018-08-27 12:24:15 -07:00
parent f6b6fe9506
commit 312b937e62
29 changed files with 129 additions and 78 deletions

View file

@ -6,7 +6,7 @@
* @version v0.0.1
*/
"use strict";
'use strict';
/*
class SerialTunnel extends require('stream').Duplex {
@ -153,13 +153,22 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
obj.app.engine('handlebars', obj.exphbs({})); // defaultLayout: 'main'
obj.app.set('view engine', 'handlebars');
obj.app.use(obj.bodyParser.urlencoded({ extended: false }));
obj.app.use(obj.session({
name: 'xid', // Recommanded security practice to not use the default cookie name
httpOnly: true,
keys: [ obj.args.sessionkey ], // If multiple instances of this server are behind a load-balancer, this secret must be the same for all instances
secure: (obj.args.notls != true), // Use this cookie only over TLS
maxAge: (obj.args.sessiontime * 60 * 1000) // 24 hours
}));
if (obj.args.sessiontime != null) {
obj.app.use(obj.session({
name: 'xid', // Recommanded security practice to not use the default cookie name
httpOnly: true,
keys: [obj.args.sessionkey], // If multiple instances of this server are behind a load-balancer, this secret must be the same for all instances
secure: (obj.args.notls != true), // Use this cookie only over TLS
maxAge: (obj.args.sessiontime * 60 * 1000) // Number of minutes
}));
} else {
obj.app.use(obj.session({
name: 'xid', // Recommanded security practice to not use the default cookie name
httpOnly: true,
keys: [obj.args.sessionkey], // If multiple instances of this server are behind a load-balancer, this secret must be the same for all instances
secure: (obj.args.notls != true) // Use this cookie only over TLS
}));
}
// Session-persisted message middleware
obj.app.use(function (req, res, next) {