feat: fix incorrect Casdoor version in system info page (#1631)

* feat: add sync module to bi-sync mysql

* feat: fix the delay problem

* feat: fix go mod

* feat: fix the varchar(100) parse error

* fix: fix go.mod space inconsistency

* fix: fix go.mod space inconsistency

* fix: use sql builder instead of concatenation

* fix: remove serverId

* fix: fix file is not `gofumpt`-ed (gofumpt) error

* feat: add mysql bi-sync

* feat: fix some data inconsistency problems

* feat: add function atuo get server uuid

* fix: encapsulate the struct to optimize the code

* fix: fix incorrect Casdoor version in system info page

* fix: fix incorrect root path

* Update sysytem_test.go

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
This commit is contained in:
longxu0509
2023-03-09 13:28:23 +08:00
committed by GitHub
parent a5dfe54a33
commit 3f623570fd
6 changed files with 187 additions and 33 deletions

View File

@ -25,6 +25,11 @@ type SystemInfo struct {
CpuUsage []float64 `json:"cpu_usage"`
}
type GitRepoInfo struct {
Commit string `json:"commit"`
Version string `json:"version"`
}
// GetSystemInfo
// @Title GetSystemInfo
// @Tag System API
@ -71,12 +76,15 @@ func (c *ApiController) GetSystemInfo() {
// @Success 200 {string} local latest version hash of casdoor
// @router /get-release [get]
func (c *ApiController) GitRepoVersion() {
version, err := util.GetGitRepoVersion()
commit, version, err := util.GetGitRepoVersion()
if err != nil {
c.ResponseError(err.Error())
return
}
c.Data["json"] = version
c.Data["json"] = GitRepoInfo{
Commit: commit,
Version: version,
}
c.ServeJSON()
}