Commit graph

330 commits

Author SHA1 Message Date
985bd3ed13 Merge pull request 'Scan the libraries by themselves when their music changed' (#36) from feat/auto-scan into main 2026-11-16 12:05:32 +00:00
tgiachi
89f1b5275a feat: scan the libraries by themselves when their music changed
Every 15 minutes (library.auto_scan_minutes, SONDA_AUTO_SCAN_MINUTES, 0 turns it off)
Sonda takes the signature of each library, a hash of the names of everything in it folder
by folder, which costs only the names of the files and so suits a NAS that sleeps. A
library whose signature changed (a song or a folder came, went or was renamed) is
scanned the usual way; every library is also scanned at least once a day, to find a song
tagged again where it stands.

It does not scan while another scan runs, tries again at the next look when a scan failed,
leaves alone a folder that cannot be read (a NAS that is not mounted), and ignores the
housekeeping folders of a NAS.
2026-11-16 13:05:09 +01:00
1b58f8412c Merge pull request 'Docker image published: say it in the README' (#34) from docs/published-image into main v0.1.0 2026-11-16 11:52:18 +00:00
tgiachi
482644a7bf docs: the Docker image is published
The image is on the registry of git.kmalloc.org: git.kmalloc.org/squid/sonda:latest and
a tag with the commit. The README says so, with the commands for pulling and running
it, and compose.yaml says how to use it instead of building.
2026-11-16 12:51:50 +01:00
ab05ec081f Merge pull request 'Radio stations in apps only when I ask' (#32) from feat/radio-in-apps-setting into main 2026-11-16 11:33:54 +00:00
tgiachi
ed32aac228 feat: the radio stations are in the apps only when the person asks
A new setting, radio_in_apps, off until the person turns it on (Settings, Apps and
devices, or PATCH /me/settings). With it off, the list of playlists of an OpenSubsonic
app is only the playlists of the person, and a station asked for by id is not found.
With it on, the stations come as playlists called Radio · Rock.

- migration 0036: user_settings.radio_in_apps
- usersettings, the settings API and the OpenAPI spec have the new field; the PATCH
  now keeps each setting apart (naming one no longer sets the other)
- Settings has a switch
2026-11-16 12:33:09 +01:00
8e278f04c2 Merge pull request 'Radio in the web app' (#30) from feat/radio-web into main 2026-11-16 11:19:29 +00:00
tgiachi
0b3bf8d49f feat: a Radio page, endless play, and the radio of an artist
The Radio page shows the stations Sonda makes by itself, in groups (made for you,
by genre, by decade). A click starts one and the player knows it is a radio: before
the queue runs out it asks the server for other songs of the same station and puts
them at the end (not the ones already queued; a station so small that all its songs
are queued starts them over), one question at a time, never twice within two seconds,
and again after ten when the server cannot answer. Every artist has a Start radio
button. The full-screen player says which station plays.

- Radio item in the menu (Library group), on the Library page and in the phone tab
- player store: radio and appendTracks; useRadioRefill
2026-11-16 12:18:15 +01:00
f146a94368 Merge pull request 'Radio stations that Sonda makes by itself' (#29) from feat/radio-stations into main 2026-11-16 11:14:16 +00:00
tgiachi
407b20334a feat: radio stations that Sonda makes by itself
Stations made from the music, random and without end, with nothing to set up: the
mixes the listener has (genres, favourites, rediscover, new to you), everything,
one for each decade that has 30 songs by 4 artists, and the radio of an artist (their
songs, four times as likely, and the songs of the two genres most of theirs have).
Every time a station is asked for it picks other songs, with the same weights as the
mixes (taste, hearts, nothing skipped lately).

- mixes.Service.Radios and Radio; Filter has All and years, the store has Decades
- GET /radio and GET /radio/{id}, in the OpenAPI spec
- OpenSubsonic: each station is a playlist (rd-<id>, "Radio · Rock") that has other
  songs every time it is opened, for apps that cannot play a radio that never ends
2026-11-16 12:13:55 +01:00
e37f1165ae Merge pull request 'OpenSubsonic: getUser, so that apps can log in' (#26) from fix/opensubsonic-getuser into main 2026-11-16 10:51:04 +00:00
tgiachi
d6064763e7 fix: OpenSubsonic apps can log in: getUser and the calls that follow
Feishin asks getUser right after the login and failed on the missing user. getUser
now says who the login is, with the roles of an app (play, download, playlists,
covers; never admin), and only about the person of the login.

Also answered with nothing, because apps ask them straight away: getArtistInfo(2),
getAlbumInfo(2), getTopSongs, getSimilarSongs(2), getLyrics, getLyricsBySongId,
getInternetRadioStations, getScanStatus, startScan and the play queue calls, and
getStarred, the older way to ask for the favourites.

A call that is not known is now in the server log with its name.
2026-11-16 11:50:44 +01:00
e77b014437 Merge pull request 'Search with a preview while I type' (#24) from feat/search-preview into main 2026-11-16 10:43:07 +00:00
tgiachi
4052ab8ce1 feat: a search box with a preview of what matches
A box on top of every page except the search (on a phone the Search tab does
this) opens a list while the person types: up to 3 artists, 3 albums and 5 songs,
each with its picture. A click opens an artist or an album and plays a song; the
arrows move through the list, Enter opens what is marked, or with nothing marked
the page with all the results, and Escape closes it. The last row, always in
sight, opens all the results.

The pictures of artists are not asked for: asking makes the server look the
artist up at a provider, which a list of whatever matched a few letters should
not do.
2026-11-16 11:33:23 +01:00
ea2478b786 Merge pull request 'Square the corners of the web app' (#22) from feat/sharp-corners into main 2026-11-16 10:28:24 +00:00
tgiachi
9bf6fd0039 style: square the corners of the web app
The base radius goes from 8 px to 2 px, which squares buttons, fields, dialogs,
covers and cards at once. The things that were made round on purpose are square
now too: the play button, the switch and its knob, the chip of a friend, the bars
of the statistics, the tab marker, the dot of a request, and the volume slider
(a thin track and a bar for a knob). The rings of a missing cover stay round:
they are the drawing of Sonda.
2026-11-16 11:27:18 +01:00
c5f548e74e Merge pull request 'Favourites teach Sonda my taste' (#20) from feat/favorites-signal into main 2026-11-16 10:08:43 +00:00
tgiachi
ca5cbbf088 feat: favourites teach Sonda my taste
A heart adds to what the listening says of an artist: a favourite artist counts
as much as three complete listens, a favourite album 1.5 for its album artist and
a favourite song 1 for each of its main artists, at most 6 for one artist, without
fading with time. An artist hearted but never played is liked, with no listens.
That feeds Discover, the mixes and the smart playlists that use the taste, and
GET /me/taste.

In the mixes of what the listener likes (genre mixes, Your favourites,
Rediscover) a hearted song is wanted 1.5 times as much and a song on a hearted
album 1.25 times. New to you is not changed.
2026-11-16 11:08:20 +01:00
84b61ce6aa Merge pull request 'Favourites in the web app' (#18) from feat/favorites-web into main 2026-11-16 09:56:37 +00:00
tgiachi
a93260af05 feat: favourites in the web app
A heart on every song, album and artist, in the player bar and the full-screen
player, and a Favourites page with the songs, albums and artists, newest first.
The heart changes at once and goes back if the server refuses. Hearts are only
for music of this server: a friend's song has none.

- FavoriteButton, useIsFavorite and useSetFavorite
- /favorites page, a Favourites item in the Library group of the menu, on the
  Library page and in the phone Library tab
2026-11-16 10:56:12 +01:00
f7c24fa6f4 Merge pull request 'Favourites in the API and in OpenSubsonic apps' (#17) from feat/favorites-api into main 2026-11-16 09:51:37 +00:00
tgiachi
74f683d26e feat: favourites of songs, albums and artists, in the API and in apps
A person can mark songs, albums and artists as favourites. They are theirs
alone: never shown to a friend, never sent anywhere. Only what can be played is
listed.

- migration 0035 favorites, internal/favorites, storage.FavoritesRepo
- PUT/DELETE /me/favorites/{kind}/{id}, GET /me/favorites/{kind} and
  GET /me/favorites/ids, in the OpenAPI spec
- catalog.Filter IDs now also reads artists by id
- OpenSubsonic: star, unstar, getStarred2, the starred date on songs, albums and
  artists, and getAlbumList2 of type starred
2026-11-16 10:51:07 +01:00
17c134ef8b Merge pull request 'OpenSubsonic: playlists and listens' (#14) from feat/opensubsonic-playlists into main 2026-11-16 09:22:34 +00:00
tgiachi
a0dc4458ef feat: OpenSubsonic playlists and listens
Apps can use the playlists of a person and report what they listened to.

- getPlaylists, getPlaylist, createPlaylist (with songs, or in place of an
  existing one), updatePlaylist (name, comment, songs to add, places to remove),
  deletePlaylist: the same playlists as the web app
- scrobble records a complete listen once however many times an app tries
  again, and shares it on Mastodon when the person connected it; a now playing
  message records nothing; getNowPlaying answers with nothing
- README section on connecting other apps
2026-11-16 10:22:11 +01:00
2cb67b1bdc Merge pull request 'OpenSubsonic: playback, covers, lists and search' (#13) from feat/opensubsonic-media into main 2026-11-16 08:45:30 +00:00
tgiachi
ccee5e8719 feat: OpenSubsonic playback, covers, lists and search
Apps can play and browse: stream and download send the original file (Range,
HEAD), getCoverArt serves the cover of an album, an artist or the album of a
song (300 pixels or less is the small one), getAlbumList2 knows every kind of
list, getRandomSongs and getSongsByGenre list songs, search3 finds artists,
albums and songs, and the starred calls answer with nothing so apps do not break.

- catalog.Filter has IDs to read albums and songs by id
- storage.SubsonicRepo answers the album and song lists (random, newest,
  frequent, recent, by name, by artist, by year, by genre)
2026-11-16 09:45:07 +01:00
90d1b7949f Merge pull request 'OpenSubsonic: core (auth, system, browsing)' (#12) from feat/opensubsonic-core into main 2026-11-16 08:32:37 +00:00
tgiachi
1ae8e77d81 feat: OpenSubsonic core, login with a device password
/rest speaks the OpenSubsonic API (Subsonic 1.16.1) so that other apps can browse
the music of a server. A call logs in with the password of a device: an apiKey,
Subsonic's token (u, t, s) or the password itself (u, p). The account password is
never accepted there.

- devices: ByKey, ByToken, ByPassword and the note of last use
- opensubsonic package: JSON and XML answers, ping, getLicense,
  getOpenSubsonicExtensions, tokenInfo, getMusicFolders, getArtists, getArtist,
  getAlbum, getSong, getGenres
- storage.SubsonicRepo: year, genres, size, bitrate, suffix and added date
2026-11-16 09:32:11 +01:00
32214127c9 Merge pull request 'A password for each app or device' (#11) from feat/device-passwords into main 2026-11-16 08:15:38 +00:00
tgiachi
010f2e5057 feat: a password for each app or device
A person can make a password for each app that connects to their server, in
Settings, Apps and devices. The secret is shown once, can be taken back, and
is for the music API of other apps only: it cannot sign in or change the
account. Secrets are kept sealed (AES-256-GCM, key derived from the jwt secret)
because token login needs them in clear, and a hash finds a device by its key.

- migration 0034 device_passwords (sqlite, postgres)
- internal/devices service, storage repo
- GET/POST /me/devices, DELETE /me/devices/{id}, in the OpenAPI spec
- Settings section with copy and remove
2026-11-16 09:15:25 +01:00
9451765861 Merge pull request 'Show how the genres I listen to changed over time' (#6) from feat/genre-timeline into main 2026-11-15 17:19:26 +00:00
tgiachi
08c83c948f feat: how the genres I listen to changed over time
- GET /stats/listening has genre_timeline: the share of the five biggest genres, of the smaller ones and of the songs with no genre, for each year, or for each month when all the listens are in one year, in the listener's time zone; years and months with no listen are empty
- web: a stacked column chart on the Statistics page, coloured in tints of the colour of this server so it follows every theme, with a legend; left out when there is only one column
- README: the new field
2026-11-15 18:17:33 +01:00
c52386f335 Merge pull request 'A statistics page' (#4) from feat/statistics into main 2026-11-15 17:06:18 +00:00
e6af9a118e Merge pull request 'Show the version of Sonda' (#3) from feat/show-version into main 2026-11-15 17:05:46 +00:00
tgiachi
d51f155a4d feat: a statistics page
- GET /stats/library: the songs that can be played with their artists, albums, length and size, the files by format, the share of each genre and decade
- GET /stats/listening: listens, time listened, songs and artists, listens by year, hour and weekday in the listener's time zone, top artists and songs, the share of each genre, for all time or a period
- a song with several genres is split between them, so the shares add up
- web: a Statistics page in the Your listening group, with bars made of CSS and four periods
- the MP3 files, which the scanner calls mpeg, are shown as MP3
- README: the two endpoints
2026-11-15 17:55:43 +01:00
tgiachi
0742ee88a9 fix: the new module path in the build info file 2026-11-15 17:32:15 +01:00
tgiachi
14710c3a55 Merge remote-tracking branch 'origin/main' into feat/show-version 2026-11-15 17:31:25 +01:00
tgiachi
a880b87a9e chore: move the module path to git.kmalloc.org/squid/sonda
Migrating hosting from Codeberg to git.kmalloc.org. Renames the
module path in go.mod, every internal import, and the OCI image
source label in the Dockerfile. Build and full test suite verified
green after the rename.
2026-11-15 17:30:29 +01:00
tgiachi
00e5254fde feat: show the version of Sonda
- GET /version (signed-in users only) answers the version and, when the binary knows it, the commit it was built from and whether the files had uncommitted changes
- the commit is read from the build info Go records in a git checkout, so no build flag is needed
- the side menu shows the version under the privacy line, and Settings has an About section with it
- the menu's own requests (friends, version) are not counted as requests of an admin page in the Shell tests
2026-11-15 17:30:14 +01:00
squidd
69c85a7b52 Merge pull request 'Brand pass, part two: the app icons and the wording' (#200) from chore/brand-pass-2 into main 2026-11-15 17:15:52 +01:00
tgiachi
c4982d85c3 chore: brand pass, part two
- the favicon and the four PNG icons are in the colours of the current theme (#08161d ground, #37e0c2 wave)
- IT: Rimuovi for every remove, Elimina where a file is deleted
- EN: Create (not Make) for an invite, a playlist and a token; '{{genre}} mix' in lower case
- phone tabs: the Friends bar is amber only when Friends is the open tab
- README: songs in the prose, tracks only in paths and fields
- a short description in the page head
2026-11-15 17:14:51 +01:00
squidd
9c636fa65a Merge pull request 'A brand pass: one wording for the same thing' (#198) from chore/brand-pass into main 2026-11-15 17:10:45 +01:00
tgiachi
32dd307535 chore: a brand pass, one wording for the same thing
- the provider settings are named where they are (Admin → Providers), not 'the server settings'
- EN: deleting duplicates says delete, 'song' everywhere, 'at least once' for the forgotten songs, 'email', 'photos' for artist pictures, singular and plural for the history months
- IT: impersonal like the rest of the text, 'niente' not 'nulla', 'mandato' for what is sent to Lidarr, 'playlist smart', 'importazione'
- type: nothing under 13px, the federation pages use the scale, dialog titles are bold like every heading
- no shadow on the update notice
- web manifest colours are the ones of the current theme
- README: 'turned on', 'email'
2026-11-15 17:09:37 +01:00
squidd
8be9e93551 Merge pull request 'Fold the side menu to a strip of icons' (#196) from feat/sidebar-collapse into main 2026-11-15 15:11:04 +01:00
tgiachi
78f3f7ec9e feat(web): fold the side menu to a strip of icons
- a button next to the logo folds the menu to icons and opens it again
- folded, each link keeps its name for a screen reader and shows it as a tooltip, the group names stay for a screen reader, the logo becomes the mark
- the choice is kept in this device's storage
- no button on a phone, where the tabs replace the menu
2026-11-15 15:09:58 +01:00
squidd
0fb57fe4f0 Merge pull request 'An icon next to each link in the side menu' (#194) from feat/sidebar-icons into main 2026-11-15 15:06:39 +01:00
tgiachi
3512f0cbaa feat(web): an icon next to each link in the side menu
- each link has a lucide icon in place of the dot; the icon of the open page is the colour of this server, Friends keeps the friend colour
- the group headings line up with the words again
- tests: every link has a decorative icon, no two pages share one
2026-11-15 15:05:17 +01:00
squidd
fee06e2bb9 Merge pull request 'A page of the artists I sent to Lidarr, and whether they arrived' (#192) from feat/lidarr-requests into main 2026-11-15 12:33:31 +01:00
tgiachi
af933ad9ea feat(lidarr): a page of the artists I sent to Lidarr, and whether they arrived
Sonda kept no record of what an admin sent to Lidarr. Each send is now kept
(migration 0033, lidarr_requests), once for each artist, with the first date.
GET /lidarr/requests lists them newest first and says for each whether its
music is in the library: it is noticed when the list is read, by the artist
that was sent or by an artist of the same name that a scan made, and the day
it first was is kept.

The web app has a Requests page for admins, under Discover in the menu and on
Home on a phone, with the waiting and the arrived artists apart.
2026-11-15 12:32:29 +01:00
squidd
d31d4da1bd Merge pull request 'Organise the menu in groups' (#190) from feat/sidebar-groups into main 2026-11-15 12:17:14 +01:00