Changeset fa08981 in Klonkt for src/routes/audio.js
- Timestamp:
- 06/20/2026 01:52:46 AM (3 months ago)
- Branches:
- main
- Children:
- 8f6225c
- Parents:
- 230e446
- File:
-
- 1 edited
-
src/routes/audio.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/audio.js
r230e446 rfa08981 141 141 }); 142 142 143 // Welke post bevat deze track? (voor de mini-speler → "spring naar de post + 144 // scroll naar de track".) Pakt de nieuwste gepubliceerde post met [[track:<id>]]. 145 router.get('/track/:id/post', (req, res) => { 146 const id = String(req.params.id || ''); 147 if (!/^[A-Za-z0-9_-]+$/.test(id)) return res.status(400).json({ error: 'bad id' }); 148 const isHub = res.locals.tenancy === 'hub'; 149 const row = db.prepare(` 150 SELECT p.slug, s.slug AS site_slug 151 FROM posts p JOIN sites s ON s.id = p.site_id 152 WHERE p.status = 'published' AND p.content LIKE ? 153 ORDER BY p.published_at DESC LIMIT 1 154 `).get('%[[track:' + id + ']]%'); 155 if (!row) return res.status(404).json({ error: 'not found' }); 156 const url = isHub ? `/user/${row.site_slug}/${row.slug}` : `/${row.slug}`; 157 res.json({ url }); 158 }); 159 143 160 export default router;
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)