webaccess: Simplify Express and express-session setup

This commit is contained in:
Richard Hansen 2020-10-03 15:21:50 -04:00 committed by John McLear
parent 275e5c31c8
commit b68969fbac
2 changed files with 11 additions and 21 deletions

View file

@ -49,8 +49,8 @@ exports.expressCreateServer = function (hook_name, args, cb) {
// check whether the user has authenticated, then any random person on the Internet can read,
// modify, or create any pad (unless the pad is password protected or an HTTP API session is
// required).
const cookieParserFn = util.promisify(cookieParser(webaccess.secret, {}));
const getSession = util.promisify(args.app.sessionStore.get).bind(args.app.sessionStore);
const cookieParserFn = util.promisify(cookieParser(settings.sessionKey, {}));
const getSession = util.promisify(webaccess.sessionStore.get).bind(webaccess.sessionStore);
io.use(async (socket, next) => {
const req = socket.request;
if (!req.headers.cookie) {