Skip to content

feat(jellycompat): sign Jellyfin apps in with Quick Connect - #2339

Merged
Quick104 merged 9 commits into
mainfrom
feat/jellycompat-quick-connect
Oct 12, 2026
Merged

Quick104 merged 9 commits into
mainfrom
feat/jellycompat-quick-connect

Conversation

@Quick104

@Quick104 Quick104 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #2144
Related issue: N/A
Validation tasks: none

Jellyfin apps can't use Quick Connect with Silo. /QuickConnect/Enabled answers false and the other Quick Connect routes don't exist, so people type a password with a TV remote and pick a profile with the username#profile / password#pin syntax. An account without a Silo password, such as one that signs in only through SSO, can't sign in from a Jellyfin app at all.

This adds Jellyfin's Quick Connect on top of Silo's device sign-in. The Jellyfin app shows a six-digit code, and the person approves it where they are signed in to Silo (the /activate page, or a Jellyfin app that is already signed in), choosing which profile the app uses.

Approach

  • A Quick Connect request is a device sign-in request with a new client_purpose, jellyfin_quick_connect; the migration only widens the CHECK constraint. It shares device sign-in's lifetimes, opened hold, states, revocation and multi-node behavior, with all state in Postgres.
  • The Jellyfin routes follow Jellyfin's shapes and status codes: /QuickConnect/Enabled, /QuickConnect/Initiate (POST, and GET for Jellyfin 10.8 apps), /QuickConnect/Connect, /QuickConnect/Authorize, and the AuthenticateWithQuickConnect sign-in under Users. Collecting an approved request mints a compat session the way password sign-in does, bound to the approved profile. That session is written in the transaction that consumes the request, and asking again with the same secret while the request lives returns the same session, as Jellyfin does, so an app that lost the answer can still sign in.
  • Codes are six digits, the form Jellyfin apps show. Each code is derived one-way from the request's secret, so Connect can return it on every poll (Jellyfin's Android TV app redraws the code from the poll) while the server keeps storing codes only as hashes.
  • The approval names a profile. Silo approvers use approve-handoff, whose profile comes from the verified X-Profile-Id and X-Profile-Token, so a PIN-protected profile needs its PIN. A signed-in Jellyfin app approves with /QuickConnect/Authorize for its own profile. approve answers 409 for these requests, and the native poll never collects them, since a native session could pick any profile.
  • Six digits are easy to guess, so a six-digit code is looked up only for the account's own session. getDeviceLogin stays public but now reads a bearer token when one is sent (a new AttachSession gate): without a valid one a six-digit lookup answers 401, from an impersonation session 403, the same for every code. Every six-digit lookup or decision also spends a per-account budget of 20 per 15 minutes, kept in Redis when the server has it, on top of the per-address device_lookup budget. The frozen /api/v1 routes never see a Quick Connect request.
  • /api/v2 changes are additive: jellyfin_quick_connect in the device capability, the new client_purpose value, 401/403/429 on the lookup for six-digit codes, and approve-handoff accepting Quick Connect requests.
  • The web /activate page takes six-digit codes, asks a signed-out person to sign in first, and for a Quick Connect request lists the account's profiles with a PIN field for protected ones. It doesn't re-read a Quick Connect request after a decision, because each lookup spends the budget.
  • Docs: docs/jellycompat-api.md, docs/architecture/device-login.md, docs/auth-api.md.

Validation

  • Go tests cover the Quick Connect routes and their Jellyfin shapes, session minting, the compat rate limits, the v2 lookup, decisions and capability, and AttachSession. Postgres tests cover start, approval and collection, the budget, deny and expiry, two nodes, approval from a Jellyfin session, expired codes being freed, the temporary-password refusal, and a failed session write leaving the request collectable, alongside the existing device sign-in, provider re-check and password-change database tests. All pass.
  • Web tests cover the /activate flows: six-digit entry, sign-in first, profile and PIN approval, wrong PIN, PIN lockout, declining, impersonation and the rate limit. All pass.
  • Full gate from CONTRIBUTING: passes, except internal/mediasample's real-FFmpeg tests, which fail the same way on main in this environment.
  • A Silo dev deployment built from this branch, with the bundled Jellyfin Web 10.11.6:
    • Before the change, Enabled answered false, Initiate 404, and an account with local password sign-in turned off got 401 from AuthenticateByName.
    • Jellyfin Web signed in with Quick Connect after the code was approved on /activate for a PIN-protected profile, and the stored compat session was bound to that profile. A repeated exchange returned the same session, and after sign-out the secret got 404.
    • Jellyfin Web, signed in, approved a second device's code from its own Quick Connect page.
    • The account without local password sign-in signed in through Quick Connect while password sign-in still answered 401.
    • Anonymous six-digit lookups answered 401 for live and unknown codes; the per-account budget refused the 21st lookup with Retry-After.
  • Not tested: the Jellyfin Android TV app, Swiftfin and other native Jellyfin apps (no device in this setup). That the Android TV app redraws the code from Connect comes from its source.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/issue-2144/

