Add Watch Buddies feature
- Created WatchBuddy model - M:N junctions to EntrySeen/EpisodeSeen and Media relation for profile pictures - Full CRUD + search + profile picture upload - WatchBuddySelect multi-select with search and inline create, replaced all seen_with text inputs - WatchBuddiesPage (grid) and WatchBuddyProfilePage (edit form, icon-based contacts, poster-grid watch history, monthly timeline)
This commit is contained in:
1 parent
4313a794ce
commit
e82b905886
28 files changed
+6813
-374
No files matched your search
@@ -1,25 +1,29 @@
|
||||
const jwt = require('jsonwebtoken');
|
||||
const configService = require('../services/configService');
|
||||
const jwt = require("jsonwebtoken");
|
||||
const configService = require("../services/configService");
|
||||
|
||||
function authMiddleware(req, res, next) {
|
||||
// Skip auth for login/verify endpoints
|
||||
if (req.path === '/auth/login' || req.path === '/auth/verify') {
|
||||
// Skip auth for login/verify/media endpoints
|
||||
if (
|
||||
req.path === "/auth/login" ||
|
||||
req.path === "/auth/verify" ||
|
||||
req.path.startsWith("/media/")
|
||||
) {
|
||||
return next();
|
||||
}
|
||||
|
||||
const auth = req.headers.authorization;
|
||||
if (!auth || !auth.startsWith('Bearer ')) {
|
||||
return res.status(401).json({ error: 'Authentication required' });
|
||||
if (!auth || !auth.startsWith("Bearer ")) {
|
||||
return res.status(401).json({ error: "Authentication required" });
|
||||
}
|
||||
|
||||
const settings = configService.getSettings();
|
||||
const jwtSecret = settings.jwtSecret || 'showy-default-secret';
|
||||
const jwtSecret = settings.jwtSecret || "showy-default-secret";
|
||||
|
||||
try {
|
||||
jwt.verify(auth.slice(7), jwtSecret);
|
||||
next();
|
||||
} catch {
|
||||
return res.status(401).json({ error: 'Invalid or expired token' });
|
||||
return res.status(401).json({ error: "Invalid or expired token" });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user