feat: opt-in auto-connect on start preference#78
Merged
Merged
Conversation
Adds an "Auto-connect on start" toggle (off by default) to the connected view's quick settings. When enabled, the extension sends `up` once per browser session if the first status after `init` reports `Stopped` or `NoState`. NeedsLogin / NeedsMachineAuth / Starting / Running / InUseOtherUser are skipped. An explicit manual disconnect within the session is respected: chrome.storage.session tracks an "already handled" flag that survives service-worker restarts but clears on browser restart, so cycling the MV3 SW after a manual `down` won't re-up the node. Closes #73
# Conflicts: # packages/shared/src/background/background.ts
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
Adds an opt-in Auto-connect on start toggle to the connected view's quick settings (off by default). When enabled, the extension sends
uponce per browser session if the first status afterinitreportsStoppedorNoState.NeedsLogin/NeedsMachineAuth/Starting/Running/InUseOtherUserare skipped.An explicit manual disconnect within the same browser session is respected:
chrome.storage.sessiontracks an "already handled" flag that survives MV3 service-worker restarts but clears on browser restart, so cycling the SW after a manualdownwon't re-up the node. There's a defensive fallback ifstorage.sessionis unavailable — the feature still works, just without the explicit-disconnect guarantee.Design choices (from the issue's open questions):
autoConnectOnStartboolean inchrome.storage.local, matches the existinglastExitNodeIDpattern.docs/FEATURE_PARITY.mdline 35 flipped to Yes with a note describing the new behavior.Closes #73
Test plan
pnpm typecheck— clean across both packagespnpm test— 296/296 pass (27 new tests; covers the auto-up matrix, session-flag interaction, manual-disconnect path, and the missing-API fallback)pnpm build— Chrome + Firefox MV3 bundles build cleanly