Skip to content

fix: clipboard HTTP fallback + direct mDNS PTR query (no avahi-daemon) - #75

Merged
reloadfast merged 2 commits into
mainfrom
fix/clipboard-mdns-direct
Mar 1, 2026
Merged

reloadfast merged 2 commits into
mainfrom
fix/clipboard-mdns-direct

Conversation

@reloadfast

Copy link
Copy Markdown
Owner

Two bugs fixed

1. Version copy silently fails on HTTP

navigator.clipboard.writeText() is HTTPS/localhost-only. Home-lab users on http://192.168.x.x:8000 clicked the version badge and got nothing.

Fix: Added copyViaExecCommand() helper in Layout.tsx and SettingsPage.tsx. Tries the Clipboard API first; falls back to textarea + execCommand on non-secure contexts.


2. mDNS hostname resolution never worked in Docker

avahi-resolve is a D-Bus client — it calls avahi-daemon via /run/dbus/system_bus_socket, which is not mounted in the container. Works on the host, always silent-fails inside Docker regardless of network_mode: host.

Fix: Replaced _avahi_resolve() with _mdns_ptr_query():

  • Sends a raw DNS PTR query directly to 224.0.0.251:5353 over UDP
  • No daemon, no D-Bus, no system config needed
  • Handles DNS name compression pointers and QU unicast responses
  • All socket errors are caught and return `"""" gracefully
  • Also removes avahi-utils from the Dockerfile (no longer needed)

Testing

  • 207 backend tests pass, lint clean, frontend lint clean

reloadfast and others added 2 commits March 1, 2026 10:48
## Clipboard copy over HTTP
navigator.clipboard.writeText() requires a secure context (HTTPS or
localhost). Home-lab deployments on http://192.168.x.x:8000 silently
got nothing. Added copyViaExecCommand() helper as a fallback in both
Layout.tsx and SettingsPage.tsx — tries Clipboard API first, falls
back to textarea + execCommand on non-secure contexts.

## mDNS hostname resolution in container
avahi-resolve is a D-Bus client; it delegates to avahi-daemon via
/run/dbus/system_bus_socket, which is not mounted inside the container.
Works on the host but never resolves from inside Docker regardless of
network_mode: host.

Replace _avahi_resolve() with _mdns_ptr_query(): sends a raw DNS PTR
query directly to the mDNS multicast group (224.0.0.251:5353) over
UDP. No daemon, no D-Bus, no system config — just a socket on the
host network namespace. Handles compression pointers, QU unicast
responses, and all socket errors gracefully.

Also removes avahi-utils from the Dockerfile (no longer needed).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@reloadfast
reloadfast merged commit e2388fd into main Mar 1, 2026
7 checks passed
@reloadfast
reloadfast deleted the fix/clipboard-mdns-direct branch March 1, 2026 10: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