Commit graph

12 commits

Author SHA1 Message Date
25f22dd363 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>
2026-12-02 12:04:03 +01:00
bda95ca946 Add section images, larger covers and track tags
All checks were successful
Deploy Palico Bot / check (push) Successful in 10s
Deploy Palico Bot / deploy (push) Successful in 6s
Section images:
- A section gets an optional image, set from its new "Modifier" dialog
  (name and image), which replaces "Renommer". It goes through the same
  conversion as track covers and is deleted with its section.
- Track and section uploads share routes/coverUpload.js. The cover
  folder is created again if it went missing, instead of failing.

Larger images: 72 px for tracks (was 48), 96 px for section headers,
160 px in the player and the edit dialog (was 96); smaller on phones.

Tags:
- Library tracks take free tags, edited in the "Modifier" dialog, which
  suggests the tags already in use. Case is ignored ("Épique" and
  "épique" are one tag); at most 15 tags of 30 characters.
- A tag bar above the library filters it, and the "Tout ajouter"
  buttons (global and per section) then only queue its tracks
  (enqueue-all takes a tag). The search also matches tags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 23:11:05 +01:00
793765fb79 Resume interrupted tracks where they stopped
A track cut off without anyone asking (voice connection lost, bot
leaving an empty channel, restart) used to start over from the
beginning; on an hour-long mix, a drop near the end replayed it all.

- The requeued track keeps resumeAt and ffmpeg seeks to it (-ss before
  -i, so it jumps there without decoding the start). It resumes 2 s
  before the cut; a track cut in its first 2 s starts over.
- The player keeps playing without a connection
  (NoSubscriberBehavior.Play), so the position of a voice drop is taken
  when the connection drops, not 5 s later when it is given up.
- The saved queue holds the current position, and it is saved every
  30 s while playing: after a crash the track resumes at most 30 s
  earlier.
- Loop mode replays a resumed track from the beginning; skip and stop
  are unchanged.
- The web page and /queue show "Reprise à 49:15" for such a track, and
  the progress bar counts from the resume point.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 23:11:05 +01:00
11ee972636 Add library sections and track covers
All checks were successful
Deploy Palico Bot / check (push) Successful in 9s
Deploy Palico Bot / deploy (push) Successful in 7s
Sections:
- The library can be split into named, ordered sections, stored in
  storage/runtime/sections.json; each track keeps its sectionId.
- Sections are created, renamed, reordered and deleted from the page
  (/api/library/sections). Deleting one keeps its tracks, without a
  section.
- A section, or the tracks without one, can be queued in one go,
  shuffled or not (enqueue-all takes a sectionId).
- The upload form (file or link) picks the section of a kept track.
- Without any section, the library stays a plain list.

Covers:
- A kept track takes the cover embedded in its file (MP3, FLAC...),
  from the web page or /play garder:. Older tracks are looked at once
  on startup; a track without one keeps cover: null.
- "Renommer" becomes "Modifier": a dialog to change the title, the
  section and the cover (upload with preview, or removal).
- ffmpeg turns covers into JPEGs of at most 512 px, stored in
  storage/covers and deleted with their track. An uploaded image is
  only passed to ffmpeg after its signature is checked (PNG, JPEG,
  WebP, GIF), with that decoder forced, so ffmpeg never guesses the
  format of an unknown file.
- Covers are served under /covers without authentication, since an
  <img> cannot send the key; their random names are only given by the
  API and never change content (one-year cache).
- The current track and the queue show the cover of their library
  track.

Docs: README lists the new data to back up; storage/covers is ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 21:27:49 +01:00
3795ee06cb Add file headers, tidy the stylesheet and document the conventions
Headers:
- Every JavaScript file (sources, front, scripts, tests) starts with a
  /** @file … */ header, in the three levels used by sokko-g: a short
  description for simple files; Utilisé par / Attention / @see for
  shared modules; a full header (context, entry points, callers,
  dependencies, pitfalls) for index.js, the music queue, the web
  server, the storage manager and the jukebox page script.
