mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
feat(appstore): Restrict application updates based on the app's suppo… (#7174)
This commit is contained in:
parent
7b1d746ce7
commit
b8d8867ebb
@ -109,7 +109,8 @@ type Tag struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AppForm struct {
|
type AppForm struct {
|
||||||
FormFields []AppFormFields `json:"formFields"`
|
FormFields []AppFormFields `json:"formFields"`
|
||||||
|
SupportVersion float64 `json:"supportVersion"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppFormFields struct {
|
type AppFormFields struct {
|
||||||
|
@ -816,7 +816,10 @@ func (a AppService) SyncAppListFromRemote() (err error) {
|
|||||||
}
|
}
|
||||||
settingService := NewISettingService()
|
settingService := NewISettingService()
|
||||||
_ = settingService.Update("AppStoreSyncStatus", constant.Syncing)
|
_ = settingService.Update("AppStoreSyncStatus", constant.Syncing)
|
||||||
|
setting, err := settingService.GetSettingInfo()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
var (
|
var (
|
||||||
tags []*model.Tag
|
tags []*model.Tag
|
||||||
appTags []*model.AppTag
|
appTags []*model.AppTag
|
||||||
@ -868,7 +871,13 @@ func (a AppService) SyncAppListFromRemote() (err error) {
|
|||||||
version := v.Name
|
version := v.Name
|
||||||
detail := detailsMap[version]
|
detail := detailsMap[version]
|
||||||
versionUrl := fmt.Sprintf("%s/%s/%s", baseRemoteUrl, app.Key, version)
|
versionUrl := fmt.Sprintf("%s/%s/%s", baseRemoteUrl, app.Key, version)
|
||||||
|
paramByte, _ := json.Marshal(v.AppForm)
|
||||||
|
var appForm dto.AppForm
|
||||||
|
_ = json.Unmarshal(paramByte, &appForm)
|
||||||
|
if appForm.SupportVersion > 0 && common.CompareVersion(strconv.FormatFloat(appForm.SupportVersion, 'f', -1, 64), setting.SystemVersion) {
|
||||||
|
delete(detailsMap, version)
|
||||||
|
continue
|
||||||
|
}
|
||||||
if _, ok := InitTypes[app.Type]; ok {
|
if _, ok := InitTypes[app.Type]; ok {
|
||||||
dockerComposeUrl := fmt.Sprintf("%s/%s", versionUrl, "docker-compose.yml")
|
dockerComposeUrl := fmt.Sprintf("%s/%s", versionUrl, "docker-compose.yml")
|
||||||
_, composeRes, err := httpUtil.HandleGetWithTransport(dockerComposeUrl, http.MethodGet, transport, constant.TimeOut20s)
|
_, composeRes, err := httpUtil.HandleGetWithTransport(dockerComposeUrl, http.MethodGet, transport, constant.TimeOut20s)
|
||||||
@ -880,7 +889,6 @@ func (a AppService) SyncAppListFromRemote() (err error) {
|
|||||||
detail.DockerCompose = ""
|
detail.DockerCompose = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
paramByte, _ := json.Marshal(v.AppForm)
|
|
||||||
detail.Params = string(paramByte)
|
detail.Params = string(paramByte)
|
||||||
detail.DownloadUrl = fmt.Sprintf("%s/%s", versionUrl, app.Key+"-"+version+".tar.gz")
|
detail.DownloadUrl = fmt.Sprintf("%s/%s", versionUrl, app.Key+"-"+version+".tar.gz")
|
||||||
detail.DownloadCallBackUrl = v.DownloadCallBackUrl
|
detail.DownloadCallBackUrl = v.DownloadCallBackUrl
|
||||||
|
Loading…
x
Reference in New Issue
Block a user