mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-03-14 01:34:47 +08:00
feat: 应用增加面板版本限制 (#6264)
This commit is contained in:
parent
7b9456453c
commit
6f1e5074ed
@ -97,6 +97,7 @@ type AppProperty struct {
|
|||||||
Architectures []string `json:"architectures"`
|
Architectures []string `json:"architectures"`
|
||||||
MemoryRequired int `json:"memoryRequired"`
|
MemoryRequired int `json:"memoryRequired"`
|
||||||
GpuSupport bool `json:"gpuSupport"`
|
GpuSupport bool `json:"gpuSupport"`
|
||||||
|
Version float64 `json:"version"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppConfigVersion struct {
|
type AppConfigVersion struct {
|
||||||
|
@ -867,7 +867,12 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) {
|
|||||||
|
|
||||||
transport := xpack.LoadRequestTransport()
|
transport := xpack.LoadRequestTransport()
|
||||||
baseRemoteUrl := fmt.Sprintf("%s/%s/1panel", global.CONF.System.AppRepo, global.CONF.System.Mode)
|
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"))
|
t.LogStart(i18n.GetMsgByKey("SyncAppDetail"))
|
||||||
for _, l := range list.Apps {
|
for _, l := range list.Apps {
|
||||||
|
@ -1091,13 +1091,17 @@ func getAppDetails(details []model.AppDetail, versions []dto.AppConfigVersion) m
|
|||||||
return appDetails
|
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))
|
apps := make(map[string]model.App, len(oldApps))
|
||||||
for _, old := range oldApps {
|
for _, old := range oldApps {
|
||||||
old.Status = constant.AppTakeDown
|
old.Status = constant.AppTakeDown
|
||||||
apps[old.Key] = old
|
apps[old.Key] = old
|
||||||
}
|
}
|
||||||
for _, item := range items {
|
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
|
config := item.AppProperty
|
||||||
key := config.Key
|
key := config.Key
|
||||||
app, ok := apps[key]
|
app, ok := apps[key]
|
||||||
|
@ -65,6 +65,7 @@ UpgradeAppSuccess: "App {{ .name }} upgraded successfully"
|
|||||||
AppStoreIsLastVersion: "The app store is up to date"
|
AppStoreIsLastVersion: "The app store is up to date"
|
||||||
AppStoreSyncSuccess: "App store synchronized successfully"
|
AppStoreSyncSuccess: "App store synchronized successfully"
|
||||||
SyncAppDetail: "Synchronize app configuration"
|
SyncAppDetail: "Synchronize app configuration"
|
||||||
|
AppVersionNotMatch: "{{ .name }} app requires an update to 1Panel, skipping synchronization"
|
||||||
|
|
||||||
|
|
||||||
#file
|
#file
|
||||||
|
@ -66,6 +66,7 @@ UpgradeAppSuccess: "應用程式 {{ .name }} 升級成功"
|
|||||||
AppStoreIsLastVersion: "應用商店已經是最新版本"
|
AppStoreIsLastVersion: "應用商店已經是最新版本"
|
||||||
AppStoreSyncSuccess: "應用商店同步成功"
|
AppStoreSyncSuccess: "應用商店同步成功"
|
||||||
SyncAppDetail: "同步應用配置"
|
SyncAppDetail: "同步應用配置"
|
||||||
|
AppVersionNotMatch: "{{ .name }} 應用需要更新 1Panel,跳過同步"
|
||||||
|
|
||||||
|
|
||||||
#file
|
#file
|
||||||
|
@ -65,6 +65,7 @@ UpgradeAppSuccess: "应用 {{ .name }} 升级成功"
|
|||||||
AppStoreIsLastVersion: "应用商店已经是最新版本"
|
AppStoreIsLastVersion: "应用商店已经是最新版本"
|
||||||
AppStoreSyncSuccess: "应用商店同步成功"
|
AppStoreSyncSuccess: "应用商店同步成功"
|
||||||
SyncAppDetail: "同步应用配置"
|
SyncAppDetail: "同步应用配置"
|
||||||
|
AppVersionNotMatch: "{{ .name }} 应用需要更新 1Panel,跳过同步"
|
||||||
|
|
||||||
#file
|
#file
|
||||||
ErrFileCanNotRead: "此文件不支持预览"
|
ErrFileCanNotRead: "此文件不支持预览"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user