GODT-2011: Use new app version format

This commit is contained in:
James Houlahan
2022-11-01 13:29:27 +01:00
parent 62d62474fb
commit 1ad821b2b7

View File

@ -21,9 +21,6 @@ package constants
import ( import (
"fmt" "fmt"
"runtime" "runtime"
"golang.org/x/text/cases"
"golang.org/x/text/language"
) )
const VendorName = "protonmail" const VendorName = "protonmail"
@ -68,21 +65,22 @@ const (
// AppVersion returns the full rendered version of the app (to be used in request headers). // AppVersion returns the full rendered version of the app (to be used in request headers).
func AppVersion(version string) string { func AppVersion(version string) string {
return getAPIOS() + cases.Title(language.Und).String(AppName) + "_" + version return fmt.Sprintf("%v-%v@%v", getAPIOS(), AppName, version)
} }
// nolint:goconst
func getAPIOS() string { func getAPIOS() string {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin":
return "macOS" return "macos"
case "linux": case "linux":
return "Linux" return "linux"
case "windows": case "windows":
return "Windows" return "windows"
default: default:
return "Linux" return "linux"
} }
} }