websockets implemented

This commit is contained in:
Torsten Schulz
2024-12-04 19:08:26 +01:00
parent d46a51db38
commit 069c97fa90
64 changed files with 2488 additions and 562 deletions

View File

@@ -2,8 +2,7 @@ import User from '../models/community/user.js';
import { updateUserTimestamp } from '../utils/redis.js';
export const authenticate = async (req, res, next) => {
const userId = req.headers.userid;
const authCode = req.headers.authcode;
const { userid: userId, authcode: authCode } = req.headers;
if (!userId || !authCode) {
return res.status(401).json({ error: 'Unauthorized: Missing credentials' });
}
@@ -12,7 +11,7 @@ export const authenticate = async (req, res, next) => {
return res.status(401).json({ error: 'Unauthorized: Invalid credentials' });
}
try {
await updateUserTimestamp(userId);
await updateUserTimestamp(user.id);
} catch (error) {
console.error('Fehler beim Aktualisieren des Zeitstempels:', error);
}