Add proper memory store

This commit is contained in:
Tarrgon
2025-05-29 22:55:39 -04:00
parent 5aa37014af
commit 6362aeb886
3 changed files with 48 additions and 359 deletions
+8 -1
View File
@@ -4,6 +4,7 @@ import { config } from '../config';
import { Database } from '../shared/Database';
import crypto from 'crypto';
import session from 'express-session';
import MemoryStore from 'memorystore';
import fs from 'fs';
import path from 'path';
@@ -150,13 +151,19 @@ function render(res: Response, code: number, title: string = '', message: string
export function initializeDiscordJoiner() {
const app = express();
const Store = MemoryStore(session);
app.use(session({
secret: config.DISCORD_CLIENT_SECRET!,
cookie: {
secure: !config.DEV_MODE,
httpOnly: !config.DEV_MODE,
sameSite: false
sameSite: false,
maxAge: 300000
},
store: new Store({
checkPeriod: 600000,
}),
resave: false,
saveUninitialized: false
}));