Skip to content

fix(proxy): persist proxy config so it survives saves and reconnects - #72

Open
sunxiaobin89 wants to merge 1 commit into
GOODBOY008:mainfrom
sunxiaobin89:fix/proxy-config-persistence
Open

fix(proxy): persist proxy config so it survives saves and reconnects#72
sunxiaobin89 wants to merge 1 commit into
GOODBOY008:mainfrom
sunxiaobin89:fix/proxy-config-persistence

Conversation

@sunxiaobin89

Copy link
Copy Markdown
Contributor

Summary

Proxy settings (type, host, port, username, password) configured on a connection were never persisted. Any save — creating a new connection, editing an existing one, or a failed connect that still saved the connection — silently dropped the proxy config. Reopening the Edit dialog showed empty proxy fields.

Root cause

  • The storage model (ConnectionData) had no proxy fields, so no save operation could store them.
  • Every save/update path in ConnectionDialog (new connect, edit save) and the connection duplication flow omitted proxy fields.
  • All ConnectionData → ConnectionConfig conversions in App.tsx (9 sites) dropped proxy fields, so the edit dialog never received them.

Changes

  • src/lib/connection-storage.ts — add proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword to ConnectionData.
  • src/lib/connection-config.ts (new) — toConnectionConfig() maps stored connections to the dialog config, carrying proxy settings; replaces 9 duplicated constructions in App.tsx.
  • src/components/connection-dialog.tsx — include proxy fields in all 5 save/update calls (SSH, SFTP/FTP/Desktop, edit save); bind value on the proxy username input so saved data displays; normalize proxyType to 'none' when loading a connection without proxy settings.
  • src/components/connection-manager.tsx — duplication preserves proxy settings.

Testing

  • 12 new tests: toConnectionConfig proxy mapping, storage round-trip, and dialog persistence (edit save, failed connect keeps proxy, edit dialog shows saved values).
  • Full suite: 522 tests pass, tsc --noEmit clean, pnpm i18n:check clean, no new lint issues.
  • Manually verified: proxy config survives a failed connect and is shown again when editing.

Note: proxy settings are now persisted and round-trip through the edit dialog, but are not yet forwarded to the backend during connection — that is a separate feature, not part of this fix.

Proxy settings (type, host, port, username, password) were never persisted:
ConnectionData had no proxy fields and every save/update path omitted them.
Saving a connection (new or edited) silently dropped the proxy config, so
reopening the edit dialog showed empty proxy fields.

- Add proxy fields to ConnectionData so the storage model can hold them
- Include proxy fields in every save/update path in ConnectionDialog
  (new connect, edit save, SSH/SFTP/FTP/Desktop) and in duplication
- Add toConnectionConfig helper to carry proxy settings when opening the
  edit dialog, replacing 9 duplicated ConnectionConfig constructions
- Fix proxy username input missing value binding so saved data displays
- Normalize proxyType to 'none' for connections without proxy settings

Test: 522 tests pass, 12 new tests cover proxy persistence
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