From e6a772ebfd3797d36e1f0a84b192a0aa3f2e7581 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:41:14 +0800 Subject: [PATCH] feat: Add System Version Restrictions for Applications (#7260) --- backend/app/dto/app.go | 1 + backend/app/service/app.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/backend/app/dto/app.go b/backend/app/dto/app.go index 535245422..3630f9bbe 100644 --- a/backend/app/dto/app.go +++ b/backend/app/dto/app.go @@ -92,6 +92,7 @@ type AppProperty struct { Website string `json:"website"` Github string `json:"github"` Document string `json:"document"` + Version float64 `json:"version"` } type AppConfigVersion struct { diff --git a/backend/app/service/app.go b/backend/app/service/app.go index 4c9b4697a..9d5a8dda5 100644 --- a/backend/app/service/app.go +++ b/backend/app/service/app.go @@ -851,6 +851,12 @@ func (a AppService) SyncAppListFromRemote() (err error) { global.LOG.Infof("Starting synchronization of application details...") for _, l := range list.Apps { app := appsMap[l.AppProperty.Key] + + if l.AppProperty.Version > 0 && common.CompareVersion(strconv.FormatFloat(l.AppProperty.Version, 'f', -1, 64), setting.SystemVersion) { + delete(appsMap, l.AppProperty.Key) + continue + } + _, iconRes, err := httpUtil.HandleGetWithTransport(l.Icon, http.MethodGet, transport, constant.TimeOut20s) if err != nil { return err