Merge pull request 'Brand pass, part two: the app icons and the wording' (#200) from chore/brand-pass-2 into main
30
README.md
|
|
@ -11,9 +11,9 @@ It is a single executable, one database (SQLite by default, PostgreSQL if you pr
|
||||||
- **Accounts.** An account is an email address and a password. The first user to register becomes the admin and registration then closes; admins create the other users. The address only identifies the account: Sonda sends no mail, does not check that the address exists, and keeps it on your server. It is trimmed and lowercased, and unique. Accounts made before addresses were asked for keep the plain name they had as their login. Short-lived access tokens (JWT) plus rotating refresh tokens, so a stolen refresh token is detected.
|
- **Accounts.** An account is an email address and a password. The first user to register becomes the admin and registration then closes; admins create the other users. The address only identifies the account: Sonda sends no mail, does not check that the address exists, and keeps it on your server. It is trimmed and lowercased, and unique. Accounts made before addresses were asked for keep the plain name they had as their login. Short-lived access tokens (JWT) plus rotating refresh tokens, so a stolen refresh token is detected.
|
||||||
- **Libraries.** A library is a name and a folder, managed through the API. Sonda only reads your music folders: it never writes or renames a file, and it deletes one only when an admin asks to remove the extra copy of a song and you turned on `library.allow_delete` (see **Duplicates**), which is off by default.
|
- **Libraries.** A library is a name and a folder, managed through the API. Sonda only reads your music folders: it never writes or renames a file, and it deletes one only when an admin asks to remove the extra copy of a song and you turned on `library.allow_delete` (see **Duplicates**), which is off by default.
|
||||||
- **Scanner.** Reads MP3 and FLAC tags and audio properties with several workers in parallel. Rescans are incremental, renamed files keep their identity, vanished files are flagged (never deleted), and a library whose folder looks empty or unreadable (an unmounted NAS) is left alone instead of being wiped. Audio in other formats (m4a, ogg, opus, wav, wma and similar) is not read yet, but it is counted as `unsupported` in the scan result instead of disappearing silently. NAS housekeeping folders (`@Recycle`, `#recycle`, `@eaDir`, `.@__thumb`, `$RECYCLE.BIN`) are skipped.
|
- **Scanner.** Reads MP3 and FLAC tags and audio properties with several workers in parallel. Rescans are incremental, renamed files keep their identity, vanished files are flagged (never deleted), and a library whose folder looks empty or unreadable (an unmounted NAS) is left alone instead of being wiped. Audio in other formats (m4a, ogg, opus, wav, wma and similar) is not read yet, but it is counted as `unsupported` in the scan result instead of disappearing silently. NAS housekeeping folders (`@Recycle`, `#recycle`, `@eaDir`, `.@__thumb`, `$RECYCLE.BIN`) are skipped.
|
||||||
- **Catalog.** Browse and search artists, albums and tracks, with paging, by library, artist or album. Only tracks you can actually play are listed.
|
- **Catalog.** Browse and search artists, albums and songs, with paging, by library, artist or album. Only songs you can actually play are listed.
|
||||||
- **Duplicates.** `GET /library/duplicates` (admin) lists the songs that are in more than one file: the same set of main artists, the same title and durations within 3 seconds, possibly on different albums. It is worked out from the index, touches no file, and returns no file path. Each group proposes the copy to keep (lossless first, then the higher bitrate, then the bigger file, then the oldest). A background job (`POST /library/duplicates/check`, like the other bulk jobs) reads the files of the groups and keeps their SHA-256, so a group can be called `identical` (byte for byte). `POST /library/duplicates/clean` **deletes the extra copies of one song from the disk**, and it is the one thing Sonda does that writes in your music folders, so it is off until you set `library.allow_delete` (or `SONDA_ALLOW_DELETE=true`) and mount the folders writable. It deletes only when an admin asks, never by itself, and the server checks again at that moment that no scan is running, that the tracks are copies of one song, and that every file is still the one the last scan saw (same size and date, a regular file, not a link, inside its library): so the last copy of a song is never deleted, a file that changed is not deleted, and every file is checked before the first is deleted. The listens and the playlist items of a deleted copy move to the one that stays, so your taste and your playlists are not lost. Folders are never removed, and nothing is sent anywhere. The web app has a Duplicates section in Admin: a table of the copies of each song with the copy to keep already chosen (you can pick another), the check with its progress and a Stop button, **Delete the others** for one song and **Clean all suggestions** for all of them, each after a question that lists the files and the space it frees; with deleting off everything is visible and the delete buttons are disabled.
|
- **Duplicates.** `GET /library/duplicates` (admin) lists the songs that are in more than one file: the same set of main artists, the same title and durations within 3 seconds, possibly on different albums. It is worked out from the index, touches no file, and returns no file path. Each group proposes the copy to keep (lossless first, then the higher bitrate, then the bigger file, then the oldest). A background job (`POST /library/duplicates/check`, like the other bulk jobs) reads the files of the groups and keeps their SHA-256, so a group can be called `identical` (byte for byte). `POST /library/duplicates/clean` **deletes the extra copies of one song from the disk**, and it is the one thing Sonda does that writes in your music folders, so it is off until you set `library.allow_delete` (or `SONDA_ALLOW_DELETE=true`) and mount the folders writable. It deletes only when an admin asks, never by itself, and the server checks again at that moment that no scan is running, that the songs are copies of one song, and that every file is still the one the last scan saw (same size and date, a regular file, not a link, inside its library): so the last copy of a song is never deleted, a file that changed is not deleted, and every file is checked before the first is deleted. The listens and the playlist items of a deleted copy move to the one that stays, so your taste and your playlists are not lost. Folders are never removed, and nothing is sent anywhere. The web app has a Duplicates section in Admin: a table of the copies of each song with the copy to keep already chosen (you can pick another), the check with its progress and a Stop button, **Delete the others** for one song and **Clean all suggestions** for all of them, each after a question that lists the files and the space it frees; with deleting off everything is visible and the delete buttons are disabled.
|
||||||
- **Streaming.** `GET` and `HEAD` with `Range` support, so players can seek. Opening or prefetching a stream does not record a listen. `GET /tracks/{id}/peaks` gives the shape of a track for the seek bar: 120 levels from 0 to 255, how loud it is along its length. The server finds it by decoding the file (MP3 and FLAC, in pure Go: nothing else to install), which takes a few seconds, so the first request starts the work in the background and answers `202` with `Retry-After`; it is done once for each file, worked out again if the size or the date of the file change, and one track at a time, so a NAS is not kept busy. A file that cannot be decoded answers `waveform_unavailable`, and that is remembered too. A friend's track has no shape yet.
|
- **Streaming.** `GET` and `HEAD` with `Range` support, so players can seek. Opening or prefetching a stream does not record a listen. `GET /tracks/{id}/peaks` gives the shape of a song for the seek bar: 120 levels from 0 to 255, how loud it is along its length. The server finds it by decoding the file (MP3 and FLAC, in pure Go: nothing else to install), which takes a few seconds, so the first request starts the work in the background and answers `202` with `Retry-After`; it is done once for each file, worked out again if the size or the date of the file change, and one song at a time, so a NAS is not kept busy. A file that cannot be decoded answers `waveform_unavailable`, and that is remembered too. A friend's song has no shape yet.
|
||||||
- **API documentation.** The full API is described in OpenAPI and browsable with Swagger UI, served by Sonda itself. The UI is embedded in the binary, so opening it contacts no other server.
|
- **API documentation.** The full API is described in OpenAPI and browsable with Swagger UI, served by Sonda itself. The UI is embedded in the binary, so opening it contacts no other server.
|
||||||
- **Listening history.** Clients report explicit `play`, `complete` and `skip` events. An event counts as a listen when it is `complete`, or when it was played for at least 20 seconds (`listening.min_listen_seconds`); the rule is applied when the history is read, so changing it re-reads the past. You can read your own history, with a `counted` flag on every event. It stays in your database and is never sent anywhere.
|
- **Listening history.** Clients report explicit `play`, `complete` and `skip` events. An event counts as a listen when it is `complete`, or when it was played for at least 20 seconds (`listening.min_listen_seconds`); the rule is applied when the history is read, so changing it re-reads the past. You can read your own history, with a `counted` flag on every event. It stays in your database and is never sent anywhere.
|
||||||
- **Your taste.** `GET /me/taste` shows what Sonda has learned from your own listening: the artists you like and the kinds of music (tags) they have in common. A complete listen counts for more than a short one, a skip counts against the artist, and older listens weigh less (they halve every 90 days, `taste.half_life_days`; only the last ten half-lives are read). It is worked out on every request from data already in your database; nothing is sent to any provider.
|
- **Your taste.** `GET /me/taste` shows what Sonda has learned from your own listening: the artists you like and the kinds of music (tags) they have in common. A complete listen counts for more than a short one, a skip counts against the artist, and older listens weigh less (they halve every 90 days, `taste.half_life_days`; only the last ten half-lives are read). It is worked out on every request from data already in your database; nothing is sent to any provider.
|
||||||
|
|
@ -22,19 +22,19 @@ It is a single executable, one database (SQLite by default, PostgreSQL if you pr
|
||||||
- **Artist photos.** `GET /artists/{id}/image` serves a free picture of an artist from Wikimedia Commons, and `GET /artists/{id}/image/credit` says whose it is and under which licence, which you must show next to it. Only free licences are kept (public domain, CC0, CC BY, CC BY-SA): non-commercial, no-derivatives, fair-use and unknown ones are refused, because Sonda stores a copy (`?size=small` is 300 pixels, `large` 1000) in the data folder. With the `commons` provider and the `musicbrainz` one turned on, Sonda follows ids and never a name: the artist's MusicBrainz id, the Wikidata item MusicBrainz links to it, the picture Wikidata names for it, and Commons for its licence. Many artists will have none. Kept for 30 days (a week when there is none) and removed, files included, with the provider's data. To look for the pictures of the whole library in one go, an admin starts a background job like a scan: `POST /library/artist-images` (follow it with `GET /library/artist-images`, stop it with `DELETE /library/artist-images`; `?refresh=true` searches every artist again). It only goes through artists that have a MusicBrainz id, never replaces a picture by a failure, and ends at once, saying so, when a provider it needs is off. See [External providers](#external-providers).
|
- **Artist photos.** `GET /artists/{id}/image` serves a free picture of an artist from Wikimedia Commons, and `GET /artists/{id}/image/credit` says whose it is and under which licence, which you must show next to it. Only free licences are kept (public domain, CC0, CC BY, CC BY-SA): non-commercial, no-derivatives, fair-use and unknown ones are refused, because Sonda stores a copy (`?size=small` is 300 pixels, `large` 1000) in the data folder. With the `commons` provider and the `musicbrainz` one turned on, Sonda follows ids and never a name: the artist's MusicBrainz id, the Wikidata item MusicBrainz links to it, the picture Wikidata names for it, and Commons for its licence. Many artists will have none. Kept for 30 days (a week when there is none) and removed, files included, with the provider's data. To look for the pictures of the whole library in one go, an admin starts a background job like a scan: `POST /library/artist-images` (follow it with `GET /library/artist-images`, stop it with `DELETE /library/artist-images`; `?refresh=true` searches every artist again). It only goes through artists that have a MusicBrainz id, never replaces a picture by a failure, and ends at once, saying so, when a provider it needs is off. See [External providers](#external-providers).
|
||||||
- **Album covers.** `GET /albums/{id}/cover` serves the cover of an album from your own files: the picture embedded in them, or else a `cover`, `folder`, `front`, `album` or `albumart` image in the album's folder. It is built the first time it is asked for (a few at a time), scaled (`?size=small` is 300 pixels, `large` 1000) and kept in the data folder (`storage.data_dir`, you can delete it: covers are built again). A picture you replace in a folder is noticed within a week, or at once after a full rescan. When your files have no picture at all and an admin turned on the `coverartarchive` provider, the cover is asked from the Cover Art Archive by the MusicBrainz release group id that the tags of the album's files carry (`MUSICBRAINZ_RELEASEGROUPID`; run a full rescan to read it for music you already indexed); your own files always come first, and only that id leaves the server. An album whose files have no id is looked up in MusicBrainz by its artist and title when the `musicbrainz` provider is on too (see the list of what leaves your server). For an album split in `CD1`/`Disc 2` folders, the picture in the folder above is used. Nothing is sent anywhere unless you turned on the `coverartarchive` provider (see [External providers](#external-providers)). It also takes `?access_token=`, so an `<img>` element can use it. To build the covers of the whole library in one go instead of one album at a time, an admin starts a background job like a scan: `POST /library/covers` (follow it with `GET /library/covers`, stop it with `DELETE /library/covers`; `?refresh=true` searches every album again; it never replaces a cover by "no cover" because a disk was not mounted, and keeps the covers that came from the archive if you switched it off).
|
- **Album covers.** `GET /albums/{id}/cover` serves the cover of an album from your own files: the picture embedded in them, or else a `cover`, `folder`, `front`, `album` or `albumart` image in the album's folder. It is built the first time it is asked for (a few at a time), scaled (`?size=small` is 300 pixels, `large` 1000) and kept in the data folder (`storage.data_dir`, you can delete it: covers are built again). A picture you replace in a folder is noticed within a week, or at once after a full rescan. When your files have no picture at all and an admin turned on the `coverartarchive` provider, the cover is asked from the Cover Art Archive by the MusicBrainz release group id that the tags of the album's files carry (`MUSICBRAINZ_RELEASEGROUPID`; run a full rescan to read it for music you already indexed); your own files always come first, and only that id leaves the server. An album whose files have no id is looked up in MusicBrainz by its artist and title when the `musicbrainz` provider is on too (see the list of what leaves your server). For an album split in `CD1`/`Disc 2` folders, the picture in the folder above is used. Nothing is sent anywhere unless you turned on the `coverartarchive` provider (see [External providers](#external-providers)). It also takes `?access_token=`, so an `<img>` element can use it. To build the covers of the whole library in one go instead of one album at a time, an admin starts a background job like a scan: `POST /library/covers` (follow it with `GET /library/covers`, stop it with `DELETE /library/covers`; `?refresh=true` searches every album again; it never replaces a cover by "no cover" because a disk was not mounted, and keeps the covers that came from the archive if you switched it off).
|
||||||
- **Mixes.** `GET /mixes` lists playlists that Sonda makes for you, like the mixes of a streaming service, from what you listen to and from the genres of your music: one mix for each genre of your library that has at least 30 songs by 4 artists (the genres you play most first), and, once you have some listening history, *Your favourites* and *Rediscover* (artists you like and have not played for a month); *New to you* is the songs you never played. `GET /mixes/{id}` gives a mix of up to 50 songs, at most 3 by one artist and never two of the same artist in a row. They are picked by weighted chance: the artists you play weigh more and songs you skipped lately or artists you avoid are left out. A mix stays the same for a day, and `?variant=2` gives another; `POST /mixes/{id}/playlist` keeps the one you are looking at as a playlist of your own. A mix is worked out when you ask for it, from your own history and the genre tags of your files: nothing is stored and nothing is sent to a provider. The id of a genre mix has the genre in it (`genre:hard rock`), so it is percent-encoded in the path. Each mix says which albums stand for it (`album_ids`: up to 4 albums that have a cover, by different artists, with most of the songs the mix draws from), for a picture made of their covers; the covers are the ones the library already has, so a mix has a picture once the covers of its albums were looked up (browsing the albums, or the covers job), and none is fetched for it.
|
- **Mixes.** `GET /mixes` lists playlists that Sonda makes for you, like the mixes of a streaming service, from what you listen to and from the genres of your music: one mix for each genre of your library that has at least 30 songs by 4 artists (the genres you play most first), and, once you have some listening history, *Your favourites* and *Rediscover* (artists you like and have not played for a month); *New to you* is the songs you never played. `GET /mixes/{id}` gives a mix of up to 50 songs, at most 3 by one artist and never two of the same artist in a row. They are picked by weighted chance: the artists you play weigh more and songs you skipped lately or artists you avoid are left out. A mix stays the same for a day, and `?variant=2` gives another; `POST /mixes/{id}/playlist` keeps the one you are looking at as a playlist of your own. A mix is worked out when you ask for it, from your own history and the genre tags of your files: nothing is stored and nothing is sent to a provider. The id of a genre mix has the genre in it (`genre:hard rock`), so it is percent-encoded in the path. Each mix says which albums stand for it (`album_ids`: up to 4 albums that have a cover, by different artists, with most of the songs the mix draws from), for a picture made of their covers; the covers are the ones the library already has, so a mix has a picture once the covers of its albums were looked up (browsing the albums, or the covers job), and none is fetched for it.
|
||||||
- **ReplayGain.** The scan reads the ReplayGain tags of each file (`REPLAYGAIN_TRACK_GAIN`, `REPLAYGAIN_ALBUM_GAIN` and the two peaks), offline, and keeps them on the file; a tag that makes no sense (not a number, more than 60 dB) is left out. A track in the API has them as `replay_gain` (gains in decibels, peaks as a fraction of full scale), or `null` when its first playable file says nothing; the files indexed before this existed have none until a full rescan (`POST /library/scan?full=true`) reads their tags again. The server never changes a file or the sound: a client uses the numbers to play every song at a similar volume, as the web app does (see [Web app](#web-app)).
|
- **ReplayGain.** The scan reads the ReplayGain tags of each file (`REPLAYGAIN_TRACK_GAIN`, `REPLAYGAIN_ALBUM_GAIN` and the two peaks), offline, and keeps them on the file; a tag that makes no sense (not a number, more than 60 dB) is left out. A song in the API has them as `replay_gain` (gains in decibels, peaks as a fraction of full scale), or `null` when its first playable file says nothing; the files indexed before this existed have none until a full rescan (`POST /library/scan?full=true`) reads their tags again. The server never changes a file or the sound: a client uses the numbers to play every song at a similar volume, as the web app does (see [Web app](#web-app)).
|
||||||
- **Smart playlists.** A smart playlist is a set of rules instead of a list of songs, worked out again every time you open it, so new songs and your listening change it by themselves. `POST /smart-playlists` keeps a name, the rules, an order (`random`, `most_played`, `least_played`, `recently_added` or `title`) and a limit (50 by default, 500 at most); `GET /smart-playlists/{id}/tracks` gives the songs now. Every rule that is set must hold: genres, artists and albums (is, or is not), file formats and a minimum bitrate (about the same file), added in the last N days (by the date of the file), never played, played or not played in the last N days, played at least N times (optionally counting only the plays of the last N days, which is what makes the songs in rotation lately and the top of the year), skipped or not skipped lately, only artists you like or without the ones you avoid, the length of the song, and the year it came out (`min_year` and `max_year`, both included: 1980 to 1989 is the eighties). The year comes from the tags of the file (the original date first, then the date); a song with no year never matches a year rule, and the files indexed before this existed have none until a full rescan (`POST /library/scan?full=true`) reads their tags again. `POST /smart-playlists/preview` tries rules without keeping them, and `POST /smart-playlists/{id}/playlist` keeps what you see as a normal playlist (a copy). Only the rules are stored; the songs come from the files and from your own history, nothing is sent to a provider, and a smart playlist is yours alone, and `GET /genres` lists the genres to choose from. A random order stays the same for a day, and `?variant=2` gives another. `GET /smart-playlists/{id}/covers` and `GET /smart-playlists/suggested/{key}/covers` say which albums stand for one (up to 4 that have a cover, in the order of the songs it gives now), for its picture; they are apart from the songs so that the list of smart playlists shows at once and each card fills in its cover when it arrives. Some are there without anybody making them: `GET /smart-playlists/suggested` lists a fixed set (`recently-added`, `on-rotation`, `top-year`, `most-played`, `never-played`, `forgotten`, `high-quality`, `long-tracks`), the same rules for everyone and worked out on your own library and history, nothing stored; `GET /smart-playlists/suggested/{key}/tracks` gives their songs and `POST /smart-playlists/suggested/{key}/playlist` keeps them as a playlist, and `on-rotation` is the songs you played most in the last 30 days and `top-year` the same over a year, so they change as you listen; a copy of their rules becomes a smart playlist of your own with `POST /smart-playlists`. A user can have 200.
|
- **Smart playlists.** A smart playlist is a set of rules instead of a list of songs, worked out again every time you open it, so new songs and your listening change it by themselves. `POST /smart-playlists` keeps a name, the rules, an order (`random`, `most_played`, `least_played`, `recently_added` or `title`) and a limit (50 by default, 500 at most); `GET /smart-playlists/{id}/tracks` gives the songs now. Every rule that is set must hold: genres, artists and albums (is, or is not), file formats and a minimum bitrate (about the same file), added in the last N days (by the date of the file), never played, played or not played in the last N days, played at least N times (optionally counting only the plays of the last N days, which is what makes the songs in rotation lately and the top of the year), skipped or not skipped lately, only artists you like or without the ones you avoid, the length of the song, and the year it came out (`min_year` and `max_year`, both included: 1980 to 1989 is the eighties). The year comes from the tags of the file (the original date first, then the date); a song with no year never matches a year rule, and the files indexed before this existed have none until a full rescan (`POST /library/scan?full=true`) reads their tags again. `POST /smart-playlists/preview` tries rules without keeping them, and `POST /smart-playlists/{id}/playlist` keeps what you see as a normal playlist (a copy). Only the rules are stored; the songs come from the files and from your own history, nothing is sent to a provider, and a smart playlist is yours alone, and `GET /genres` lists the genres to choose from. A random order stays the same for a day, and `?variant=2` gives another. `GET /smart-playlists/{id}/covers` and `GET /smart-playlists/suggested/{key}/covers` say which albums stand for one (up to 4 that have a cover, in the order of the songs it gives now), for its picture; they are apart from the songs so that the list of smart playlists shows at once and each card fills in its cover when it arrives. Some are there without anybody making them: `GET /smart-playlists/suggested` lists a fixed set (`recently-added`, `on-rotation`, `top-year`, `most-played`, `never-played`, `forgotten`, `high-quality`, `long-tracks`), the same rules for everyone and worked out on your own library and history, nothing stored; `GET /smart-playlists/suggested/{key}/tracks` gives their songs and `POST /smart-playlists/suggested/{key}/playlist` keeps them as a playlist, and `on-rotation` is the songs you played most in the last 30 days and `top-year` the same over a year, so they change as you listen; a copy of their rules becomes a smart playlist of your own with `POST /smart-playlists`. A user can have 200.
|
||||||
- **Playlists.** `POST /playlists` makes a playlist (a name and an optional description) and `GET /playlists` lists yours, the one changed last first. `POST /playlists/{id}/tracks` adds 1 to 500 tracks at the end or at a `position`, `GET /playlists/{id}/tracks` lists them in order, `PATCH /playlists/{id}/tracks/{item}` moves one and `DELETE` takes one out; `PATCH /playlists/{id}` renames and `DELETE /playlists/{id}` deletes (the tracks stay in the library). A track can be in a playlist more than once, which is why each place has its own item id. A playlist is yours alone: someone else's answers `playlist_not_found`, as one that does not exist. A track whose files were deleted or moved away stays in the playlist and shows `available: false`; it plays again when the files come back and a scan finds them. Each playlist says which albums stand for it (`album_ids`: up to 4 albums that have a cover, in the order they first appear in it, each once), for a picture made of their covers; nothing is fetched for it. A user can have 1000 playlists of up to 10000 tracks. Nothing is shared and nothing leaves your server.
|
- **Playlists.** `POST /playlists` makes a playlist (a name and an optional description) and `GET /playlists` lists yours, the one changed last first. `POST /playlists/{id}/tracks` adds 1 to 500 songs at the end or at a `position`, `GET /playlists/{id}/tracks` lists them in order, `PATCH /playlists/{id}/tracks/{item}` moves one and `DELETE` takes one out; `PATCH /playlists/{id}` renames and `DELETE /playlists/{id}` deletes (the songs stay in the library). A song can be in a playlist more than once, which is why each place has its own item id. A playlist is yours alone: someone else's answers `playlist_not_found`, as one that does not exist. A song whose files were deleted or moved away stays in the playlist and shows `available: false`; it plays again when the files come back and a scan finds them. Each playlist says which albums stand for it (`album_ids`: up to 4 albums that have a cover, in the order they first appear in it, each once), for a picture made of their covers; nothing is fetched for it. A user can have 1000 playlists of up to 10000 songs. Nothing is shared and nothing leaves your server.
|
||||||
- **Wishlist and "not interested".** `PUT /wishlist/{artist}` puts an artist on your wishlist (`GET /wishlist` lists it, `DELETE` takes it off), and `POST /discover/{artist}/dismiss` hides an artist from your Discover for good (`DELETE` brings it back, `GET /discover/dismissed` lists them). An artist is wished or dismissed, never both, and both lists are yours alone. Discover marks the wished artists it shows (`wishlisted`) and never suggests a dismissed one. The wishlist is a list for you and sends nothing anywhere; Sonda downloads nothing, but an admin can send an artist that Discover showed to their own Lidarr (see [External providers](#external-providers)), which works for an artist that has a MusicBrainz id and that Sonda knows of from a list or from your files. An artist that only Last.fm named is kept while you have it marked (your lists still show it, but other users cannot see that it exists), and goes with the rest of Last.fm's data if an admin removes Last.fm's data. Removing MusicBrainz's data does not touch it.
|
- **Wishlist and "not interested".** `PUT /wishlist/{artist}` puts an artist on your wishlist (`GET /wishlist` lists it, `DELETE` takes it off), and `POST /discover/{artist}/dismiss` hides an artist from your Discover for good (`DELETE` brings it back, `GET /discover/dismissed` lists them). An artist is wished or dismissed, never both, and both lists are yours alone. Discover marks the wished artists it shows (`wishlisted`) and never suggests a dismissed one. The wishlist is a list for you and sends nothing anywhere; Sonda downloads nothing, but an admin can send an artist that Discover showed to their own Lidarr (see [External providers](#external-providers)), which works for an artist that has a MusicBrainz id and that Sonda knows of from a list or from your files. An artist that only Last.fm named is kept while you have it marked (your lists still show it, but other users cannot see that it exists), and goes with the rest of Last.fm's data if an admin removes Last.fm's data. Removing MusicBrainz's data does not touch it.
|
||||||
- **Your own settings.** `GET` and `PATCH /me/settings` hold choices that belong to you, not to the server. Everyone starts private: `discover_from_listening` is off, so this setting never sends your listening to a provider. When you turn it on, Discover may start from the artists you listen to most, and their names are sent to Last.fm (only if an admin switched it on). What Last.fm answers is kept in the shared database like any other lookup, so another local user can see, from `retrieved_at` of `GET /artists/{id}/similar`, that someone looked up an artist, but not who.
|
- **Your own settings.** `GET` and `PATCH /me/settings` hold choices that belong to you, not to the server. Everyone starts private: `discover_from_listening` is off, so this setting never sends your listening to a provider. When you turn it on, Discover may start from the artists you listen to most, and their names are sent to Last.fm (only if an admin switched it on). What Last.fm answers is kept in the shared database like any other lookup, so another local user can see, from `retrieved_at` of `GET /artists/{id}/similar`, that someone looked up an artist, but not who.
|
||||||
- **Importing from Spotify.** `POST /me/import/spotify` brings your listening history and your playlists from a Spotify data export into your own account. Ask Spotify for your data (Account, Privacy, "Extended streaming history" and "Account data") and send what it gives, as a multipart form with a `files` field for each file: the zip itself, or the JSON files in it (`Streaming_History_Audio_*.json`, the older `StreamingHistory_music_*.json` and `Playlist*.json`); a request may be up to 512 MB, and the rest of the export (the account, the searches, the library) is never opened. It all happens on your server and nothing is sent anywhere; the files are read from the request and not kept, and of each play only the song, the artist, the album, the time and how it ended are read, never the IP addresses, the country or the platform in the file. Of a play of a song you do not have that counts as listened, the name of the artist and the time are kept (and nothing else), so that Sonda can learn which artists you play together. A play is matched to a song of your library by artist and title (case, accents and punctuation do not matter, a `Remastered` note on either side does not, any credited artist will do, and a play of a compilation is matched by its album when Spotify says `Various Artists`). A match is recorded as a listen at the time of the play: `complete` when it ran to its end (or nine tenths were played), `skip` when Spotify says it was skipped or it lasted less than a listen, `play` otherwise; nothing is posted to Mastodon. Importing the same files again records nothing twice, and the same play in the extended and in the older history is one. A playlist becomes a playlist of yours with the songs that were found, in order; one whose name you already have is left alone, and one with none of its songs in your library is not made. The report counts what was added, what was already there and what is not in your library (and lists those artists, most played first), so you can see what is missing. One import of yours runs at a time. The report is kept: `GET /me/import/spotify` lists your past imports, newest first, with the numbers of each (never the files). The web app has an Import page for the form and for those numbers.
|
- **Importing from Spotify.** `POST /me/import/spotify` brings your listening history and your playlists from a Spotify data export into your own account. Ask Spotify for your data (Account, Privacy, "Extended streaming history" and "Account data") and send what it gives, as a multipart form with a `files` field for each file: the zip itself, or the JSON files in it (`Streaming_History_Audio_*.json`, the older `StreamingHistory_music_*.json` and `Playlist*.json`); a request may be up to 512 MB, and the rest of the export (the account, the searches, the library) is never opened. It all happens on your server and nothing is sent anywhere; the files are read from the request and not kept, and of each play only the song, the artist, the album, the time and how it ended are read, never the IP addresses, the country or the platform in the file. Of a play of a song you do not have that counts as listened, the name of the artist and the time are kept (and nothing else), so that Sonda can learn which artists you play together. A play is matched to a song of your library by artist and title (case, accents and punctuation do not matter, a `Remastered` note on either side does not, any credited artist will do, and a play of a compilation is matched by its album when Spotify says `Various Artists`). A match is recorded as a listen at the time of the play: `complete` when it ran to its end (or nine tenths were played), `skip` when Spotify says it was skipped or it lasted less than a listen, `play` otherwise; nothing is posted to Mastodon. Importing the same files again records nothing twice, and the same play in the extended and in the older history is one. A playlist becomes a playlist of yours with the songs that were found, in order; one whose name you already have is left alone, and one with none of its songs in your library is not made. The report counts what was added, what was already there and what is not in your library (and lists those artists, most played first), so you can see what is missing. One import of yours runs at a time. The report is kept: `GET /me/import/spotify` lists your past imports, newest first, with the numbers of each (never the files). The web app has an Import page for the form and for those numbers.
|
||||||
- **Suggestions from your own listening.** `GET /me/suggestions` learns which artists you play together: your history is split into sittings (plays less than 30 minutes apart) and two artists that turn up in the same sitting often are linked (a cosine over the sittings of each). It is a count over your own data, built on your server in a moment and again when plays are added, with no provider and nothing sent anywhere; it needs `discover_from_listening` in `PATCH /me/settings`. The model reads your listening events and the plays of artists you have no music of that an import kept (the artist and the time only). `library` are artists you have that go with what you play and that you did not play for two months; `missing` are artists you played at least three times and have no music of, the ones you play most that also go with what you play now first. Each says which of your artists it goes with. `POST /me/suggestions/wishlist` puts an artist you played on your wishlist by name (it is made without music and without a MusicBrainz id: Sonda never looks one up by name, so it cannot be sent to Lidarr from here). The web app has a "From your listening" tab in Discover.
|
- **Suggestions from your own listening.** `GET /me/suggestions` learns which artists you play together: your history is split into sittings (plays less than 30 minutes apart) and two artists that turn up in the same sitting often are linked (a cosine over the sittings of each). It is a count over your own data, built on your server in a moment and again when plays are added, with no provider and nothing sent anywhere; it needs `discover_from_listening` in `PATCH /me/settings`. The model reads your listening events and the plays of artists you have no music of that an import kept (the artist and the time only). `library` are artists you have that go with what you play and that you did not play for two months; `missing` are artists you played at least three times and have no music of, the ones you play most that also go with what you play now first. Each says which of your artists it goes with. `POST /me/suggestions/wishlist` puts an artist you played on your wishlist by name (it is made without music and without a MusicBrainz id: Sonda never looks one up by name, so it cannot be sent to Lidarr from here). The web app has a "From your listening" tab in Discover.
|
||||||
- **Listening history by year and month.** `GET /listens/months` says how many listens that count you made in each calendar month, newest first, in the time zone you send as `tz` (UTC without it), and `GET /listens` takes `from` and `until` to read the listens of one of them; each listen now names its artists. The web app has a History page: a button for each year, the months of the year as bars, and the listens of the month a day at a time.
|
- **Listening history by year and month.** `GET /listens/months` says how many listens that count you made in each calendar month, newest first, in the time zone you send as `tz` (UTC without it), and `GET /listens` takes `from` and `until` to read the listens of one of them; each listen now names its artists. The web app has a History page: a button for each year, the months of the year as bars, and the listens of the month a day at a time.
|
||||||
- **Requests to Lidarr.** `GET /lidarr/requests` (admin) lists the artists you sent to your Lidarr with `POST /artists/{id}/lidarr`, newest first, and says for each whether its music has arrived: `waiting` while there is none in the library, `arrived` once a scan found some (by the artist you sent or by an artist of the same name; the day it was first noticed is kept). Sending an artist again keeps one request with the first date; only what you sent from Sonda is listed. The web app has a Requests page (admins only), with the waiting and the arrived artists apart.
|
- **Requests to Lidarr.** `GET /lidarr/requests` (admin) lists the artists you sent to your Lidarr with `POST /artists/{id}/lidarr`, newest first, and says for each whether its music has arrived: `waiting` while there is none in the library, `arrived` once a scan found some (by the artist you sent or by an artist of the same name; the day it was first noticed is kept). Sending an artist again keeps one request with the first date; only what you sent from Sonda is listed. The web app has a Requests page (admins only), with the waiting and the arrived artists apart.
|
||||||
- **Sharing on Mastodon.** `PUT /me/mastodon` connects your own Mastodon account (the address of your instance and an access token that can only write posts); `GET` shows which account is connected and `DELETE` forgets it and the token. Nothing is connected by default. Once it is, each track of this server that counts as a listen is posted to your account as an unlisted status with the title, artists, album and `#NowPlaying`, and no link: at most one post a minute, never music of a friend. The token stays on the server and is never sent back. If the instance refuses the token on a post (it was revoked or expired), `GET /me/mastodon` says `problem: token_refused`, Settings shows it, and nothing is posted until you connect again with a new token. The address of the instance must be a domain name on https, and the server never connects to a private, loopback or link-local address for it, never follows a redirect and ignores proxy settings.
|
- **Sharing on Mastodon.** `PUT /me/mastodon` connects your own Mastodon account (the address of your instance and an access token that can only write posts); `GET` shows which account is connected and `DELETE` forgets it and the token. Nothing is connected by default. Once it is, each song of this server that counts as a listen is posted to your account as an unlisted status with the title, artists, album and `#NowPlaying`, and no link: at most one post a minute, never music of a friend. The token stays on the server and is never sent back. If the instance refuses the token on a post (it was revoked or expired), `GET /me/mastodon` says `problem: token_refused`, Settings shows it, and nothing is posted until you connect again with a new token. The address of the instance must be a domain name on https, and the server never connects to a private, loopback or link-local address for it, never follows a redirect and ignores proxy settings.
|
||||||
- **Tags.** `GET /artists/{id}/tags` shows what Last.fm and MusicBrainz say kind of music an artist plays, each with its own weights, and the genres of the artist's own files, read offline. See [External providers](#external-providers).
|
- **Tags.** `GET /artists/{id}/tags` shows what Last.fm and MusicBrainz say kind of music an artist plays, each with its own weights, and the genres of the artist's own files, read offline. See [External providers](#external-providers).
|
||||||
- **Similar artists.** With Last.fm turned on, `GET /artists/{id}/similar` lists artists similar to an artist, and says which of them you already have. See [External providers](#external-providers). Without it, Sonda makes no outbound network requests at all.
|
- **Similar artists.** With Last.fm turned on, `GET /artists/{id}/similar` lists artists similar to an artist, and says which of them you already have. See [External providers](#external-providers). Without it, Sonda makes no outbound network requests at all.
|
||||||
- **Friends (federation).** Two Sonda servers can become friends, and the listeners of one can read what the other chose to share. `PUT /federation` (admin) turns federation on, which is off by default, and gives this server a name and a public address (`https`; plain `http` only on a network of your own); the server then makes its own Ed25519 key, kept in the database and never returned. `POST /federation/invites` makes an invite that works once and expires in 24 hours (only a hash of its code is kept). The other admin uses it with `POST /federation/friends`: that server is asked to accept this one, the key it answers with must be the one named in the invite, and the friend waits as `outgoing` until the first admin approves it with `POST /federation/friends/{id}/approve` (`POST /federation/friends/{id}/check` lets the waiting side find out). Either side can remove a friend with `DELETE /federation/friends/{id}`. Nothing is shared until an admin turns on `shared` for a library (`PATCH /libraries/{id}`). A friend's server then reads, with requests signed by its key (the method, the path and query, a date, a nonce and the hash of the body), the routes under `/peer`: the artists, albums and tracks that have a file in a shared library, their covers once they are built, and the audio itself with `Range`. A friend never sees a path, a library id, a listen, a taste or a user, never makes this server build a cover or ask a provider, and has a few streams at a time and a number of KiB a second to share (`max_streams`, `max_kib_per_sec`); the admin sees the last requests it made (`GET /federation/requests`, the route and the size, never what was searched for). Sharing a library lets friends play it and, in practice, copy its files. A listener browses the music of a friend with `GET /friends` (the names of the friends whose friendship both admins agreed to, never an address or a key) and `GET /friends/{friend}/artists`, `albums` and `tracks` with `q`, `limit` and `offset`, and one item at a time: this server asks the friend with a signed request, checks the shape of the answer and passes it on, and nothing is kept; the ids are the friend's own. A friend that cannot be reached or no longer takes this server for a friend is told in words. The web app has a Friends section for it, shown only when there is a friend to browse. A listener plays it with `GET /friends/{friend}/tracks/{id}/stream` and sees its covers with `GET /friends/{friend}/albums/{id}/cover`, which accept the access token in the query like the local ones: this server asks the friend with a signed request, forwards `Range` and the conditional headers, and passes on only audio (or a JPEG for a cover) with `Content-Type`, `Content-Length`, `Content-Range`, `Accept-Ranges`, `Last-Modified` and `ETag`, so the friend sees this server and never the listener, and a friend cannot make this server serve anything else. A friend's track plays in the same player as the others but is never reported as a listen and does not feed taste. The admin area has a Federation section for all of it.
|
- **Friends (federation).** Two Sonda servers can become friends, and the listeners of one can read what the other chose to share. `PUT /federation` (admin) turns federation on, which is off by default, and gives this server a name and a public address (`https`; plain `http` only on a network of your own); the server then makes its own Ed25519 key, kept in the database and never returned. `POST /federation/invites` makes an invite that works once and expires in 24 hours (only a hash of its code is kept). The other admin uses it with `POST /federation/friends`: that server is asked to accept this one, the key it answers with must be the one named in the invite, and the friend waits as `outgoing` until the first admin approves it with `POST /federation/friends/{id}/approve` (`POST /federation/friends/{id}/check` lets the waiting side find out). Either side can remove a friend with `DELETE /federation/friends/{id}`. Nothing is shared until an admin turns on `shared` for a library (`PATCH /libraries/{id}`). A friend's server then reads, with requests signed by its key (the method, the path and query, a date, a nonce and the hash of the body), the routes under `/peer`: the artists, albums and songs that have a file in a shared library, their covers once they are built, and the audio itself with `Range`. A friend never sees a path, a library id, a listen, a taste or a user, never makes this server build a cover or ask a provider, and has a few streams at a time and a number of KiB a second to share (`max_streams`, `max_kib_per_sec`); the admin sees the last requests it made (`GET /federation/requests`, the route and the size, never what was searched for). Sharing a library lets friends play it and, in practice, copy its files. A listener browses the music of a friend with `GET /friends` (the names of the friends whose friendship both admins agreed to, never an address or a key) and `GET /friends/{friend}/artists`, `albums` and `tracks` with `q`, `limit` and `offset`, and one item at a time: this server asks the friend with a signed request, checks the shape of the answer and passes it on, and nothing is kept; the ids are the friend's own. A friend that cannot be reached or no longer takes this server for a friend is told in words. The web app has a Friends section for it, shown only when there is a friend to browse. A listener plays it with `GET /friends/{friend}/tracks/{id}/stream` and sees its covers with `GET /friends/{friend}/albums/{id}/cover`, which accept the access token in the query like the local ones: this server asks the friend with a signed request, forwards `Range` and the conditional headers, and passes on only audio (or a JPEG for a cover) with `Content-Type`, `Content-Length`, `Content-Range`, `Accept-Ranges`, `Last-Modified` and `ETag`, so the friend sees this server and never the listener, and a friend cannot make this server serve anything else. A friend's song plays in the same player as the others but is never reported as a listen and does not feed taste. The admin area has a Federation section for all of it.
|
||||||
|
|
||||||
## What is not there yet
|
## What is not there yet
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ Sonda creates and migrates its tables on start. The storage tests run against bo
|
||||||
|
|
||||||
## Demo
|
## Demo
|
||||||
|
|
||||||
This takes you from an empty database to streaming a track. Run the server in one terminal and the commands in another.
|
This takes you from an empty database to streaming a song. Run the server in one terminal and the commands in another.
|
||||||
|
|
||||||
**1. Get some music.** Point `MUSIC` at a folder of MP3 or FLAC files. The path must be absolute. If you have none, generate two 30-second test tones:
|
**1. Get some music.** Point `MUSIC` at a folder of MP3 or FLAC files. The path must be absolute. If you have none, generate two 30-second test tones:
|
||||||
|
|
||||||
|
|
@ -178,7 +178,7 @@ curl -s "$BASE/albums" -H "$AUTH" | jq '.items[] | {id, title, artist: .artist.n
|
||||||
curl -s "$BASE/tracks?q=tone" -H "$AUTH" | jq '.items[] | {id, title, artists: [.artists[].name], format}'
|
curl -s "$BASE/tracks?q=tone" -H "$AUTH" | jq '.items[] | {id, title, artists: [.artists[].name], format}'
|
||||||
```
|
```
|
||||||
|
|
||||||
**6. Stream a track:**
|
**6. Stream a song:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
TRACK=$(curl -s "$BASE/tracks?limit=1" -H "$AUTH" | jq -r '.items[0].id')
|
TRACK=$(curl -s "$BASE/tracks?limit=1" -H "$AUTH" | jq -r '.items[0].id')
|
||||||
|
|
@ -202,7 +202,7 @@ curl -s -X POST $BASE/listens -H "$AUTH" -d "{\"track_id\":$TRACK,\"event_type\"
|
||||||
curl -s "$BASE/listens" -H "$AUTH" | jq '.items[] | {track: .track.title, event_type, duration_played_ms, counted}'
|
curl -s "$BASE/listens" -H "$AUTH" | jq '.items[] | {track: .track.title, event_type, duration_played_ms, counted}'
|
||||||
```
|
```
|
||||||
|
|
||||||
The answer to each report says whether it counts. A reported play time far beyond the length of the track (more than twice its length plus 10 seconds) is rejected.
|
The answer to each report says whether it counts. A reported play time far beyond the length of the song (more than twice its length plus 10 seconds) is rejected.
|
||||||
|
|
||||||
**8. Refresh the session and log out:**
|
**8. Refresh the session and log out:**
|
||||||
|
|
||||||
|
|
@ -267,13 +267,13 @@ The key is stored in the database, in clear text, and is never returned by the A
|
||||||
|
|
||||||
**Claude (Anthropic)** is the one provider that names things: with it on, a playlist, a mix or a smart playlist can get a name and a line of description that fit its songs. An admin turns it on with an Anthropic API key (`PUT /providers/anthropic`, the key is write-only, and `POST /providers/anthropic/test` reads one model, which costs nothing and sends no text). `POST /playlists/{id}/suggest-name`, `POST /mixes/{id}/suggest-name` and `POST /smart-playlists/{id}/suggest-name` answer with a name, a description and a `source`. They are a pipeline: the facts about the list (up to 5 genres, up to 8 artist names, how many songs, for a smart playlist a few words about its rules, and the language) go to a namer. With the provider off, or when Claude fails or declines, the local namer builds a name from the genres and the artists on this server, and nothing leaves it. When Claude answers, the name is kept (under a hash of the facts, which holds no artist name), so the same facts are not asked, or paid, twice. A suggestion changes nothing: the client decides what to do with it, and the web app offers it where a playlist is renamed. With the provider on, names are also made by themselves: a mix, a smart playlist or a suggested smart playlist that is kept as a playlist with `auto_name` (the web app always sends it) gets Claude's name and line of description, with `name` as the fallback when Claude is off, fails or declines; a smart playlist can be made with no name at all and Claude names it from the songs its rules give (without Claude that is `invalid_input`); and `GET /naming` says whether names are automatic, so that the editor does not ask for one. Every question to Claude is counted (a made name, a name taken from the kept ones, a failure with its reason, and the tokens that were billed, also for a failure that was billed) and nothing of what was sent is kept; `GET /providers/anthropic/usage?days=30` (admin) gives the totals, a row for each day and an **estimate** of the cost in dollars, worked out from the tokens and the price of the model (the invoice of Anthropic is the truth), and the Costs section of the admin area shows it for 7, 30 or 90 days; records older than a year are removed. The model is `claude-opus-5-5`, at low effort; the key is never taken from the environment of the server, and a redirect is never followed.
|
**Claude (Anthropic)** is the one provider that names things: with it on, a playlist, a mix or a smart playlist can get a name and a line of description that fit its songs. An admin turns it on with an Anthropic API key (`PUT /providers/anthropic`, the key is write-only, and `POST /providers/anthropic/test` reads one model, which costs nothing and sends no text). `POST /playlists/{id}/suggest-name`, `POST /mixes/{id}/suggest-name` and `POST /smart-playlists/{id}/suggest-name` answer with a name, a description and a `source`. They are a pipeline: the facts about the list (up to 5 genres, up to 8 artist names, how many songs, for a smart playlist a few words about its rules, and the language) go to a namer. With the provider off, or when Claude fails or declines, the local namer builds a name from the genres and the artists on this server, and nothing leaves it. When Claude answers, the name is kept (under a hash of the facts, which holds no artist name), so the same facts are not asked, or paid, twice. A suggestion changes nothing: the client decides what to do with it, and the web app offers it where a playlist is renamed. With the provider on, names are also made by themselves: a mix, a smart playlist or a suggested smart playlist that is kept as a playlist with `auto_name` (the web app always sends it) gets Claude's name and line of description, with `name` as the fallback when Claude is off, fails or declines; a smart playlist can be made with no name at all and Claude names it from the songs its rules give (without Claude that is `invalid_input`); and `GET /naming` says whether names are automatic, so that the editor does not ask for one. Every question to Claude is counted (a made name, a name taken from the kept ones, a failure with its reason, and the tokens that were billed, also for a failure that was billed) and nothing of what was sent is kept; `GET /providers/anthropic/usage?days=30` (admin) gives the totals, a row for each day and an **estimate** of the cost in dollars, worked out from the tokens and the price of the model (the invoice of Anthropic is the truth), and the Costs section of the admin area shows it for 7, 30 or 90 days; records older than a year are removed. The model is `claude-opus-5-5`, at low effort; the key is never taken from the environment of the server, and a redirect is never followed.
|
||||||
|
|
||||||
**What leaves your server, when a provider is on:** to Anthropic, only when someone asks for a name, up to 5 genres and 8 artist names of that list, how many songs it has, a few words about the rules of a smart playlist, the language, your API key, your IP address and a User-Agent (never your users, your listens, track titles or file paths); to Last.fm, the artist name (or MusicBrainz id) being looked up, your API key, your IP address and the `User-Agent`; to MusicBrainz, the MusicBrainz id of the artist (and, only for the covers of albums that have no id, the artist's name and the album's title: see **Covers**), your IP address and a `User-Agent` that carries your contact. Never your users, your listens or file paths. Requests only happen when someone asks for them, never as a bulk pass over your library (the exceptions are the three jobs that an admin starts on purpose, each of them one request that goes through the whole library, one item after the other, spaced out, and each stops when its providers keep failing: `POST /library/covers`, with the Cover Art Archive on, sends the release group id of every album that has no picture in its files (and, for the albums whose files have no id, with MusicBrainz on, the artist and the title, one request a second); `POST /library/artist-images`, with Commons and MusicBrainz on, sends the MusicBrainz id of every artist that has one, to MusicBrainz, Wikidata and Commons; `POST /library/descriptions`, with Wikipedia and MusicBrainz on, sends it to MusicBrainz, Wikidata and Wikipedia), and they are spaced out, retried with backoff, and stopped by a circuit breaker if a provider is down. When MusicBrainz answers that an id was merged into another, Sonda follows that one redirect, and only to an artist or a release group of musicbrainz.org over https; the new id is used for that request and is not stored, and any other redirect is refused. **Descriptions** (the Wikipedia provider, which also needs MusicBrainz on) send the MusicBrainz id to MusicBrainz, the Wikidata item to Wikidata and the title of the page to Wikipedia, with your IP address and a `User-Agent` that carries a contact (the one set for each provider; Wikimedia refuses requests without one), and never a name. **Photos** (the Commons provider, which also needs MusicBrainz on) send the MusicBrainz id to MusicBrainz, the Wikidata item to Wikidata, the name of the picture to Commons and the address of a copy to Wikimedia, with your IP address and a `User-Agent` with a contact, and never a name. **Covers** (the Cover Art Archive provider) send the MusicBrainz release group id of an album, read from the tags of its own files, and only when the files have no picture. When the files have no id either and the MusicBrainz provider is on too, the name of the album's artist and its title go to MusicBrainz, which is asked for the release group: a result is taken only when MusicBrainz scores it 95 or more and its title and artist are the ones asked for (compared without case, accents or punctuation), and anything doubtful is no cover. A title that ends with a note about the disc or the edition (`(disc 2)`, `(bonus disc)`, `(Deluxe Edition)`) is asked as it is first and, if MusicBrainz is not sure, once more without the note, because a release group is named after the album and not after a disc. The id that comes back is used for that request and is not stored: it is not what your files say, and it is never used to read an artist or to send anything to Lidarr; the redirects of the archive are followed only to archive.org, over https. Its covers have no licence of their own: Sonda keeps a copy for your library and never treats it as free. **Discover** asks Last.fm for the similar artists of each seed (the seed's name or MusicBrainz id) and, for the best suggestions that have no tags yet, for the tags of that suggestion (its name); never MusicBrainz. Seeds you name are sent when you ask. Seeds taken from your listening, which are the names of the artists you play most, are sent only if you turned on `discover_from_listening` yourself; otherwise Discover refuses to run without a `seed`. **Lidarr** (your own server, at the address an admin set) gets the MusicBrainz id of an artist an admin sends, or of an artist someone opens `GET /artists/{id}/lidarr` for, and the API key, nothing else; asking it what it offers and testing the key send only the key. Never a name, your users, your listens or your files. What Lidarr then does is up to its own indexers and download clients. Besides the three jobs, the other exception to "only when someone asks" is `POST /providers/{name}/test`, which an admin sends to check a key (or, for Lidarr, the address and the key); it sends nothing but the key.
|
**What leaves your server, when a provider is on:** to Anthropic, only when someone asks for a name, up to 5 genres and 8 artist names of that list, how many songs it has, a few words about the rules of a smart playlist, the language, your API key, your IP address and a User-Agent (never your users, your listens, song titles or file paths); to Last.fm, the artist name (or MusicBrainz id) being looked up, your API key, your IP address and the `User-Agent`; to MusicBrainz, the MusicBrainz id of the artist (and, only for the covers of albums that have no id, the artist's name and the album's title: see **Covers**), your IP address and a `User-Agent` that carries your contact. Never your users, your listens or file paths. Requests only happen when someone asks for them, never as a bulk pass over your library (the exceptions are the three jobs that an admin starts on purpose, each of them one request that goes through the whole library, one item after the other, spaced out, and each stops when its providers keep failing: `POST /library/covers`, with the Cover Art Archive on, sends the release group id of every album that has no picture in its files (and, for the albums whose files have no id, with MusicBrainz on, the artist and the title, one request a second); `POST /library/artist-images`, with Commons and MusicBrainz on, sends the MusicBrainz id of every artist that has one, to MusicBrainz, Wikidata and Commons; `POST /library/descriptions`, with Wikipedia and MusicBrainz on, sends it to MusicBrainz, Wikidata and Wikipedia), and they are spaced out, retried with backoff, and stopped by a circuit breaker if a provider is down. When MusicBrainz answers that an id was merged into another, Sonda follows that one redirect, and only to an artist or a release group of musicbrainz.org over https; the new id is used for that request and is not stored, and any other redirect is refused. **Descriptions** (the Wikipedia provider, which also needs MusicBrainz on) send the MusicBrainz id to MusicBrainz, the Wikidata item to Wikidata and the title of the page to Wikipedia, with your IP address and a `User-Agent` that carries a contact (the one set for each provider; Wikimedia refuses requests without one), and never a name. **Photos** (the Commons provider, which also needs MusicBrainz on) send the MusicBrainz id to MusicBrainz, the Wikidata item to Wikidata, the name of the picture to Commons and the address of a copy to Wikimedia, with your IP address and a `User-Agent` with a contact, and never a name. **Covers** (the Cover Art Archive provider) send the MusicBrainz release group id of an album, read from the tags of its own files, and only when the files have no picture. When the files have no id either and the MusicBrainz provider is on too, the name of the album's artist and its title go to MusicBrainz, which is asked for the release group: a result is taken only when MusicBrainz scores it 95 or more and its title and artist are the ones asked for (compared without case, accents or punctuation), and anything doubtful is no cover. A title that ends with a note about the disc or the edition (`(disc 2)`, `(bonus disc)`, `(Deluxe Edition)`) is asked as it is first and, if MusicBrainz is not sure, once more without the note, because a release group is named after the album and not after a disc. The id that comes back is used for that request and is not stored: it is not what your files say, and it is never used to read an artist or to send anything to Lidarr; the redirects of the archive are followed only to archive.org, over https. Its covers have no licence of their own: Sonda keeps a copy for your library and never treats it as free. **Discover** asks Last.fm for the similar artists of each seed (the seed's name or MusicBrainz id) and, for the best suggestions that have no tags yet, for the tags of that suggestion (its name); never MusicBrainz. Seeds you name are sent when you ask. Seeds taken from your listening, which are the names of the artists you play most, are sent only if you turned on `discover_from_listening` yourself; otherwise Discover refuses to run without a `seed`. **Lidarr** (your own server, at the address an admin set) gets the MusicBrainz id of an artist an admin sends, or of an artist someone opens `GET /artists/{id}/lidarr` for, and the API key, nothing else; asking it what it offers and testing the key send only the key. Never a name, your users, your listens or your files. What Lidarr then does is up to its own indexers and download clients. Besides the three jobs, the other exception to "only when someone asks" is `POST /providers/{name}/test`, which an admin sends to check a key (or, for Lidarr, the address and the key); it sends nothing but the key.
|
||||||
|
|
||||||
**Similar artists.** `GET /api/v1/artists/{id}/similar` asks Last.fm for the artists similar to an artist (one of yours, or one Last.fm named earlier) and keeps the answer in your database: 7 days, or 1 day when Last.fm does not know the artist. Until then a second look costs nothing and sends nothing, and if Last.fm is down you still get the last answer, marked `stale`. If the provider is off the answer says `disabled` instead of failing. Each similar artist says whether you have it (`in_library`); the ones you do not have are stored as artists without files. They can be opened with `GET /artists/{id}` but are never part of your artist lists, and if you later add their music, the scan finds them there. Last.fm's `score` is relative to each answer (the best one is usually 1), so compare artists only inside one answer.
|
**Similar artists.** `GET /api/v1/artists/{id}/similar` asks Last.fm for the artists similar to an artist (one of yours, or one Last.fm named earlier) and keeps the answer in your database: 7 days, or 1 day when Last.fm does not know the artist. Until then a second look costs nothing and sends nothing, and if Last.fm is down you still get the last answer, marked `stale`. If the provider is off the answer says `disabled` instead of failing. Each similar artist says whether you have it (`in_library`); the ones you do not have are stored as artists without files. They can be opened with `GET /artists/{id}` but are never part of your artist lists, and if you later add their music, the scan finds them there. Last.fm's `score` is relative to each answer (the best one is usually 1), so compare artists only inside one answer.
|
||||||
|
|
||||||
**Tags.** `GET /api/v1/artists/{id}/tags` asks each provider that is on, at the same time, and keeps the answers with the same rules (7 days, 1 for an unknown artist, old data if a provider fails). Each provider has its own entry with its own weights: Last.fm's are relative to the artist (1 to 100), MusicBrainz's are counts of votes, and they are never mixed. MusicBrainz also marks the tags it lists as genres. Its tags and genres are CC BY-NC-SA, so show the `attribution` that comes with them.
|
**Tags.** `GET /api/v1/artists/{id}/tags` asks each provider that is on, at the same time, and keeps the answers with the same rules (7 days, 1 for an unknown artist, old data if a provider fails). Each provider has its own entry with its own weights: Last.fm's are relative to the artist (1 to 100), MusicBrainz's are counts of votes, and they are never mixed. MusicBrainz also marks the tags it lists as genres. Its tags and genres are CC BY-NC-SA, so show the `attribution` that comes with them.
|
||||||
|
|
||||||
**Genres from your own files.** The scan also reads the genre tag of each file (several genres separated by `;`, at most five per file) and `GET /artists/{id}/tags` adds a `files` entry: the genres of the playable tracks the artist is credited on, each weighted by how many tracks have it. It needs no provider, asks nobody, and is always there.
|
**Genres from your own files.** The scan also reads the genre tag of each file (several genres separated by `;`, at most five per file) and `GET /artists/{id}/tags` adds a `files` entry: the genres of the playable songs the artist is credited on, each weighted by how many songs have it. It needs no provider, asks nobody, and is always there.
|
||||||
|
|
||||||
**MusicBrainz ids come from your files, never from a guess.** If your files carry MusicBrainz artist ids in their tags (taggers like Picard write them), the scan reads them, offline, and keeps them on your artists, but only when each id can be paired with its artist for certain. MusicBrainz is asked only about artists whose id is known; for the others its entry says `no_id`. Sonda never searches MusicBrainz for an artist by name, because a search returns look-alikes and picking one would be a guess; the one search there is is for the cover of an album that has no id (see **Covers** below), and it takes a result only when it is sure. A normal scan reads a file's tags when the file is new or changed. To pick up ids and genres for music that is already indexed, scan with `full=true` (`POST /library/scan?full=true`, or `POST /libraries/{id}/scan?full=true`): every file is read again, keeps its identity, and your listening history is untouched.
|
**MusicBrainz ids come from your files, never from a guess.** If your files carry MusicBrainz artist ids in their tags (taggers like Picard write them), the scan reads them, offline, and keeps them on your artists, but only when each id can be paired with its artist for certain. MusicBrainz is asked only about artists whose id is known; for the others its entry says `no_id`. Sonda never searches MusicBrainz for an artist by name, because a search returns look-alikes and picking one would be a guess; the one search there is is for the cover of an album that has no id (see **Covers** below), and it takes a result only when it is sure. A normal scan reads a file's tags when the file is new or changed. To pick up ids and genres for music that is already indexed, scan with `full=true` (`POST /library/scan?full=true`, or `POST /libraries/{id}/scan?full=true`): every file is read again, keeps its identity, and your listening history is untouched.
|
||||||
|
|
||||||
|
|
@ -311,7 +311,7 @@ Everything lives under `/api/v1`. Bodies are JSON. Errors always look like `{"er
|
||||||
| signed in | `GET /smart-playlists/suggested`, `GET /smart-playlists/suggested/{key}/tracks`, `POST /smart-playlists/suggested/{key}/playlist` | The smart playlists Sonda makes for everybody (a fixed set), their songs for you now (query `variant`), and one kept as a normal playlist. |
|
| signed in | `GET /smart-playlists/suggested`, `GET /smart-playlists/suggested/{key}/tracks`, `POST /smart-playlists/suggested/{key}/playlist` | The smart playlists Sonda makes for everybody (a fixed set), their songs for you now (query `variant`), and one kept as a normal playlist. |
|
||||||
| signed in | `GET /smart-playlists/{id}/tracks`, `POST /smart-playlists/preview`, `POST /smart-playlists/{id}/playlist` | The songs the rules give now (query `variant`), a preview of rules that are not kept, and a smart playlist kept as a normal playlist. |
|
| signed in | `GET /smart-playlists/{id}/tracks`, `POST /smart-playlists/preview`, `POST /smart-playlists/{id}/playlist` | The songs the rules give now (query `variant`), a preview of rules that are not kept, and a smart playlist kept as a normal playlist. |
|
||||||
| signed in | `GET /playlists`, `POST /playlists`, `GET`, `PATCH`, `DELETE /playlists/{id}` | Your playlists: list them (query `limit`, `offset`), make one, read, rename or delete one. Never anybody else's. |
|
| signed in | `GET /playlists`, `POST /playlists`, `GET`, `PATCH`, `DELETE /playlists/{id}` | Your playlists: list them (query `limit`, `offset`), make one, read, rename or delete one. Never anybody else's. |
|
||||||
| signed in | `GET /playlists/{id}/tracks`, `POST /playlists/{id}/tracks`, `PATCH`, `DELETE /playlists/{id}/tracks/{item}` | The tracks of a playlist: list them in order, add some (at the end or at a `position`), move or remove an item. |
|
| signed in | `GET /playlists/{id}/tracks`, `POST /playlists/{id}/tracks`, `PATCH`, `DELETE /playlists/{id}/tracks/{item}` | The songs of a playlist: list them in order, add some (at the end or at a `position`), move or remove an item. |
|
||||||
| signed in | `GET /wishlist`, `PUT /wishlist/{id}`, `DELETE /wishlist/{id}` | Your wishlist: list it (query `limit`, `offset`), add an artist, take one off. |
|
| signed in | `GET /wishlist`, `PUT /wishlist/{id}`, `DELETE /wishlist/{id}` | Your wishlist: list it (query `limit`, `offset`), add an artist, take one off. |
|
||||||
| signed in | `GET /discover/dismissed`, `POST /discover/{id}/dismiss`, `DELETE /discover/{id}/dismiss` | The artists you are not interested in: list them, dismiss one, bring it back. |
|
| signed in | `GET /discover/dismissed`, `POST /discover/{id}/dismiss`, `DELETE /discover/{id}/dismiss` | The artists you are not interested in: list them, dismiss one, bring it back. |
|
||||||
| signed in | `GET /me/taste` | The artists and tags Sonda learned you like, from your own listening. Query: `limit` (default 20, max 50). |
|
| signed in | `GET /me/taste` | The artists and tags Sonda learned you like, from your own listening. Query: `limit` (default 20, max 50). |
|
||||||
|
|
@ -349,7 +349,7 @@ Back up the database and `sonda.toml`. Your music stays wherever you keep it.
|
||||||
|
|
||||||
## Web app
|
## 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. The player draws a live picture of what is playing, in the browser, from the sound itself (Web Audio). Settings has a choice for it, kept on the device: a spectrogram (the last seconds, low notes at the bottom, the default), the classic bars with falling caps, an oscilloscope, Milkdrop, or nothing. The bars, the oscilloscope and the spectrogram take the colour of this server or, for a friend's track, the colour of the friend. Milkdrop fills the background of the full-screen player with the pictures Winamp made famous, drawn on the device with [butterchurn](https://github.com/jberg/butterchurn) (MIT) and its presets, which are part of the app: nothing is fetched from outside. It is loaded only when chosen, and anyone who asked the system for less motion gets the spectrogram instead, because the pictures flash. The player listens to the sound and changes nothing of it, and draws only while something plays.
|
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 picture of what is playing, in the browser, from the sound itself (Web Audio). Settings has a choice for it, kept on the device: a spectrogram (the last seconds, low notes at the bottom, the default), the classic bars with falling caps, an oscilloscope, Milkdrop, or nothing. The bars, the oscilloscope and the spectrogram take the colour of this server or, for a friend's song, the colour of the friend. Milkdrop fills the background of the full-screen player with the pictures Winamp made famous, drawn on the device with [butterchurn](https://github.com/jberg/butterchurn) (MIT) and its presets, which are part of the app: nothing is fetched from outside. It is loaded only when chosen, and anyone who asked the system for less motion gets the spectrogram instead, because the pictures flash. The player listens to the sound and changes nothing of it, and draws 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`):
|
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`):
|
||||||
|
|
||||||
|
|
@ -415,4 +415,4 @@ Migrations are plain SQL files in `migrations/sqlite` and `migrations/postgres`.
|
||||||
|
|
||||||
## Third-party code
|
## Third-party code
|
||||||
|
|
||||||
Audio tags are read with `go.senan.xyz/taglib`, which embeds [TagLib](https://github.com/taglib/taglib) compiled to WebAssembly and is licensed under the LGPL 2.1. The Swagger UI assets come from `github.com/swaggest/swgui` (Apache-2.0), which embeds [Swagger UI](https://github.com/swagger-api/swagger-ui) (Apache-2.0). The other dependencies are listed in `go.mod`. The Milkdrop pictures of the player are drawn by [butterchurn](https://github.com/jberg/butterchurn) and [butterchurn-presets](https://github.com/jberg/butterchurn-presets) (both MIT), bundled in the web app. The shape of a track is found with `github.com/hajimehoshi/go-mp3` (Apache-2.0) and `github.com/eaburns/flac` (MIT), two decoders written in Go.
|
Audio tags are read with `go.senan.xyz/taglib`, which embeds [TagLib](https://github.com/taglib/taglib) compiled to WebAssembly and is licensed under the LGPL 2.1. The Swagger UI assets come from `github.com/swaggest/swgui` (Apache-2.0), which embeds [Swagger UI](https://github.com/swagger-api/swagger-ui) (Apache-2.0). The other dependencies are listed in `go.mod`. The Milkdrop pictures of the player are drawn by [butterchurn](https://github.com/jberg/butterchurn) and [butterchurn-presets](https://github.com/jberg/butterchurn-presets) (both MIT), bundled in the web app. The shape of a song is found with `github.com/hajimehoshi/go-mp3` (Apache-2.0) and `github.com/eaburns/flac` (MIT), two decoders written in Go.
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
<meta name="mobile-web-app-capable" content="yes" />
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
<meta name="apple-mobile-web-app-title" content="Sonda" />
|
<meta name="apple-mobile-web-app-title" content="Sonda" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<meta name="description" content="Your own music, on your own server." />
|
||||||
<title>Sonda</title>
|
<title>Sonda</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.2 KiB |
|
|
@ -1 +1 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><rect width="512" height="512" rx="112" fill="#041d3a"/><svg x="88" y="88" width="336" height="336" viewBox="56.1 4.3 756.1 746.2"><path fill="#70e7d4" fill-rule="evenodd" d="M 400 25 C 345.5 31, 294.8 46, 257.5 67.2 C 255.3 68.5, 249.3 71.9, 244 74.9 C 235.9 79.5, 226.3 85.9, 213.1 95.6 C 190.5 112, 160.2 142, 143.4 164.6 C 123.9 190.7, 106.9 219.8, 99.5 239.8 C 98.8 241.8, 97.2 246, 96 249 C 89.8 265, 85.2 279.7, 83.9 288 C 83.5 291, 82.4 296.4, 81.6 300 C 80.7 303.6, 80 308.5, 80 311 C 80 313.5, 79.3 318.7, 78.4 322.5 C 76.3 331.5, 75.2 396.8, 76.9 413 C 80.2 445.4, 83.4 462.6, 91.4 491.1 C 104.2 536.7, 145 601.2, 182.4 635.2 C 213.5 663.4, 255.9 690.1, 291.5 704 C 297.6 706.3, 304.6 709.1, 307.2 710.1 C 309.8 711.2, 312.5 712, 313.2 712 C 313.9 712, 316.7 712.9, 319.5 713.9 C 322.2 715, 328.1 716.8, 332.5 717.9 C 336.9 719, 344.2 720.8, 348.6 721.9 C 353.1 723.1, 358.2 724, 360 724 C 361.8 724, 365.8 724.7, 368.9 725.5 C 372 726.3, 379.9 727.2, 386.5 727.5 C 393.1 727.8, 403.2 728.5, 409 729.1 C 445.3 732.9, 496 728.5, 537.2 718.1 C 598.3 702.5, 654.3 668.7, 703.2 617.9 C 745.9 573.5, 780.7 500.6, 788 440.5 C 788.7 435, 789.8 429.5, 790.6 428.3 C 792.7 425, 792.7 337, 790.6 333.7 C 789.8 332.5, 788.7 327.2, 788.1 321.9 C 784.1 285.4, 766.6 232.4, 747.1 197.7 C 706.1 124.5, 633.8 65.9, 555 42 C 550.9 40.8, 545.7 39.2, 543.5 38.4 C 531.9 34.6, 500 28, 492.5 28 C 489.8 27.9, 484.8 27.2, 481.5 26.4 C 474.6 24.6, 413.2 23.5, 400 25 M 405.9 144.1 C 329.6 150.4, 257.7 199.4, 228 265.5 C 208.9 307.9, 199.7 377.3, 207.6 418.8 C 208.5 423.3, 211.8 421.5, 214.8 414.8 C 216.4 411.3, 218.4 407.9, 219.3 407.2 C 220.2 406.4, 221.4 404.2, 222.1 402.2 C 223.9 396.4, 237.1 377, 239.1 377 C 239.6 377, 240 377.7, 240 378.5 C 240 380.9, 241.9 380.3, 243.8 377.2 C 244.7 375.7, 248.4 371.4, 252 367.7 C 261.7 357.4, 264.8 352.6, 261.9 352.2 C 260 351.9, 260.4 351.1, 266.1 345.4 C 272.9 338.5, 274 337.9, 274 341 C 274 343.9, 276.8 342.5, 285.6 335 C 293 328.7, 294.1 326.4, 288.1 329.4 C 281.3 333, 284.3 329, 293.5 322.5 C 311.5 309.7, 345 295.5, 365.5 292.1 C 389.4 288, 391.7 287.8, 407.5 288.3 C 422.8 288.7, 435.7 291.3, 429.8 292.7 C 427.1 293.4, 427.7 295, 430.5 295 C 431.9 295, 433.3 294.3, 433.6 293.5 C 436 287.2, 478.4 302.9, 497.8 317.2 C 512.6 328.2, 520.8 336.7, 530.5 351.2 C 535.4 358.5, 536.1 361.5, 533 362.3 C 531.4 362.7, 531 363.7, 531 367.3 C 531 376.8, 527.9 380, 518.8 380 C 510.3 380, 516.4 383.6, 525.3 383.9 C 530.1 384, 529.8 386.1, 524.8 387.4 C 520.8 388.4, 514.8 385.9, 502 378 C 486.2 368.2, 479.7 366.1, 464.5 366 C 384.2 365.8, 344.9 457.7, 397.7 522.2 C 441.3 575.6, 525.5 588.8, 582.7 551.4 C 613.4 531.3, 632.1 509.1, 644.3 478.5 C 647.6 470.2, 649 465.9, 654.1 448 C 656.3 440.3, 659.1 424.5, 659.5 417.5 C 662.4 361.5, 659.8 332.9, 648 290.5 C 638.4 256.2, 607.5 211.1, 578.9 189.5 C 565.9 179.7, 533.4 161, 529.5 161 C 528.3 161, 510.4 153.7, 509.6 152.9 C 509 152.4, 507.5 152, 506.1 152 C 504.6 152, 500.4 151.1, 496.5 150.1 C 473.6 143.8, 437.7 141.4, 405.9 144.1 M 567.3 414 C 554.8 420.3, 541.8 443.8, 545.9 452.6 C 547.5 456.3, 548.9 454.6, 549.7 448.1 C 550 445.3, 550.7 442.7, 551.1 442.4 C 551.6 442.1, 551.7 443.2, 551.4 444.9 C 550.2 450.9, 553.5 457.5, 561.1 464 C 564.9 467.3, 568.8 470, 569.8 470 C 570.7 470, 573 470.9, 574.8 472 C 583 477, 586.8 475.9, 597.4 465.5 C 603.8 459.2, 606 454.7, 606 447.7 C 606 436, 609.7 437.1, 612.3 449.5 C 612.6 450.6, 612.8 449, 612.9 445.9 C 613.1 437.1, 610.8 431.2, 604.4 424.1 C 596.2 415.1, 586.2 410.6, 583 414.5 C 581.4 416.4, 579.3 416.4, 578.3 414.5 C 576.8 411.9, 571.9 411.7, 567.3 414 M 398.5 723.8 C 379.5 724.8, 401.3 727.5, 424.5 727.1 C 438.2 726.9, 442.1 726, 439 723.9 C 437.6 723, 414.9 723, 398.5 723.8"/></svg></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><rect width="512" height="512" rx="112" fill="#08161d"/><svg x="88" y="88" width="336" height="336" viewBox="56.1 4.3 756.1 746.2"><path fill="#37e0c2" fill-rule="evenodd" d="M 400 25 C 345.5 31, 294.8 46, 257.5 67.2 C 255.3 68.5, 249.3 71.9, 244 74.9 C 235.9 79.5, 226.3 85.9, 213.1 95.6 C 190.5 112, 160.2 142, 143.4 164.6 C 123.9 190.7, 106.9 219.8, 99.5 239.8 C 98.8 241.8, 97.2 246, 96 249 C 89.8 265, 85.2 279.7, 83.9 288 C 83.5 291, 82.4 296.4, 81.6 300 C 80.7 303.6, 80 308.5, 80 311 C 80 313.5, 79.3 318.7, 78.4 322.5 C 76.3 331.5, 75.2 396.8, 76.9 413 C 80.2 445.4, 83.4 462.6, 91.4 491.1 C 104.2 536.7, 145 601.2, 182.4 635.2 C 213.5 663.4, 255.9 690.1, 291.5 704 C 297.6 706.3, 304.6 709.1, 307.2 710.1 C 309.8 711.2, 312.5 712, 313.2 712 C 313.9 712, 316.7 712.9, 319.5 713.9 C 322.2 715, 328.1 716.8, 332.5 717.9 C 336.9 719, 344.2 720.8, 348.6 721.9 C 353.1 723.1, 358.2 724, 360 724 C 361.8 724, 365.8 724.7, 368.9 725.5 C 372 726.3, 379.9 727.2, 386.5 727.5 C 393.1 727.8, 403.2 728.5, 409 729.1 C 445.3 732.9, 496 728.5, 537.2 718.1 C 598.3 702.5, 654.3 668.7, 703.2 617.9 C 745.9 573.5, 780.7 500.6, 788 440.5 C 788.7 435, 789.8 429.5, 790.6 428.3 C 792.7 425, 792.7 337, 790.6 333.7 C 789.8 332.5, 788.7 327.2, 788.1 321.9 C 784.1 285.4, 766.6 232.4, 747.1 197.7 C 706.1 124.5, 633.8 65.9, 555 42 C 550.9 40.8, 545.7 39.2, 543.5 38.4 C 531.9 34.6, 500 28, 492.5 28 C 489.8 27.9, 484.8 27.2, 481.5 26.4 C 474.6 24.6, 413.2 23.5, 400 25 M 405.9 144.1 C 329.6 150.4, 257.7 199.4, 228 265.5 C 208.9 307.9, 199.7 377.3, 207.6 418.8 C 208.5 423.3, 211.8 421.5, 214.8 414.8 C 216.4 411.3, 218.4 407.9, 219.3 407.2 C 220.2 406.4, 221.4 404.2, 222.1 402.2 C 223.9 396.4, 237.1 377, 239.1 377 C 239.6 377, 240 377.7, 240 378.5 C 240 380.9, 241.9 380.3, 243.8 377.2 C 244.7 375.7, 248.4 371.4, 252 367.7 C 261.7 357.4, 264.8 352.6, 261.9 352.2 C 260 351.9, 260.4 351.1, 266.1 345.4 C 272.9 338.5, 274 337.9, 274 341 C 274 343.9, 276.8 342.5, 285.6 335 C 293 328.7, 294.1 326.4, 288.1 329.4 C 281.3 333, 284.3 329, 293.5 322.5 C 311.5 309.7, 345 295.5, 365.5 292.1 C 389.4 288, 391.7 287.8, 407.5 288.3 C 422.8 288.7, 435.7 291.3, 429.8 292.7 C 427.1 293.4, 427.7 295, 430.5 295 C 431.9 295, 433.3 294.3, 433.6 293.5 C 436 287.2, 478.4 302.9, 497.8 317.2 C 512.6 328.2, 520.8 336.7, 530.5 351.2 C 535.4 358.5, 536.1 361.5, 533 362.3 C 531.4 362.7, 531 363.7, 531 367.3 C 531 376.8, 527.9 380, 518.8 380 C 510.3 380, 516.4 383.6, 525.3 383.9 C 530.1 384, 529.8 386.1, 524.8 387.4 C 520.8 388.4, 514.8 385.9, 502 378 C 486.2 368.2, 479.7 366.1, 464.5 366 C 384.2 365.8, 344.9 457.7, 397.7 522.2 C 441.3 575.6, 525.5 588.8, 582.7 551.4 C 613.4 531.3, 632.1 509.1, 644.3 478.5 C 647.6 470.2, 649 465.9, 654.1 448 C 656.3 440.3, 659.1 424.5, 659.5 417.5 C 662.4 361.5, 659.8 332.9, 648 290.5 C 638.4 256.2, 607.5 211.1, 578.9 189.5 C 565.9 179.7, 533.4 161, 529.5 161 C 528.3 161, 510.4 153.7, 509.6 152.9 C 509 152.4, 507.5 152, 506.1 152 C 504.6 152, 500.4 151.1, 496.5 150.1 C 473.6 143.8, 437.7 141.4, 405.9 144.1 M 567.3 414 C 554.8 420.3, 541.8 443.8, 545.9 452.6 C 547.5 456.3, 548.9 454.6, 549.7 448.1 C 550 445.3, 550.7 442.7, 551.1 442.4 C 551.6 442.1, 551.7 443.2, 551.4 444.9 C 550.2 450.9, 553.5 457.5, 561.1 464 C 564.9 467.3, 568.8 470, 569.8 470 C 570.7 470, 573 470.9, 574.8 472 C 583 477, 586.8 475.9, 597.4 465.5 C 603.8 459.2, 606 454.7, 606 447.7 C 606 436, 609.7 437.1, 612.3 449.5 C 612.6 450.6, 612.8 449, 612.9 445.9 C 613.1 437.1, 610.8 431.2, 604.4 424.1 C 596.2 415.1, 586.2 410.6, 583 414.5 C 581.4 416.4, 579.3 416.4, 578.3 414.5 C 576.8 411.9, 571.9 411.7, 567.3 414 M 398.5 723.8 C 379.5 724.8, 401.3 727.5, 424.5 727.1 C 438.2 726.9, 442.1 726, 439 723.9 C 437.6 723, 414.9 723, 398.5 723.8"/></svg></svg>
|
||||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
|
|
@ -68,6 +68,14 @@ test('with a friend there is a Friends tab, marked in the friend colour', async
|
||||||
expect(within(nav).getByRole('link', { name: 'Home' }).querySelector('[data-bar]')).toHaveClass('bg-transparent')
|
expect(within(nav).getByRole('link', { name: 'Home' }).querySelector('[data-bar]')).toHaveClass('bg-transparent')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('the Friends bar is amber only when Friends is the open tab, so there is one bar at a time', async () => {
|
||||||
|
const nav = renderTabs('/albums', [{ id: 3, name: 'Anna' }])
|
||||||
|
const friends = await within(nav).findByRole('link', { name: 'Friends' })
|
||||||
|
expect(friends.querySelector('[data-bar]')).toHaveClass('bg-transparent')
|
||||||
|
expect(friends.querySelector('[data-bar]')).not.toHaveClass('bg-friend')
|
||||||
|
expect(within(nav).getByRole('link', { name: 'Library' }).querySelector('[data-bar]')).toHaveClass('bg-primary')
|
||||||
|
})
|
||||||
|
|
||||||
test('the bar of the current tab is the colour of this server', () => {
|
test('the bar of the current tab is the colour of this server', () => {
|
||||||
const nav = renderTabs('/')
|
const nav = renderTabs('/')
|
||||||
expect(within(nav).getByRole('link', { name: 'Home' }).querySelector('[data-bar]')).toHaveClass('bg-primary')
|
expect(within(nav).getByRole('link', { name: 'Home' }).querySelector('[data-bar]')).toHaveClass('bg-primary')
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ const under = (path: string, prefixes: string[]) => prefixes.some((p) => path ==
|
||||||
/**
|
/**
|
||||||
* The bar of tabs at the bottom of a phone, under the player: Home, Search, Library, Friends (only when there is a
|
* The bar of tabs at the bottom of a phone, under the player: Home, Search, Library, Friends (only when there is a
|
||||||
* friend to browse) and More. The menu on the left of a wide screen does not show on a phone, and this does not show on
|
* friend to browse) and More. The menu on the left of a wide screen does not show on a phone, and this does not show on
|
||||||
* a wide screen. The mark on top of the current tab is the colour of this server; the Friends tab has the friend colour.
|
* a wide screen. The mark on top of the current tab is the colour of this server, and the friend colour when the current tab is Friends: one mark at a time.
|
||||||
*/
|
*/
|
||||||
export default function PhoneTabs() {
|
export default function PhoneTabs() {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
@ -43,7 +43,7 @@ export default function PhoneTabs() {
|
||||||
<span
|
<span
|
||||||
data-bar
|
data-bar
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className={cn('h-[3px] w-6 rounded-full', 'friend' in tab ? 'bg-friend' : tab.current ? 'bg-primary' : 'bg-transparent')}
|
className={cn('h-[3px] w-6 rounded-full', tab.current ? ('friend' in tab ? 'bg-friend' : 'bg-primary') : 'bg-transparent')}
|
||||||
/>
|
/>
|
||||||
<span>{tab.label}</span>
|
<span>{tab.label}</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
"tokenHelp": "In your instance open Preferences, Development, New application, and give it only the write:statuses permission. Paste its access token here. The server keeps it and never shows it again.",
|
"tokenHelp": "In your instance open Preferences, Development, New application, and give it only the write:statuses permission. Paste its access token here. The server keeps it and never shows it again.",
|
||||||
"connect": "Connect",
|
"connect": "Connect",
|
||||||
"connecting": "Connecting…",
|
"connecting": "Connecting…",
|
||||||
"refused": "Mastodon no longer accepts the token for {{handle}}, so nothing is posted. Make a new token as described below and paste it here.",
|
"refused": "Mastodon no longer accepts the token for {{handle}}, so nothing is posted. Create a new token as described below and paste it here.",
|
||||||
"connectAgain": "Connect again",
|
"connectAgain": "Connect again",
|
||||||
"connected": "Your listens are posted to {{handle}}.",
|
"connected": "Your listens are posted to {{handle}}.",
|
||||||
"connectedHelp": "Each song that counts as a listen is posted as an unlisted status with #NowPlaying. Music of a friend is never posted.",
|
"connectedHelp": "Each song that counts as a listen is posted as an unlisted status with #NowPlaying. Music of a friend is never posted.",
|
||||||
|
|
@ -497,7 +497,7 @@
|
||||||
"invites": "Invites",
|
"invites": "Invites",
|
||||||
"makeTitle": "Invite a friend",
|
"makeTitle": "Invite a friend",
|
||||||
"useTitle": "You got an invite",
|
"useTitle": "You got an invite",
|
||||||
"makeInvite": "Make an invite",
|
"makeInvite": "Create an invite",
|
||||||
"invite": "Invite",
|
"invite": "Invite",
|
||||||
"copy": "Copy",
|
"copy": "Copy",
|
||||||
"copied": "Copied",
|
"copied": "Copied",
|
||||||
|
|
@ -875,7 +875,7 @@
|
||||||
"none": "No import yet. When you bring in a Spotify export, what it did is kept here."
|
"none": "No import yet. When you bring in a Spotify export, what it did is kept here."
|
||||||
},
|
},
|
||||||
"playlists": {
|
"playlists": {
|
||||||
"empty": "You have no playlists yet. Make one below, or put a song in a new one with the playlist button next to it.",
|
"empty": "You have no playlists yet. Create one below, or put a song in a new one with the playlist button next to it.",
|
||||||
"newLabel": "Name of the new playlist",
|
"newLabel": "Name of the new playlist",
|
||||||
"create": "Create playlist",
|
"create": "Create playlist",
|
||||||
"meta_one": "{{count}} song · {{duration}}",
|
"meta_one": "{{count}} song · {{duration}}",
|
||||||
|
|
@ -899,7 +899,7 @@
|
||||||
"remove": "Remove from playlist",
|
"remove": "Remove from playlist",
|
||||||
"add": "Add to playlist",
|
"add": "Add to playlist",
|
||||||
"addTitle": "Add “{{title}}” to a playlist",
|
"addTitle": "Add “{{title}}” to a playlist",
|
||||||
"addBody": "Choose a playlist, or make a new one.",
|
"addBody": "Choose a playlist, or create a new one.",
|
||||||
"noneYet": "You have no playlists yet.",
|
"noneYet": "You have no playlists yet.",
|
||||||
"newName": "New playlist name",
|
"newName": "New playlist name",
|
||||||
"createAndAdd": "Create and add",
|
"createAndAdd": "Create and add",
|
||||||
|
|
@ -916,7 +916,7 @@
|
||||||
"rediscover": "Rediscover",
|
"rediscover": "Rediscover",
|
||||||
"unheard": "New to you"
|
"unheard": "New to you"
|
||||||
},
|
},
|
||||||
"genreMix": "{{genre}} Mix",
|
"genreMix": "{{genre}} mix",
|
||||||
"with": "With {{artists}}",
|
"with": "With {{artists}}",
|
||||||
"notFound": "This mix is not available now. Mixes change with what you listen to.",
|
"notFound": "This mix is not available now. Mixes change with what you listen to.",
|
||||||
"shuffle": "Shuffle again",
|
"shuffle": "Shuffle again",
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"duplicates": {
|
"duplicates": {
|
||||||
"intro": "Sono brani che stanno in più di un file: stessi artisti, stesso titolo e durata quasi uguale. Guardarli non costa niente: si legge solo l'indice. Eliminare è un'altra cosa: toglie file dalla tua cartella musicale.",
|
"intro": "Sono brani che stanno in più di un file: stessi artisti, stesso titolo e durata quasi uguale. Guardarli non costa niente: si legge solo l'indice. Eliminare è un'altra cosa: elimina file dalla tua cartella musicale.",
|
||||||
"checkTitle": "Controlla i file",
|
"checkTitle": "Controlla i file",
|
||||||
"checkWhat": "Legge ogni file che ha una copia e ne salva l'impronta, così i file uguali byte per byte vengono segnati come identici. Legge soltanto: non elimina e non invia niente.",
|
"checkWhat": "Legge ogni file che ha una copia e ne salva l'impronta, così i file uguali byte per byte vengono segnati come identici. Legge soltanto: non elimina e non invia niente.",
|
||||||
"checkAgain": "Rileggi tutti i file",
|
"checkAgain": "Rileggi tutti i file",
|
||||||
|
|
@ -285,9 +285,9 @@
|
||||||
"noKey": "Nessuna chiave salvata.",
|
"noKey": "Nessuna chiave salvata.",
|
||||||
"saveKey": "Salva chiave",
|
"saveKey": "Salva chiave",
|
||||||
"saveKeyOne": "Salva la chiave di {{name}}",
|
"saveKeyOne": "Salva la chiave di {{name}}",
|
||||||
"removeKey": "Togli chiave",
|
"removeKey": "Rimuovi chiave",
|
||||||
"removeKeyOne": "Togli la chiave di {{name}}",
|
"removeKeyOne": "Rimuovi la chiave di {{name}}",
|
||||||
"removeKeyTitle": "Togliere la chiave di {{name}}?",
|
"removeKeyTitle": "Rimuovere la chiave di {{name}}?",
|
||||||
"removeKeyBody": "Si disattiva anche {{name}}.",
|
"removeKeyBody": "Si disattiva anche {{name}}.",
|
||||||
"save": "Salva",
|
"save": "Salva",
|
||||||
"contact": "Contatto",
|
"contact": "Contatto",
|
||||||
|
|
@ -307,14 +307,14 @@
|
||||||
"unreachable": "Il provider non ha risposto.",
|
"unreachable": "Il provider non ha risposto.",
|
||||||
"error": "La prova è fallita per un altro motivo."
|
"error": "La prova è fallita per un altro motivo."
|
||||||
},
|
},
|
||||||
"purge": "Togli i dati",
|
"purge": "Rimuovi i dati",
|
||||||
"purgeOne": "Togli i dati di {{name}}",
|
"purgeOne": "Rimuovi i dati di {{name}}",
|
||||||
"purgeTitle": "Togliere ciò che ha dato {{name}}?",
|
"purgeTitle": "Rimuovere ciò che ha dato {{name}}?",
|
||||||
"purgeBody": "Vengono tolti tutti i dati che ha fornito a Sonda (artisti simili, tag, descrizioni e immagini) e gli artisti che compaiono solo in quei dati e di cui nessuno ha file. La tua musica, i tuoi ascolti e le tue impostazioni restano, e il provider non viene disattivato.",
|
"purgeBody": "Vengono rimossi tutti i dati che ha fornito a Sonda (artisti simili, tag, descrizioni e immagini) e gli artisti che compaiono solo in quei dati e di cui nessuno ha file. La tua musica, i tuoi ascolti e le tue impostazioni restano, e il provider non viene disattivato.",
|
||||||
"purgeConfirm": "Togli i dati",
|
"purgeConfirm": "Rimuovi i dati",
|
||||||
"removed": {
|
"removed": {
|
||||||
"done": "Dati tolti: {{list}}.",
|
"done": "Dati rimossi: {{list}}.",
|
||||||
"nothing": "Non è stato tolto niente: non c'era niente di questo provider.",
|
"nothing": "Non è stato rimosso niente: non c'era niente di questo provider.",
|
||||||
"and": "e",
|
"and": "e",
|
||||||
"similar_one": "{{count}} collegamento tra artisti simili",
|
"similar_one": "{{count}} collegamento tra artisti simili",
|
||||||
"similar_other": "{{count}} collegamenti tra artisti simili",
|
"similar_other": "{{count}} collegamenti tra artisti simili",
|
||||||
|
|
@ -396,11 +396,11 @@
|
||||||
"you": "Tu",
|
"you": "Tu",
|
||||||
"makeAdmin": "Rendi admin",
|
"makeAdmin": "Rendi admin",
|
||||||
"makeAdminOne": "Rendi admin {{email}}",
|
"makeAdminOne": "Rendi admin {{email}}",
|
||||||
"removeAdmin": "Togli admin",
|
"removeAdmin": "Rimuovi admin",
|
||||||
"removeAdminOne": "Togli il ruolo admin a {{email}}",
|
"removeAdminOne": "Rimuovi il ruolo admin a {{email}}",
|
||||||
"removeAdminTitle": "Togliere il ruolo admin a {{email}}?",
|
"removeAdminTitle": "Rimuovere il ruolo admin a {{email}}?",
|
||||||
"removeAdminBody": "Non potrà più gestire librerie, utenti o provider.",
|
"removeAdminBody": "Non potrà più gestire librerie, utenti o provider.",
|
||||||
"removeAdminConfirm": "Togli ruolo admin",
|
"removeAdminConfirm": "Rimuovi ruolo admin",
|
||||||
"reset": "Reimposta password",
|
"reset": "Reimposta password",
|
||||||
"resetOne": "Reimposta la password di {{email}}",
|
"resetOne": "Reimposta la password di {{email}}",
|
||||||
"resetTitle": "Reimposta la password di {{email}}",
|
"resetTitle": "Reimposta la password di {{email}}",
|
||||||
|
|
@ -633,7 +633,7 @@
|
||||||
},
|
},
|
||||||
"marked": {
|
"marked": {
|
||||||
"hideOwned": "Nascondi quelli che ho già",
|
"hideOwned": "Nascondi quelli che ho già",
|
||||||
"remove": "Togli",
|
"remove": "Rimuovi",
|
||||||
"interestedAgain": "Mi interessa di nuovo",
|
"interestedAgain": "Mi interessa di nuovo",
|
||||||
"emptyWishlist": "Ancora niente nella wishlist. Aggiungi artisti dai suggerimenti.",
|
"emptyWishlist": "Ancora niente nella wishlist. Aggiungi artisti dai suggerimenti.",
|
||||||
"emptyDismissed": "Non hai scartato nessun artista."
|
"emptyDismissed": "Non hai scartato nessun artista."
|
||||||
|
|
@ -642,7 +642,7 @@
|
||||||
"label": "Cerca un artista da cui partire",
|
"label": "Cerca un artista da cui partire",
|
||||||
"list": "Artisti di partenza",
|
"list": "Artisti di partenza",
|
||||||
"add": "Aggiungi {{name}}",
|
"add": "Aggiungi {{name}}",
|
||||||
"remove": "Togli {{name}}",
|
"remove": "Rimuovi {{name}}",
|
||||||
"max": "Puoi scegliere al massimo {{count}} artisti.",
|
"max": "Puoi scegliere al massimo {{count}} artisti.",
|
||||||
"privacy": "Last.fm viene interrogato su questi artisti, se un admin l'ha attivato."
|
"privacy": "Last.fm viene interrogato su questi artisti, se un admin l'ha attivato."
|
||||||
},
|
},
|
||||||
|
|
@ -896,7 +896,7 @@
|
||||||
"deleteConfirm": "Elimina",
|
"deleteConfirm": "Elimina",
|
||||||
"moveUp": "Sposta su",
|
"moveUp": "Sposta su",
|
||||||
"moveDown": "Sposta giù",
|
"moveDown": "Sposta giù",
|
||||||
"remove": "Togli dalla playlist",
|
"remove": "Rimuovi dalla playlist",
|
||||||
"add": "Aggiungi a una playlist",
|
"add": "Aggiungi a una playlist",
|
||||||
"addTitle": "Aggiungi «{{title}}» a una playlist",
|
"addTitle": "Aggiungi «{{title}}» a una playlist",
|
||||||
"addBody": "Scegli una playlist, oppure creane una nuova.",
|
"addBody": "Scegli una playlist, oppure creane una nuova.",
|
||||||
|
|
@ -1034,7 +1034,7 @@
|
||||||
"genresHint": "Brani con uno qualsiasi di questi generi. Scrivine uno e premi Invio.",
|
"genresHint": "Brani con uno qualsiasi di questi generi. Scrivine uno e premi Invio.",
|
||||||
"notGenres": "Escludi generi",
|
"notGenres": "Escludi generi",
|
||||||
"addGenre": "Aggiungi genere",
|
"addGenre": "Aggiungi genere",
|
||||||
"removeGenre": "Togli {{genre}}",
|
"removeGenre": "Rimuovi {{genre}}",
|
||||||
"format": "Formato del file",
|
"format": "Formato del file",
|
||||||
"formatAny": "Qualsiasi",
|
"formatAny": "Qualsiasi",
|
||||||
"formatFlac": "FLAC",
|
"formatFlac": "FLAC",
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ test('it starts off, says what a friend is sent, and offers no invite while it i
|
||||||
renderPage()
|
renderPage()
|
||||||
expect(await screen.findByText(/It never learns who listens/)).toBeInTheDocument()
|
expect(await screen.findByText(/It never learns who listens/)).toBeInTheDocument()
|
||||||
expect(screen.getByRole('switch', { name: 'Federation' })).toHaveAttribute('aria-checked', 'false')
|
expect(screen.getByRole('switch', { name: 'Federation' })).toHaveAttribute('aria-checked', 'false')
|
||||||
expect(screen.queryByRole('button', { name: 'Make an invite' })).not.toBeInTheDocument()
|
expect(screen.queryByRole('button', { name: 'Create an invite' })).not.toBeInTheDocument()
|
||||||
expect(screen.queryByText(/Key of this server/)).not.toBeInTheDocument()
|
expect(screen.queryByText(/Key of this server/)).not.toBeInTheDocument()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -143,7 +143,7 @@ test('an invite is made on request, shown once with when it stops working, and c
|
||||||
{ 'POST /api/v1/federation/invites': () => ({ invite: 'sonda1.abc', expires_at: '2026-11-14T10:00:00Z' }) },
|
{ 'POST /api/v1/federation/invites': () => ({ invite: 'sonda1.abc', expires_at: '2026-11-14T10:00:00Z' }) },
|
||||||
)
|
)
|
||||||
renderPage()
|
renderPage()
|
||||||
await user.click(await screen.findByRole('button', { name: 'Make an invite' }))
|
await user.click(await screen.findByRole('button', { name: 'Create an invite' }))
|
||||||
const field = await screen.findByLabelText('Invite')
|
const field = await screen.findByLabelText('Invite')
|
||||||
expect(field).toHaveValue('sonda1.abc')
|
expect(field).toHaveValue('sonda1.abc')
|
||||||
expect(field).toHaveAttribute('readonly')
|
expect(field).toHaveAttribute('readonly')
|
||||||
|
|
@ -156,7 +156,7 @@ test('an invite cannot be made before the address is set, and the page says why'
|
||||||
const user = userEvent.setup()
|
const user = userEvent.setup()
|
||||||
server({ enabled: true, key_id: 'abcdef0123456789' }, { 'POST /api/v1/federation/invites': () => apiError(409, 'address_required') })
|
server({ enabled: true, key_id: 'abcdef0123456789' }, { 'POST /api/v1/federation/invites': () => apiError(409, 'address_required') })
|
||||||
renderPage()
|
renderPage()
|
||||||
await user.click(await screen.findByRole('button', { name: 'Make an invite' }))
|
await user.click(await screen.findByRole('button', { name: 'Create an invite' }))
|
||||||
expect(await screen.findByRole('alert')).toHaveTextContent('Set the public address of this server first.')
|
expect(await screen.findByRole('alert')).toHaveTextContent('Set the public address of this server first.')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,10 +79,10 @@ test('the mixes page shows the mixes made from my listening first, then one for
|
||||||
expect(within(forYou).getByRole('link', { name: /Your favourites/ })).toHaveTextContent('From your listening')
|
expect(within(forYou).getByRole('link', { name: /Your favourites/ })).toHaveTextContent('From your listening')
|
||||||
|
|
||||||
const genres = screen.getByRole('region', { name: 'By genre' })
|
const genres = screen.getByRole('region', { name: 'By genre' })
|
||||||
const rock = within(genres).getByRole('link', { name: /Hard Rock Mix/ })
|
const rock = within(genres).getByRole('link', { name: /Hard Rock mix/ })
|
||||||
expect(rock).toHaveAttribute('href', `/mixes/${HARD_ROCK}`)
|
expect(rock).toHaveAttribute('href', `/mixes/${HARD_ROCK}`)
|
||||||
expect(rock).toHaveTextContent('From the genres of your files')
|
expect(rock).toHaveTextContent('From the genres of your files')
|
||||||
expect(within(genres).getByRole('link', { name: /Synthwave Mix/ })).toBeInTheDocument()
|
expect(within(genres).getByRole('link', { name: /Synthwave mix/ })).toBeInTheDocument()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('a section with no mix is not shown', async () => {
|
test('a section with no mix is not shown', async () => {
|
||||||
|
|
@ -121,7 +121,7 @@ const open = () => renderPage(<MixPage />, `/mixes/${HARD_ROCK}`, '/mixes/:id')
|
||||||
test('a mix shows its name, its artists and its songs in order, and asks for the mix of the day', async () => {
|
test('a mix shows its name, its artists and its songs in order, and asks for the mix of the day', async () => {
|
||||||
const { calls } = mockFetch(oneMix())
|
const { calls } = mockFetch(oneMix())
|
||||||
open()
|
open()
|
||||||
expect(await screen.findByRole('heading', { level: 1, name: 'Hard Rock Mix' })).toBeInTheDocument()
|
expect(await screen.findByRole('heading', { level: 1, name: 'Hard Rock mix' })).toBeInTheDocument()
|
||||||
expect(screen.getByText(/3 songs/)).toBeInTheDocument()
|
expect(screen.getByText(/3 songs/)).toBeInTheDocument()
|
||||||
expect(screen.getByRole('button', { name: /Song 1/ })).toBeInTheDocument()
|
expect(screen.getByRole('button', { name: /Song 1/ })).toBeInTheDocument()
|
||||||
expect(screen.getByRole('button', { name: /Song 3/ })).toBeInTheDocument()
|
expect(screen.getByRole('button', { name: /Song 3/ })).toBeInTheDocument()
|
||||||
|
|
@ -170,7 +170,7 @@ test('Save as playlist keeps the variant that is shown, names it with the title,
|
||||||
[`POST /api/v1/mixes/${HARD_ROCK}/playlist`]: ({ init }) => {
|
[`POST /api/v1/mixes/${HARD_ROCK}/playlist`]: ({ init }) => {
|
||||||
saved = JSON.parse(init.body as string)
|
saved = JSON.parse(init.body as string)
|
||||||
return new Response(
|
return new Response(
|
||||||
JSON.stringify({ id: 42, name: 'Hard Rock Mix', description: '', track_count: 2, duration_ms: 400_000, created_at: '2026-11-12T10:00:00Z', updated_at: '2026-11-12T10:00:00Z' }),
|
JSON.stringify({ id: 42, name: 'Hard Rock mix', description: '', track_count: 2, duration_ms: 400_000, created_at: '2026-11-12T10:00:00Z', updated_at: '2026-11-12T10:00:00Z' }),
|
||||||
{ status: 201, headers: { 'Content-Type': 'application/json' } },
|
{ status: 201, headers: { 'Content-Type': 'application/json' } },
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
@ -182,8 +182,8 @@ test('Save as playlist keeps the variant that is shown, names it with the title,
|
||||||
await userEvent.click(screen.getByRole('button', { name: 'Save as playlist' }))
|
await userEvent.click(screen.getByRole('button', { name: 'Save as playlist' }))
|
||||||
|
|
||||||
const status = await screen.findByRole('status')
|
const status = await screen.findByRole('status')
|
||||||
expect(status).toHaveTextContent('Saved as “Hard Rock Mix”')
|
expect(status).toHaveTextContent('Saved as “Hard Rock mix”')
|
||||||
expect(saved).toEqual({ name: 'Hard Rock Mix', variant: 1, auto_name: true, lang: 'en' })
|
expect(saved).toEqual({ name: 'Hard Rock mix', variant: 1, auto_name: true, lang: 'en' })
|
||||||
expect(calls.some((c) => c.key === `POST /api/v1/mixes/${HARD_ROCK}/playlist`)).toBe(true)
|
expect(calls.some((c) => c.key === `POST /api/v1/mixes/${HARD_ROCK}/playlist`)).toBe(true)
|
||||||
|
|
||||||
await userEvent.click(within(status).getByRole('link', { name: 'Open the playlist' }))
|
await userEvent.click(within(status).getByRole('link', { name: 'Open the playlist' }))
|
||||||
|
|
@ -226,11 +226,11 @@ const coversOf = (el: HTMLElement) => Array.from(el.querySelectorAll('img')).map
|
||||||
test('a mix is a tile of colour with its name big, not a picture', async () => {
|
test('a mix is a tile of colour with its name big, not a picture', async () => {
|
||||||
mockFetch({ 'GET /api/v1/mixes': () => ({ items: [mix('genre:rock', 'genre', 'rock', ['Queen'], [11, 12, 13, 14])] }) })
|
mockFetch({ 'GET /api/v1/mixes': () => ({ items: [mix('genre:rock', 'genre', 'rock', ['Queen'], [11, 12, 13, 14])] }) })
|
||||||
renderPage(<MixesPage />, '/mixes', '/mixes')
|
renderPage(<MixesPage />, '/mixes', '/mixes')
|
||||||
const tile = await screen.findByRole('link', { name: /Rock Mix/ })
|
const tile = await screen.findByRole('link', { name: /Rock mix/ })
|
||||||
expect(coversOf(tile)).toEqual([])
|
expect(coversOf(tile)).toEqual([])
|
||||||
expect(tile).toHaveAttribute('data-tone')
|
expect(tile).toHaveAttribute('data-tone')
|
||||||
expect(tile).toHaveClass('min-h-36', 'text-white')
|
expect(tile).toHaveClass('min-h-36', 'text-white')
|
||||||
expect(within(tile).getByText('Rock Mix')).toHaveClass('text-3xl', 'font-extrabold')
|
expect(within(tile).getByText('Rock mix')).toHaveClass('text-3xl', 'font-extrabold')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('a mix has the same colour every time, and two mixes can have different ones', async () => {
|
test('a mix has the same colour every time, and two mixes can have different ones', async () => {
|
||||||
|
|
@ -243,7 +243,7 @@ test('a mix has the same colour every time, and two mixes can have different one
|
||||||
test('the page of a mix shows the same collage', async () => {
|
test('the page of a mix shows the same collage', async () => {
|
||||||
mockFetch(oneMix({ [`GET /api/v1/mixes/${HARD_ROCK}`]: () => withTracks('genre:hard rock', 'genre', 'hard rock', 0, songs(1, 2), [5, 6, 7, 8]) }))
|
mockFetch(oneMix({ [`GET /api/v1/mixes/${HARD_ROCK}`]: () => withTracks('genre:hard rock', 'genre', 'hard rock', 0, songs(1, 2), [5, 6, 7, 8]) }))
|
||||||
open()
|
open()
|
||||||
const title = await screen.findByRole('heading', { level: 1, name: 'Hard Rock Mix' })
|
const title = await screen.findByRole('heading', { level: 1, name: 'Hard Rock mix' })
|
||||||
const header = title.closest('header')!
|
const header = title.closest('header')!
|
||||||
expect(coversOf(header)).toEqual(['/api/v1/albums/5/cover', '/api/v1/albums/6/cover', '/api/v1/albums/7/cover', '/api/v1/albums/8/cover'])
|
expect(coversOf(header)).toEqual(['/api/v1/albums/5/cover', '/api/v1/albums/6/cover', '/api/v1/albums/7/cover', '/api/v1/albums/8/cover'])
|
||||||
})
|
})
|
||||||
|
|
|
||||||