fix: 解决升级信息获取失败的问题 (#4925)

pull/4932/head
ssongliu 7 months ago committed by GitHub
parent 395bc63946
commit 0fa027d01d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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 {

@ -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',

@ -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: '',

@ -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: '',

Loading…
Cancel
Save