- federation_settings (per user; off, followers-only, not discoverable
by default) and federation_keys (RSA-2048; NULL user = instance
actor), on the federation migration branch
- Private keys encrypted at rest with Fernet, keyed by HKDF-SHA256 from
FEDERATION_KEY_SECRET (now required, 32+ chars, never printed)
- Keys are created when a user first enables sharing and never
regenerated; sharing.shared_user() treats unknown and non-sharing
users identically
- One flask-smorest Api per app (get_api(app)), so apps with and
without federation never share an OpenAPI spec
- Test fixtures for a second, federation-enabled app on the same DB
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
- /api/v1/imports/options lists the available sources; `lastfm` only
appears when the server has a Last.fm API key
- POST /imports/file (multipart; format detected or forced with
?format=), POST /imports/lastfm, GET /imports, GET /imports/{id},
POST /imports/{id}/cancel
- Upload size limit (IMPORT_MAX_BYTES, default 200 MB) with a 413
- Documented in OpenAPI under the Imports tag
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
- API image (uv multi-stage, non-root, gunicorn, migrations on start,
health check) and UI image (nginx, CSP, config.js rendered from
API_BASE_URL); /healthz documented in OpenAPI
- docker compose runs db, api and ui; the "monitoring" profile adds
Prometheus, postgres-exporter and Grafana, all provisioned from files
- Grafana dashboards: API overview (RED), Last.fm API, Usage, Database
- Prometheus alert rules: API down, error rate, latency, auth failure
spike, ignored scrobbles, DB pool saturation, Postgres down
- Pool checkout gauge counts events (the pool's own counters lag the
checkin event); error ratios show 0 instead of "No data"
- Tests check dashboards and alerts only use metrics that exist
- scripts/generate_traffic.py drives realistic traffic for demos
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
- /2.0/ and /api/auth/ are described from the Last.fm method registry:
method enum, per-method parameter tables, auth requirements, notes,
request schemas and XML example responses
- Readable tags (Auth, Apps, Sessions, Tokens, Stats, Last.fm)
- docs/openapi.json is exported with `flask openapi write`; tests fail
if it drifts from the code, if any route is undocumented, or if a UI
route is missing its bearer-auth security declaration
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
- Stats service shared by both APIs: recent scrobbles, top artists,
albums and tracks over Last.fm periods, per-day/week/month counts
(with empty days filled) and totals
- Case-insensitive grouping that displays the most common spelling
- user.getInfo, user.getRecentTracks (now playing first, from/to),
user.getTopArtists/Albums/Tracks with Last.fm paging attributes
- /api/v1/me: now-playing, recent, top/{artists,albums,tracks},
counts and summary
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
- auth.getMobileSession (username + password), auth.getToken and
auth.getSession with Last.fm error codes 4/14/15
- /api/auth/ redirects clients' approval links to the web UI's
approve page; /api/v1/tokens lets the UI show and approve a token
- Tokens expire after an hour, are single use and bound to their app
- The legacy md5 authToken form is deliberately unsupported (it needs
unsalted password hashes)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- flask-smorest API under /api/v1 with a uniform JSON error shape;
spec at /api/openapi.json, Swagger UI at /api/docs, ReDoc at /api/redoc
- Register/login/logout/me with hashed, expiring bearer tokens,
documented as an OpenAPI bearer security scheme
- API application and client-session management endpoints
- CORS restricted to the configured UI origin(s)
- Flask no longer serves static files: it is API-only
- Login and registration metrics
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>