From 0fa027d01df72157f1ccec86819d535f53ca0d88 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Wed, 8 May 2024 18:46:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=8E=B7=E5=8F=96=E5=A4=B1=E8=B4=A5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#4925)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/upgrade.go | 34 ++++++++++++++++++++++++++++----- frontend/src/lang/modules/en.ts | 2 +- frontend/src/lang/modules/tw.ts | 2 +- frontend/src/lang/modules/zh.ts | 2 +- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/backend/app/service/upgrade.go b/backend/app/service/upgrade.go index db1b0f98a..c542b5b2b 100644 --- a/backend/app/service/upgrade.go +++ b/backend/app/service/upgrade.go @@ -55,7 +55,11 @@ func (u *UpgradeService) SearchUpgrade() (*dto.UpgradeInfo, error) { if len(itemVersion) == 0 { return &upgrade, nil } - notes, err := u.loadReleaseNotes(fmt.Sprintf("%s/%s/%s/release/1panel-%s-release-notes", global.CONF.System.RepoUrl, global.CONF.System.Mode, itemVersion, itemVersion)) + mode := global.CONF.System.Mode + if strings.Contains(itemVersion, "beta") { + mode = "beta" + } + notes, err := u.loadReleaseNotes(fmt.Sprintf("%s/%s/%s/release/1panel-%s-release-notes", global.CONF.System.RepoUrl, mode, itemVersion, itemVersion)) if err != nil { return nil, fmt.Errorf("load releases-notes of version %s failed, err: %v", itemVersion, err) } @@ -215,14 +219,34 @@ func (u *UpgradeService) loadVersionByMode(developer, currentVersion string) (st return devVersionLatest, "", "" } + betaVersionLatest := "" latest = u.loadVersion(true, currentVersion, "stable") current = u.loadVersion(false, currentVersion, "stable") - if len(developer) == 0 || developer == "disable" { - return "", current, latest + if developer == "enable" { + betaVersionLatest = u.loadVersion(true, currentVersion, "beta") + } + if current != latest { + return betaVersionLatest, current, latest } - betaVersionLatest := u.loadVersion(true, currentVersion, "beta") - return betaVersionLatest, current, latest + versionPart := strings.Split(current, ".") + if len(versionPart) < 3 { + return betaVersionLatest, current, latest + } + num, _ := strconv.Atoi(versionPart[1]) + if num == 0 { + return betaVersionLatest, current, latest + } + if num >= 10 { + if current[:6] == currentVersion[:6] { + return betaVersionLatest, current, "" + } + return betaVersionLatest, "", latest + } + if current[:5] == currentVersion[:5] { + return betaVersionLatest, current, "" + } + return betaVersionLatest, "", latest } func (u *UpgradeService) loadVersion(isLatest bool, currentVersion, mode string) string { diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index ef6852fca..6dad0a831 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1477,7 +1477,7 @@ const message = { 'Name rules: [major version].[functional version].[Bug fix version], as shown in the following example:', versionHelper1: 'v1.0.1 is a Bug fix after v1.0.0', versionHelper2: 'v1.1.0 is a feature release after v1.0.0', - testVersion: '(Beta version)', + testVersion: '(Pre-release version)', newVersion: '(Bug fix version)', latestVersion: '(Functional version)', upgradeCheck: 'Check for updates', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index aa68a7466..0e94f7e77 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1304,7 +1304,7 @@ const message = { versionHelper: '1Panel 版本號命名規則為: [大版本].[功能版本].[Bug 修復版本],例:', versionHelper1: 'v1.0.1 是 v1.0.0 之後的 Bug 修復版本', versionHelper2: 'v1.1.0 是 v1.0.0 之後的功能版本', - testVersion: '(內測版本)', + testVersion: '(預發布版本)', newVersion: '(Bug 修復版本)', latestVersion: '(功能版本)', upgradeCheck: '檢查更新', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index a68a50a79..5de11dcb4 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1305,7 +1305,7 @@ const message = { versionHelper: '1Panel 版本号命名规则为: [大版本].[功能版本].[Bug 修复版本],例:', versionHelper1: 'v1.0.1 是 v1.0.0 之后的 Bug 修复版本', versionHelper2: 'v1.1.0 是 v1.0.0 之后的功能版本', - testVersion: '(内测版本)', + testVersion: '(预发布版本)', newVersion: '(Bug 修复版本)', latestVersion: '(功能版本)', upgradeCheck: '检查更新',