Risks

  • Anyone who can reach the Jellyfin port can open Quick Connect requests, bounded per address by the device_start budget. Many addresses could fill a noticeable share of the six-digit space while their requests live, which makes a mistyped code more likely to land on someone else's request. The approval card shows the device, its app, when it asked and its masked address. Eight-digit codes derived the same way would remove the six-digit special handling (Jellyfin Web accepts longer codes); this keeps Jellyfin's six digits.
  • Silo's iOS and Android apps can't approve Quick Connect codes yet: both block typed six-digit codes, iOS refuses the new purpose, and Android would call approve and get 409. /activate works in a phone browser meanwhile.
  • getDeviceLogin now checks a bearer token when one is sent, one session read, as on any authenticated route.
  • The down migration deletes Quick Connect requests, which live at most 30 minutes.

Follow-ups: Apple and Android approval of Quick Connect codes.
User manual: Silo-Server/siloserver.org#184, draft docs PR Silo-Server/siloserver.org#185

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5 (implementation and review), claude-sonnet-5-5 (review subagent and validation check)
  • Involvement: Fully AI-generated at a maintainer's direction; not yet verified by a person
  • Adversarial review: before opening, a multi-agent review of the diff (three finders and a validation check); its confirmed findings were fixed, among them a 404 instead of 401 for six-digit lookups with an expired token, the PIN-lockout message, and collection after a temporary password. Codex gpt-6.1-sol (xhigh) reviewed ffd7d2c and found one issue: a failure after collection stranded the approval (later retries got 404). Fixed in 739a73c as described in Approach.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6c6a1380-9be6-45d4-bad7-add75a23f09a

📥 Commits

Reviewing files that changed from the base of the PR and between 1747a12 and 7a9d6a0.


📒 Files selected for processing (40)
  • cmd/silo/main.go
  • contracts/api/v2/fixtures/get_device_login_capability_ok.json
  • contracts/api/v2/openapi.json
  • contracts/api/v2/scenarios/api/api-v1-auth.json
  • docs/architecture/device-login.md
  • docs/auth-api.md
  • docs/jellycompat-api.md
  • internal/api/handlers/auth_device.go
  • internal/api/middleware/attach_session_test.go
  • internal/api/middleware/auth.go
  • internal/api/router.go
  • internal/apiv2/device_login.go
  • internal/apiv2/device_login_test.go
  • internal/apiv2/gates.go
  • internal/apiv2/pilot_fakes_test.go
  • internal/auth/device_login.go
  • internal/auth/device_login_quick_connect_db_test.go
  • internal/auth/device_login_revocation_db_test.go
  • internal/auth/device_login_test.go
  • internal/auth/provider_recheck_db_test.go
  • internal/jellycompat/handlers_auth.go
  • internal/jellycompat/handlers_quickconnect.go
  • internal/jellycompat/handlers_quickconnect_test.go
  • internal/jellycompat/handlers_system.go
  • internal/jellycompat/login.go
  • internal/jellycompat/path_normalization.go
  • internal/jellycompat/router.go
  • internal/jellycompat/server.go
  • internal/jellycompat/session_repository.go
  • internal/jellycompat/session_store.go
  • internal/jellycompat/testdata/media_routes.txt
  • internal/ratelimit/attempts.go
  • migrations/sql/20261012003048_device_login_jellyfin_quick_connect.sql
  • web/src/api/client.ts
  • web/src/api/v2/schema.ts
  • web/src/components/auth/QuickConnectApproval.tsx
  • web/src/lib/deviceCode.test.ts
  • web/src/lib/deviceCode.ts
  • web/src/pages/ActivateDevice.test.tsx
  • web/src/pages/ActivateDevice.tsx

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@silo-kody

silo-kody Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review (gpt-6.1-sol, reviewed ffd7d2c)

One P2 finding on recovery after Quick Connect collection. Focused Go checks passed. Failure injection exercised the production compat resolver and handler with a one-shot collector double; the database commit order was verified from source. PostgreSQL tests skipped because no test database was configured. Web tests could not start because Vitest was unavailable, and native Jellyfin apps were not exercised.

AI-generated review: Codex (gpt-6.1-sol) in T3 Code, requested by the PR's automated run.

Comment thread internal/jellycompat/login.go Resolved
Comment thread internal/jellycompat/login.go Resolved
Comment thread web/src/pages/ActivateDevice.tsx Resolved
…h a moved request after decline

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@silo-triage silo-triage Bot added enhancement New feature or request go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish labels Oct 12, 2026
@Quick104
Quick104 merged commit 6dc5163 into main Oct 12, 2026
32 checks passed
@Quick104
Quick104 deleted the feat/jellycompat-quick-connect branch October 12, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] Support Quick Connect on the Jellyfin-compatible API

1 participant