From 63f41c146cc3678cf30dad9a8dae6fc6ad6c29aa Mon Sep 17 00:00:00 2001 From: sawka Date: Thu, 19 Sep 2024 11:57:40 -0700 Subject: [PATCH] send autoupdate enabled/channel w/ telemetry --- pkg/telemetry/telemetry.go | 10 ++++++++++ pkg/wcloud/wcloud.go | 10 +++++++++- pkg/wcloud/wclouddata.go | 13 +++++++------ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/pkg/telemetry/telemetry.go b/pkg/telemetry/telemetry.go index fda73313b..98818c051 100644 --- a/pkg/telemetry/telemetry.go +++ b/pkg/telemetry/telemetry.go @@ -78,6 +78,16 @@ func IsTelemetryEnabled() bool { return settings.Settings.TelemetryEnabled } +func IsAutoUpdateEnabled() bool { + settings := wconfig.GetWatcher().GetFullConfig() + return settings.Settings.AutoUpdateEnabled +} + +func AutoUpdateChannel() string { + settings := wconfig.GetWatcher().GetFullConfig() + return settings.Settings.AutoUpdateChannel +} + func IsAllowedRenderer(renderer string) bool { return allowedRenderers[renderer] } diff --git a/pkg/wcloud/wcloud.go b/pkg/wcloud/wcloud.go index aecc4efea..bb8b7b0ac 100644 --- a/pkg/wcloud/wcloud.go +++ b/pkg/wcloud/wcloud.go @@ -130,7 +130,15 @@ func SendTelemetry(ctx context.Context, clientId string) error { } log.Printf("[wcloud] sending telemetry data\n") dayStr := daystr.GetCurDayStr() - input := TelemetryInputType{ClientId: clientId, UserId: clientId, CurDay: dayStr, Activity: activity, AppType: "w2"} + input := TelemetryInputType{ + ClientId: clientId, + UserId: clientId, + AppType: "w2", + AutoUpdateEnabled: telemetry.IsAutoUpdateEnabled(), + AutoUpdateChannel: telemetry.AutoUpdateChannel(), + CurDay: dayStr, + Activity: activity, + } req, err := makeAnonPostReq(ctx, TelemetryUrl, input) if err != nil { return err diff --git a/pkg/wcloud/wclouddata.go b/pkg/wcloud/wclouddata.go index 466d83465..5ab1ee88e 100644 --- a/pkg/wcloud/wclouddata.go +++ b/pkg/wcloud/wclouddata.go @@ -13,10 +13,11 @@ type NoTelemetryInputType struct { } type TelemetryInputType struct { - UserId string `json:"userid"` - ClientId string `json:"clientid"` - AppType string `json:"apptype"` - CurDay string `json:"curday"` - DefaultShell string `json:"defaultshell"` - Activity []*telemetry.ActivityType `json:"activity"` + UserId string `json:"userid"` + ClientId string `json:"clientid"` + AppType string `json:"apptype,omitempty"` + AutoUpdateEnabled bool `json:"autoupdateenabled,omitempty"` + AutoUpdateChannel string `json:"autoupdatechannel,omitempty"` + CurDay string `json:"curday"` + Activity []*telemetry.ActivityType `json:"activity"` }