WebThingsIO / gateway

WebThings Gateway - a self-hosted web application for monitoring and controlling a building over the web
http://webthings.io/gateway
Mozilla Public License 2.0
2.62k stars 339 forks source link

[Snap] Implement Local Domain Settings #3157

Open benfrancis opened 3 months ago

benfrancis commented 3 months ago

In the web interface at Settings -> Domain there is a check box to toggle mDNS/DNS-SD broadcasts on and off, and a text field to set the local hostname.

On other platforms this allows users to enable and configure a .local domain.

E.g. see https://github.com/WebThingsIO/gateway/blob/master/src/platforms/linux-raspbian.ts#L492

ogra1 commented 4 weeks ago

this should be trivial to achieve through the avahi-control interface that allows you to talk to the avahi daemon on the OS (either directly on classic installs or through the snap interface to the avahi snap on UbuntuCore (which you'd indeed need to bundle in the image))

Looking at the existing code you linked above it would indeed need some patching though since it extensively hacks directly into system files (like /etc/hosts and /etc/hostname) and uses long obsoleted tools (like iwlist instead of iw) but looking at the code it would surely benefit from some cleanup and abstraction anyway :)