Add tracks from a direct link and from Discord with /play, /skip, /queue

- Download direct audio links server side (web page and /play), refusing
  internal and special addresses at connection time and after every
  redirect, with size and time limits.
- /play takes an attachment, a direct link or a library track
  (autocomplete), and can keep the file in the library; /skip and /queue
  control and show the shared queue.
- Share one ingest path between uploads, links and Discord attachments.
- Answer 413 instead of 500 when the library is full.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-29 12:13:12 +01:00
parent 98f4d29ac7
commit 39d2b6acfb
14 changed files with 715 additions and 54 deletions

View file

@ -0,0 +1,17 @@
// Durée lisible : 3:07, 1:05:09.
function formatDuration(seconds) {
if (!Number.isFinite(seconds) || seconds < 0) return null;
const total = Math.round(seconds);
const hours = Math.floor(total / 3600);
const minutes = Math.floor((total % 3600) / 60);
const secs = String(total % 60).padStart(2, "0");
return hours > 0 ? `${hours}:${String(minutes).padStart(2, "0")}:${secs}` : `${minutes}:${secs}`;
}
function trackLabel(track) {
const title = track.title || track.originalName || "Sans titre";
const duration = formatDuration(track.duration);
return duration ? `${title} (${duration})` : title;
}
export { formatDuration, trackLabel };