Changeset bd7f10d in Klonkt
- Timestamp:
- 06/15/2026 01:18:56 AM (3 months ago)
- Branches:
- main
- Children:
- e6888ca
- Parents:
- f45fc82
- File:
-
- 1 edited
-
src/views/partials/playlist-editor.ejs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/views/partials/playlist-editor.ejs
rf45fc82 rbd7f10d 387 387 <input type="text" id="pli-cover" placeholder="https://… of upload" value="${esc(initial.cover)}" style="flex:1"> 388 388 </div> 389 ${isEdit ? `390 389 <div class="pl-cover-upload-row"> 391 390 <input type="file" id="pli-cover-file" accept="image/jpeg,image/png,image/webp,image/gif" hidden> 392 391 <button type="button" class="pl-btn-small" id="pli-cover-pick">📷 Foto kiezen…</button> 393 392 <span class="pl-cover-status" id="pli-cover-status"></span> 394 </div>` : ` 395 <small class="pl-cover-note">Upload van een afbeelding kan na het aanmaken van de playlist.</small>`} 393 </div> 396 394 </div> 397 395 </div> … … 448 446 }); 449 447 450 // ── Cover file upload ( edit mode only) ────────────────────451 // The upload widget only exists once a playlist has an id to attach to.452 // In create mode the user types/pastes a URL, saves the playlist, then453 // re-opens for upload. The route is the same as for tracks: returns454 // { ok, url, cover_url }.448 // ── Cover file upload (werkt in create ÉN edit) ─────────── 449 // We uploaden naar het generieke image-endpoint (/posts/upload-image, 450 // requireAuth) dat een /media/-URL teruggeeft — dat heeft GEEN playlist-id 451 // nodig, dus uploaden kan ook al vóór het aanmaken. De URL belandt in het 452 // cover-veld en wordt bij 'Aanmaken'/'Opslaan' met de playlist meegestuurd. 455 453 const coverFileInput = $('#pli-cover-file'); 456 454 const coverPickBtn = $('#pli-cover-pick'); … … 470 468 coverStatus.className = 'pl-cover-status'; 471 469 const fd = new FormData(); 472 fd.append(' cover', file);470 fd.append('image', file); 473 471 try { 474 const r = await fetch( 475 `/admin/playlists/api/${encodeURIComponent(opts.id)}/cover`, 472 const r = await fetch('/posts/upload-image', 476 473 { method: 'POST', body: fd, credentials: 'same-origin' } 477 474 ); 478 475 const j = await r.json(); 479 if (!r.ok || !j. ok) throw new Error(j.error || 'Upload mislukt');480 const url = j. cover_url || j.url || '';476 if (!r.ok || !j.url) throw new Error(j.error || 'Upload mislukt'); 477 const url = j.url || ''; 481 478 coverEl.value = url; 482 479 coverThumb.innerHTML = url
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)