Simplify moodboard: free images + editable captions

- Remove category/label system, replace with free text captions
- Click image area to upload, caption editable below
- Images uploaded as files to server (same as hero, avoids NocoDB limit)
- Wider cards (160px min), cleaner layout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Etienne Delvarre
2026-05-29 12:55:53 +02:00
parent ea396c7bde
commit 1f0087c73b
2 changed files with 75 additions and 30 deletions
+19
View File
@@ -261,6 +261,25 @@ app.post('/api/hero-upload', requireAuth, (req, res) => {
}
});
// Moodboard image upload
app.post('/api/mood-upload', requireAuth, (req, res) => {
try {
const { dataUrl, index } = req.body;
if (!dataUrl || !dataUrl.startsWith('data:image/')) return res.status(400).json({ error: 'Invalid image' });
const matches = dataUrl.match(/^data:image\/(\w+);base64,(.+)$/);
if (!matches) return res.status(400).json({ error: 'Invalid format' });
const ext = matches[1] === 'jpeg' ? 'jpg' : matches[1];
const buffer = Buffer.from(matches[2], 'base64');
const uploadDir = path.join(__dirname, 'public', 'uploads');
if (!fs.existsSync(uploadDir)) fs.mkdirSync(uploadDir, { recursive: true });
const filename = `mood-${index}.${ext}`;
fs.writeFileSync(path.join(uploadDir, filename), buffer);
res.json({ path: `/uploads/${filename}?t=${Date.now()}` });
} catch (e) {
res.status(500).json({ error: e.message });
}
});
// Auth gate — redirect to login page if not authenticated
app.get('/', (req, res) => {
if (isAuth(req)) {