chore(server): add logs to debug missing session

This commit is contained in:
Elian Doran 2025-06-06 09:23:24 +03:00
parent 1a54a17b0d
commit 63a6f00a47
No known key found for this signature in database

View File

@ -64,6 +64,7 @@ function checkAuth(req: Request, res: Response, next: NextFunction) {
// currently, we're doing that for file upload because handling form data seems to be difficult
function checkApiAuthOrElectron(req: Request, res: Response, next: NextFunction) {
if (!req.session.loggedIn && !isElectron && !noAuthentication) {
console.warn(`Missing session with ID '${req.sessionID}'.`);
reject(req, res, "Logged in session not found");
} else {
next();
@ -72,6 +73,7 @@ function checkApiAuthOrElectron(req: Request, res: Response, next: NextFunction)
function checkApiAuth(req: Request, res: Response, next: NextFunction) {
if (!req.session.loggedIn && !noAuthentication) {
console.warn(`Missing session with ID '${req.sessionID}'.`);
reject(req, res, "Logged in session not found");
} else {
next();