Repository navigation
Conversation
A Plex server refuses the account token of someone it is shared with; plex.tv issues them a separate token for that server. Availability checks sent the account token, got 401, and showed every title as missing to all non-admin Plex users. Look up the server token once per user (cached 6 h, retried after 1 min on failure) without adding tokens to device lists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mediaServerAvailability) called the Plex server with the user's plex.tv account token.PlexTvAPI.getServerAccessToken(machineId)reads/api/resourcesand returns theaccessTokenplex.tv issued this account for the configured server, ornullwhen the server isn't listed.getDevices) still never carry tokens. Values are length-bounded like the other resource fields.resolvePlexServerTokenuses that token for the item and episode access checks. Without one it keeps the account token, which is what works for the owner.Testing
mediaServerAvailability.test.tschecks that a shared server is called with the server token plex.tv issued to the viewer, and never with the account token. The other availability tests mock plex.tv with no shared server, so they still use the account token.00b4b12d1):tsc -p server/tsconfig.json, ESLint on the changed files,pnpm i18n:check: pass;src/hooks/detailDisclosureMediaServer.test.mjs(same as in perf: keep the server responsive on SQLite, and music fallbacks for a busy Aurral #740 and fix(lumen): tidy Manage sheets, Issues filters, admin columns; faster All search #741).AI assistance
AI tools helped write parts of the code and tests. I reviewed the changes, ran the tests listed above, and checked it on a live install.