The saved Plex server token or address can stop working (token rotated, server moved). That
looked like "signed out" and sent the person back to the sign-in screen. The proxy now asks plex.tv
(using the saved account sign-in) for a fresh token and address, retries once, and saves them.
Sign-ins saved before the server id was recorded are matched by server name. A revoked account
sign-in signs the person out cleanly; repairs are one at a time and pause 30s after a failure.
The server logs [plex] lines for sign-in, connect, repair and failure.
tools/plex-test.js (31 checks, fake plex.tv + fake Plex) runs in the Gitea workflow.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>