Skip to content

fix(ftp): show the node's real host in the FTP connect hint#25

Merged
nechodom merged 1 commit into
mainfrom
fix/ftp-connect-host-dynamic
Jul 1, 2026
Merged

fix(ftp): show the node's real host in the FTP connect hint#25
nechodom merged 1 commit into
mainfrom
fix/ftp-connect-host-dynamic

Conversation

@nechodom

@nechodom nechodom commented Jul 1, 2026

Copy link
Copy Markdown
Owner

The bug

The FTP-access card showed the literal placeholder:

ftp://hyperion_nechodom_cz@<server-host> · port 21 (FTPS) · chroot /home/hyperion_nechodom_cz

<server-host> is useless to whoever's configuring an FTP client — they have to guess the address. (Reported: "Nechceš tam rovnou psát dynamicky IP adresu podle té node, na které to je?")

Fix

Resolve the real reachable host for the hosting's node:

  • Master-local hosting → the host the operator reached the panel on (Host header → cached public IP). On a single-node box that's exactly the FTP host.
  • Worker hosting → that worker's public_ip (enrollment label, then panel host, as fallbacks) — FTP connects straight to the owning box, not the master. Printing the panel host there would point the client at the wrong machine.

New panel_host() — a bare-host (no scheme/port) sibling of derive_master_url, with a host_without_port helper that strips :port while keeping IPv6 brackets. New ftp_host_for() picks node-vs-master. The value is only rendered inside the "new FTP password" block, so the create path passes an empty string.

Result

  • s4 (single node): ftp://hyperion_nechodom_cz@s4.digitalka.cz
  • worker-hosted site: ftp://user@<worker-public-ip>
  • proxy/loopback Host or a failed node lookup degrade gracefully (public IP / master host), never error.

Test

clippy -D warnings clean; host_without_port unit test (IPv4/hostname/bracketed+bare IPv6) + full hyperion-web suite green — the suite compiles the Askama templates, so the new {{ ftp_host }} binding is verified.

🤖 Generated with Claude Code

…aceholder

The FTP-access card printed `ftp://<user>@<server-host>` — a literal
placeholder the client had to guess at. Resolve the actual reachable host
per hosting instead:

  * hosting on the master node → the host the operator reached the panel on
    (Host header → cached public IP), which on a single-node box IS the FTP
    host;
  * hosting on an enrolled worker → that worker's public_ip (its label, then
    the panel host, as fallbacks), because FTP connects straight to the
    owning box, not the master.

New `panel_host()` (bare-host sibling of `derive_master_url`, with a
`host_without_port` helper that keeps IPv6 brackets) + `ftp_host_for()` that
picks node vs master. Populated on the detail page; unused on the create
path (the "new password" block never renders there).

clippy -D warnings clean; host_without_port unit test + hyperion-web suite
(templates compile) green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nechodom nechodom merged commit 005a461 into main Jul 1, 2026
1 check passed
@nechodom nechodom deleted the fix/ftp-connect-host-dynamic branch July 1, 2026 11:05
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