feat(ota): show short hash

This commit is contained in:
Jacky 2025-05-03 08:13:58 +08:00
parent 1c282a57ad
commit 3fe4d859df
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
6 changed files with 34 additions and 18 deletions

View file

@ -9,15 +9,10 @@ import (
)
type RuntimeInfo struct {
OS string `json:"os"`
Arch string `json:"arch"`
ExPath string `json:"ex_path"`
}
type CurVersion struct {
Version string `json:"version"`
BuildID int `json:"build_id"`
TotalBuild int `json:"total_build"`
OS string `json:"os"`
Arch string `json:"arch"`
ExPath string `json:"ex_path"`
CurVersion *Info `json:"cur_version"`
}
func GetRuntimeInfo() (r RuntimeInfo, err error) {
@ -33,9 +28,10 @@ func GetRuntimeInfo() (r RuntimeInfo, err error) {
}
r = RuntimeInfo{
OS: runtime.GOOS,
Arch: runtime.GOARCH,
ExPath: realPath,
OS: runtime.GOOS,
Arch: runtime.GOARCH,
ExPath: realPath,
CurVersion: GetVersionInfo(),
}
return

View file

@ -11,6 +11,7 @@ type Info struct {
Version string `json:"version"`
BuildId int `json:"build_id"`
TotalBuild int `json:"total_build"`
ShortHash string `json:"short_hash"`
}
var versionInfo *Info
@ -21,6 +22,7 @@ func GetVersionInfo() *Info {
Version: Version,
BuildId: BuildId,
TotalBuild: TotalBuild,
ShortHash: GetShortHash(),
}
}
return versionInfo