Clean up cookie-session instance.

This commit is contained in:
Ylian Saint-Hilaire 2022-07-11 11:19:04 -07:00
parent 626c490771
commit 4382899468
2 changed files with 3 additions and 5 deletions

View File

@ -19,7 +19,6 @@ module.exports.CreateWebRelayServer = function (parent, db, args, certificates,
obj.parent = parent;
obj.db = db;
obj.express = require('express');
obj.session = require('cookie-session');
obj.expressWs = null;
obj.tlsServer = null;
obj.net = require('net');
@ -74,8 +73,8 @@ module.exports.CreateWebRelayServer = function (parent, db, args, certificates,
secure: (args.tlsoffload == null), // Use this cookie only over TLS (Check this: https://expressjs.com/en/guide/behind-proxies.html)
sameSite: (args.sessionsamesite ? args.sessionsamesite : 'lax')
}
if (args.sessiontime != null) { sessionOptions.maxAge = (args.sessiontime * 60 * 1000); }
obj.app.use(obj.session(sessionOptions));
if (args.sessiontime != null) { sessionOptions.maxAge = (args.sessiontime * 60000); } // sessiontime is minutes
obj.app.use(require('cookie-session')(sessionOptions));
// Add HTTP security headers to all responses
obj.app.use(function (req, res, next) {

View File

@ -40,7 +40,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
obj.tls = require('tls');
obj.path = require('path');
obj.bodyParser = require('body-parser');
obj.session = require('cookie-session');
obj.exphbs = require('express-handlebars');
obj.crypto = require('crypto');
obj.common = require('./common.js');
@ -5773,7 +5772,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
sameSite: (obj.args.sessionsamesite ? obj.args.sessionsamesite : 'lax')
}
if (obj.args.sessiontime != null) { sessionOptions.maxAge = (obj.args.sessiontime * 60000); } // sessiontime is minutes
obj.app.use(obj.session(sessionOptions));
obj.app.use(require('cookie-session')(sessionOptions));
// Handle all incoming web sockets, see if some need to be handled as web relays
obj.app.ws('/*', function (ws, req, next) {