Changeset d727e92 in Klonkt for src/views


Ignore:
Timestamp:
06/20/2026 05:37:42 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
a66f691
Parents:
183875b
Message:

feat(audio): tracks without audio (link-only) — list with open-in links, no upload

You can now add a "Track without audio" in Admin → Audio (button) — only
title/artist + the Spotify/YouTube/SoundCloud links, no file. Such tracks
appear in albums & playlists (and standalone track embeds) in the list
with the open-in icons but WITHOUT a play button, and stay outside the
playback queue (which matches on URL). Lookups (posts album/single +
PlaylistService) no longer filter out fileless tracks. New route POST
/admin/audio/create-link. buster audio.css?v=9.

Co-Authored-By: Claude <noreply@…>

Location:
src/views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/admin-audio.ejs

    r183875b rd727e92  
    6262  <%# ── TRACK LIST ─────────────────────────────────────────── %>
    6363  <section class="ax-card">
    64     <div class="ax-card-title">
     64    <div class="ax-card-title" style="display:flex;align-items:center;gap:.5rem">
    6565      Tracks <span class="ax-count"><%= tracks.length %></span>
     66      <button type="button" class="ax-btn ax-btn-secondary" id="add-link-track-btn"
     67              style="margin-left:auto;font-size:.85rem" title="Een track zonder audiobestand — alleen titel + open-in links">
     68        + Track zonder audio
     69      </button>
    6670    </div>
    6771
     
    889893    });
    890894  });
     895
     896  // ── "+ Track zonder audio": maak een link-only stub + open de editor ──
     897  const addLinkBtn = document.getElementById('add-link-track-btn');
     898  if (addLinkBtn) {
     899    addLinkBtn.addEventListener('click', async () => {
     900      addLinkBtn.disabled = true;
     901      try {
     902        const r = await fetch('/admin/audio/create-link', {
     903          method: 'POST', credentials: 'same-origin',
     904          headers: { 'Content-Type': 'application/json' },
     905          body: JSON.stringify({ title: 'Nieuwe track' }),
     906        });
     907        const j = await r.json();
     908        if (!r.ok || !j.ok) throw new Error(j.error || 'Aanmaken mislukt');
     909        if (typeof window.openTrackEditor !== 'function') { location.reload(); return; }
     910        window.openTrackEditor({ id: j.id, onSaved: () => location.reload() });
     911      } catch (err) {
     912        alert('Track aanmaken mislukt: ' + err.message);
     913      } finally {
     914        addLinkBtn.disabled = false;
     915      }
     916    });
     917  }
    891918
    892919  // ── Wire all "Edit" buttons to the track-editor modal ─────────
  • src/views/shell.ejs

    r183875b rd727e92  
    168168     anywhere (admin previews, post embeds, etc). The player itself is
    169169     a singleton — see the script tag near </body>. -->
    170 <link rel="stylesheet" href="/assets/css/audio.css?v=8">
     170<link rel="stylesheet" href="/assets/css/audio.css?v=9">
    171171<!-- Eigen custom media-embeds (YouTube/SoundCloud/Spotify) in huisstijl. -->
    172172<link rel="stylesheet" href="/assets/css/embed.css?v=8">
Note: See TracChangeset for help on using the changeset viewer.