Skip to content

feat(dweb): user kill switch to shut down all dweb networking - #14

Merged
NotASithLord merged 1 commit into
mainfrom
feat/dweb-kill-switch
Jun 22, 2026
Merged

feat(dweb): user kill switch to shut down all dweb networking#14
NotASithLord merged 1 commit into
mainfrom
feat/dweb-kill-switch

Conversation

@NotASithLord

Copy link
Copy Markdown
Owner

Implements the network kill switch from docs/specs/FEATURE-FIRST-CLASS-MESSAGING.md §2 — turning the dweb on is a deliberate user action, so shutting it down must be one too.

What

  • New dweb/base/stop SW route (background/routes/dweb.js) — symmetric to dweb/base/start:
    • Persists dwebEnabled = false first, so it won't auto-restart on the next unlock (maybeStartBaseNetwork already gates on the setting, service-worker.js:2639).
    • Tears down a live host via the existing complete offscreen teardown (dweb/base-host/stop, offscreen/dweb-base.js:388-397: closes every room, drops the mesh + lobby, clears the re-sub timer).
    • Never spawns the offscreen just to stop it (checks getContexts first).
    • Gated on DWEB_ENABLED only (not dwebOn()) so it can stop precisely as it flips the setting off.
  • "Stop the network" control in the home Network section (home/network-section.js), confirm-gated since it drops live connections.

Net effect: one user action turns all dweb networking off and keeps it off until they start it again — also the master fail-closed for the §7 unattended messaging surface once that lands.

Scope

The offscreen-side teardown already existed and is complete; this PR wires it to a user-reachable route + UI. The inbound-monitor teardown referenced in spec §2 is N/A until those monitors exist (workstream B).

Verification

bun run lint and bun run typecheck clean. (Extension UI/SW — not dev-server-previewable; reload the unpacked extension to exercise.)

🤖 Generated with Claude Code

Symmetric to "Start the network": a new dweb/base/stop SW route persists dwebEnabled=false (so it won't auto-restart on unlock — maybeStartBaseNetwork gates on it) and tears down a live host via the existing complete offscreen teardown (closes every room, drops the mesh + lobby, clears the re-sub timer), without spawning the offscreen just to stop. A confirm-gated "Stop the network" control in the home Network section drives it. Implements docs/specs/FEATURE-FIRST-CLASS-MESSAGING.md section 2 (the kill switch / master off).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant