An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Prevent LAN sync preflight panic https://github.com/siyuan-note/siyuan/issues/18556
Danielf08016571fcd
diff --git a/kernel/model/sync.go b/kernel/model/sync.goindex d718c05583..2dd4ceadcd 100644--- a/kernel/model/sync.go+++ b/kernel/model/sync.go@@ -34,6 +34,7 @@ import ("github.com/gorilla/websocket""github.com/siyuan-note/dejavu""github.com/siyuan-note/dejavu/cloud"+ "github.com/siyuan-note/eventbus""github.com/siyuan-note/logging""github.com/siyuan-note/siyuan/kernel/cache""github.com/siyuan-note/siyuan/kernel/conf"@@ -103,7 +104,8 @@ func getSyncCloudLatestID() (ret string) {logging.LogWarnf("create repo before perceived sync failed: %s", err)return}- latest, err := repo.GetCloudLatest(map[string]interface{}{})+ syncContext := map[string]any{eventbus.CtxPushMsg: eventbus.CtxPushMsgToNone}+ latest, err := repo.GetCloudLatestFast(syncContext)if nil != err {logging.LogWarnf("get cloud latest before perceived sync failed: %s", err)returndiff --git a/kernel/util/websocket.go b/kernel/util/websocket.goindex 63bfbc67d5..c72bcbdcea 100644--- a/kernel/util/websocket.go+++ b/kernel/util/websocket.go@@ -319,7 +319,11 @@ type BlockStatResult struct {}func ContextPushMsg(context map[string]any, msg string) {- switch context[eventbus.CtxPushMsg].(int) {+ pushTarget, ok := context[eventbus.CtxPushMsg].(int)+ if !ok {+ return+ }+ switch pushTarget {case eventbus.CtxPushMsgToNone:breakcase eventbus.CtxPushMsgToProgress:diff --git a/kernel/util/websocket_test.go b/kernel/util/websocket_test.goindex c4e53ab2ac..469b663f04 100644--- a/kernel/util/websocket_test.go+++ b/kernel/util/websocket_test.go@@ -21,8 +21,22 @@ import ("testing""github.com/olahol/melody"+ "github.com/siyuan-note/eventbus")+func TestContextPushMsgIgnoresInvalidContext(t *testing.T) {+ contexts := []map[string]any{+ nil,+ {},+ {eventbus.CtxPushMsg: nil},+ {eventbus.CtxPushMsg: "invalid"},+ {eventbus.CtxPushMsg: eventbus.CtxPushMsgToNone},+ }+ for _, context := range contexts {+ ContextPushMsg(context, "test")+ }+}+func TestIsPublishSession(t *testing.T) {tests := []struct {name string