From 80599a35760416645e33225581998b4f30d21656 Mon Sep 17 00:00:00 2001 From: zhengkunwang223 <31820853+zhengkunwang223@users.noreply.github.com> Date: Thu, 1 Jun 2023 14:47:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=A0=E9=99=A4=20AppStoreVersion=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0=20(#1217)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/app_install.go | 5 +++-- backend/i18n/lang/en.yaml | 1 + backend/i18n/lang/zh.yaml | 1 + backend/init/business/business.go | 2 +- cmd/server/cmd/version.go | 2 -- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/app/service/app_install.go b/backend/app/service/app_install.go index 27fa2a0bf..fb2fcd1a4 100644 --- a/backend/app/service/app_install.go +++ b/backend/app/service/app_install.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/1Panel-dev/1Panel/backend/i18n" "github.com/1Panel-dev/1Panel/backend/utils/files" "gopkg.in/yaml.v3" "math" @@ -344,10 +345,10 @@ func (a *AppInstallService) SyncAll(systemInit bool) error { return err } for _, i := range allList { - if i.Status == constant.Installing { + if i.Status == constant.Installing || i.Status == constant.Upgrading { if systemInit { i.Status = constant.Error - i.Message = "System restart causes application exception" + i.Message = i18n.GetMsgByKey("ErrAppSystemRestart") _ = appInstallRepo.Save(context.Background(), &i) } continue diff --git a/backend/i18n/lang/en.yaml b/backend/i18n/lang/en.yaml index c22011bf1..68e92a1de 100644 --- a/backend/i18n/lang/en.yaml +++ b/backend/i18n/lang/en.yaml @@ -38,6 +38,7 @@ ErrFileParseApp: 'Failed to parse {{.name}} file {{.err}}' ErrAppDirNull: 'version folder does not exist' LocalAppErr: "App {{.name}} sync failed! {{.err}}" ErrContainerName: "ContainerName is already exist" +ErrAppSystemRestart: "1Panel restart causes the task to terminate" #file ErrFileCanNotRead: "File can not read" diff --git a/backend/i18n/lang/zh.yaml b/backend/i18n/lang/zh.yaml index d22cd8370..5cb579ece 100644 --- a/backend/i18n/lang/zh.yaml +++ b/backend/i18n/lang/zh.yaml @@ -38,6 +38,7 @@ ErrFileParseApp: '{{.name}} 文件解析失败 {{.err}}' ErrAppDirNull: '版本文件夹不存在' LocalAppErr: "应用 {{.name}} 同步失败!{{.err}}" ErrContainerName: "容器名称已存在" +ErrAppSystemRestart: "1Panel 重启导致任务终止" #file ErrFileCanNotRead: "此文件不支持预览" diff --git a/backend/init/business/business.go b/backend/init/business/business.go index a1520b8ff..aa4613615 100644 --- a/backend/init/business/business.go +++ b/backend/init/business/business.go @@ -16,7 +16,7 @@ func syncApp() { global.LOG.Errorf("sync app error: %s", err.Error()) return } - if setting.AppStoreVersion != "" { + if setting.AppStoreLastModified != "0" { global.LOG.Info("no need to sync") return } diff --git a/cmd/server/cmd/version.go b/cmd/server/cmd/version.go index 170e94931..421aa380c 100644 --- a/cmd/server/cmd/version.go +++ b/cmd/server/cmd/version.go @@ -23,10 +23,8 @@ var versionCmd = &cobra.Command{ return err } version := getSettingByKey(db, "SystemVersion") - appStoreVersion := getSettingByKey(db, "AppStoreVersion") fmt.Printf("1panel version: %s\n", version) - fmt.Printf("appstore version: %s\n", appStoreVersion) config := configs.ServerConfig{} if err := yaml.Unmarshal(conf.AppYaml, &config); err != nil { return fmt.Errorf("unmarshal conf.App.Yaml failed, errL %v", err)