Expensive bee

This commit is contained in:
2026-02-03 16:49:05 +02:00
parent d3f29e3927
commit cdcdf2c644
10 changed files with 376 additions and 50 deletions

View File

@@ -201,6 +201,12 @@ type Settings struct {
ColorClock string
ColorAlarm string
ShowSeconds bool
// Client/server mode
ServerURL string // If set, run as client connecting to this URL
ServerPassword string // Password for authenticating to remote server
APIPassword string // Password required for incoming API requests (host mode)
PollSeconds int // How often to poll server in client mode
}
func DefaultSettings() Settings {
@@ -213,6 +219,10 @@ func DefaultSettings() Settings {
ColorClock: "#00FF88",
ColorAlarm: "#FF4444",
ShowSeconds: true,
ServerURL: "",
ServerPassword: "",
APIPassword: "",
PollSeconds: 5,
}
}
@@ -226,6 +236,10 @@ func (s *Store) LoadSettings() Settings {
cfg.ColorClock = s.GetSetting("color_clock", cfg.ColorClock)
cfg.ColorAlarm = s.GetSetting("color_alarm", cfg.ColorAlarm)
cfg.ShowSeconds = s.GetSetting("show_seconds", "true") == "true"
cfg.ServerURL = s.GetSetting("server_url", cfg.ServerURL)
cfg.ServerPassword = s.GetSetting("server_password", cfg.ServerPassword)
cfg.APIPassword = s.GetSetting("api_password", cfg.APIPassword)
cfg.PollSeconds = s.getSettingInt("poll_seconds", cfg.PollSeconds)
return cfg
}
@@ -239,6 +253,10 @@ func (s *Store) SaveSettings(cfg Settings) error {
"color_clock": cfg.ColorClock,
"color_alarm": cfg.ColorAlarm,
"show_seconds": fmt.Sprintf("%t", cfg.ShowSeconds),
"server_url": cfg.ServerURL,
"server_password": cfg.ServerPassword,
"api_password": cfg.APIPassword,
"poll_seconds": fmt.Sprintf("%d", cfg.PollSeconds),
}
for k, v := range pairs {
if err := s.SetSetting(k, v); err != nil {