fix(vpn): use OPERATOR_USERNAME for headless Plex token/notification#71
Merged
smartwatermelon merged 1 commit intomainfrom Feb 23, 2026
Conversation
Replaces `stat -f%Su /dev/console` console-user detection with the deploy-time template variable `__OPERATOR_USERNAME__`. On headless servers, `stat` returns `(NNN)` (UID in parens) when no GUI session is active, which is neither empty nor "root" — so the old guard passed but the username was garbage. Token lookup failed → customConnections stayed stale. Changes: - plex-vpn-bypass.sh template: add OPERATOR_USERNAME config var, remove console_user detection from notify() and get_plex_token() - transmission-setup.sh: add sed substitution for __OPERATOR_USERNAME__ - docs/vpn-transmission.md: document the new template placeholder Live patch uploaded to /tmp/plex-vpn-bypass-fixed.sh on TILSIT for manual apply (see PR for apply instructions). AI review: code-reviewer (1 iteration) Adversarial review: code-critic:adversarial-reviewer (1 iteration) Issues fixed: none additional Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
stat -f%Su /dev/consoleconsole-user detection inplex-vpn-bypass.shwith the deploy-time__OPERATOR_USERNAME__template variablestatreturns(NNN)(UID in parens) — neither empty nor"root"— so the old guard passed but the username was garbage, causing token lookup to fail andcustomConnectionsto go stalesedsubstitution for__OPERATOR_USERNAME__intransmission-setup.shso future deployments work correctlyFiles changed
app-setup/templates/plex-vpn-bypass.shOPERATOR_USERNAMEconfig var; removeconsole_userdetection fromnotify()andget_plex_token()app-setup/transmission-setup.shsedsubstitution for__OPERATOR_USERNAME__at deploy timedocs/vpn-transmission.mdLive fix on TILSIT
The patched script is already uploaded to
/tmp/plex-vpn-bypass-fixed.shon TILSIT. To activate:The daemon will update
customConnectionsto the current public IP within 60 seconds.Test Plan
shellcheck app-setup/templates/plex-vpn-bypass.sh— cleanshellcheck app-setup/transmission-setup.sh— cleancustomConnectionsupdate to current IP (67.5.106.16)🤖 Generated with Claude Code