From 0f8bfe0132809b879120ce7894d73f7c8e21a461 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 6 Jan 2026 17:19:42 +0800 Subject: [PATCH 1/2] :art: Clean code Signed-off-by: Daniel <845765@qq.com> --- kernel/api/av.go | 2 +- kernel/model/attribute_view.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/api/av.go b/kernel/api/av.go index 1f3cb1b83..d9a20c275 100644 --- a/kernel/api/av.go +++ b/kernel/api/av.go @@ -921,7 +921,7 @@ func setAttributeViewBlockAttr(c *gin.Context) { if _, ok := arg["itemID"]; ok { itemID = arg["itemID"].(string) } else if _, ok := arg["rowID"]; ok { - // TODO 划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15708#issuecomment-3239694546 + // TODO 计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15708#issuecomment-3239694546 itemID = arg["rowID"].(string) } value := arg["value"].(interface{}) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index c210280fe..dd8290a60 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -4754,7 +4754,7 @@ func BatchUpdateAttributeViewCells(tx *Transaction, avID string, values []interf if _, ok := v["itemID"]; ok { itemID = v["itemID"].(string) } else if _, ok := v["rowID"]; ok { - // TODO 划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15708#issuecomment-3239694546 + // TODO 计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15708#issuecomment-3239694546 itemID = v["rowID"].(string) } valueData := v["value"] From 549e1faa09464eeda591b7db35d9173a35bb3f63 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 6 Jan 2026 17:37:51 +0800 Subject: [PATCH 2/2] :bug: Multiple workspace access authentication error https://github.com/siyuan-note/siyuan/issues/16786 Signed-off-by: Daniel <845765@qq.com> --- kernel/model/conf.go | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/kernel/model/conf.go b/kernel/model/conf.go index 6871f946a..960c4e44a 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -587,8 +587,13 @@ func InitConf() { Conf.DataIndexState = 0 - if "" == Conf.CookieKey { - Conf.CookieKey = gulu.Rand.String(16) + if cookieKey := readCookieKey(); "" != cookieKey { + Conf.CookieKey = cookieKey + } else { + if "" == Conf.CookieKey { + Conf.CookieKey = gulu.Rand.String(16) + } + writeCookieKey(Conf.CookieKey) } Conf.Save() @@ -600,6 +605,33 @@ func InitConf() { go util.InitTesseract() } +func readCookieKey() (cookieKey string) { + cookieKeyPath := filepath.Join(util.HomeDir, ".config", "siyuan", "cookie.key") + if !gulu.File.IsExist(cookieKeyPath) { + return + } + + data, err := os.ReadFile(cookieKeyPath) + if err != nil { + logging.LogErrorf("read cookie key file [%s] failed: %s", cookieKeyPath, err) + return + } + + cookieKey = string(bytes.TrimSpace(data)) + return +} + +func writeCookieKey(cookieKey string) { + cookieKeyPath := filepath.Join(util.HomeDir, ".config", "siyuan", "cookie.key") + if gulu.File.IsExist(cookieKeyPath) { + return + } + + if err := os.WriteFile(cookieKeyPath, []byte(cookieKey), 0644); err != nil { + logging.LogErrorf("save cookie key file [%s] failed: %s", cookieKeyPath, err) + } +} + func initLang() { p := filepath.Join(util.WorkingDir, "appearance", "langs") dir, err := os.Open(p)