An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Supports local shorthands on Android https://github.com/siyuan-note/siyuan/issues/14414
Daniel25383ad760c9
diff --git a/kernel/job/cron.go b/kernel/job/cron.goindex 7255631f2a..133c2fbd77 100644--- a/kernel/job/cron.go+++ b/kernel/job/cron.go@@ -44,6 +44,7 @@ func StartCron() {go every(30*time.Second, model.HookDesktopUIProcJob)go every(24*time.Hour, model.AutoPurgeRepoJob)go every(30*time.Minute, model.AutoCheckMicrosoftDefender)+ go every(3*time.Second, model.WatchLocalShorthands)}func every(interval time.Duration, f func()) {diff --git a/kernel/model/shortcuts.go b/kernel/model/shortcuts.goindex 9f53f75b01..53dd420375 100644--- a/kernel/model/shortcuts.go+++ b/kernel/model/shortcuts.go@@ -33,7 +33,7 @@ func MoveLocalShorthands(boxID, hPath, parentID, id string) (retID string, err ereturn}- dir, err := os.ReadDir(shorthandsDir)+ entries, err := os.ReadDir(shorthandsDir)if nil != err {logging.LogErrorf("read dir [%s] failed: %s", shorthandsDir, err)return@@ -41,7 +41,7 @@ func MoveLocalShorthands(boxID, hPath, parentID, id string) (retID string, err ebuff := bytes.Buffer{}var toRemoves []string- for _, entry := range dir {+ for _, entry := range entries {if entry.IsDir() {continue}@@ -88,3 +88,35 @@ func MoveLocalShorthands(boxID, hPath, parentID, id string) (retID string, err eclearShorthand(toRemoves)return}++func WatchLocalShorthands() {+ shorthandsDir := filepath.Join(util.ShortcutsPath, "shorthands")+ if !gulu.File.IsDir(shorthandsDir) {+ return+ }++ entries, err := os.ReadDir(shorthandsDir)+ if nil != err {+ logging.LogErrorf("read dir [%s] failed: %s", shorthandsDir, err)+ return+ }++ shorthandCount := 0+ for _, entry := range entries {+ if entry.IsDir() {+ continue+ }++ if filepath.Ext(entry.Name()) != ".md" {+ continue+ }++ shorthandCount+++ }++ if 1 > shorthandCount {+ return+ }++ util.PushLocalShorthandCount(shorthandCount)+}diff --git a/kernel/util/websocket.go b/kernel/util/websocket.goindex 954c427ed2..6ba7242664 100644--- a/kernel/util/websocket.go+++ b/kernel/util/websocket.go@@ -275,6 +275,10 @@ func PushSetDefRefCount(rootID, blockID string, defIDs []string, refCount, rootRBroadcastByType("main", "setDefRefCount", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "refCount": refCount, "rootRefCount": rootRefCount, "defIDs": defIDs})}+func PushLocalShorthandCount(count int) {+ BroadcastByType("main", "setLocalShorthandCount", 0, "", map[string]interface{}{"count": count})+}+func PushProtyleLoading(rootID, msg string) {BroadcastByType("protyle", "addLoading", 0, msg, rootID)}