Skip to content

fix(hosts): keep the host OS icon in step with the detected distro - #659

Merged
kipavy merged 2 commits into
devfrom
fix/host-icon-follows-distro-655
Oct 19, 2026
Merged

kipavy merged 2 commits into
devfrom
fix/host-icon-follows-distro-655

Conversation

@kipavy

@kipavy kipavy commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #655

What changes

  • Icon follows the OS. A stored icon equal to the distro (older builds copied it there) is treated as derived. Changing the distro through Auto-detect, sync or undo clears it, so the card shows the new OS. An icon the user picked is kept.
  • Re-detect on connect. The OS is checked on every SSH connect, not only when no distro is saved, so a reinstalled host updates itself. Nothing is written when the result is unchanged. The generic linux fallback (unrecognised OS) never replaces a saved distro, so a hand-set FreeBSD or OpenWrt host stays as set.
  • Windows and MikroTik RouterOS. Both are recognised from the SSH banner (OpenSSH_for_Windows, ROSSSH) with no command run, and get entries in the distro list and icon picker.
  • No POSIX bootstrap on RouterOS. Shell integration, persistence and the export/cd startup lines were skipped only for Windows. They are now skipped for any platform the banner names, so RouterOS gets a plain shell instead of a POSIX wrapper exec'd into its CLI. Not tested against a real RouterOS (no KVM on the dev box).
  • Form auto-detect uses a new backend one-shot command (ssh_detect_distro_direct) that shares detection with connected sessions, replacing the TypeScript os-release parsing.
  • Edit form: clearing the icon now clears it on save instead of keeping the old one.
  • Refactor: the one-shot ssh_exec_command / ssh_kill_persistent take a single target struct instead of nine arguments each.

Testing

  • New connectionStore.distroIcon.test.ts: a legacy icon is dropped, a custom icon is kept, team vault hosts follow the same rule, an unchanged detection writes nothing, and the linux fallback rule.
  • Rust: banner platform detection, os-release/Proxmox parsing, and clearing the icon through the form merge.
  • Live in a headless container against an OpenSSH target faked to Debian: a legacy Ubuntu host became Debian with the icon cleared and persisted, a custom Docker icon survived, and with VersionAddendum ROSSSH both the form and connect-time paths returned routeros. Exec and kill still work with the new payload.
  • Re-detection on later connects is covered by unit tests only; it was not exercised live.

The host card prefers the stored icon over the distro, and older builds
copied the distro into the icon, so a host whose OS changed kept the old
logo. An icon equal to the distro is now treated as derived: changing the
distro (Auto-detect, sync, undo) clears it, while an icon the user picked
stays. An empty icon from the edit form now clears the saved one instead
of being ignored.

The OS is re-detected on every SSH connect, not only when no distro is
saved, so a reinstalled host picks up its new OS. Nothing is written when
the result is unchanged, and the generic "linux" fallback never replaces
a saved distro.

Windows and MikroTik RouterOS are recognised from the SSH banner
(OpenSSH_for_Windows, ROSSSH) and get their own entries in the distro list
and icon picker. Form auto-detect now goes through a backend one-shot
command that shares the same detection as connected sessions, and the
one-shot exec/kill commands take a single target struct.

Fixes #655
Shell integration, persistence and the export/cd startup lines all assume
a POSIX shell. They were skipped only for Windows, so a MikroTik RouterOS
host would get the wrapper exec'd into its CLI. Skip them for any platform
the banner names, since that list is exactly the hosts without a POSIX
shell.
@kipavy
kipavy merged commit 1919e7e into dev Oct 19, 2026
5 checks passed
@kipavy
kipavy deleted the fix/host-icon-follows-distro-655 branch October 19, 2026 07:56
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