diff --git a/http/controller/api/peer.go b/http/controller/api/peer.go index b2565cf..8a6f0ea 100644 --- a/http/controller/api/peer.go +++ b/http/controller/api/peer.go @@ -1,6 +1,7 @@ package api import ( + "fmt" "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" requstform "github.com/lejianwen/rustdesk-api/v2/http/request/api" @@ -60,5 +61,7 @@ func (p *Peer) SysInfo(c *gin.Context) { func (p *Peer) SysInfoVer(c *gin.Context) { //读取resources/version文件 v := service.AllService.AppService.GetAppVersion() + // 加上启动时间,方便client上传信息 + v = fmt.Sprintf("%s\n%s", v, service.AllService.AppService.GetStartTime()) c.String(http.StatusOK, v) } diff --git a/service/app.go b/service/app.go index 1c77a9c..96acb69 100644 --- a/service/app.go +++ b/service/app.go @@ -3,13 +3,14 @@ package service import ( "os" "sync" + "time" ) type AppService struct { } var version = "" - +var startTime = "" var once = &sync.Once{} func (a *AppService) GetAppVersion() string { @@ -26,3 +27,13 @@ func (a *AppService) GetAppVersion() string { }) return version } + +func init() { + // Initialize the AppService if needed + startTime = time.Now().Format("2006-01-02 15:04:05") +} + +// GetStartTime +func (a *AppService) GetStartTime() string { + return startTime +}