Skip to content

feat(web): import history for a Plex Home user - #3669

Merged
Quick104 merged 2 commits into
mainfrom
feat/plex-import-home-users
Nov 8, 2026
Merged

Quick104 merged 2 commits into
mainfrom
feat/plex-import-home-users

Conversation

@Quick104

@Quick104 Quick104 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1239
Validation tasks: changes #1240 C2 and #1243 C1 (neither has a recorded result yet)

A self-service Plex history import always imports the Plex account that signed in. A household on Plex Home, where each person has their own Home user or managed user on one Plex account, can only bring the account owner's history into Silo. To get everyone else's history, an admin has to set up the admin import with a server admin token and a user mapping for each person, and that path only sees plays that crossed the watched threshold. It misses titles marked watched by hand, resume positions, and the watchlist.

After signing in with Plex, the web history import page now offers a Plex Home user picker. Choosing a member imports that person's history, using their own Plex tokens, into whichever profile is selected. A household with five Home users can move each one into their own Silo profile from a single Plex sign-in.

Approach

The web page already signs in to plex.tv in the browser and sends the server address and tokens with createHistoryImportRun. The change stays in that browser flow. After sign-in it reads the account's Plex Home members. On Start Import, if someone other than the signed-in account is chosen, it switches to that member on plex.tv (POST /api/v2/home/users/{uuid}/switch, sending their Home PIN when they have one). It then reads that member's own token for the chosen server from /api/v2/resources and sends those tokens instead of the owner's. The server, API contract, and import run path are unchanged.

Each run covers one person. The one-active-personal-import-per-account rule from #3554 stays, so the page keeps the Plex sign-in and the user picks the next member after the previous import finishes. Queueing several Home users in one request was considered and left out to keep that rule intact.

A member without access to the chosen server, or a wrong PIN, stops before a run is created, with a message saying so. An account that is not in a Plex Home sees no picker.

Neither the Apple nor the Android app has a history import, so neither needs a follow-up. The server's own Plex PIN session endpoints (createPlexPin / checkPlexPin), which first-party clients do not use, still import the signed-in account only. Jellyfin compatibility is unaffected.

Validation

  • Web lint, format check, build, and bundle budget: pass.
  • make test-web: 7062 of 7064 passed. The two failures were 5-second timeouts in unrelated files (AdminCollections.select.test.tsx, pgs.test.ts) on a heavily loaded host; both pass when rerun alone.
  • New tests cover the page sending the Home member's server and plex.tv tokens rather than the owner's (the test fails if the owner's tokens are sent), a rejected PIN, a member who cannot reach the server, an account outside a Plex Home, and sign-in finishing while plex.tv never answers the Home lookup.
  • Go gate not run: no Go files changed.
  • Not verified against a real Plex Home with server access. The plex.tv Home endpoints were confirmed to exist and to allow browser requests, and the UI was checked against mocked plex.tv responses on a test server. The response shapes follow Plex's API as documented and used by other clients.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3669/

Surface and build: web app, desktop and phone width, this branch against a test server with plex.tv responses mocked in the browser (a five-member Plex Home). The before capture is the same screen on the base commit.

Risks

If plex.tv's Home user or switch responses differ from what this expects, the picker is either hidden (list failure is treated as "no Plex Home") or the switch fails with a message. The signed-in account's own import works the same as before either way.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • 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
  • Involvement: Fully AI-generated; human verification pending (not yet tested against a real Plex Home)
  • Adversarial review: n/a

🤖 Generated with Claude Code

Note

Add Plex Home user selection to history import

  • Lets the history-import page start a Plex OAuth import as a selected Plex Home member, using that member's resolved server token and account token in plexAuth.ts
  • New helpers list Home members, fetch the account UUID, and switch to a member. HTTP 401/403 from the switch produce PIN-specific errors, and a member without access to the chosen server cannot start the import
  • HistoryImportSettings.tsx adds a Home-user selector, a conditional PIN field for protected users, and switch-error display. The Home lookup runs in the background and does not block Plex sign-in
  • Stale Home lookups are discarded via a request counter, and the PIN is cleared after a successful run creation
  • Behavioral Change: OAuth imports with a selected Home user now pass that user's token as the account token instead of the signed-in account's token

Macroscope summarized b344f93.

After signing in with Plex, the history import page now lists the
account's Plex Home members, managed users included. Picking one switches
to that member on plex.tv (with their Home PIN when they have one) and
starts the import with their own server token and plex.tv token, so the
run reads their watch state and watchlist instead of the account owner's.

One member is imported per run. The Plex sign-in stays on the page, so the
next member can be picked once the previous import finishes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Nov 8, 2026
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 19 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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ae71efa5-5de9-4249-acd2-27cf450f3511
Commits

Reviewing files that changed from the base of the PR and between a529411 and b344f93.

Files selected for processing: 4

  • web/src/lib/plexAuth.test.ts
  • web/src/lib/plexAuth.ts
  • web/src/pages/settings/HistoryImportSettings.tsx
  • web/src/pages/settings/HistoryImportSettings.v2.test.tsx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@silo-kody

silo-kody Bot commented Nov 8, 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 ❌

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T18:11:16.125535Z b344f93 New commits
🔒 Security Review ✅ Completed 2026-11-08T18:13:18.479279Z b344f93 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@silo-triage silo-triage Bot added enhancement New feature or request javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish labels Nov 8, 2026
…lookups

Show the Plex sign-in as soon as the servers load and fetch Plex Home
users afterwards, so a slow optional lookup cannot keep the signed-in
account from importing. Lock the server, Home user, PIN, and profile
fields while an import is starting, so a change made during the Home
switch cannot leave the run going to a profile other than the one shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

silo-kody Bot commented Nov 8, 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 merged commit f69e14a into main Nov 8, 2026
28 checks passed
@Quick104
Quick104 deleted the feat/plex-import-home-users branch November 8, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish size/L 200–499 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant