Update version.go

This commit is contained in:
Alexander-Ger-Reich
2025-12-13 10:49:15 +01:00
committed by GitHub
parent 116bb50364
commit dec1621850

View File

@@ -48,6 +48,24 @@ func (s *Service) GetVersion(c *gin.Context) {
})
}
func (s *Service) GetCurrentVersion(c *gin.Context) {
var rsp proto.Response
// current version
currentVersion := "1.0.0"
versionFile := fmt.Sprintf("%s/version", AppDir)
if version, err := os.ReadFile(versionFile); err == nil {
currentVersion = strings.ReplaceAll(string(version), "\n", "")
}
log.Debugf("current version: %s", currentVersion)
rsp.OkRspWithData(c, &proto.GetVersionRsp{
Current: currentVersion,
})
}
func getLatest() (*Latest, error) {
baseURL := StableURL
if isPreviewEnabled() {