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

@ -1,6 +1,7 @@
/**
* @file Couvre l'application web : route des messages privés (clé, limite, connexions locales),
* /readyz et flux d'événements.
* /readyz, ancienne adresse du jukebox, déplacement dans le morceau en cours et flux
* d'événements.
*/
import test from "node:test";
@ -47,6 +48,8 @@ function fakeClient() {
const fakeQueue = {
snapshot: () => ({ current: null, upcoming: [], status: "idle" }),
// Aucun morceau en cours, sauf quand la position demandée vaut 42.
seek: (seconds) => (seconds === 42 ? { position: 42_000 } : null),
};
async function withServer(options, run) {
@ -198,6 +201,35 @@ test("the events stream sends the queue state, then every update", async () => {
}
});
test("the old jukebox address redirects to the home page", async () => {
await withServer({}, async ({ base }) => {
const get = (path) => fetch(`${base}${path}`, { redirect: "manual" });
const plain = await get("/jukebox/");
assert.equal(plain.status, 301);
assert.equal(plain.headers.get("location"), "/");
assert.equal((await get("/jukebox?login=denied")).headers.get("location"), "/?login=denied");
const home = await get("/");
assert.equal(home.status, 200);
assert.match(await home.text(), /<title>Palico Jukebox<\/title>/);
});
});
test("seeking needs a position in seconds and a track playing", async () => {
await withServer({}, async ({ base }) => {
const seek = (body) =>
fetch(`${base}/api/player/seek`, {
method: "POST",
headers: { authorization: "Bearer web-key", "content-type": "application/json" },
body: JSON.stringify(body),
});
assert.equal((await seek({ position: 42 })).status, 200);
assert.equal((await seek({ position: 10 })).status, 409);
assert.equal((await seek({ position: "42" })).status, 400);
assert.equal((await seek({ position: -1 })).status, 400);
assert.equal((await seek({})).status, 400);
});
});
test("the events stream requires the jukebox key", async () => {
await withServer({}, async ({ base }) => {
assert.equal((await fetch(`${base}/api/events`)).status, 401);