send autoupdate enabled/channel w/ telemetry

This commit is contained in:
sawka 2024-09-19 11:57:40 -07:00
parent ec6a5bbeb3
commit 63f41c146c
3 changed files with 26 additions and 7 deletions

View File

@ -78,6 +78,16 @@ func IsTelemetryEnabled() bool {
return settings.Settings.TelemetryEnabled 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 { func IsAllowedRenderer(renderer string) bool {
return allowedRenderers[renderer] return allowedRenderers[renderer]
} }

View File

@ -130,7 +130,15 @@ func SendTelemetry(ctx context.Context, clientId string) error {
} }
log.Printf("[wcloud] sending telemetry data\n") log.Printf("[wcloud] sending telemetry data\n")
dayStr := daystr.GetCurDayStr() 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) req, err := makeAnonPostReq(ctx, TelemetryUrl, input)
if err != nil { if err != nil {
return err return err

View File

@ -13,10 +13,11 @@ type NoTelemetryInputType struct {
} }
type TelemetryInputType struct { type TelemetryInputType struct {
UserId string `json:"userid"` UserId string `json:"userid"`
ClientId string `json:"clientid"` ClientId string `json:"clientid"`
AppType string `json:"apptype"` AppType string `json:"apptype,omitempty"`
CurDay string `json:"curday"` AutoUpdateEnabled bool `json:"autoupdateenabled,omitempty"`
DefaultShell string `json:"defaultshell"` AutoUpdateChannel string `json:"autoupdatechannel,omitempty"`
Activity []*telemetry.ActivityType `json:"activity"` CurDay string `json:"curday"`
Activity []*telemetry.ActivityType `json:"activity"`
} }