Commit graph

303 commits

Author SHA1 Message Date
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
tgiachi
b2549336ba feat(web): the menu in groups
The left menu was a flat list of 14 links. It is now in groups, in the order
of what a person does: find (Home, Search, Discover), the library (Artists,
Albums, Songs, Playlists, Smart playlists, Mixes), their listening (History,
Import) and Friends, with Settings and Admin at the foot. Only the library and
the listening have a quiet heading; space tells the groups apart.

The phone follows it: the Library page lists the same rows in the same order
with a "Your listening" section, Discover (which has no tab) is a row at the
end of Home, and More keeps Settings and Admin.
2026-11-15 12:14:57 +01:00
squidd
2b6e80fda6 Merge pull request 'Browse my listening history by year and month' (#188) from feat/history into main 2026-11-15 12:08:08 +01:00
tgiachi
9f63121028 feat(history): browse my listening by year and month
GET /listens/months counts the listens that count in each calendar month,
newest first, in the time zone the client sends (the zone database is built
into the binary). GET /listens takes from and until to read one month, and
each listen now names its artists.

The web app has a History page: a button for each year with its listens, the
months of the year as bars, and the listens of the chosen month a day at a
time, with the choice kept in the address.
2026-11-15 12:07:19 +01:00
squidd
9ce7beb42d Merge pull request 'Suggestions learned from my own listening' (#186) from feat/suggestions into main 2026-11-15 11:10:26 +01:00
tgiachi
7c961028bb feat(discover): suggestions learned from my own listening
A new model (internal/affinity) splits my listening into sittings (plays less
than 30 minutes apart) and links the artists that are often played in the same
sitting. It is built from my listening events and from the plays of artists I
have no music of that an import kept, on my server, with no provider, and is
built again when plays are added (migration 0032 keeps it as a cache).

GET /me/suggestions gives two lists, each artist with the artists it goes
with: the ones I have and did not play for two months, and the ones I played
at least three times and have no music of. It needs discover_from_listening.
POST /me/suggestions/wishlist puts an artist I played on my wishlist by name.
Discover has a "From your listening" tab for both lists.
2026-11-15 11:09:19 +01:00
squidd
7b18478fe4 Merge pull request 'Keep the artist and the time of plays of artists I do not have' (#185) from feat/outside-plays into main 2026-11-15 10:51:26 +01:00
tgiachi
3ba087bcc5 feat(import): keep the artist and the time of plays of artists I do not have
The plays of songs that are not in the library were only counted. Now, when
such a play counts as listened (not a skip, long enough), its artist and its
time are kept in a new table (migration 0031, outside_plays), so a model can
later learn which artists are played together, also those not in the library.
No title, album, IP address, country or platform is stored. The same play is
kept once however many times the export is imported, and the report says how
many were kept (history.kept_outside).
2026-11-15 10:50:29 +01:00
squidd
01cbab21be Merge pull request 'A page for imports, with the numbers of each one kept' (#182) from feat/import-page into main 2026-11-15 10:34:53 +01:00
tgiachi
aa4883b955 feat(import): an Import page, with the numbers of every import kept
The report of an import used to be shown once in Settings and lost. Each
import is now stored (migration 0030, spotify_imports) as the report in
JSON, and GET /me/import/spotify lists the past ones, newest first.
POST /me/import/spotify answers with the same shape plus id and created_at.

The web app gets an Import page (menu, More tab) with the form and one card
for each past import: plays read, added, already there, not in the library,
the playlists it made and the artists that are missing. Settings only links
to it. An import that finds nothing is not kept, and a report that cannot be
stored is still returned to the person who asked.
2026-11-15 10:34:12 +01:00
squidd
83b578ea4c Merge pull request 'Import my Spotify history and playlists' (#180) from feat/spotify-import into main 2026-11-14 16:27:02 +01:00
tgiachi
c08a234159 feat(import): bring my Spotify history and playlists in
I want my listening history and my playlists from Spotify in Sonda, so that Mixes, Discover and the smart playlists know what I listened to before.

- POST /me/import/spotify takes the zip of a Spotify data export, or the JSON files in it (extended streaming history, the older StreamingHistory files, the playlists), as a multipart form. A request may be up to 512 MB; the zip is limited in how much it may inflate and how many files it may hold, and only the history and playlist files are opened.
- Everything is read on the server and nothing is sent anywhere. The files are not kept, and of each play only the song, artist, album, time and how it ended are read: never the IP addresses, the country or the platform.
- A play is matched to a song of the library by artist and title (no case, accents or punctuation; a "Remastered" note on either side; any credited artist; a compilation by its album). A match is recorded as a listen at the time of the play: complete, skip or play. Nothing is posted to Mastodon.
- Importing the same files again records nothing twice, and the same play in the two shapes of history file is counted once. One import per person at a time.
- A playlist becomes a playlist of mine with the songs that were found; one with a name I already have is left alone, and one with none of its songs found is not made.
- The report counts what was added, what was already there and what is not in the library, and lists the missing artists, most played first.
- Settings gets an Import from Spotify section; the API client can send files.
- English and Italian.
2026-11-14 16:25:58 +01:00
squidd
2bc74b2d26 Merge pull request 'Play every song at a similar volume with ReplayGain' (#178) from feat/replaygain into main 2026-11-14 16:03:40 +01:00
tgiachi
a92326c1b4 feat(player): play every song at a similar volume with ReplayGain
I want songs from different albums to play at about the same loudness without touching the volume.

- The scan reads REPLAYGAIN_TRACK_GAIN, REPLAYGAIN_ALBUM_GAIN and the two peaks from each file, offline, and keeps them on the file (migration 0029, SQLite and PostgreSQL). A tag that makes no sense (not a number, more than 60 dB) is left out. Files indexed before have none until a full rescan.
- A track in the API carries them as replay_gain (null when its first playable file says nothing).
- The web player levels each song with them: the sound passes through a gain node, so a quiet song can be raised too, but never so much that its peak would clip (and never more than 12 dB when there is no peak). Without Web Audio the element is turned down instead.
- A new Playback section in Settings chooses song by song (default), album by album or off; the choice stays on the device.
- README: the ReplayGain entry, and the old line that said the year was not in the index is removed.
- English and Italian.
2026-11-14 16:02:23 +01:00
squidd
e9f85c2f39 Merge pull request 'Attiva and disattiva in the Italian texts' (#176) from fix/italian-on-off into main 2026-11-14 11:02:09 +01:00
tgiachi
d29d824f56 fix(i18n): attiva and disattiva instead of accendi and spegni
Providers, federation, Lidarr and Discover now say attiva, attivo, disattivato in Italian, which reads better for settings than accendi and spegni.
2026-11-14 11:00:44 +01:00
squidd
a507741460 Merge pull request 'A pass over the Italian texts' (#174) from fix/italian-pass into main 2026-11-14 10:52:54 +01:00
tgiachi
8263e0ca43 fix(i18n): a pass over the Italian texts
Rifai tutto sounded wrong, and a number of other texts were calques from English or used different words for the same thing.

- Riesegui tutto instead of Rifai tutto.
- brano everywhere instead of canzone, eliminare instead of cancellare, Successivo and Precedente in the player, one kind of quotes and of apostrophe.
- Fixes to sentences with the wrong meaning or grammar: removing a friend, the invite hint, the jobs that need a provider turned on, the plural of what a purge removes, the Duplicates texts.
2026-11-14 10:52:15 +01:00
squidd
f3ab8f0c8e Merge pull request 'Show the albums added last on Home' (#172) from feat/recently-added into main 2026-11-14 10:29:41 +01:00
tgiachi
246cdc63d3 feat: Recently added on Home, with a newest-first order for albums
I can now see on Home what I added to the library lately.

- GET /albums takes sort=recent: the albums added last first, by the date of the newest file of the album that is not missing, then the newest album. The default stays by title and any other value is invalid_input.
- The albums shelf on Home is Recently added and asks for that order; See all leads to /albums?sort=recent, which the albums page understands.
- English and Italian.
2026-11-14 10:29:08 +01:00
squidd
2f1a86dedb Merge pull request 'Smart playlists by the year a song came out' (#170) from feat/smart-year into main 2026-11-14 10:20:24 +01:00
tgiachi
d3695d00d6 feat(smart): smart playlists by the year a song came out
I can now ask for songs from a year to a year, for example the eighties.

- The year is read from the tags of each file (the original date first, then the date) and kept on the track: migration 0028 adds tracks.year (SQLite and PostgreSQL).
- Two new rules, min_year and max_year, both included and checked (1000 to 2999, the first not after the second). The index answers them. A song with no year never matches.
- Files indexed before have no year until a full rescan reads their tags again; the editor and the API description say so.
- The smart playlist editor gets From year and Up to year, and the rules are described in words.
- English and Italian.
2026-11-14 10:19:39 +01:00
squidd
6028d8e686 Merge pull request 'Say in Settings when Mastodon no longer accepts my token' (#168) from feat/mastodon-revoked-token into main 2026-11-14 10:04:56 +01:00
tgiachi
a7a258464b feat(mastodon): say in Settings when the instance no longer accepts the token
When the instance refuses the token on a post (it was revoked or expired), the account now remembers it: GET /me/mastodon says problem: token_refused and nothing is posted until I connect again with a new token.

- migration 0027 adds mastodon_accounts.problem (SQLite and PostgreSQL).
- Only a refused token marks the account; an instance that is down does not.
- Saving the account again clears the problem.
- Settings shows the warning and the form with the instance already filled in, next to Disconnect.
- English and Italian.
2026-11-14 10:04:07 +01:00
squidd
2962698baa Merge pull request 'A Duplicates section in the admin area' (#166) from feat/admin-duplicates into main 2026-11-14 09:53:28 +01:00
tgiachi
4ede6d4118 feat(web): a Duplicates section in the admin area
I can now see the songs that are in more than one file and delete the extra copies from Admin.

- A table of the copies of each song (album, format, bitrate, size, length) with the copy to keep already chosen and changeable.
- The check that reads the files, with a question first, progress, Stop, and the result of the last run; the groups are read again when it ends.
- 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. It stops at the first refusal and says what was already deleted.
- With deleting off everything is visible and the delete buttons are disabled, with the reason.
- English and Italian.
2026-11-14 09:52:57 +01:00
squidd
58a596c88e Merge pull request 'Post what I listen to on Mastodon, if I connect an account' (#165) from feat/mastodon-post into main 2026-11-13 21:59:41 +01:00
tgiachi
0dc7782028 feat: post what I listen to on Mastodon, if I connect an account
In Settings a person connects their Mastodon account: the address of their instance and an access token that can only write posts. Nothing is connected by default, and disconnecting forgets the token.

- When a track of this server counts as a listen, it is posted as an unlisted status: title, artists, album and #NowPlaying, with no link. Music of a friend is never reported as a listen, so it is never posted. At most one post a minute for each person, in the background, with a bounded queue.
- PUT, GET and DELETE /me/mastodon. The token is never sent back.
- The address of the instance is typed by a person, so it must be a domain name on https, and the client never connects to a private, loopback or link-local address (checked on the address it really dials, so a name that points inside is no way in), never follows a redirect, ignores proxy settings and reads at most a megabyte.
- New table mastodon_accounts (SQLite and PostgreSQL) that goes with the account.
- README: the feature, and the credit for butterchurn and its presets.
2026-11-13 21:59:03 +01:00