Repository navigation
feat(web): import history for a Plex Home user - #3669
Conversation
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>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
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. View limit details
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…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 — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
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/resourcesand 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
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.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
AI Disclosure
🤖 Generated with Claude Code
Note
Add Plex Home user selection to history import
Macroscope summarized b344f93.