diff --git a/app.js b/app.js index f4e5300..efac98b 100644 --- a/app.js +++ b/app.js @@ -9,9 +9,12 @@ const path = require('path') const toml = require('toml') const fs = require('fs') const uuid = require('uuid/v4') +const connectSession = require('connect-redis') require('express-async-errors') +const SessionStore = connectSession(session) + const util = require('util') const get = util.promisify(request.get) const post = util.promisify(request.post) @@ -91,9 +94,11 @@ nunjucks.configure('templates', { }) app.use(session({ + key: 'Streamserver Session', secret: config['Streaming']['Secret'], resave: false, saveUninitialized: true, + store: new SessionStore(), cookie: { secure: !dev, maxAge: 2678400000 // 1 month diff --git a/package-lock.json b/package-lock.json index 640d5c2..f0ad916 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1190,6 +1190,11 @@ "xdg-basedir": "^3.0.0" } }, + "connect-redis": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/connect-redis/-/connect-redis-4.0.3.tgz", + "integrity": "sha512-Php0P0ShNfilW6f2d/2v7Q0VAiFeBYsg0bIgu8ST3x26CcQ1JtzV6vxPLUwK0uiq10hQSMR+HzSNhWbcvx6nLg==" + }, "console-browserify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", diff --git a/package.json b/package.json index c656ade..43d0b96 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ }, "dependencies": { "body-parser": "^1.18.3", + "connect-redis": "^4.0.3", "ejs": "^2.6.1", "express": "^4.16.4", "express-async-errors": "^3.1.1",