stream: let listeners download any track still in the cache
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
/download now accepts ?file=<name> to fetch any cached file, not just the current track. History entries carry that filename token (via /history), so the web UI renders each aired track as a download link. A shared serve_attachment helper validates the request (basename-only, real audio file, no hidden/.part files) before streaming it; LRU-evicted tracks return 404. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
453ecd1353
commit
aad3c9d0f7
2 changed files with 54 additions and 19 deletions
|
|
@ -55,7 +55,16 @@
|
|||
.history h2 { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
|
||||
color: #7d768f; margin: 0 0 .4rem; font-weight: 600; }
|
||||
.history ul { list-style: none; margin: 0; padding: 0; }
|
||||
.history li { padding: .45rem 0; border-top: 1px solid rgba(255,255,255,.06); }
|
||||
.history li { border-top: 1px solid rgba(255,255,255,.06); }
|
||||
.history li > :not(a) { padding: .45rem 0; }
|
||||
.history .h-dl {
|
||||
display: flex; align-items: center; gap: .6rem; padding: .45rem 0;
|
||||
text-decoration: none; color: inherit;
|
||||
}
|
||||
.history .h-dl > div { flex: 1; min-width: 0; }
|
||||
.history .h-icon { color: #7d768f; font-size: .95rem; transition: color .15s; }
|
||||
.history .h-dl:hover .h-icon { color: #9b8cff; }
|
||||
.history .h-dl:hover .h-title { color: #fff; }
|
||||
.history .h-title { color: #e8e4f2; font-size: .92rem; }
|
||||
.history .h-artist { color: #8b849c; font-size: .8rem; margin-top: .1rem; }
|
||||
.history .empty { color: #6b6480; font-size: .85rem; padding: .45rem 0; }
|
||||
|
|
@ -142,7 +151,14 @@
|
|||
const t = escapeHtml((m.title || "").trim() || "—");
|
||||
const a = (m.artist || "").trim();
|
||||
const artist = a ? `<div class="h-artist">${escapeHtml(a)}</div>` : "";
|
||||
return `<li><div class="h-title">${t}</div>${artist}</li>`;
|
||||
const meta = `<div class="h-title">${t}</div>${artist}`;
|
||||
// Lien de téléchargement si le fichier est encore dans le cache.
|
||||
const f = (m.file || "").trim();
|
||||
if (f) {
|
||||
const href = "/download?file=" + encodeURIComponent(f);
|
||||
return `<li><a class="h-dl" href="${href}" download>${meta}<span class="h-icon">⬇</span></a></li>`;
|
||||
}
|
||||
return `<li>${meta}</li>`;
|
||||
}).join("");
|
||||
} catch (e) { /* keep last known values */ }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue