app: Surface Ethernet uplink in the UI and gate wpa_supplicant access

When the configured Ethernet interface holds a DHCP-assigned IPv4 at
startup, the app now skips wifi.Initialize / StartEventMonitoring and
guards every wifi.* wrapper against a nil backend. This prevents D-Bus
calls to fi.w1.wpa_supplicant1 from re-activating the daemon via
dbus-activation, honoring the "do nothing" intent of the Ethernet path.

The probed state is exposed in SystemStatus and rendered in the header
as a third pill ("Ethernet · <IP>"); a new "disabled" connectionState
covers the WiFi pill in this mode.
This commit is contained in:
nemunaire 2026-05-02 11:24:36 +08:00
commit 8b1debdddc
7 changed files with 166 additions and 37 deletions

View file

@ -31,6 +31,14 @@ type HotspotConfig struct {
Channel int `json:"channel"`
}
// EthernetStatus represents the state of the wired uplink interface.
// Active is true when the interface holds a DHCP-assigned IPv4 address.
type EthernetStatus struct {
Active bool `json:"active"`
Interface string `json:"interface"`
IPv4 string `json:"ipv4,omitempty"`
}
// HotspotStatus represents detailed hotspot status
type HotspotStatus struct {
State string `json:"state"` // ENABLED, DISABLED, etc.
@ -49,6 +57,7 @@ type SystemStatus struct {
ConnectionState string `json:"connectionState"` // Connection state: connected, disconnected, connecting, disconnecting, roaming
ConnectedSSID string `json:"connectedSSID"`
HotspotStatus *HotspotStatus `json:"hotspotStatus,omitempty"` // Detailed hotspot status
EthernetStatus *EthernetStatus `json:"ethernetStatus,omitempty"` // Wired uplink state, when probed
ConnectedCount int `json:"connectedCount"`
DataUsage float64 `json:"dataUsage"`
Uptime int64 `json:"uptime"`