Commit graph sonda/web/src
Author SHA1 Message Date
tgiachi
4810564aac feat(web): a sidebar that collapses
- A button in the sidebar folds it to a narrow bar with the icon of each page, and opens it again. The choice is remembered in the browser, which may refuse to keep it.
- Every link keeps its name for screen readers and gets a tooltip when only its icon shows.
- On a phone, where the sidebar is a row of links, nothing changes.
2026-11-13 10:10:25 +01:00
tgiachi
17f70d582d feat(smart): smart playlists made for everybody, without making them
- A fixed set that is there with no setup: recently added, never played, most played, not heard for a while, high quality files and long tracks. The rules are the same for everyone and are worked out on each one's own library and history, like the mixes; nothing is stored, so they follow the library.
- GET /smart-playlists/suggested, GET /smart-playlists/suggested/{key}/tracks and POST /smart-playlists/suggested/{key}/playlist.
- The Smart playlists page begins with them, with names and descriptions in the language of the page. A suggested one can be played, shuffled again, kept as a playlist, or made one's own: a copy of its rules opens in the editor.
2026-11-13 10:06:58 +01:00
tgiachi
1ad0d718c8 feat(mixes): a picture for each mix, a collage of album covers
- The server says which albums stand for a mix (album_ids): up to 4 albums that have a cover, by different artists, with most of the songs the mix draws from. The list gives them for every mix and a mix gives its own.
- The Mixes page shows the collage on each card (a 2 by 2 collage with four covers, the first one alone with fewer, the rings with none), and the page of a mix shows it in its header.
- Nothing is fetched for it: a mix has a picture once the covers of its albums were looked up.
2026-11-13 09:58:04 +01:00
tgiachi
a2938f0f96 feat(web): smart playlists
- A Smart playlists page with the ones I made and a way to make a new one.
- A page for a smart playlist: its rules in words, its songs, Play, Shuffle again (for the random order), Save as playlist (keeps what is on screen), Edit and Delete.
- An editor for a new one and for one that exists, with a live preview of the songs the rules give: genres (chips, with the library's genres offered), file format and bitrate, when it was added, listening, taste, length, order and limit. What the editor has no field for (artists, albums, skipped lately, another format) is kept when a playlist is changed.
- Texts in English and Italian, and tests for the list, the page, the editor and the preview.
2026-11-13 09:46:03 +01:00
tgiachi
19fa5ff9ce feat(web): mixes page, shuffle again and save as playlist
- A Mixes link in the sidebar and a page with one card for each mix: the ones made from listening first, then one for each genre.
- A page for a mix: its songs, Play, Shuffle again (the next variant, one at a time) and Save as playlist (keeps the variant on screen, named with the title, with a link to the new playlist).
- Mix names are translated from the kind and the genre, since the server title is always English.
- Texts in English and Italian; tests for the list, the page, shuffle, save and the errors.
2026-11-12 18:36:41 +01:00
tgiachi
94dbf57544 feat(mixes): playlists made for a listener, by listening and by genre
GET /mixes lists the mixes a listener has, GET /mixes/{id}?variant= gives one with its
songs, and POST /mixes/{id}/playlist keeps one as a playlist of their own.

- Genre mixes: one for each genre with at least 30 songs by 4 artists, the genres the
  listener plays most first. Spellings that differ by case or punctuation are one
  genre (jazz+funk, jazz-funk); other and unknown are not genres.
- Made for the listener: Your favourites, Rediscover (liked artists not played for a
  month; both need history) and New to you (songs never played).
- A mix has up to 50 songs, at most 3 by one artist, never two of an artist in a row,
  picked by weighted chance (artist preference, never-played, less if played lately;
  skipped lately and avoided artists are out). The seed is user, mix, day and variant,
  so a mix is steady for a day and another is one variant away.
- Worked out when asked, from the listener's own history and the genre tags; nothing is
  stored and nothing leaves the server.

internal/mixes holds the selection and the service, internal/storage/mixes.go the
queries (SQLite and PostgreSQL). Spec, contract test, README and web types follow;
the web app comes separately.

Closes #95
2026-11-12 17:25:49 +01:00
tgiachi
c0e8874e71 feat(web): playlists
A Playlists page lists the user's playlists and makes a new one. A playlist has its
own page: play it (songs that are not available are skipped), rename it, delete it
after a confirmation, move a song up or down and take one out. Every song of a list
gets an Add to playlist button that opens a window to choose a playlist or make a
new one, and says what it did.

TrackRow keeps the song as one button and takes extra buttons at its end, so the
add button is not inside the button that plays. A long playlist is read whole,
page after page. English and Italian texts, error texts for the new codes.

Closes #92
2026-11-12 17:04:44 +01:00
tgiachi
f900a22904 feat(playlists): a user keeps playlists of tracks
Each user can make playlists: a name (1 to 200 characters), an optional
description and an ordered list of tracks, where a track may appear more than once
(each place has its own item id). The API makes, lists, renames and deletes
playlists, and adds tracks (at the end or at a position), lists them, moves one and
removes one; positions count from 0 without gaps.

A playlist is its owner's alone: somebody else's answers playlist_not_found (404),
as one that does not exist. A track whose files were deleted or moved stays in the
playlist and is listed with available false. Deleting a user deletes their
playlists. Limits: 1,000 playlists per user, 10,000 tracks per playlist, 500 tracks
per request.

Changes of one playlist are serialised by locking its row, so two requests at once
keep the positions unique on PostgreSQL too. Migration 0019, OpenAPI spec, contract
test, README and the web API types follow. The web app comes separately.

Closes #89
2026-11-12 16:55:25 +01:00
tgiachi
2669f6c6dc feat(images): ask again without the disc or edition note of a title
Many titles end with a note taken from the tags: (disc 2), (bonus disc),
(Deluxe Edition), sometimes cut off by a tag that is too short. A release group is
named after the album, not after a disc, so those albums found nothing.

The lookup now asks for the title as it is first and, only when MusicBrainz has no
sure result, once more without the notes at its end (baseTitle). A group in brackets
with none of the words of a note stays part of the title, and a title that would be
left empty is kept. The rule for accepting a result does not change.

On 25 albums of a real library with such notes, 19 found a cover (none before).

Closes #87
2026-11-12 16:35:23 +01:00
tgiachi
12f487f223 feat(images): find the cover of an album that has no MusicBrainz id
The covers asked the Cover Art Archive only for albums whose files carried a
release group id. In a library tagged without MusicBrainz, 3,321 of 3,433 albums
have none, so almost no cover could come from the archive.

An album with no id is now looked up in MusicBrainz by the name of its artist and
its title (musicbrainz.Client.FindReleaseGroup), when the musicbrainz provider is
on too. A result is taken only if MusicBrainz scores it 95 or more and its title
and one name of its artist credit equal the ones asked for after folding case,
accents and punctuation; the first such result wins and anything doubtful is no
cover. The id is used for that request and is not stored on the album.

Artists are still never looked up by name. The MusicBrainz and Cover Art Archive
provider texts, the README and the API spec say what is sent.

On 47 albums sampled from a real library, 23 got a cover (all checked as the right
ones by eye or by exact title and artist); a title like 'Live (disc 2)' finds nothing.

Closes #83
2026-11-12 16:22:02 +01:00
tgiachi
f447a11269 fix(web): wait for the address in the search page test instead of assuming it
The test read the address right after the Artists section appeared, but the address is updated by an effect a moment later. On a busy machine it failed in every full run and passed alone. Closes #80.
2026-11-12 15:41:47 +01:00
tgiachi
82f6e91d7a feat(web): a Jobs section in the admin area
Three cards at /admin/jobs, for admins only; anyone else gets the notice and the server is not asked. The page reads which providers are on to block a job whose provider is off. README says the admin area now covers everything the API offers an admin.
2026-11-12 15:34:33 +01:00
tgiachi
3ca3226e91 feat(web): a card for each bulk job, with what it sends, progress, stop and the last result
Starting asks first and says the job goes through the whole library and what it sends; reading everything again is a separate choice. A job whose providers are off cannot be started and the card says which. The status follows the job while it runs.
2026-11-12 15:33:24 +01:00
tgiachi
c8bad5538b feat(web): hooks for the bulk jobs (covers, artist pictures, descriptions)
One set of hooks for the three jobs: read the status (again and again while it runs, by itself stopping), start (optionally reading everything again) and stop.
2026-11-12 15:31:53 +01:00
tgiachi
f1b99aed0a fix(web): line the volume control up with the other controls in the full-screen player 2026-11-12 15:24:41 +01:00
tgiachi
99d25acd9a feat(web): the volume control in the player bar and the full-screen player
Both places move the same volume. README mentions it.
2026-11-12 15:23:50 +01:00
tgiachi
606845ae72 feat(web): a volume control with a mute button and a slider
The slider shows zero while muted and moving it unmutes; on a phone the slider is hidden, since the device has its own volume, and the button stays.
2026-11-12 15:22:57 +01:00
tgiachi
edab170d3f feat(web): the audio follows the volume and mute of the player
The audio starts at the remembered level and follows every change, also while a track plays; once the engine is gone it is left alone.
2026-11-12 15:22:23 +01:00
tgiachi
394208de75 feat(web): volume and mute in the player state, remembered in the browser
The level is kept while muted so unmuting brings it back, moving it unmutes, pressing mute on silence raises it instead of doing nothing, and a browser that refuses storage just forgets it.
2026-11-12 15:21:41 +01:00
tgiachi
fed1213030 feat(web): a Providers section in the admin area
One card for each provider at /admin/providers, for admins only; anyone else gets the notice and the server is not asked. README says what the admin area covers.
2026-11-12 15:12:23 +01:00
tgiachi
369bd2ec3f feat(web): choose what is sent to Lidarr when an artist is added
Nothing is asked of Lidarr until the admin loads its choices on purpose, which needs its address and a key. A folder Lidarr cannot use is shown and cannot be picked; saving sends all the options at once.
2026-11-12 15:11:20 +01:00
tgiachi
0ddcaff8e1 feat(web): the provider card with the switch, the write-only key, contact, address, test and removing data
Turning a provider on asks first and repeats what it will be sent; one that needs a key or an address cannot be turned on without it and the card says why. The key is never shown or filled in, and is gone from the page once saved; removing it says it also turns the provider off. The confirm dialog is now shared with the users section.
2026-11-12 15:09:54 +01:00
tgiachi
c3edc564f4 feat(web): hooks for the external providers
List them, change one (only the fields given are sent), test a key, remove what a provider gave, and read what Lidarr offers only when asked.
2026-11-12 15:05:42 +01:00
tgiachi
a39c0f7719 fix(web): clear the short-password complaint when the password is changed
Found in a real browser: after the complaint, typing a valid password left it on screen until the next submit. Same in the reset dialog and the add form.
2026-11-12 14:59:37 +01:00
tgiachi
52569a0f8d feat(web): a Users section in the admin area
Opens at /admin/users next to Libraries, for admins only; anyone else gets the notice and the server is not asked. README says what the admin area covers.
2026-11-12 14:58:01 +01:00
tgiachi
9b1594e9f2 feat(web): the user list with its actions and the form to add a user
Give the admin role at once, take it away or delete an account after a question, reset a password in a dialog that forgets it (and ends that person's sessions), and add an account by email. Your own row has no buttons, and the last admin cannot be changed: the page says so.
2026-11-12 14:57:22 +01:00
tgiachi
b190835185 feat(web): hooks for listing, creating, changing and deleting users
Listing, creating, giving or taking the admin role, resetting a password and deleting, each refreshing the list when the list changes.
2026-11-12 14:55:26 +01:00
tgiachi
04526f8576 fix(web): build test users with an email address, so the type check passes
The tests of Discover, the Lidarr button and the admin libraries built a signed-in user with a username, which no longer exists since accounts are identified by email. They passed, but the type check failed on 18 fixtures and so did npm run build. Closes #71.
2026-11-12 14:52:20 +01:00
squidd
0b9d158f2b Merge pull request 'feat(web): admin area with libraries and scanning (F3a)' (#70) from feat/admin-libraries into main 2026-11-12 14:49:29 +01:00
tgiachi
d88710fd73 feat(web): the Admin area with libraries and scanning, and an Admin link for admins
The Admin link is shown only to an admin and /admin opens the libraries. Someone else who opens the address gets a notice and the server is not asked anything. README describes what the admin area covers so far.
2026-11-12 14:44:08 +01:00
tgiachi
3dd85fc230 feat(web): admin layout, library list, add form and scan panel
The admin frame shows its sections only to an admin and asks nothing of the server for anyone else. Libraries can be added, edited (only what changed is sent) and removed after a confirmation that says the music on disk is never touched; a scan can be started for one library or all, optionally reading every file again, and the panel follows it and shows the summary, with the files in unsupported formats standing out.
2026-11-12 14:42:54 +01:00
squidd
7b24f76c46 Merge pull request 'feat(auth): accounts are identified by an email address' (#69) from feat/email-login into main 2026-11-12 14:41:32 +01:00
tgiachi
96ad8b1f62 feat(auth): accounts are identified by an email address
Registration, login and the admin's create-user call take `email` instead of
`username`, and the user object returns `email`. The address is checked for its
shape (a plain address, no display name, at most 254 bytes), trimmed, lowercased
and unique. Sonda sends no mail and does not verify it.

- Migration 0018 renames the users column (and the PostgreSQL index); values are
  kept, so an account made before keeps its plain name and still logs in with it
  (login does not check the shape).
- Error code username_taken becomes email_taken; the JWT claim is now `email`,
  so access tokens issued before the upgrade are refused once and clients refresh.
- OpenAPI spec, README, the web login form (type email), strings (en, it) and
  the generated API types follow.

Closes #65
2026-11-12 14:40:33 +01:00
tgiachi
1f8498f6ea feat(web): hooks for libraries and scanning
List, add, rename or move and remove libraries, start a scan of one or all (reading every file again on request), and follow the scan by reading its status while it runs.
2026-11-12 14:40:22 +01:00
tgiachi
0527a12c87 feat(web): the Lidarr button on the artist page and on Discover cards
The artist page reads what Lidarr has first, so it also works for an artist the library has nothing of. A card does not ask Lidarr anything until an admin sends the artist.
2026-11-12 14:30:29 +01:00
tgiachi
67205ec2e1 feat(web): the Request on Lidarr button, for admins, with a confirmation first
Only an admin gets it. It reads what Lidarr has before showing itself (or, on a list card, not at all), asks before sending, sends one artist once, and explains every outcome in words, including a timeout that rereads the state. The API types are regenerated from the spec, which gained the Lidarr endpoints and providers since they were last built.
2026-11-12 14:29:46 +01:00
tgiachi
9dcb7637e7 feat(web): hooks to read and send an artist to Lidarr
Reading is a status, never an error. Sending is one POST for one artist; when it worked, or Lidarr did not answer in time, what Lidarr has is read again.
2026-11-12 14:28:17 +01:00
tgiachi
44dbc727aa fix(web): no photo lookups for artists you do not have, and stale suggestions after changes
A suggestion for an artist outside the library no longer asks for its photo, since that makes the server look the name up at the providers for every card. Changing a wish or a dismissal marks the kept suggestions old without asking Discover at once. Visible focus on the switch, the tabs and the chip buttons.
2026-11-12 14:17:05 +01:00
tgiachi
edbe212f46 fix(web): clear the artist box after choosing, wrap suggestion cards on phones
Found in a real browser: after choosing a starting artist the box kept its text and claimed nothing matched, the card's buttons squeezed the name on a phone, and the switch knob was almost invisible when off.
2026-11-12 14:15:51 +01:00
tgiachi
0198a6d10b fix(web): say what to do when Discover starts from a listening that is empty
Found against a real server: with the setting on and nothing played, the answer is empty with no seeds. The page now says to play something or pick an artist, instead of a plain 'no suggestions'.
2026-11-12 14:12:57 +01:00
tgiachi
88d3df9f61 feat(web): the Discover page with its three tabs, a sidebar link and a route
The tab is kept in the address (?tab=) and moves with the arrow keys; only the open tab asks the server for its list. README now describes Discover in the web app.
2026-11-12 14:11:27 +01:00
tgiachi
6d03b1b661 feat(web): the wishlist and the not-interested lists
Paged rows with remove, not interested and interested again. An artist links to its page only when it is in the library, since one kept alive only by a mark answers 404. The wishlist can hide the artists you already have.
2026-11-12 14:10:07 +01:00
tgiachi
60349153c0 feat(web): the Suggestions tab of Discover with seeds, taste and clear states
Nothing is asked of Discover until there is an artist the user picked or their listening is allowed. Covers a busy server (Retry-After countdown), Last.fm off or failing, cancelling a slow request when leaving, and no automatic retries. Also adds the starting-artist picker and a taste panel.
2026-11-12 14:09:24 +01:00
tgiachi
71b0b39a07 feat(web): a card for a Discover suggestion with its score explained
Shows the score in percent, the seeds it comes from, a part-by-part explanation (a missing genre is not a zero), and the wishlist and not-interested actions.
2026-11-12 14:06:49 +01:00
tgiachi
3cd0ef7150 feat(web): a switch in Settings for starting Discover from your listening
Turning it on shows a dialog that says the names of the most played artists go to Last.fm. Turning it off asks nothing, and a failed change leaves the switch as it was.
2026-11-12 14:05:49 +01:00
tgiachi
63ed483936 feat(web): data hooks for Discover, the wishlist, dismissed artists, taste and own settings
Suggestions are kept five minutes and cancelled when nobody looks. Wishlist and dismiss change the suggestions at once and go back if the call fails.
2026-11-12 14:04:16 +01:00
tgiachi
54b19d6d4f feat(web): lists in query values, request cancelling and Retry-After in the API client
A list value is sent once per item (seed=1&seed=2). A signal can cancel a request and a cancelled call rejects with AbortError, not as a lost connection. ApiError keeps Retry-After in seconds.
2026-11-12 14:03:11 +01:00
tgiachi
075e000fd8 feat(web): a button for browser full screen
- one button in the player bar and one in the full-screen player puts the whole page in full screen and takes it out
- it follows the browser: Esc and F11 flip it back, a refused request leaves the page as it was
- left out where the browser has no Fullscreen API (for example iPhone Safari)
- English and Italian labels
2026-11-12 12:28:15 +01:00
tgiachi
241c1efc5d feat(web): Neon theme
- colour in the surfaces too: deep indigo ground, saturated violet panels, electric yellow accent
- checked by the same contrast test as the other themes
- README lists six themes
2026-11-12 12:10:36 +01:00
tgiachi
0d5805fd37 feat(web): Dracula theme
- a livelier dark theme: violet ground, hot pink accent
- covered by the same contrast test as the others
- README lists five themes
2026-11-12 12:08:54 +01:00