Block uploads for demo user, restore PDF preview modal (v2.2.3)

- Demo user gets 403 on all upload endpoints (files, photos, cover, avatar)
- Admin uploads still work normally
- PDF export back in modal popup using srcdoc iframe
- Zero behavior change when DEMO_MODE is not set
This commit is contained in:
Maurice
2026-03-19 15:09:20 +01:00
parent 1a5c8cd385
commit c582a7b6c8
7 changed files with 50 additions and 16 deletions
+8 -1
View File
@@ -53,4 +53,11 @@ const adminOnly = (req, res, next) => {
next();
};
module.exports = { authenticate, optionalAuth, adminOnly };
const demoUploadBlock = (req, res, next) => {
if (process.env.DEMO_MODE === 'true' && req.user?.email === 'demo@nomad.app') {
return res.status(403).json({ error: 'Uploads are disabled in demo mode. Self-host NOMAD for full functionality.' });
}
next();
};
module.exports = { authenticate, optionalAuth, adminOnly, demoUploadBlock };