Changeset 5300652 in Klonkt for src/routes/admin-audio.js
- Timestamp:
- 08/13/2026 01:08:32 PM (4 weeks ago)
- Branches:
- main
- Children:
- 6401681
- Parents:
- a117862
- git-author:
- Robin <roboburr@…> (08/13/2026 12:10:40 PM)
- git-committer:
- Robin <roboburr@…> (08/13/2026 01:08:32 PM)
- File:
-
- 1 edited
-
src/routes/admin-audio.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/admin-audio.js
ra117862 r5300652 414 414 }); 415 415 416 /** 417 * De keuze vastleggen. Alleen een echte MBID komt de kolom in: de naam die we 418 * ernaast bewaren is voor het scherm, de MBID is het enige dat naar buiten gaat. 419 */ 420 router.post('/musicbrainz/link', requireGod, (req, res) => { 421 const site = res.locals.site; 422 if (!site) return res.status(404).end(); 423 const mbid = String(req.body.mbid || '').trim().toLowerCase(); 424 const naam = String(req.body.naam || '').trim().slice(0, 200); 425 const terug = (res.locals.siteUrlBase || '') + '/admin/audio'; 426 if (!MusicBrainz.isMbid(mbid)) return res.redirect(`${terug}?error=` + encodeURIComponent('Geen geldige MusicBrainz-id.')); 427 db.prepare('UPDATE sites SET mb_artist_id = ?, mb_artist_name = ? WHERE id = ?').run(mbid, naam || null, site.id); 428 res.redirect(`${terug}?success=` + encodeURIComponent('Gekoppeld aan MusicBrainz.')); 429 }); 430 431 /** Terugdraaien. Een verkeerde koppeling zet jouw naam onder andermans werk. */ 432 router.post('/musicbrainz/unlink', requireGod, (req, res) => { 433 const site = res.locals.site; 434 if (!site) return res.status(404).end(); 435 db.prepare('UPDATE sites SET mb_artist_id = NULL, mb_artist_name = NULL WHERE id = ?').run(site.id); 436 res.redirect((res.locals.siteUrlBase || '') + '/admin/audio?success=' + encodeURIComponent('Ontkoppeld.')); 437 }); 438 416 439 router.get('/api/albums', requireGod, (req, res) => { 417 440 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)