- No @author, @version or @since: git already knows.
- test/fileHeaders.test.js fails `npm run check` when a header is
  missing or a central file's header is incomplete.

Stylesheet (no visual change, checked by comparing every element's
computed styles in Chromium at 1280, 800 and 400 px, hover included):
- Role header and section comments.
- Transparent shades derive from the colour variables with
  color-mix() instead of copied rgba() values; new tokens for repeated
  values (text, text on accent, accent gradient, white veils, shadow).
- Native nesting for buttons, the live indicator, upload rows and
  home cards; drop the unused .hero__visual--large and redundant rules.
- Utility classes move to the end so they win over components. The
  library list's u-mt-1, which never applied (.list reset it), is
  removed to keep the layout as it was.

Docs: CONTRIBUTING.md describes the language, header and stylesheet
conventions; CLAUDE.md points to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 21:05:59 +01:00
60080df7dc Hide the password login when Discord login is enabled
All checks were successful
Deploy Palico Bot / check (push) Successful in 10s
Deploy Palico Bot / deploy (push) Successful in 7s
The password form only shows up as a fallback when Discord login is
off. A password already saved in a browser is still sent and accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 19:25:12 +01:00
03c410973e Rework the jukebox page: live updates, Discord login, progress, batch uploads
- Follow the queue live through /api/events (read with fetch so the key can
  be sent), reconnect with backoff and reload the state meanwhile; an
  indicator shows whether the page is live.
- Log in with Discord when enabled, the password stays available as a
  fallback; explain failed logins and expired sessions.
- Show a progress bar and durations, the queue length and total time, and a
  hint when the queue waits for listeners.
- Shuffle and loop buttons; search, rename and add the whole library,
  optionally shuffled.
- Upload several files at once with per-file progress (XMLHttpRequest), add
  a direct link, drag and drop files; allow 40 uploads per 15 minutes.
- Style password, URL and search fields, focus rings, and the phone layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 12:21:43 +01:00
d200040691 Lighten the website and make it more accessible
- Serve the hero images as WebP at their display size: 118 KB and 55 KB
  instead of 3.5 MB and 1.4 MB.
- Add a favicon, an apple-touch icon, a description and a theme colour.
- Announce status messages to screen readers and label the move buttons.
- Offer "Se souvenir de moi" to keep the password on the device, and keep
  working when browser storage is unavailable.
- Fix typos in the jukebox introduction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 12:05:57 +01:00
a1cefe6da5 Fix jukebox playback getting stuck and make the web page reflect actions
- Adding a track or someone joining the voice channel now resumes a queue
  suspended because the bot was alone; before, only the Play button did.
- Retry the voice connection with backoff instead of giving up after one
  failed attempt.
- Keep playing when the head of the queue changes while connecting.
- Requeue the interrupted track when the bot leaves an empty channel or
  loses its voice connection.
- Removing the current track no longer answers 404; other bots no longer
  count as listeners.
- Accept uploads whatever MIME type the browser sends (ffprobe validates the
  content) and clean temporary files hourly, sparing queued ones.
- Web page: refresh again after an action instead of reusing a stale
  request, disable buttons while a request runs, show the real start time and
  custom titles, and support drag and drop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 11:59:58 +01:00
6895d20459 Fix deploy and lock down the DM route; add /invitation
All checks were successful
Deploy Palico Bot / deploy (push) Successful in 32s
- Deploy workflow: pin node:24-bookworm; install openssh-client only if missing
- Auth failure limiter counts only 401s (422/404 no longer lock out clients)
- trust proxy configurable (WEB_TRUSTED_PROXIES), never "true"
- DM route: loopback connections only, dedicated NOTIFICATIONS_API_KEY, 503 when unset
- Jukebox: no polling without a key, stop on 401
- /invitation: posts the temporary invite message after checking the link
- Stop tracking storage/library.json; README describes the real deployment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 10:57:22 +01:00
20624a5c9c Harden bot, storage and web API 2026-06-30 17:25:00 +02:00
6d2e379a0c Initial Commit 2026-06-28 22:44:04 +02:00