mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-10 18:05:48 +02:00
feat(ota): show short hash
This commit is contained in:
parent
1c282a57ad
commit
3fe4d859df
6 changed files with 34 additions and 18 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue