- feat: an event counts as a listen when it is `complete`, or when it was played for at least listening.min_listen_seconds (default 20, 1 to 3600). The rule is applied when the history is read, not when an event is stored, so changing the setting re-reads the past; streaming never counts - feat(api): POST /listens answers with `counted`, also for a duplicate - feat(api): GET /listens returns the signed-in user's own history, newest first, with `counted` per event, paging and ?counted=true; nobody sees anybody else's events - feat: a reported play time more than twice the track length plus ten seconds is rejected as implausible; looping and seeking back stay allowed, and a track of unknown length is not checked - feat(storage): TrackDurationMs and ListEvents on SQLite and PostgreSQL - docs: OpenAPI operations and schemas, README rule, setting, API table and a demo that reports a 25 s and a 3 s play and reads the history; the demo tones now last 30 s so a 25 s play is plausible - test: the rule at its boundaries, the plausibility bound, history order, paging and isolation on both databases, and the contract test for the new operation Closes #17
30 lines
1.1 KiB
TOML
30 lines
1.1 KiB
TOML
# Copy to sonda.toml and adjust. sonda.toml is git-ignored.
|
|
# Precedence: defaults < this file < environment variables
|
|
# (SONDA_ENV, SONDA_LISTEN, SONDA_DB_DRIVER, SONDA_DB_PATH, SONDA_DB_DSN,
|
|
# SONDA_JWT_SECRET, SONDA_LASTFM_API_KEY).
|
|
|
|
[server]
|
|
listen = "127.0.0.1:8080" # localhost by default
|
|
|
|
# Libraries (name + directory) are managed through the API: POST /api/v1/libraries.
|
|
[library]
|
|
scan_workers = 4 # parallel tag readers during a scan
|
|
|
|
[database]
|
|
driver = "sqlite" # "sqlite" or "postgres"
|
|
path = "sonda.db" # sqlite only
|
|
dsn = "" # postgres only, e.g. "postgres://user:pass@localhost:5432/sonda?sslmode=disable"
|
|
|
|
[log]
|
|
env = "production" # "dev" or "production"
|
|
|
|
[auth]
|
|
jwt_secret = "" # required, 32+ chars: openssl rand -hex 32
|
|
access_ttl_minutes = 15 # lifetime of an access token
|
|
refresh_ttl_hours = 720 # lifetime of a refresh token (30 days)
|
|
|
|
[listening]
|
|
min_listen_seconds = 20 # a play counts as a listen after this long, or when it completes
|
|
|
|
[providers.lastfm]
|
|
api_key = ""
|