Files
CodeNomad/packages/ui/src/lib/i18n/messages/en/remoteAccess.ts
VooDisss f3c54df283 fix(server): show sane remote URLs for 0.0.0.0 binds (#262)
Closes #261

## Summary

- improve startup remote URL selection when the server binds to
`0.0.0.0`
- print additional reachable remote URLs instead of advertising only the
first external address
- add targeted tests for address ordering and advertisability behavior

## Problem

When CodeNomad was started with `--host 0.0.0.0`, the CLI chose the
first external IPv4 address it discovered and displayed only that one as
the remote URL.

On Windows machines with WSL, Hyper-V, Docker, or other virtual
adapters, that often surfaced a virtual `172.x.x.x` address even though
a more useful LAN address such as `192.168.x.x` was also reachable and
usable from other devices.

That made remote access look broken or confusing even though the server
itself was accessible.

## What changed

- reuse the resolved network-address list for both:
  - primary remote URL selection
  - startup logging of additional reachable URLs
- choose the primary remote URL from the **advertisable** external
addresses instead of any external address
- print `Other Accessible URLs` when multiple useful remote URLs are
available
- avoid hard-coding a preference like `192.168 > 10 > 172`
- suppress link-local `169.254.*` addresses from user-facing advertised
URLs
- add tests covering:
  - stable ordering across RFC1918 address ranges
  - link-local addresses being non-advertisable
  - link-local-first discovery not stealing the primary LAN URL

## Why this approach

This keeps address derivation in the network-address resolver layer and
limits `index.ts` to startup wiring and presentation.

It also fixes the misleading terminal output without redesigning binding
behavior, TLS behavior, or the server API contract.

## Validation

- `npm run typecheck --workspace @neuralnomads/codenomad`
- `npx tsx --test
'.\\src\\server\\__tests__\\network-addresses.test.ts'`

## Notes

- this change is intentionally focused on selection and presentation of
reachable addresses
- it does not attempt a broader virtual-adapter classification policy
beyond suppressing clearly low-value link-local addresses in user-facing
output

---------

Co-authored-by: Shantur Rathore <i@shantur.com>
2026-04-01 22:12:28 +01:00

54 lines
3.4 KiB
TypeScript

export const remoteAccessMessages = {
"remoteAccess.eyebrow": "Remote handover",
"remoteAccess.title": "Connect to CodeNomad remotely",
"remoteAccess.subtitle": "Use the addresses below to open CodeNomad from another device.",
"remoteAccess.close": "Close remote access",
"remoteAccess.refresh": "Refresh",
"remoteAccess.sections.listeningMode.label": "Listening mode",
"remoteAccess.sections.listeningMode.help": "Allow or limit remote handovers by binding to all interfaces or just localhost.",
"remoteAccess.toggle.on": "On",
"remoteAccess.toggle.off": "Off",
"remoteAccess.toggle.title": "Allow connections from other IPs",
"remoteAccess.toggle.caption.all": "Binding to 0.0.0.0",
"remoteAccess.toggle.caption.local": "Binding to 127.0.0.1",
"remoteAccess.toggle.note": "Changing this requires a restart and temporarily stops all active instances. Share the addresses below once the server restarts.",
"remoteAccess.listeningMode.restartConfirm.message": "Restart to apply listening mode? This will stop all running instances.",
"remoteAccess.listeningMode.restartConfirm.title.all": "Open to other devices",
"remoteAccess.listeningMode.restartConfirm.title.local": "Limit to this device",
"remoteAccess.listeningMode.restartConfirm.confirmLabel": "Restart now",
"remoteAccess.listeningMode.restartConfirm.cancelLabel": "Cancel",
"remoteAccess.restart.errorManual": "Unable to restart automatically. Please restart the app to apply the change.",
"remoteAccess.sections.serverPassword.label": "Server password",
"remoteAccess.sections.serverPassword.help": "Remote handovers require a password. Set a memorable one to enable logins from other devices.",
"remoteAccess.authStatus.unavailable": "Authentication status unavailable.",
"remoteAccess.username": "Username: {username}",
"remoteAccess.password.status.set": "A password is set for remote access.",
"remoteAccess.password.status.unset": "No memorable password is set yet. Set one to allow remote handover logins.",
"remoteAccess.password.actions.cancel": "Cancel",
"remoteAccess.password.actions.change": "Change password",
"remoteAccess.password.actions.set": "Set password",
"remoteAccess.password.form.newPassword": "New password",
"remoteAccess.password.form.confirmPassword": "Confirm password",
"remoteAccess.password.form.placeholder": "At least 8 characters",
"remoteAccess.password.error.tooShort": "Password must be at least 8 characters.",
"remoteAccess.password.error.mismatch": "Passwords do not match.",
"remoteAccess.password.save.saving": "Saving…",
"remoteAccess.password.save.label": "Save password",
"remoteAccess.sections.addresses.label": "Reachable addresses",
"remoteAccess.sections.addresses.help": "Launch or scan from another machine to hand over control.",
"remoteAccess.addresses.loading": "Loading addresses…",
"remoteAccess.addresses.none": "No addresses available yet.",
"remoteAccess.addresses.actions.showOther": "Show {count} other addresses",
"remoteAccess.addresses.actions.hideOther": "Hide other addresses",
"remoteAccess.address.scope.network": "Network",
"remoteAccess.address.scope.loopback": "Loopback",
"remoteAccess.address.scope.internal": "Internal",
"remoteAccess.address.open": "Open",
"remoteAccess.address.showQr": "Show QR",
"remoteAccess.address.hideQr": "Hide QR",
"remoteAccess.address.qrAlt": "QR for {url}",
} as const