Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/server/main-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ func startupActivityUpdate(firstLaunch bool) {
ClientArch: wavebase.ClientArch(),
ClientOSRelease: wavebase.UnameKernelRelease(),
ClientIsDev: wavebase.IsDevMode(),
ClientPackageType: wavebase.ClientPackageType(),
ClientMacOSVersion: wavebase.ClientMacOSVersion(),
AutoUpdateChannel: autoUpdateChannel,
AutoUpdateEnabled: autoUpdateEnabled,
LocalShellType: shellType,
Expand Down
4 changes: 4 additions & 0 deletions frontend/types/gotypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,8 @@ declare global {
"client:buildtime"?: string;
"client:osrelease"?: string;
"client:isdev"?: boolean;
"client:packagetype"?: string;
"client:macos"?: string;
"cohort:month"?: string;
"cohort:isoweek"?: string;
"autoupdate:channel"?: string;
Expand Down Expand Up @@ -1540,6 +1542,8 @@ declare global {
"client:buildtime"?: string;
"client:osrelease"?: string;
"client:isdev"?: boolean;
"client:packagetype"?: string;
"client:macos"?: string;
"cohort:month"?: string;
"cohort:isoweek"?: string;
"autoupdate:channel"?: string;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/telemetry/telemetrydata/telemetrydata.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ type TEventUserProps struct {
ClientBuildTime string `json:"client:buildtime,omitempty"`
ClientOSRelease string `json:"client:osrelease,omitempty"`
ClientIsDev bool `json:"client:isdev,omitempty"`
ClientPackageType string `json:"client:packagetype,omitempty"`
ClientMacOSVersion string `json:"client:macos,omitempty"`

CohortMonth string `json:"cohort:month,omitempty"`
CohortISOWeek string `json:"cohort:isoweek,omitempty"`
Expand Down
40 changes: 40 additions & 0 deletions pkg/wavebase/wavebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,46 @@ func ClientArch() string {
return fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)
}

func ClientPackageType() string {
if os.Getenv("SNAP") != "" {
return "snap"
}
if os.Getenv("APPIMAGE") != "" {
return "appimage"
}
return ""
}

var macOSVersionOnce = &sync.Once{}
var cachedMacOSVersion string

var macOSVersionRegex = regexp.MustCompile(`^(\d+\.\d+(?:\.\d+)?)`)

func internalMacOSVersion() string {
ctx, cancelFn := context.WithTimeout(context.Background(), 2*time.Second)
defer cancelFn()
out, err := exec.CommandContext(ctx, "sw_vers", "-productVersion").Output()
if err != nil {
return ""
}
versionStr := strings.TrimSpace(string(out))
m := macOSVersionRegex.FindStringSubmatch(versionStr)
if len(m) < 2 {
return ""
}
return m[1]
}

func ClientMacOSVersion() string {
if runtime.GOOS != "darwin" {
return ""
}
macOSVersionOnce.Do(func() {
cachedMacOSVersion = internalMacOSVersion()
})
return cachedMacOSVersion
}

var releaseRegex = regexp.MustCompile(`^(\d+\.\d+\.\d+)`)
var osReleaseOnce = &sync.Once{}
var osRelease string
Expand Down
Loading