feat(web): new look, part 2: the player with a live spectrogram

- A spectrogram drawn in the browser from the sound being played: the last
  seconds, time running to the right and ending now, low notes at the bottom,
  brighter where there is more energy. Small in the player bar, large in the
  full-screen player. It works the same for a friend's track, since its audio
  comes through this server.
- It is drawn only while something plays and the page is in view, and with
  reduced motion it is redrawn four times a second; where the browser has no
  Web Audio it stays empty and nothing else changes.
- The play button is round, in the colour of this server and in the friend
  colour for a friend's track.
- The bar and the full-screen player show the name of the friend whose server
  a track comes from, and nothing for this server's own music.
This commit is contained in:
tgiachi 2026-11-13 17:17:57 +01:00
commit fdf1ebfabc

View file

@ -343,7 +343,7 @@ Back up the database and `sonda.toml`. Your music stays wherever you keep it.
## Web app
A web client lives in `web/` (React, Vite and shadcn/ui). It talks only to the Sonda server: no CDN, no external fonts, no analytics. With the app built into the binary (`make build`, or the Docker image) `sondad` serves it: open the address of the server, for example `http://127.0.0.1:8080`, and sign in. The page carries a strict Content-Security-Policy (only resources of the server itself, no inline scripts), cannot be framed and sends no referrer, and a link inside the app (`/admin/users`) works when you reload it.
A web client lives in `web/` (React, Vite and shadcn/ui). It talks only to the Sonda server: no CDN, no external fonts, no analytics. With the app built into the binary (`make build`, or the Docker image) `sondad` serves it: open the address of the server, for example `http://127.0.0.1:8080`, and sign in. The page carries a strict Content-Security-Policy (only resources of the server itself, no inline scripts), cannot be framed and sends no referrer, and a link inside the app (`/admin/users`) works when you reload it. The player draws a live spectrogram of what is playing, in the browser, from the sound itself (Web Audio): the last seconds, low notes at the bottom, in the colour of this server or, for a friend's track, in the colour of the friend. It listens to the sound and changes nothing of it, and it is drawn only while something plays.
To work on the interface itself, run the Vite dev server next to a running `sondad` (set `SONDA_URL` to where it listens: the default is `http://127.0.0.1:8080`):