sonda/internal/storage
Repository files (latest commit first)
Filename Latest commit message Latest commit date
tgiachi 89826fcd07 feat(federation): shared libraries and the signed read API for friends
A friend's server can now read what an admin chose to share.

- A library has a shared flag, off by default (migration 0024), set with
  PATCH /libraries/{id}. Changing it never waits for a scan.
- Requests between friends are signed with each server's Ed25519 key: the
  method, the path and query from /api/v1/peer on, a date, a nonce and the
  hash of the empty body. A date more than two minutes off, a nonce used
  before, an unknown or removed key and a bad signature all get the same
  401. A friend still waiting for approval gets 403, and while federation is
  off the routes are missing.
- Routes under /api/v1/peer: info, artists, albums, tracks, covers and
  streaming with Range. The catalogue, the counts and the format come from
  the shared libraries only, and the file served is the one in a shared
  library. No path, library id, listen, taste, user or provider data is part
  of an answer.
- A friend never makes this server build a cover, read an audio file or ask
  a provider: only covers already built from the audio files are served.
- Per-friend limits, set by the admin: parallel streams (default 3) and KiB
  a second (default 4096, 0 for none), shared by all the streams of a friend.
- A log of the last requests friends made (route, status, bytes; never the
  query), kept for 7 days, in GET /federation/requests.
- POST /federation/friends/{id}/check lets the side that pasted an invite
  find out that the other admin approved; a signed call from a friend this
  server is waiting for makes it active too.
- Admin: a Shared with friends switch on each library, which asks first, and
  limits, recent requests and a Check button in the Federation section, in
  English and Italian.
- OpenAPI paths and schemas, contract test, two real servers checked end to
  end with tagged audio files.
2026-11-13 15:04:07 +01:00
..
about_test.go feat(about): artist descriptions from Wikipedia 2026-11-11 21:36:27 +01:00
artist_jobs.go feat(jobs): background jobs for artist photos and descriptions 2026-11-12 09:58:45 +01:00
artist_jobs_test.go feat(jobs): background jobs for artist photos and descriptions 2026-11-12 09:58:45 +01:00
auth_test.go feat(auth): accounts are identified by an email address 2026-11-12 14:40:33 +01:00
catalog.go feat(federation): shared libraries and the signed read API for friends 2026-11-13 15:04:07 +01:00
catalog_test.go feat(search): search ignores accents 2026-11-12 10:17:21 +01:00
discovery.go feat(search): search ignores accents 2026-11-12 10:17:21 +01:00
discovery_test.go fix(discovery): purge lock, cleanup chains and rescans that cannot read 2026-11-11 17:36:14 +01:00
duplicates.go fix(duplicates): move the playlist items of a removed copy to the one that stays 2026-11-12 17:01:36 +01:00
duplicates_test.go fix(duplicates): move the playlist items of a removed copy to the one that stays 2026-11-12 17:01:36 +01:00
federation.go feat(federation): shared libraries and the signed read API for friends 2026-11-13 15:04:07 +01:00
federation_test.go feat(federation): shared libraries and the signed read API for friends 2026-11-13 15:04:07 +01:00
feedback.go fix(feedback): purge only what the provider named, no leak between users 2026-11-11 20:18:04 +01:00
feedback_test.go fix(feedback): purge only what the provider named, no leak between users 2026-11-11 20:18:04 +01:00
images.go feat(images): find the cover of an album that has no MusicBrainz id 2026-11-12 16:22:02 +01:00
images_test.go feat(images): find the cover of an album that has no MusicBrainz id 2026-11-12 16:22:02 +01:00
library.go feat(federation): shared libraries and the signed read API for friends 2026-11-13 15:04:07 +01:00
library_test.go fix(images): purge removes every archive cover, the id of an emptied album moves on 2026-11-12 09:21:11 +01:00
listening.go fix(listening): report a deleted account first and document one event per play 2026-11-11 15:02:28 +01:00
mixes.go feat(mixes): a picture for each mix, a collage of album covers 2026-11-13 09:58:04 +01:00
mixes_test.go feat(mixes): a picture for each mix, a collage of album covers 2026-11-13 09:58:04 +01:00
naming.go feat(naming): an admin section that shows what Claude costs 2026-11-13 11:14:45 +01:00
naming_test.go feat(naming): an admin section that shows what Claude costs 2026-11-13 11:14:45 +01:00
playlists.go feat: playlists with a cover, a collage of the covers of their albums 2026-11-13 11:32:01 +01:00
playlists_test.go feat: playlists with a cover, a collage of the covers of their albums 2026-11-13 11:32:01 +01:00
providers.go feat(lidarr): set up Lidarr as a provider and read what it offers 2026-11-12 11:04:53 +01:00
providers_test.go feat(lidarr): set up Lidarr as a provider and read what it offers 2026-11-12 11:04:53 +01:00
refresh.go fix(auth): close session races found in review 2026-11-11 12:45:06 +01:00
repos_test.go feat(auth): accounts are identified by an email address 2026-11-12 14:40:33 +01:00
search_key.go fix(search): empty folded queries, compatibility forms, final sigma, start-up log 2026-11-12 10:24:44 +01:00
search_keys_test.go perf(storage): fix stale match and search keys in batches on PostgreSQL 2026-11-12 14:08:40 +01:00
sharing_test.go feat(federation): shared libraries and the signed read API for friends 2026-11-13 15:04:07 +01:00
smart.go feat(smart): covers on the Smart playlists page 2026-11-13 11:41:23 +01:00
smart_test.go feat(smart): covers on the Smart playlists page 2026-11-13 11:41:23 +01:00
storage.go fix(discovery): concurrent writes, adopted artists and a client that leaves 2026-11-11 16:47:33 +01:00
storage_test.go feat(federation): shared libraries and the signed read API for friends 2026-11-13 15:04:07 +01:00
taste.go fix(taste): order by the score, clamp future events, keep tags short 2026-11-11 18:52:08 +01:00
taste_test.go fix(taste): order by the score, clamp future events, keep tags short 2026-11-11 18:52:08 +01:00
upgrade_test.go fix(library): make the libraries upgrade and validation robust 2026-11-11 13:34:44 +01:00
users.go feat(auth): accounts are identified by an email address 2026-11-12 14:40:33 +01:00
usersettings.go fix(settings): strict body, deleted-account race, doc wording 2026-11-11 19:20:42 +01:00
usersettings_test.go fix(settings): strict body, deleted-account race, doc wording 2026-11-11 19:20:42 +01:00