Commit graph sonda/internal/api/http/handlers_usersettings.go
Author SHA1 Message Date
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
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
acede4bd91 fix(settings): strict body, deleted-account race, doc wording
- PATCH /me/settings accepts exactly one JSON object: text after it, null, a
  differently cased name or an unknown name are refused (400) and change nothing.
- A user deleted between the read and the write of the settings gives 401, not a
  500, on PostgreSQL too (foreign key violation mapped to user not found).
- The spec says a 401 can also mean the account no longer exists, and that the
  body is strict.
- README no longer says more than the setting does.
- Tests: strict body cases, tokens of a deleted account on GET and PATCH,
  recognising a foreign key violation on both databases.
2026-11-11 19:20:42 +01:00
tgiachi
e0592c0260 feat(settings): my own settings, starting with Discover from my listening
- GET and PATCH /me/settings: settings that belong to the signed-in user.
- First setting, discover_from_listening, is off by default. When on, Discover
  may start from the artists I listen to most, which sends their names to
  Last.fm.
- New user_settings table (migration 0011, SQLite and PostgreSQL), removed with
  the account. A user with no row has the private defaults.
- A misspelt setting is rejected instead of being ignored.
- Spec, contract test and README updated.

Refs #29
2026-11-11 19:16:26 +01:00