Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Get the update log only in non-pre-release versions (#17983)

Jeffrey Chen7ad73c3b759c
diff --git a/kernel/api/system.go b/kernel/api/system.go
index f6c2a54baa..bb3aa788c4 100644
--- a/kernel/api/system.go
+++ b/kernel/api/system.go
@@ -127,6 +127,12 @@ func getChangelog(c *gin.Context) {
return
}
+ if !util.IsReleaseVer(util.Ver) {
+ model.Conf.ShowChangelog = false
+ model.Conf.Save()
+ return
+ }
+
verDir := filepath.Join(changelogsDir, "v"+util.Ver)
changelogPath := filepath.Join(verDir, "v"+util.Ver+"."+model.Conf.Lang+".md")
if !gulu.File.IsExist(changelogPath) {
@@ -144,6 +150,7 @@ func getChangelog(c *gin.Context) {
}
model.Conf.ShowChangelog = false
+ model.Conf.Save()
luteEngine := lute.New()
htmlContent := luteEngine.MarkdownStr("", string(contentData))
htmlContent = util.LinkTarget(htmlContent, "")
diff --git a/kernel/util/working.go b/kernel/util/working.go
index 6c53699611..8bfa76c238 100644
--- a/kernel/util/working.go
+++ b/kernel/util/working.go
@@ -38,6 +38,7 @@ import (
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/httpclient"
"github.com/siyuan-note/logging"
+ "golang.org/x/mod/semver"
)
// var Mode = "dev"
@@ -48,6 +49,12 @@ const (
IsInsider = false
)
+// IsReleaseVer 判断是否为正式版(不含 beta、rc 等预发布标识)。
+func IsReleaseVer(ver string) bool {
+ v := "v" + strings.TrimPrefix(ver, "v")
+ return semver.IsValid(v) && semver.Prerelease(v) == ""
+}
+
var (
RunInContainer = false // 是否运行在容器中
SiYuanAccessAuthCodeBypass = false // 是否跳过空锁屏密码检查