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
}
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]
}

View File

@ -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

View File

@ -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"`
}