mirror of
https://github.com/henrygd/beszel.git
synced 2026-09-27 03:47:47 +02:00
wifi: omit empty info snapshot and tidy up
- Info.WiFi uses json "wf" with omitempty so systems without Wi-Fi no longer store/broadcast "wifi":null - move osascript exec into wifi_darwin.go; drop unused commandRunner - share strongest-connection logic between table cell and sorting - trim agent/wifi README
This commit is contained in:
@@ -165,7 +165,6 @@ const (
|
||||
|
||||
// Core system data that is needed in All Systems table
|
||||
type Info struct {
|
||||
// Always serialize the current snapshot, including null on unsupported agents.
|
||||
Hostname string `json:"h,omitempty" cbor:"0,keyasint,omitempty"` // deprecated - moved to Details struct
|
||||
KernelVersion string `json:"k,omitempty" cbor:"1,keyasint,omitempty"` // deprecated - moved to Details struct
|
||||
Cores int `json:"c,omitzero" cbor:"2,keyasint,omitzero"` // deprecated - moved to Details struct
|
||||
@@ -194,7 +193,7 @@ type Info struct {
|
||||
Battery Battery `json:"bat,omitzero" cbor:"23,keyasint,omitzero"` // [percent, charge state]
|
||||
RootDiskName string `json:"rdn,omitempty" cbor:"24,keyasint,omitempty"` // custom name for root disk (set via FILESYSTEM=device__name)
|
||||
PackageUpdates []uint16 `json:"pu,omitempty" cbor:"25,keyasint,omitempty"` // [totalUpdates, securityUpdates] (security omitted if unknown)
|
||||
WiFi map[string]WiFi `json:"wifi" cbor:"26,keyasint"`
|
||||
WiFi map[string]WiFi `json:"wf,omitempty" cbor:"26,keyasint,omitempty"` // connected Wi-Fi interfaces
|
||||
}
|
||||
|
||||
// Data that does not change during process lifetime and is not needed in All Systems table
|
||||
|
||||
@@ -33,8 +33,8 @@ func TestWiFiWireSnapshot(t *testing.T) {
|
||||
if err = json.Unmarshal(encoded, &info); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, ok := info["wifi"]; !ok {
|
||||
t.Fatal("current absence must be explicit")
|
||||
if _, ok := info["wf"]; ok != (len(wifi) > 0) {
|
||||
t.Fatalf("wf present = %v for snapshot %v", ok, wifi)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user