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: Generate file history before locking encrypted notebook https://github.com/siyuan-note/siyuan/issues/18034
Danielcd5ebe8a3568
diff --git a/kernel/model/history.go b/kernel/model/history.goindex fe63ea9aac..2202f8534b 100644--- a/kernel/model/history.go+++ b/kernel/model/history.go@@ -59,6 +59,16 @@ func AutoGenerateFileHistory() {}}+// GenerateFileHistoryForBox 对单个 box 生成文件历史。供加密笔记本关闭(锁定)前调用——+// 锁定后定时器(GenerateFileHistory)无法为加密笔记本生成历史(不在 GetOpenedBoxes 里)。+func GenerateFileHistoryForBox(box *Box) {+ defer logging.Recover()+ if 1 > Conf.Editor.GenerateHistoryInterval {+ return+ }+ box.generateDocHistory0()+}+func GenerateFileHistory() {defer logging.Recover()diff --git a/kernel/model/mount.go b/kernel/model/mount.goindex 27263a053e..414e3d9ab2 100644--- a/kernel/model/mount.go+++ b/kernel/model/mount.go@@ -240,6 +240,10 @@ func unmount0(boxID string) {// 关闭即删文件避免残留旧索引数据导致下次解锁叠加重复行。FlushTxQueue()sql.FlushQueue()+ // 关闭前生成一次文件历史:锁定后定时器无法为加密笔记本生成历史(不在 GetOpenedBoxes 里)+ if box := Conf.Box(boxID); nil != box {+ GenerateFileHistoryForBox(box)+ }ClearDEK(boxID)}}