Browse Source

feat: 删除 AppStoreVersion 参数 (#1217)

pull/1219/head
zhengkunwang223 2 years ago committed by GitHub
parent
commit
80599a3576
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      backend/app/service/app_install.go
  2. 1
      backend/i18n/lang/en.yaml
  3. 1
      backend/i18n/lang/zh.yaml
  4. 2
      backend/init/business/business.go
  5. 2
      cmd/server/cmd/version.go

5
backend/app/service/app_install.go

@ -4,6 +4,7 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/1Panel-dev/1Panel/backend/i18n"
"github.com/1Panel-dev/1Panel/backend/utils/files" "github.com/1Panel-dev/1Panel/backend/utils/files"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
"math" "math"
@ -344,10 +345,10 @@ func (a *AppInstallService) SyncAll(systemInit bool) error {
return err return err
} }
for _, i := range allList { for _, i := range allList {
if i.Status == constant.Installing { if i.Status == constant.Installing || i.Status == constant.Upgrading {
if systemInit { if systemInit {
i.Status = constant.Error i.Status = constant.Error
i.Message = "System restart causes application exception" i.Message = i18n.GetMsgByKey("ErrAppSystemRestart")
_ = appInstallRepo.Save(context.Background(), &i) _ = appInstallRepo.Save(context.Background(), &i)
} }
continue continue

1
backend/i18n/lang/en.yaml

@ -38,6 +38,7 @@ ErrFileParseApp: 'Failed to parse {{.name}} file {{.err}}'
ErrAppDirNull: 'version folder does not exist' ErrAppDirNull: 'version folder does not exist'
LocalAppErr: "App {{.name}} sync failed! {{.err}}" LocalAppErr: "App {{.name}} sync failed! {{.err}}"
ErrContainerName: "ContainerName is already exist" ErrContainerName: "ContainerName is already exist"
ErrAppSystemRestart: "1Panel restart causes the task to terminate"
#file #file
ErrFileCanNotRead: "File can not read" ErrFileCanNotRead: "File can not read"

1
backend/i18n/lang/zh.yaml

@ -38,6 +38,7 @@ ErrFileParseApp: '{{.name}} 文件解析失败 {{.err}}'
ErrAppDirNull: '版本文件夹不存在' ErrAppDirNull: '版本文件夹不存在'
LocalAppErr: "应用 {{.name}} 同步失败!{{.err}}" LocalAppErr: "应用 {{.name}} 同步失败!{{.err}}"
ErrContainerName: "容器名称已存在" ErrContainerName: "容器名称已存在"
ErrAppSystemRestart: "1Panel 重启导致任务终止"
#file #file
ErrFileCanNotRead: "此文件不支持预览" ErrFileCanNotRead: "此文件不支持预览"

2
backend/init/business/business.go

@ -16,7 +16,7 @@ func syncApp() {
global.LOG.Errorf("sync app error: %s", err.Error()) global.LOG.Errorf("sync app error: %s", err.Error())
return return
} }
if setting.AppStoreVersion != "" { if setting.AppStoreLastModified != "0" {
global.LOG.Info("no need to sync") global.LOG.Info("no need to sync")
return return
} }

2
cmd/server/cmd/version.go

@ -23,10 +23,8 @@ var versionCmd = &cobra.Command{
return err return err
} }
version := getSettingByKey(db, "SystemVersion") version := getSettingByKey(db, "SystemVersion")
appStoreVersion := getSettingByKey(db, "AppStoreVersion")
fmt.Printf("1panel version: %s\n", version) fmt.Printf("1panel version: %s\n", version)
fmt.Printf("appstore version: %s\n", appStoreVersion)
config := configs.ServerConfig{} config := configs.ServerConfig{}
if err := yaml.Unmarshal(conf.AppYaml, &config); err != nil { if err := yaml.Unmarshal(conf.AppYaml, &config); err != nil {
return fmt.Errorf("unmarshal conf.App.Yaml failed, errL %v", err) return fmt.Errorf("unmarshal conf.App.Yaml failed, errL %v", err)

Loading…
Cancel
Save