Changeset 91094a4 in Klonkt for src/routes/admin-audio.js
- Timestamp:
- 06/19/2026 01:09:15 AM (3 months ago)
- Branches:
- main
- Children:
- 37edecd
- Parents:
- 2e247e4
- File:
-
- 1 edited
-
src/routes/admin-audio.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/admin-audio.js
r2e247e4 r91094a4 78 78 const rows = db.prepare(` 79 79 SELECT t.id, t.title, t.artist, t.album, t.duration, t.cover_url, 80 t.position, t.created_at, m.filename, m.size, m.mime_type80 t.position, t.created_at, t.downloadable, m.filename, m.size, m.mime_type 81 81 FROM audio_tracks t 82 82 LEFT JOIN media m ON m.id = t.media_id … … 241 241 }); 242 242 }); 243 }); 244 245 // Download-voor-email per track aan/uit (premium #2). Zonder-JS toggle vanaf de 246 // audio-beheerlijst → flip + terug. 247 router.post('/:id/downloadable', requireGod, (req, res) => { 248 const site = res.locals.site; 249 if (!site) return res.status(404).send('Site required'); 250 const row = db.prepare('SELECT downloadable FROM audio_tracks WHERE id = ? AND site_id = ?').get(req.params.id, site.id); 251 if (row) { 252 db.prepare('UPDATE audio_tracks SET downloadable = ? WHERE id = ? AND site_id = ?') 253 .run(row.downloadable ? 0 : 1, req.params.id, site.id); 254 } 255 res.redirect('/admin/audio'); 243 256 }); 244 257 … … 413 426 } 414 427 428 if (Object.prototype.hasOwnProperty.call(body, 'downloadable')) { 429 fields.push('downloadable = ?'); values.push(body.downloadable ? 1 : 0); 430 } 431 415 432 if (fields.length === 0) { 416 433 return res.status(400).json({ error: 'Niks om te updaten' });
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)