Files
YUZHEthefool 157ff7e8d1 feat(proxy): add auto-resume routing on startup setting
The routing takeover previously re-armed itself unconditionally on every
launch: when the process was killed without cleanup (direct shutdown,
power loss), the proxy address stayed in client configs and the next
cc-switch launch re-took-over even if the proxy never came back, leaving
CLI tools pointed at a dead 127.0.0.1:<port> address indefinitely.

Add a proxy_restore_on_startup setting (default off) modeled after
Clash-style proxy autostart options:

- Off (default): any exit restores the original client configs and clears
  the per-app takeover flags. After an abnormal exit, startup recovery
  restores the live configs and clears the flags instead of re-taking
  over, so no stale routing address survives a relaunch.
- On: previous behavior kept - exit preserves proxy_config.enabled and the
  next launch re-arms takeover automatically (requires Launch on Startup).

cleanup_before_exit now branches on the setting (stop_with_restore vs
stop_with_restore_keep_state) with a half-takeover fallback that clears
stray enabled flags even when no backups or placeholders remain. The
settings page gains a toggle in the Local Routing section with a hint
when auto-resume is on but Launch on Startup is off, plus zh/zh-TW/en/ja
translations and user-manual updates.
2026-09-04 19:17:36 +08:00
..