Skip to content

fix: remove hardcoded desktop gateway URL default and allow clearing optional fields - #86

Open
realchrisolin wants to merge 1 commit into
rusty4444:mainfrom
realchrisolin:fix/desktop-gateway-url-field-bugs
Open

realchrisolin wants to merge 1 commit into
rusty4444:mainfrom
realchrisolin:fix/desktop-gateway-url-field-bugs

Conversation

@realchrisolin

Copy link
Copy Markdown

Summary

Fixes two bugs in the connection add/edit dialog that made the Desktop
Gateway URL field effectively unmanageable. This matters because, per #84,
stock Hermes always falls back to legacy REST — reaching a clean REST setup
is the only practical path, and these bugs block it.

1. Hardcoded default

_AddDialog defaulted "Desktop Gateway URL" to a hardcoded developer IP
(http://192.168.1.193/desktop) instead of empty, so a fresh connection
pre-filled a bogus URL.

2. Un-clearable fields

_validateAndSave converted empty optional fields (gatewayPrefix,
dashboardPrefix, desktopGatewayUrl) to null before saving, but
updateConnection's clear* flags (in connection_manager.dart) require a
non-null empty string to detect a clear. With null passed, copyWith's
null ?? oldValue kept the previous value, so these fields silently reverted
to their last value on every edit.

Changes

lib/main.dart only — pass the raw (possibly empty) value through instead of
null-coalescing it, and default the desktop gateway field text to empty.

Verification

Built and installed locally; confirmed the "Desktop Gateway URL" field now
defaults to empty and can be cleared on an existing connection, allowing the
app to fall back to REST chat against a stock Hermes gateway.

Related

…optional fields

- _AddDialog: the 'Desktop Gateway URL' field defaulted to a hardcoded
  developer IP (http://192.168.1.193/desktop) instead of empty.

- _validateAndSave: empty optional fields (gateway prefix, dashboard
  prefix, desktop gateway URL) were converted to null before save, but
  updateConnection's clear* flags require a non-null empty string to
  detect a clear — so these fields could never be cleared on an existing
  connection. Pass the raw (possibly empty) value through instead.

@rusty4444 rusty4444 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: PR #86 — hermes-android

Verdict: ✅ Approve (no blocking issues)

Reviewed by Hermes Agent (daily automation).

Summary

Two fixes in lib/main.dart _AddDialogState:

  1. Removes the hardcoded dev IP default http://192.168.1.193/desktop for the Desktop Gateway URL field — correct, this was a leak of a developer machine address.
  2. Passes raw (possibly empty) gatewayPrefix / dashboardPrefix / desktopGatewayUrl values through instead of converting empty→null.

Verification

I verified the second change against the updateConnection contract in lib/core/services/connection_manager.dart (lines ~265–287):

  • clearGatewayPrefix: gateway != null && gateway.isEmpty
  • clearDashboardPrefix: dashboard != null && dashboard.isEmpty
  • clearDesktopGatewayUrl: desktopGateway != null && desktopGateway.isEmpty

Empty→null conversion made clear* flags impossible to trigger on existing connections, so these fields could never be cleared. Passing the raw value through is the correct fix.

Notes

  • ⚠️ No CI checks reported on this PR branch (fork PR, cross-repository). Not eligible for auto-merge until CI runs and passes.
  • dashboardUsername / dashboardPassword still convert empty→null at call sites; updateConnection derives clearDashboardUsername/clearDashboardPassword from non-null empty values — the same latent bug may exist there. Non-blocking suggestion for a follow-up.

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.

2 participants