navidrome/cmd
Deluan Quintão b76ae14286
feat(jellyfin): add Quick Connect sign-in (#6174)
* feat(jellyfin): add Quick Connect sign-in

Jellyfin clients can now sign in without a password: the client shows a
6-digit code, a signed-in user approves it, and the client redeems a secret
for its access token.

- core/quickconnect: in-memory store shared by both routers through wire.
  Codes expire after 10 minutes; a secret redeems only once (Jellyfin
  allows repeats for 10 minutes); at most 1000 pending requests.
- Jellyfin API: Initiate, Connect, Authorize and AuthenticateWithQuickConnect.
  Admins may approve for another user via UserId, like Swiftfin's admin page.
  Initiate and redeem share the login rate limiter; Connect does not, since
  Finamp and Streamyfin poll it every second.
- Web UI: a Quick Connect item in the user menu looks up the code and shows
  the app and device before approving, so a user can't be tricked into
  approving an unknown device blindly.
- Jellyfin.QuickConnect option, on by default like Jellyfin. It only matters
  when the Jellyfin API is enabled.

* refactor(jellyfin): tidy Quick Connect naming and route guards

Group the Quick Connect routes under one requireQuickConnect guard, make the
request's device a named field so req.Device.ID can't be mistaken for a
request id, and rename the web API response type to quickConnectDevice.

* refactor(jellyfin): remove duplicated Jellyfin date formatting function

* test(jellyfin): set play count and starred in the song fixture literal

* refactor(jellyfin): inline the Quick Connect redeem body and use the shared date helper

* fix(jellyfin): bound the client fields Quick Connect keeps in memory

Initiate is unauthenticated and keeps the Client, Device, DeviceId and Version
header fields for up to ten minutes. With no header size limit, each pending
request could hold about 1 MB, and even a short field kept the whole header
alive because the parsed values are substrings of it. Reject fields over 512
bytes and copy the stored values.

Also answer 500 instead of 401 when the redeem user lookup fails for a reason
other than the user being gone.

* fix(jellyfin): rate-limit Quick Connect code approval

Any signed-in user could try codes without limit on the Jellyfin Authorize
endpoint and the web UI lookup/authorize endpoints, and so could approve
another person's pending device for their own account. Apply the same per-IP
limiter as the login (AuthRequestLimit/AuthWindowLength) to both surfaces.
2026-09-19 14:57:01 -04:00
..
artwork.go fix(artwork): never retry absent artwork on its own (#6054) 2026-09-01 20:48:41 -04:00
artwork_test.go fix(artwork): never retry absent artwork on its own (#6054) 2026-09-01 20:48:41 -04:00
backup.go feat(cli): add 'doctor' and 'search rebuild' commands to recover from FTS5 corruption (#6069) 2026-09-11 22:26:28 -04:00
cmd_suite_test.go feat(plugins): experimental support for plugins (#3998) 2025-06-22 20:45:38 -04:00
doctor.go feat(cli): add 'doctor' and 'search rebuild' commands to recover from FTS5 corruption (#6069) 2026-09-11 22:26:28 -04:00
doctor_test.go feat(cli): add 'doctor' and 'search rebuild' commands to recover from FTS5 corruption (#6069) 2026-09-11 22:26:28 -04:00
inspect.go chore: go fix 2026-05-28 22:13:05 -03:00
missing.go feat(cli): add missing file list and remap subcommands (#5928) 2026-09-12 12:08:25 -04:00
missing_test.go feat(cli): add missing file list and remap subcommands (#5928) 2026-09-12 12:08:25 -04:00
pls.go fix(cli): write pls -p playlist output to stdout (#5996) 2026-08-20 09:04:09 -04:00
pls_test.go fix(cli): write pls -p playlist output to stdout (#5996) 2026-08-20 09:04:09 -04:00
plugin.go feat(cli): add an artwork command group for diagnosing and re-driving artwork (#5957) 2026-08-14 21:07:56 -04:00
plugin_test.go feat(cli): add a 'navidrome plugin' CLI for managing and inspecting plugins (#5682) 2026-06-28 13:26:32 -04:00
root.go feat(jellyfin): add opt-in LAN auto-discovery (#6169) 2026-09-19 13:33:19 -04:00
root_test.go fix: assorted scanner, plugin, and server fixes from the Go 1.27 work (#6050) 2026-08-30 21:24:50 -04:00
scan.go feat(artwork): new artwork pipeline with background resolution and Low Quality Image Placeholders (#5847) 2026-08-09 15:03:27 -04:00
scan_test.go perf(db): keep query planner statistics trustworthy with full ANALYZE (#5740) 2026-07-13 12:04:29 -04:00
search.go feat(cli): add 'doctor' and 'search rebuild' commands to recover from FTS5 corruption (#6069) 2026-09-11 22:26:28 -04:00
signaller_nounix.go Fix typo 2024-05-01 23:09:11 -04:00
signaller_unix.go feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
svc.go fix(service): rewrite systemd service template for kardianos/service v1.3.0 (#5743) 2026-07-08 16:40:07 -04:00
svc_test.go fix(service): rewrite systemd service template for kardianos/service v1.3.0 (#5743) 2026-07-08 16:40:07 -04:00
user.go fix(cli): restore int cast for syscall.Stdin on Windows 2026-05-20 19:33:42 -03:00
utils.go feat(cli): add 'doctor' and 'search rebuild' commands to recover from FTS5 corruption (#6069) 2026-09-11 22:26:28 -04:00
wire_gen.go feat(jellyfin): add Quick Connect sign-in (#6174) 2026-09-19 14:57:01 -04:00
wire_injectors.go feat(jellyfin): add opt-in LAN auto-discovery (#6169) 2026-09-19 13:33:19 -04:00