返回 DeepSeek-Reasonix
tray_health.go
根目录 / desktop / tray_health.go
1 package main
2
3 import "strings"
4
5 type statusNotifierSnapshot struct {
6 WatcherOwner string
7 Host bool
8 ItemOwner string
9 Items []string
10 }
11
12 func evaluateStatusNotifierSnapshot(snapshot statusNotifierSnapshot, itemName string) (bool, string) {
13 if strings.TrimSpace(snapshot.WatcherOwner) == "" {
14 return false, "no_watcher"
15 }
16 if !snapshot.Host {
17 return false, "no_host"
18 }
19 if strings.TrimSpace(snapshot.ItemOwner) == "" {
20 return false, "item_no_owner"
21 }
22 for _, registered := range snapshot.Items {
23 service := strings.TrimSpace(strings.SplitN(registered, "/", 2)[0])
24 if service == itemName || service == snapshot.ItemOwner {
25 return true, ""
26 }
27 }
28 return false, "item_not_registered"
29 }
30
30 lines GO