Skip to content

ADR-0035: Complete SnatchArr integration inside Jellyfin without an external identity provider

Context

SnatchArr (/ˈsnætʃ.ɑːr/, from English "snatch" — to grab a media release — plus the -arr suffix of the Servarr /ˈsɜːr.vɑːr/ automation family) serves as the operational front door of the media stack (ADR-0018). Jellyfin (/ˈdʒɛl.i.fɪn/, the free-software media server forked from Emby in December 2018, blending "jellyfish" and "fin") is the household media server where users browse libraries, watch shows, and manage playback.

The fleet's media products bring all their functions into Jellyfin itself so that any adopter can operate the entire stack from inside Jellyfin using only their Jellyfin account:

  1. Any-adopter constraint (no cluster, reverse proxy, or identity provider assumed): A typical adopter runs Jellyfin, SnatchArr, and one or more *arr applications — Sonarr (/ˈsoʊ.nɑːr/, television series, from "sonar" + -arr), Radarr (/ˈreɪ.dɑːr/, films, from "radar" + -arr), Lidarr (/ˈlaɪ.dɑːr/, music, from "lidar" + -arr), Readarr (/ˈriː.dɑːr/, books, from "reader" + -arr), and Whisparr (/ˈwɪs.pɑːr/, adult video scenes, from "whisper" + -arr) — plus Prowlarr (/ˈpraʊ.lɑːr/, indexer manager, from "prowl" + -arr) on a single host or home NAS without Kubernetes, an ingress reverse proxy, or Authentik (/ɔːˈθɛn.tɪk/, open-source identity provider, from "authentic") / OpenID Connect (OIDC). Third-party media servers outside the fleet's products (such as Audiobookshelf or RomM) are out of scope.
  2. What ADR-0028 already decides: ADR-0028 establishes the companion C# plugin repository (jellysin/plugin-snatcharr, licensed under GPL-3.0-or-later), adult scene metadata and PhotoAlbum gallery delivery, request routing boundaries with Seerr (/ˈsiː.ər/, formerly Jellyseerr /ˈdʒɛl.i.siː.ər/ and Overseerr /ˈoʊ.vər.siː.ər/, media request manager from "overseer" / "seer"), and user token verification against Jellyfin GET /Users/Me (snatcharr-jellyfin-plugin-user-auth-method). However, ADR-0028 scoped the plugin to adult metadata, image-set galleries, status badges, and request modals, leaving SnatchArr's remaining 105 OpenAPI operations (api/openapi/openapi.yaml) and 18 single-page application (SPA) routes (web/src/routes/) exclusively in the standalone web UI.
  3. What ADR-0026 already decides and where it assumes an external IdP: ADR-0026 defines the three roles (viewer, requester, admin), Jellyfin credential sign-in (POST /api/v1/auth/jellyfin), Quick Connect (POST /api/v1/auth/jellyfin/quickconnect/*), and the user_identities(provider, subject) -> user_id linking table (api/internal/auth/identity.go). Its implementation in api/internal/httpapi/handlers_jellyfin.go and api/internal/auth/service.go still assumes that a local password administrator (POST /api/v1/auth/setup) or OIDC/proxy SSO account is provisioned first, returning 409 Conflict when a Jellyfin administrator signs in before /setup (handlers_jellyfin.go:88-96) or when an already-provisioned Jellyfin user later links an external identity (identity.go:55-68).

Upstream Jellyfin v12.3 and client capability audit

An inspection of jellyfin/jellyfin tag v12.3 (commit 06de749d435e2d0be0c5119a41f2300fdd7143e5, GPL-2.0-only, checked 2026-10-26) and jellyfin/jellyfin-web tag v12.3 (commit c06cb17b274c10f9015412305edb0afdc010ae7a, GPL-2.0-only, checked 2026-10-26) establishes the exact technical boundaries of a server plugin:

  1. Admin dashboard configuration pages (IHasWebPages):
  2. A server plugin implements MediaBrowser.Model.Plugins.IHasWebPages (MediaBrowser.Model/Plugins/IHasWebPages.cs:7-10) returning IEnumerable<PluginPageInfo> (MediaBrowser.Model/Plugins/PluginPageInfo.cs:8-39: Name, DisplayName, EmbeddedResourcePath, EnableInMainMenu, MenuSection, MenuIcon), as demonstrated in jellyfin/jellyfin-plugin-template (master commit c93225a0a5a76d3843db05b4b5b77fcfc482fba3, GPL-3.0-only, Jellyfin.Plugin.Template/Plugin.cs:37-47, checked 2026-10-26).
  3. Jellyfin.Api.Controllers.DashboardController (Jellyfin.Api/Controllers/DashboardController.cs:45-92) serves page metadata at GET /web/ConfigurationPages with [Authorize(Policy = Policies.RequiresElevation)] (administrators only) and streams the embedded resource at GET /web/ConfigurationPage?name=<Name>.
  4. In jellyfin-web v12.3, PluginDrawerSection.tsx (src/apps/dashboard/components/drawer/sections/PluginDrawerSection.tsx:16-59) queries useConfigurationPages({ enableInMainMenu: true }) and renders matching entries inside the Admin Dashboard sidebar. PluginPageInfo.MenuSection has zero references in jellyfin-web v12.3.
  5. Plugin-served pages for normal users (viewer and requester):
  6. In jellyfin-web v12.3, the built-in hash route /#/configurationpage?name=<Name> (src/apps/dashboard/routes/routes.tsx:15,47-50) is wrapped inside <ConnectionRequired level='admin' /> (src/components/ConnectionRequired.tsx:10-12,55-57), which redirects non-administrator users away to /home or /login.
  7. Consequently, IHasWebPages alone cannot serve interactive pages to non-admin Jellyfin users in v12.3. Normal users must be served through plugin-registered ASP.NET Core controller routes (/SnatchArr/app/{**path}) and an in-app jellyfin-web view or same-origin frame reachable without level='admin'.
  8. Main-menu and toolbar navigation entries (menuLinks):
  9. In jellyfin-web v12.3, both the Modern drawer (src/apps/modern/components/drawers/MainDrawerContent.tsx:59-79), the Modern top toolbar (src/apps/modern/components/AppToolbar/userViews/UserViewNav.tsx:64,80-83), and the legacy settings reader (src/scripts/settings/webSettings.js:97-106) read menuLinks (MenuLink[]: { name, icon, url }, defined in src/types/webConfig.ts:8-12) from GET /web/config.json (src/config.json:32).
  10. A server plugin implementing MediaBrowser.Controller.Plugins.IPluginServiceRegistrator (MediaBrowser.Controller/Plugins/IPluginServiceRegistrator.cs:11-19) can register an IStartupFilter in IServiceCollection that transforms /web/config.json in memory (the pattern proved by IAmParadox27/jellyfin-plugin-file-transformation tag 3.0.2.0, commit 2dd4279bc7aedd082de0639278f9142ead229a52, GPL-3.0-only, PluginServiceRegistrator.cs:10-24 and FileTransformationMiddleware.cs:188-246, checked 2026-10-26) without modifying files on disk.
  11. Custom home sections, tabs, item detail buttons, and script injection:
  12. Stock jellyfin-web v12.3 exposes no declarative API for custom home tabs (src/apps/legacy/controllers/home.js) or extra buttons on #/details?id=<itemId> (src/apps/legacy/controllers/itemDetails/index.js:103-118).
  13. Community plugins surface these by injecting a client script into /web/index.html and serving backing JSON from a plugin controller, as demonstrated by IAmParadox27/jellyfin-plugin-custom-tabs (tag 0.3.2.0, commit 30a9f4e91502780a5766589b1c23e1d7aeb62a02, GPL-3.0-only, TransformationPatches.cs:9-48 and CustomTabsController.cs:7-16, checked 2026-10-26) and IAmParadox27/jellyfin-plugin-home-sections (tag 3.0.3.0, commit 288a1f6ae7a9af3e4ac0d145b6285d84888d0ab1, GPL-3.0-only, HomeScreenSectionsPlugin.cs:15-78, checked 2026-10-26).
  14. Plugin REST endpoints and in-process Jellyfin authentication:
  15. Jellyfin.Server/Startup.cs:301-317 runs app.UseAuthentication(), app.UseRouting(), app.UseAuthorization(), and endpoints.MapControllers(), automatically mounting any ControllerBase subclass in a loaded plugin assembly.
  16. Jellyfin.Api.Auth.CustomAuthenticationHandler (Jellyfin.Api/Auth/CustomAuthenticationHandler.cs:40-81) authenticates the incoming Authorization: MediaBrowser Token="..." (or X-Emby-Token) header against IAuthService.Authenticate(Request) and populates HttpContext.User (ClaimsPrincipal) with verified claims read via Jellyfin.Api.Extensions.ClaimsPrincipalExtensions (Jellyfin.Api/Extensions/ClaimsPrincipalExtensions.cs:14-75):
    • User.GetUserId() (InternalClaimTypes.UserId, Guid)
    • User.Identity.Name (ClaimTypes.Name)
    • User.IsInRole(UserRoles.Administrator) (ClaimTypes.Role, set when PermissionKind.IsAdministrator holds)
    • User.GetToken() (InternalClaimTypes.Token, the verified session token)
    • User.GetIsApiKey() (InternalClaimTypes.IsApiKey; CustomAuthenticationHandler.cs:50-54 grants UserRoles.Administrator to server API keys, so user-acting plugin endpoints must reject User.GetIsApiKey() == true).
  17. Plugin repository manifest installation:
  18. Jellyfin's catalog deserializes a JSON array of MediaBrowser.Model.Updates.PackageInfo (MediaBrowser.Model/Updates/PackageInfo.cs:11-77: guid, name, description, overview, owner, category, imageUrl, versions) containing VersionInfo entries (MediaBrowser.Model/Updates/VersionInfo.cs:11-69: version, changelog, targetAbi, sourceUrl, MD5 checksum, timestamp).
  19. Non-web clients:
  20. Jellyfin Media Player / Jellyfin Desktop (jellyfin/jellyfin-media-player tag v2.0.0, commit 1634d3d263b881dccc62bf278d1289b471ec7af1, GPL-2.0-only, README.md:3-16, checked 2026-10-26) embeds the server's jellyfin-web inside Qt WebEngine and renders all web plugin pages, menuLinks, dashboard views, and item-detail buttons identically to a web browser.
  21. Jellyfin for Android TV (jellyfin/jellyfin-androidtv tag v0.19.9, commit 14a5e160efbb33d471ef2efe7ed9073fc2206785, GPL-2.0-only, checked 2026-10-26), Swiftfin (/ˈswɪft.fɪn/, native iOS/tvOS client in Swift, jellyfin/Swiftfin tag v76, commit e5f3ab9a0c715041fb9f83a49fc9378313b3630a, MPL-2.0, checked 2026-10-26), and Findroid (/ˈfɪn.drɔɪd/, native Android client blending "Jellyfin" and "Android", jarnedemeulemeester/findroid tag v1.2.0, commit 1cceb434f8f761d38159c0d4e24b1e19e0d9cbbe, GPL-3.0-only, checked 2026-10-26) use native Kotlin and Swift UIs against Jellyfin's REST item/playback APIs and never load /web/ConfigurationPage or jellyfin-web scripts. They render only server-side effects: library items (Movie, Series, Season, Episode, Audio, Book, PhotoAlbum, Photo), native BoxSet collections, NFO/provider metadata, and playback/favourite events observed by the server.

Decision

1. Integration shape: one UI served inside Jellyfin via the plugin BFF proxy

Rather than building and maintaining a second frontend in C# or vanilla JavaScript for 105+ operations (which would violate HISS-19's single-implementation invariant), jellysin/plugin-snatcharr acts as a same-origin Backend-for-Frontend (BFF) proxy and host for SnatchArr's built SvelteKit SPA (web/, built on sveltesentio /ˌsvɛltˈsɛn.ti.oʊ/, the Lusoris Svelte 5 component library from "Svelte" + Latin sentio, "I perceive"):

sequenceDiagram
    autonumber
    participant Browser as Jellyfin Web / Desktop Client
    participant Plugin as Jellyfin Server + SnatchArr Plugin (/SnatchArr/*)
    participant API as SnatchArr API (api/)
    participant JFAuth as Jellyfin /Users/Me

    Browser->>Plugin: GET /SnatchArr/app (or item detail action) + Authorization: MediaBrowser Token=<jf-token>
    Plugin->>Plugin: CustomAuthenticationHandler validates <jf-token>, checks !User.GetIsApiKey()
    Plugin->>API: POST /api/v1/auth/jellyfin { "access_token": "<jf-token>" }
    API->>JFAuth: GET /Users/Me (X-Emby-Token: <jf-token>) via goenvoy/jellyfin
    JFAuth-->>API: 200 OK (Id, Name, Policy.IsAdministrator, Policy.IsDisabled, ParentalPolicy)
    API-->>Plugin: 200 OK + Set-Cookie: snatcharr_session (Path=/SnatchArr/api; HttpOnly; SameSite=Lax)
    Plugin-->>Browser: Same-origin session established; proxies /SnatchArr/api/v1/* and SSE /SnatchArr/api/v1/events
  1. Same-origin plugin proxy (/SnatchArr/app/{**path} and /SnatchArr/api/v1/{**path}):
  2. The C# plugin registers SnatchArrProxyController ([ApiController], [Route("SnatchArr")]) inside Jellyfin Server.
  3. Requests to /SnatchArr/app/{**path} stream the static SPA assets embedded in the paired SnatchArr API instance (api/internal/web), so upgrading SnatchArr immediately updates all 18+ UI routes inside Jellyfin without requiring a lockstep C# plugin rebuild.
  4. Requests to /SnatchArr/api/v1/{**path} (including Server-Sent Events on GET /SnatchArr/api/v1/events streamed with HttpCompletionOption.ResponseHeadersRead and X-Accel-Buffering: no) are proxied over the local host/container network to SnatchArrUrl. Adopters never have to expose SnatchArr's port, configure TLS certificates for a second hostname, or set Cross-Origin Resource Sharing (CORS) headers.
  5. Embedded shell mode in web/:
  6. When web/ runs under /SnatchArr/app (or detects the Jellyfin host bridge), it activates embedded layout mode: it hides standalone sign-in/setup chrome, reads the caller's Jellyfin accessToken() from window.ApiClient (or receives the plugin-exchanged session cookie), synchronizes locale (en/de) and dark/light oklch theme variables with Jellyfin, and filters its navigation bar by the user's resolved role (viewer, requester, admin) and active modules (listModules).
  7. Web injection through an optional JavaScript Injector snippet (refining ADR-0028 OQ-3; ledger snatcharr-jellyfin-plugin-web-injection-method):
  8. The plugin does not rewrite /web/index.html or /web/config.json. It ships SnatchArr/client.js plus an optional snippet for n00bcodr/Jellyfin-JavaScript-Injector; the snippet loads client.js, which adds the SnatchArr navigation entry, mounts the in-app #/snatcharr route (OQ-0035-1), adds item-detail actions on #/details, adds a request or wish button to every poster and item card (OQ-0036-6, ledger snatcharr-oq-0036-6), and adds optional status rails on #/home.
  9. Every server-side feature works with the injector absent: /SnatchArr/app, Dashboard -> Plugins -> SnatchArr (/web/ConfigurationPage?name=SnatchArr), the request and vote API, background playback events and the plugin proxy. The plugin documents the injector as optional and writes a log line at start when it is missing, so a missing button is never a silent fallback.
  10. Rationale (ledger, derived 2026-10-24): rewriting the jellyfin-web bundle or its served files breaks on Jellyfin Web bundle changes; the injector snippet keeps the plugin out of jellyfin-web internals.

2. Plugin-to-SnatchArr authentication and delegation without an IdP

Two mechanisms for authenticating plugin requests on a Jellyfin user's behalf without an external IdP were weighed:

Criterion Option A: Shared plugin API key + forwarded X-Jellyfin-User-Id header Option B: Jellyfin user access-token exchange validated via GET /Users/Me (Chosen)
Mechanism Plugin authenticates caller via [Authorize], extracts User.GetUserId(), and sends Authorization: Bearer <plugin-key> + X-Jellyfin-User-Id: <guid> to SnatchArr, which maps (provider='jellyfin', subject=<guid>). Plugin (or embedded SPA via plugin proxy) forwards the caller's verified Jellyfin session token (User.GetToken()) to POST /api/v1/auth/jellyfin; SnatchArr validates it against Jellyfin GET /Users/Me via goenvoy (/ɡoʊˈɛn.vɔɪ/, Lusoris Go API client library, from "Go" + "envoy") and mints a snatcharr_session.
Compromise blast radius Critical (confused deputy): Any leak of the single plugin API key (Jellyfin.Plugin.SnatchArr.xml) or SSRF on the local network allows arbitrary impersonation of every household user and admin by forging X-Jellyfin-User-Id. Contained: No static key can impersonate a user. Every user/admin session requires a live Jellyfin user token verified against GET /Users/Me and revalidated every 5 minutes by jellyfin.Revalidator (api/internal/jellyfin/revalidator.go:34-103).
Adult parental policy fidelity Low: SnatchArr must either trust unverified header claims for parental flags or query Jellyfin anyway. High: GET /Users/Me returns the authoritative UserDto.Policy (IsAdministrator, IsDisabled, MaxParentalRating, BlockUnratedItems, BlockedTags, EnableAllFolders, EnabledFolders) directly from Jellyfin.
Codebase reuse (HISS-19) Poor: Duplicates proxy_auth (api/internal/httpapi/handlers_auth.go) with a second trusted-header path. Exact: Reuses jellyfin.Authenticator.ByToken (api/internal/jellyfin/authenticator.go:63-91), startJellyfinSession (api/internal/httpapi/handlers_jellyfin.go:84-114), and jellyfin.Revalidator.

Decision: Adopt Option B (refining and confirming ADR-0028 OQ-4):

  1. Interactive user and admin calls:
  2. Every user-initiated request reaching SnatchArrProxyController requires [Authorize] on Jellyfin and explicitly rejects API-key callers (if (User.GetIsApiKey()) return Forbid();, guarding against CustomAuthenticationHandler.cs:50-54).
  3. When the browser has no active snatcharr_session cookie (or its sso_subject does not match User.GetUserId()), the plugin exchanges User.GetToken() against SnatchArr's POST /api/v1/auth/jellyfin (jellyfinLogin), which verifies the token via GET /Users/Me (Jellyfin.Api/Controllers/UserController.cs:581) and returns an HttpOnly session cookie plus CSRF token (getSession).
  4. Subsequent requests through /SnatchArr/api/v1/* carry that session cookie; jellyfin.Revalidator (api/internal/jellyfin/revalidator.go) re-verifies the user's active status, administrator bit, and parental policy against Jellyfin every 5 minutes (revalidationInterval = 5 * time.Minute).
  5. Background server-to-server calls:
  6. A scoped SnatchArr API key (ApiKeyScope core:write, requests:read) stored in PluginConfiguration is used exclusively for non-user background events (such as ISessionManager.PlaybackStopped watch-aware notifications and plugin health probes). SnatchArr ignores any X-Jellyfin-User-Id header on API-key requests.
  7. Threat model:
  8. Forged or expired Jellyfin token: Rejected at both layers — Jellyfin's CustomAuthenticationHandler returns 401 Unauthorized before the plugin controller executes, and SnatchArr's Authenticator.ByToken returns domain.ErrUnauthorized (401 application/problem+json) if GET /Users/Me fails or Policy.IsDisabled == true.
  9. Privilege escalation (viewer/requester -> admin): Role assignment is computed solely inside SnatchArr from the Policy.IsAdministrator boolean returned by Jellyfin's GET /Users/Me (domain.RoleForJellyfinMember in api/internal/httpapi/handlers_jellyfin.go:85), never from client-supplied parameters.
  10. Adult content disclosure to restricted accounts: Adult routes check both the adult module switch (ADR-0025) and the Jellyfin user's parental policy cached from GET /Users/Me (ADR-0027); unauthorized requests receive an indistinguishable RFC 9457 404 Not Found (application/problem+json).

3. Account paths

Re-checking ADR-0026 (api/internal/auth/identity.go, api/internal/auth/service.go, api/internal/httpapi/handlers_jellyfin.go, api/internal/httpapi/security.go) shows three places where the current implementation assumes OIDC, reverse-proxy SSO, or a pre-existing local password administrator alongside Jellyfin:

  1. First-admin bootstrap barrier (handlers_jellyfin.go:88-96, service.go:315-324): Currently, when a Jellyfin administrator signs in via POST /api/v1/auth/jellyfin, startJellyfinSession calls h.auth.FirstAdmin(ctx), which fails with 409 Conflict (ErrSetupRequired: initial admin setup has not been completed) if CountUsers == 0. Non-admin Jellyfin users are similarly blocked until SetupComplete is true.
  2. Self-owned identity 409 Conflict (identity.go:55-68 checkExternalIDOwnership): When a user signs in with Jellyfin first, ProvisionJellyfinUser creates a users row with external_id = "jellyfin:<uuid>". If the operator later enables OIDC or proxy SSO and that user calls POST /api/v1/auth/identities/jellyfin to link their Jellyfin identity, checkExternalIDOwnership sees extUser.ID != userID and rejects the link with 409 Conflict (identity belongs to another account).
  3. Session sso_role override (security.go:85-88): LoadSession replaces u.Role with ssoRole when sso_role is non-empty on the session row, assuming the active SSO login source always dictates the role.

To guarantee that no external identity provider is ever assumed while preserving optional multi-IdP support for advanced deployments, SnatchArr defines five explicit account paths:

Account path Config / operations Status & default Role in architecture
1. Jellyfin account snatcharr.jellyfin.enabled (POST /auth/jellyfin, POST /auth/jellyfin/quickconnect/*) Stays — primary default for Jellyfin adopters (auto-enabled on plugin pairing) Primary authentication and role source (admin from Policy.IsAdministrator, requester/viewer from default_role and parental policy) inside Jellyfin and on standalone /login.
2. Local admin fallback POST /auth/setup, POST /auth/login, POST /auth/password Stays — break-glass & non-Jellyfin fallback Break-glass administrator login when Jellyfin is unreachable, and initial bootstrap for standalone deployments without Jellyfin. Never used for non-admin household accounts.
3. API keys GET /auth/api-keys, POST /auth/api-keys, DELETE /auth/api-keys/{id} Stays — enabled for machine callers Authenticates non-interactive callers: the Jellyfin plugin's background webhook/health channel, Model Context Protocol (MCP) / LLM clients (#564), and scripts.
4. OpenID Connect (OIDC) snatcharr.oidc.enabled: false (GET /auth/sso, /auth/oidc/*) Stays — optional, OFF by default Optional external IdP login (e.g. Authentik) for multi-service homelabs. Never required or assumed by any SnatchArr or Jellyfin plugin workflow.
5. Trusted reverse-proxy SSO snatcharr.proxy_auth.enabled: false (POST /auth/proxy-session) Stays — optional, OFF by default Optional forward-auth header integration (Remote-User) from CIDR-trusted proxies. Never required or assumed.

Revised bootstrap and linking semantics

  1. Jellyfin administrator bootstrap with a one-time setup code (decided; OQ-0035-4 answer c, ledger snatcharr-oq-0035-4):
  2. At first start with CountUsers == 0, SnatchArr prints a one-time setup code in its log. When snatcharr.jellyfin.enabled = true, the first Jellyfin user with Policy.IsAdministrator == true verified via GET /Users/Me on POST /api/v1/auth/jellyfin becomes the initial admin only after entering that code; SnatchArr then provisions the users row (role = 'admin', external_id = 'jellyfin:<id>', password_hash = '') and records (provider = 'jellyfin', subject = '<id>') in user_identities in one transaction, and the code is spent. A wrong or reused code is refused, so a stranger holding some Jellyfin admin account cannot claim a fresh install, and the adopter still never invents a local password.
  3. If the administrator later wants a break-glass local password for when Jellyfin is down, they set one from /account via POST /api/v1/auth/password.
  4. Jellyfin-first account linking without false 409 Conflict (decided; OQ-0035-3 answer a narrowed, ledger snatcharr-oq-0035-3):
  5. When snatcharr.oidc.enabled = false and snatcharr.proxy_auth.enabled = false (the default), the /account page hides the external identity-linking card (listIdentities, linkJellyfinIdentity, unlinkJellyfinIdentity, linkProxyIdentity, unlinkProxyIdentity) because Jellyfin is the sole identity provider.
  6. When an operator later enables OIDC or proxy SSO, the standalone jellyfin:<id> users row is merged into the signed-in row in one database transaction (reassigning user-owned foreign keys and attaching user_identities(provider='jellyfin', subject=<id>)) only when the signed-in user starts the link from the account page and proves the Jellyfin account live through POST /api/v1/auth/identities/jellyfin. The merge never runs automatically and never matches by username. 409 Conflict stays for a (provider, subject) already linked to a different multi-identity account.
  7. Role resolution (sso_role):
  8. For Jellyfin sessions (sso_source = 'jellyfin'), sso_role reflects Jellyfin's Policy.IsAdministrator (admin if true, else default_role — requester by default — unless downgraded to viewer by an explicit per-user role override or parental restriction).

4. UI placement: where every surface lives

  1. Inside Jellyfin for all users (Plugin user page + Item detail button + Home section):
  2. Reachable from the SnatchArr link in Jellyfin's main navigation drawer (MainDrawerContent.tsx) and top toolbar (UserViewNav.tsx), opening /SnatchArr/app:
    • Requests & Discovery: Search and request missing movies, series, music, books, and adult scenes/image sets (#565, Seerr requests listSeerrRequests), and track personal and household request status.
    • Watch-Aware Series Gate: View series held by the season gate (listWatchawareGateSeries, listWatchawareGateDecisions) and trigger "Fetch Next Season Now" (releaseWatchawareGateSeries).
    • Activity & Queue Read-Only Feed: View recent snatches (listEvents), instance hourly cap stamina (getHourlyCaps), and active download progress (listQueueItems, listQueueStrikes).
    • Adult Favourites & Image-Set Galleries (visible only when the adult module is enabled and the Jellyfin user's parental policy permits adult content): Follow favourite performers, studios, and tags across stash-box (/ˈstæʃ.bɒks/, the open-source GraphQL metadata server behind community metadata indexes, ADR-0027) and browse image-set galleries synced as Jellyfin PhotoAlbum items.
    • Account Settings: View session role, set a break-glass admin password, manage API keys (admin), or link secondary identities when OIDC/proxy SSO is enabled.
  3. Contextual Item detail buttons on #/details?id=<itemId>: "Search Missing / Upgrade", "Fetch Next Season Now", download queue status/strike badge, "Follow Performer / Studio", and "View Linked Image Sets".
  4. Inside Jellyfin for administrators (Dashboard config page):
  5. Reachable from Dashboard -> Plugins -> SnatchArr (/#/configurationpage?name=SnatchArr) and from the Admin switcher inside /SnatchArr/app when role == 'admin':
    • Plugin bootstrap connection panel (SnatchArrUrl, one-click Jellyfin admin pairing, Test Connection).
    • Full SnatchArr administrative console: Overview (/), Instances (/instances, /instances/[id], policy, priority, queue policy & manual queue actions, processed memory reset), Automation schedules (/automation), Connections (/connections/prowlarr, /connections/download-clients, /connections/seerr, /connections/configarr for Configarr /kənˈfɪɡ.ɑːr/, declarative GitOps *arr configuration tool from "configure" + -arr, watch-aware sources, and Stash /stæʃ/, self-hosted GraphQL adult collection organiser from English "stash"), Adult Matching Audit Queue (ADR-0031, ADR-0033), Module switches (ADR-0025), Notifications, LLM/MCP opt-in (ADR-0021), and System status/logs (/system backed by golusoris /ˌɡoʊ.luːˈsɔː.rɪs/, the Lusoris shared Go foundation library from Latin lusorius, "playful").
  6. What stays only in the standalone SnatchArr UI and why:
  7. Zero functional or administrative features are exclusive to the standalone UI.
  8. Only three external/fallback authentication entrypoints remain standalone-only (/login and /setup when accessed directly on SnatchArr's port) because they exist specifically for when Jellyfin is not the active host shell:
    1. Break-glass local password sign-in (login) and non-Jellyfin initial setup (completeSetup) when the Jellyfin container is down or not used.
    2. Standalone Jellyfin credential and Quick Connect sign-in prompts (jellyfinQuickConnectInitiate, jellyfinQuickConnectAuthenticate) — inside Jellyfin, the user is already authenticated to Jellyfin and the plugin exchanges their active session token silently.
    3. Optional OIDC redirect and reverse-proxy session bootstrap (getSSO, createProxySession) for multi-IdP homelabs.

Function-by-function surface mapping

Every one of the 105 existing OpenAPI operationIds in api/openapi/openapi.yaml (.workingdir/agy/jfint-ops.tsv) appears in exactly one row below (rows 1–19), followed by the 9 planned functional surfaces (rows 20–28). The machine-readable companion table is written to .workingdir/agy/jfint-surfaces.tsv.

Milestone key

  • 0.7 — Sign-in, accounts, roles, and identity surfaces (ADR-0026, docs/roadmap.md Milestone 0.7).
  • 0.9 — API-only protocol surfaces (such as the MCP server endpoint for external LLM clients) that require no Jellyfin web view (docs/roadmap.md Milestone 0.9).
  • 0.12 — Jellyfin companion plugin user pages, dashboard config views, item detail buttons, and home sections (ADR-0028, docs/roadmap.md Milestone 0.12).
# Surface Operations (operationIds) Who (role) Jellyfin surface Non-web clients Status Milestone
1 Sign-in and session getSetupStatus, completeSetup, login, logout, getSession, changePassword, getSSO, createProxySession, jellyfinLogin, jellyfinQuickConnectInitiate, jellyfinQuickConnectAuthenticate viewer (all roles) server-side only (silent token exchange via plugin proxy; break-glass password change in /SnatchArr/app/account) Native Jellyfin sign-in (session token drives all server-side effects) exists in API 0.7
2 Account linking listIdentities, linkJellyfinIdentity, unlinkJellyfinIdentity, linkProxyIdentity, unlinkProxyIdentity viewer plugin user page (/SnatchArr/app/account, shown only when optional OIDC or proxy SSO is enabled) None exists in API 0.7
3 API keys listAPIKeys, createAPIKey, revokeAPIKey admin dashboard config page (/SnatchArr/app/account & plugin pairing panel) None (used by plugin background channel and CLI/MCP callers) exists in API 0.7
4 Search a missing item and manage runs previewRun, triggerRun, listRuns, getRun, cancelRun admin (plus requester for scoped item search; see OQ-0035-2) item detail button ("Search Missing / Upgrade") & dashboard config page (/SnatchArr/app/instances/[id]) Server-side scheduled runs; snatched media appears in all native client libraries exists in API 0.12
5 Snatch activity, hourly caps, and processed memory listEvents, deleteInstanceEvents, getHourlyCaps, resetState viewer (read) / admin (delete, reset) plugin user page (/SnatchArr/app/activity) & dashboard config page (/SnatchArr/app/instances/[id]/memory) None (Jellyfin Media Player renders web view) exists in API 0.12
6 Seerr request sync and dispatch listSeerrRequests, snatchSeerrRequest viewer (list) / admin (snatch) plugin user page (/SnatchArr/app/activity & requests tab) & item detail button Fulfilled items appear in native Jellyfin libraries exists in API 0.12
7 Seerr connection settings listSeerrLinks, getSeerrLink, createSeerrLink, updateSeerrLink, deleteSeerrLink, testSeerrLinkInput, testSeerrLink, syncSeerrLink, importSeerrInstances admin (viewer read) dashboard config page (/SnatchArr/app/connections/seerr) None exists in API 0.12
8 Instance settings listInstances, getInstance, createInstance, updateInstance, deleteInstance, testInstanceInput, testInstance admin (viewer read) dashboard config page (/SnatchArr/app/instances & /SnatchArr/app/instances/[id]) None exists in API 0.12
9 Snatch policy and instance priority getPolicy, updatePolicy, getPolicyFilterOptions, getInstancePriority, updateInstancePriority admin (viewer read) dashboard config page (/SnatchArr/app/instances/[id]/policy) Server-side priority and policy enforcement on all runs exists in API 0.12
10 Queue view and strike policy listQueueItems, listQueueStrikes, getQueuePolicy, updateQueuePolicy viewer (queue & strikes) / admin (policy) plugin user page & item detail button (download status badge) & dashboard config page (/SnatchArr/app/instances/[id]/queue) Server-side automatic stalled/failed queue sweeps exists in API 0.12
11 Schedules listSchedules, createSchedule, updateSchedule, deleteSchedule admin (viewer read) dashboard config page (/SnatchArr/app/automation) Server-side scheduled execution exists in API 0.12
12 Notifications listNotificationChannels, getNotificationChannel, createNotificationChannel, updateNotificationChannel, deleteNotificationChannel, testNotificationChannel, listNotificationRules, getNotificationRule, createNotificationRule, updateNotificationRule, deleteNotificationRule admin (viewer read) dashboard config page (/SnatchArr/app/system notifications tab) Out-of-band webhook/push/email delivery to user devices exists in API 0.12
13 Prowlarr indexer links and health getProwlarrStatus, listProwlarrLinks, getProwlarrLink, createProwlarrLink, updateProwlarrLink, deleteProwlarrLink, testProwlarrLinkInput, testProwlarrLink admin (viewer read) dashboard config page (/SnatchArr/app/connections/prowlarr) None exists in API 0.12
14 Download client health and connections getDownloadClientStatus, listDownloadClients, getDownloadClient, createDownloadClient, updateDownloadClient, deleteDownloadClient, testDownloadClientInput, testDownloadClient, discoverDownloadClients admin (viewer read) dashboard config page (/SnatchArr/app/connections/download-clients) Server-side backpressure pacing (ADR-0006) exists in API 0.12
15 Configarr GitOps import getConfigarrStatus, importConfigarr admin (viewer status) dashboard config page (/SnatchArr/app/connections/configarr) None exists in API 0.12
16 Watch-aware gate status and manual release getWatchawareSyncStatus, listWatchawareGateSeries, listWatchawareGateDecisions, releaseWatchawareGateSeries viewer (status) / admin & requester (release; see OQ-0035-2) item detail button ("Fetch Next Season Now"), plugin user page, & home section Playback in Android TV, Swiftfin, and Findroid triggers server-side season gate release automatically exists in API 0.12
17 Watch-aware source settings listWatchawareSources, createWatchawareSource, updateWatchawareSource, deleteWatchawareSource admin (viewer read) dashboard config page (/SnatchArr/app/connections watch-aware sources; auto-linked on plugin pairing) None exists in API 0.12
18 Module switches listModules, getModule, updateModule admin (viewer read) dashboard config page (/SnatchArr/app/system modules tab) Server-side module gating across all endpoints exists in API 0.12
19 System status, settings, and logs getSystemStatus, getSettings, updateSettings, getPriorityPresets, listLogs admin (viewer read except listLogs/updateSettings) dashboard config page (/SnatchArr/app/system & /SnatchArr/app/) None exists in API 0.12
20 Request a title (native request portal) none (planned #565: catalog search and request creation across movies, series, music, books, comics, games) requester plugin user page (/SnatchArr/app/requests), item detail button ("Request Missing Season / Upgrade") & request or wish button on every poster and item card (injector snippet, OQ-0036-6) Requested items appear in native Jellyfin libraries once snatched planned 0.12
21 View my requests and approvals none (planned #565: list personal/household requests, cancel own pending request, admin approve/decline) viewer (own/household list) / requester (cancel own) / admin (approve/decline) plugin user page (/SnatchArr/app/requests/mine) & home section ("My Requests") Optional "Requested" BoxSet collection and push notifications planned 0.12
22 Queue action (retry, remove, blocklist) none (planned #362, ADR-0012: manual retry, remove from queue, blocklist and re-search) admin dashboard config page (/SnatchArr/app/instances/[id]/queue) & item detail button None planned 0.12
23 Watch-aware remove-when-seen policies none (planned ADR-0024: per-instance retention rules, multi-user seen grace window, favourite exclusion) admin dashboard config page (/SnatchArr/app/instances/[id]/policy retention tab) Native client playback completion & favourite hearts govern retention on server planned 0.12
24 Adult favourites and subscriptions none (planned ADR-0027, ADR-0031: search metadata sources, manage favourite performers/studios/tags, auto-snatch rules) requester (with Jellyfin adult parental permission) plugin user page (/SnatchArr/app/adult/favourites) & item detail button ("Follow Performer / Studio") Snatched scenes and favourite BoxSet collections appear in adult-permitted native libraries planned 0.12
25 Adult image-set galleries none (planned ADR-0027, ADR-0031, ADR-0032: browse, snatch, and link image sets to scenes/performers) requester (with Jellyfin adult parental permission) plugin user page (/SnatchArr/app/adult/galleries), item detail button ("View Linked Image Sets"), & Jellyfin Photos library Native browsing and slideshow viewing via Jellyfin Photos (PhotoAlbum / Photo) in Android TV, desktop, and mobile planned 0.12
26 Adult matching audit queue none (planned ADR-0031, ADR-0033, ADR-0034: review and resolve low-confidence fingerprint/text matches) admin dashboard config page (/SnatchArr/app/adult/audit) Approved sidecar NFOs and artwork update Jellyfin library items for all clients planned 0.12
27 Stash companion instance settings none (planned ADR-0032: configure, test, and sync optional Stash organiser instance) admin dashboard config page (/SnatchArr/app/connections/stash) Server-side metadata and NFO sync planned 0.12
28 LLM and MCP tool surface none (planned #564, ADR-0021: MCP server endpoint and module configuration) admin server-side only (MCP protocol endpoint on SnatchArr API; opt-in switch in /SnatchArr/app/system modules tab) External MCP/LLM clients via scoped API keys planned 0.9

Consequences, risks, and alternatives considered

Positive consequences

  • Complete single-app experience for any adopter: Every SnatchArr user workflow and administrative setting is operable from inside Jellyfin with a single Jellyfin login, requiring zero Kubernetes, reverse proxy, TLS ingress, or external IdP setup.
  • Single frontend implementation (HISS-19): Serving web/ in embedded mode through the plugin's /SnatchArr/app proxy avoids duplicating 18+ routes and 105+ API bindings in C# or vanilla JavaScript, preserving Paraglide (en/de) localization and sveltesentio WCAG 2.2 AA / EN 301 549 accessibility guarantees.
  • Zero-setup admin onboarding: First-run Jellyfin administrator bootstrap removes the chicken-and-egg requirement of visiting standalone /setup before pairing the Jellyfin plugin.
  • Cryptographic session verification without static impersonation keys: Token exchange against GET /Users/Me plus 5-minute revalidation ensures a leaked plugin config file cannot impersonate users or bypass parental controls.

Risks and mitigations

  • jellyfin-web DOM and router evolution: Upstream changes to #/details button containers (src/apps/legacy/controllers/itemDetails/index.js) or poster card markup in future Jellyfin releases can affect injected item buttons, poster buttons or the navigation entry.
  • Mitigation: All full-page workflows live inside /SnatchArr/app and /web/ConfigurationPage?name=SnatchArr; SnatchArr/client.js is restricted to small, defensive mount hooks tested in CI against the pinned jellyfin/jellyfin:12.3 container.
  • Long-lived SSE connections through the C# plugin proxy: Buffering by ASP.NET Core response middleware would stall real-time snatcharr.v1.EventType SSE updates (GET /SnatchArr/api/v1/events).
  • Mitigation: SnatchArrProxyController disables response buffering (IHttpResponseBodyFeature.DisableBuffering()), uses HttpCompletionOption.ResponseHeadersRead, and forwards Last-Event-ID.

Alternatives considered

  1. Standalone SnatchArr UI only (status quo prior to this ADR):
  2. Rejected: Forces every household member to learn a second URL and sign-in flow, requires adopters to expose a second port or configure a reverse proxy, and leaves item browsing disconnected from requesting, watch-aware season release, and adult galleries.
  3. Cross-origin <iframe> embedding pointing directly at SnatchArr's standalone port:
  4. Rejected: Requires the adopter to expose SnatchArr's HTTP/HTTPS port to every client browser, triggers third-party cookie blocking (SameSite=Lax / partitioned cookies) when Jellyfin and SnatchArr sit on different ports or hostnames, and fails under mixed-content rules when Jellyfin is served over HTTPS. Proxying /SnatchArr/app and /SnatchArr/api through the plugin controller keeps all traffic same-origin on the Jellyfin server port.
  5. Client-side script injection only (rebuilding all 18 routes as DOM-injected vanilla JS modals):
  6. Rejected: Re-implementing 105 operations, complex policy forms, queue strike tables, and the adult matching audit queue in injected vanilla JavaScript would violate HISS-19, lose compile-time OpenAPI type safety (web/src/lib/api/schema.d.ts), and break across jellyfin-web Legacy vs Modern React transitions.

Verification

  1. OpenAPI coverage and surface completeness check:
  2. Every operationId in api/openapi/openapi.yaml (.workingdir/agy/jfint-ops.tsv, 105 operations) must appear in .workingdir/agy/jfint-surfaces.tsv with zero unplaced operations and zero duplicate placements.
  3. End-to-end CI test against a real Jellyfin container:
  4. CI spins up jellyfin/jellyfin:12.3 with jellysin/plugin-snatcharr installed alongside api and PostgreSQL:
    • First-admin bootstrap: With CountUsers == 0 in SnatchArr, a Jellyfin administrator signs in through the plugin and enters the one-time setup code from the SnatchArr log (a wrong code is refused with 401 application/problem+json, planted case); verify GET /SnatchArr/api/v1/auth/session returns role = "admin" and GET /SnatchArr/api/v1/auth/setup/status returns setup_required = false.
    • User navigation and role scoping: A non-admin Jellyfin user (Policy.IsAdministrator = false) loads Jellyfin Web with the injector snippet (verifying the SnatchArr navigation entry and a request button on a poster card), and once without the injector (verifying the plugin log line and that /SnatchArr/app still works), exchanges their Jellyfin token via /SnatchArr/api/v1/auth/jellyfin, and accesses /SnatchArr/app with role = "requester".
    • SSE streaming: Verify GET /SnatchArr/api/v1/events through the plugin proxy delivers search_dispatched events within 1 second without buffering.
  5. Planted negative security cases (replayed red-then-green):
  6. Planted case 1 — Forged or expired Jellyfin token: Presenting an invalid or expired token to /SnatchArr/api/v1/auth/jellyfin or /SnatchArr/api/v1/instances must return HTTP 401 with Content-Type: application/problem+json. Removing the ByToken check in api/internal/jellyfin/authenticator.go must cause the test to fail (red).
  7. Planted case 2 — Jellyfin server API key used on user-delegated plugin endpoint: Calling /SnatchArr/api/v1/* through the plugin using a server-level Jellyfin API key (User.GetIsApiKey() == true) with a forged X-Jellyfin-User-Id header must be rejected with HTTP 403 / 401 and never mint an admin or user session.
  8. Planted case 3 — Role escalation (requester calling admin-only mutation): A non-admin Jellyfin user calling PUT /SnatchArr/api/v1/settings (updateSettings) or POST /SnatchArr/api/v1/auth/api-keys (createAPIKey) must receive HTTP 403 application/problem+json.
  9. Planted case 4 — Disabled module and parental-control adult gate: A Jellyfin user with MaxParentalRating set (or when the adult module is disabled) requesting /SnatchArr/api/v1/adult/* must receive HTTP 404 application/problem+json with zero metadata leakage (ADR-0025, ADR-0028).
  10. Planted case 5 — Item search inside the cooldown: a second item-scoped search by the same user inside the per-user cooldown must return HTTP 429 application/problem+json and dispatch nothing; a search that would exceed the instance hourly cap is refused the same way (snatcharr-oq-0035-2). Boundary cases: a cooldown of 0 allows the second search at once, and a setting outside 0 to 3600 s is refused with HTTP 400 (snatcharr-oq-0035-2-cooldown-cap-values).
  11. Planted case 6 — Merge without live proof: linking from the account page with a wrong Jellyfin password, or a matching username alone, must leave both user rows unchanged (snatcharr-oq-0035-3).

Answered questions

The operator answered every open question on 2026-10-26. Each answer is recorded in the decision ledger under the id shown; the wording is a paraphrase. Where an answer differs from the recommendation in the question list that follows, the answer binds.

ID Answer Ledger id
OQ-0035-1 a: SnatchArr opens inside Jellyfin as a same-origin frame on the #/snatcharr route under the Jellyfin header; playback keeps running. snatcharr-oq-0035-1
OQ-0035-2 a (confirmed by the operator on 2026-10-26): a dedicated item-scoped search endpoint with a per-user cooldown and the per-instance hourly cap; the requester role gets no triggerRun. Values (snatcharr-oq-0035-2-cooldown-cap-values a): per-user item-search cooldown 60 s by default, admin-settable from 0 to 3600 s; item searches debit the existing per-indexer hourly cap (HourlyCap, default 15 per hour), and no second cap exists. snatcharr-oq-0035-2, snatcharr-oq-0035-0036-popup-20261026, snatcharr-oq-0035-2-cooldown-cap-values
OQ-0035-3 a, narrowed (confirmed by the operator on 2026-10-26): the jellyfin:<id> row merges into the signed-in row in one transaction only when the user links from the account page and proves the Jellyfin account live; never automatic, never by username. snatcharr-oq-0035-3, snatcharr-oq-0035-0036-popup-20261026
OQ-0035-4 c: the first Jellyfin admin becomes the first SnatchArr admin only after entering a one-time setup code printed in the SnatchArr log at first start. snatcharr-oq-0035-4

Poster and item-card buttons: the answer to OQ-0036-6 (ledger snatcharr-oq-0036-6) adds a request or wish button to every poster and item card through the web injection path of section 1.3; surface 20 in the function table below carries it.

Question record

The question list below is kept as the record of the options and risks the answers chose from.

  • OQ-0035-1 | How should the plugin mount SnatchArr's user-facing UI when the user clicks "SnatchArr" in Jellyfin's main navigation menu? | a) Same-origin <iframe src="/SnatchArr/app"> inside an in-app Jellyfin route (#/snatcharr) injected by SnatchArr/client.js, keeping the Jellyfin top header visible while isolating SvelteKit CSS and routing from jellyfin-web React/legacy DOM (risk: requires postMessage bridge for deep-link hash synchronization and viewport height sizing) b) Full-page same-origin navigation to /SnatchArr/app with a "Back to Jellyfin" header link inside the SnatchArr shell (risk: leaves the jellyfin-web SPA document, stopping background audio/video mini-player playback during navigation) | recommended: a, because a same-origin iframe inside #/snatcharr preserves active Jellyfin media playback and isolates Svelte 5 styles from jellyfin-web while sharing same-origin cookies
  • OQ-0035-2 | Which existing instance-level mutations should be opened to the requester role (with per-item scope) when triggered from a Jellyfin item detail button? | a) Add a dedicated item-scoped endpoint POST /api/v1/jellyfin/items/{itemId}/search (and allow requester on releaseWatchawareGateSeries for series in the user's accessible libraries) that enforces per-user cooldowns and instance hourly caps without granting full triggerRun on an entire instance (risk: adds one narrow endpoint to api/openapi/openapi.yaml in Milestone 0.12) b) Allow the requester role to call POST /api/v1/instances/{instanceId}/runs (triggerRun) and POST /api/v1/watchaware/gate/series/{instance_id}/{series_id}/release directly (risk: triggerRun queues a full instance-wide wanted sweep rather than searching a single item, allowing one requester to spend the instance's hourly cap) | recommended: a, because item-detail buttons should search or release only the specific series/movie/album clicked while protecting instance-wide hourly budget
  • OQ-0035-3 | How should pre-existing Jellyfin-provisioned user rows (users.external_id = "jellyfin:<id>") behave if an operator later enables optional OIDC or proxy SSO and a user links their Jellyfin account via POST /api/v1/auth/identities/jellyfin? | a) Automatically merge the standalone jellyfin:<id> user row into the authenticated OIDC/proxy user row in one transaction (migrating requests, favourites, and API keys) when the caller proves possession of the Jellyfin account via live Jellyfin credentials (risk: requires a transactional user-merge query in api/internal/store/queries/) b) Keep checkExternalIDOwnership returning 409 Conflict and require an administrator to delete or merge the old Jellyfin user first (risk: every household user who used SnatchArr inside Jellyfin before OIDC was enabled hits a 409 error when linking accounts) | recommended: a, so Jellyfin-first adopters can later add an optional IdP without stranding existing user history on 409 Conflict
  • OQ-0035-4 | May the first Jellyfin administrator who signs in become the first SnatchArr admin when no user exists yet? | a) Yes, when snatcharr.jellyfin.enabled is true and the configured Jellyfin server confirms Policy.IsAdministrator (risk: whoever holds a Jellyfin admin account and reaches SnatchArr first owns it; the operator controls this only through the Jellyfin server choice) b) No, keep /setup with a local password first; Jellyfin admins map to admin only after setup (risk: every Jellyfin-only adopter has to create a local password they never use again) c) Yes, but only with a one-time setup code printed in the SnatchArr log at first start (risk: one more step; needs log access) | recommended: c, because it keeps the zero-password path while a stranger with a Jellyfin admin account cannot claim a fresh install

References