Make the jukebox the home page, add seeking and redesign the site
All checks were successful
Deploy Palico Bot / check (push) Successful in 9s
Deploy Palico Bot / deploy (push) Successful in 7s

Seeking: the progress bar is now a slider. Releasing it calls
POST /api/player/seek, which restarts ffmpeg at that position and swaps
the audio resource without going through Idle, so the track is neither
finished nor requeued in loop mode.

Structure: the jukebox is served at / and the old home page is gone.
/jukebox/ redirects to / with its query string, and the Discord login
callback now returns to /.

Redesign: a login screen until the visitor is signed in, then an app
layout with a top bar, the library on the left and the player and queue
on the right (sticky, two columns from 1000 px). Small screens get a
mini player while the main one is out of view. Icon buttons, a single
play/pause button, a drop zone for uploads, toast messages and a
refined violet palette with checked contrast. A refused password now
returns to the login screen instead of leaving an empty page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-12-02 12:04:03 +01:00
parent d14cc414b5
commit 25f22dd363
13 changed files with 1615 additions and 1051 deletions

View file

@ -4,7 +4,7 @@
*
* Contexte : une seule instance, créée par index.js et partagée par les commandes Discord
* (client.musicQueue) et le serveur web.
* Points d'entrée : enqueue, remove, move, skip, stop, start, snapshot ; événements « queueUpdate »
* Points d'entrée : enqueue, remove, move, skip, seek, stop, start, snapshot ; événements « queueUpdate »
* (état de la file, émis ici) et « libraryUpdate » (bibliothèque modifiée, émis par les routes).
* Utilisé par : index.js, /play, /queue, /skip, web/routes/ et music/ingest.js.
* Dépend de : @discordjs/voice, media/validateAudioFile.js (flux Opus),
@ -431,6 +431,24 @@ class MusicQueue extends EventEmitter {
this.emit("queueUpdate", this.snapshot());
}
// Déplace la lecture du morceau en cours à `seconds`, bornée à sa durée connue. Un nouveau flux
// ffmpeg, qui démarre à cette position (resumeAt), remplace l'ancien : le lecteur ne passe pas
// par Idle, le morceau n'est donc ni terminé ni remis en boucle. En pause, la lecture repart.
// Renvoie null sans morceau en cours.
seek(seconds) {
if (!this.currentTrack) return null;
let position = Math.max(0, Math.floor(Number(seconds) || 0));
const duration = Number(this.currentTrack.duration);
if (duration > 0) {
position = Math.min(position, Math.max(0, Math.floor(duration) - 1));
}
const { resumeAt: _resumeAt, ...track } = this.currentTrack;
this.currentTrack = position > 0 ? { ...track, resumeAt: position } : track;
this.audioPlayer.play(this.createResource(this.currentTrack));
this.emit("queueUpdate", this.snapshot());
return this.snapshot();
}
pause() {
this.audioPlayer.pause(true);
}