Changeset d727e92 in Klonkt for src/routes/admin-audio.js
- Timestamp:
- 06/20/2026 05:37:42 AM (3 months ago)
- Branches:
- main
- Children:
- a66f691
- Parents:
- 183875b
- File:
-
- 1 edited
-
src/routes/admin-audio.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/admin-audio.js
r183875b rd727e92 394 394 395 395 /** GET /admin/audio/api/:id — single track with all metadata */ 396 // Maak een track ZONDER audiobestand (alleen titel + open-in links). Verschijnt 397 // in albums/playlists in de lijst, met open-in-iconen maar zonder afspeelknop. 398 router.post('/create-link', requireGod, express.json(), (req, res) => { 399 const site = res.locals.site; 400 if (!site) return res.status(404).json({ error: 'Site required' }); 401 const trackId = uuid(); 402 const title = ((req.body && req.body.title) || 'Nieuwe track').toString().trim().slice(0, 200) || 'Nieuwe track'; 403 try { 404 db.prepare(` 405 INSERT INTO audio_tracks (id, site_id, title, media_id, position) 406 VALUES (?, ?, ?, NULL, COALESCE((SELECT MAX(position) + 1 FROM audio_tracks WHERE site_id = ?), 0)) 407 `).run(trackId, site.id, title, site.id); 408 } catch (e) { 409 return res.status(500).json({ error: e.message }); 410 } 411 res.json({ ok: true, id: trackId }); 412 }); 413 396 414 router.get('/api/:id', requireGod, (req, res) => { 397 415 const site = res.locals.site;
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)