feat: Add System Version Restrictions for Applications (#7260)

pull/7263/head
zhengkunwang 2024-12-05 14:41:14 +08:00 committed by GitHub
parent f320492164
commit e6a772ebfd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -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 {

View File

@ -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