feat: 应用增加面板版本限制 (#6264)

pull/6277/head
zhengkunwang 3 months ago committed by GitHub
parent 7b9456453c
commit 6f1e5074ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -97,6 +97,7 @@ type AppProperty struct {
Architectures []string `json:"architectures"`
MemoryRequired int `json:"memoryRequired"`
GpuSupport bool `json:"gpuSupport"`
Version float64 `json:"version"`
}
type AppConfigVersion struct {

@ -867,7 +867,12 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) {
transport := xpack.LoadRequestTransport()
baseRemoteUrl := fmt.Sprintf("%s/%s/1panel", global.CONF.System.AppRepo, global.CONF.System.Mode)
appsMap := getApps(oldApps, list.Apps)
setting, err := NewISettingService().GetSettingInfo()
if err != nil {
return err
}
appsMap := getApps(oldApps, list.Apps, setting.SystemVersion, t)
t.LogStart(i18n.GetMsgByKey("SyncAppDetail"))
for _, l := range list.Apps {

@ -1091,13 +1091,17 @@ func getAppDetails(details []model.AppDetail, versions []dto.AppConfigVersion) m
return appDetails
}
func getApps(oldApps []model.App, items []dto.AppDefine) map[string]model.App {
func getApps(oldApps []model.App, items []dto.AppDefine, systemVersion string, task *task.Task) map[string]model.App {
apps := make(map[string]model.App, len(oldApps))
for _, old := range oldApps {
old.Status = constant.AppTakeDown
apps[old.Key] = old
}
for _, item := range items {
if item.AppProperty.Version > 0 && common.CompareVersion(strconv.FormatFloat(item.AppProperty.Version, 'f', -1, 64), systemVersion) {
task.Log(i18n.GetWithName("AppVersionNotMatch", item.Name))
continue
}
config := item.AppProperty
key := config.Key
app, ok := apps[key]

@ -65,6 +65,7 @@ UpgradeAppSuccess: "App {{ .name }} upgraded successfully"
AppStoreIsLastVersion: "The app store is up to date"
AppStoreSyncSuccess: "App store synchronized successfully"
SyncAppDetail: "Synchronize app configuration"
AppVersionNotMatch: "{{ .name }} app requires an update to 1Panel, skipping synchronization"
#file

@ -66,6 +66,7 @@ UpgradeAppSuccess: "應用程式 {{ .name }} 升級成功"
AppStoreIsLastVersion: "應用商店已經是最新版本"
AppStoreSyncSuccess: "應用商店同步成功"
SyncAppDetail: "同步應用配置"
AppVersionNotMatch: "{{ .name }} 應用需要更新 1Panel跳過同步"
#file

@ -65,6 +65,7 @@ UpgradeAppSuccess: "应用 {{ .name }} 升级成功"
AppStoreIsLastVersion: "应用商店已经是最新版本"
AppStoreSyncSuccess: "应用商店同步成功"
SyncAppDetail: "同步应用配置"
AppVersionNotMatch: "{{ .name }} 应用需要更新 1Panel跳过同步"
#file
ErrFileCanNotRead: "此文件不支持预览"

Loading…
Cancel
Save