Skip to content

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

:bug: Keep encrypted notebook state consistent

Daniel1cf1b0b03f77
diff --git a/kernel/api/notebook.go b/kernel/api/notebook.go
index 8481df1b7a..24cf2f484c 100644
--- a/kernel/api/notebook.go
+++ b/kernel/api/notebook.go
@@ -553,7 +553,7 @@ func createEncryptedNotebook(c *gin.Context) {
return
}
- box := model.Conf.GetBox(id)
+ box := model.Conf.Box(id)
evt := util.NewCmdResult("mount", 0, util.PushModeBroadcast)
evt.Data = map[string]any{
"box": box,
diff --git a/kernel/api/search.go b/kernel/api/search.go
index 1b990b5ab9..b69c75b22e 100644
--- a/kernel/api/search.go
+++ b/kernel/api/search.go
@@ -515,6 +515,11 @@ func fullTextSearchBlock(c *gin.Context) {
var docMode bool
// 加密笔记本的全文搜索走 InBox 版(查加密 content db + blocks_fts)
if notebook, ok := arg["notebook"].(string); ok && notebook != "" && model.IsEncryptedBox(notebook) {
+ if !model.IsBoxUnlocked(notebook) {
+ ret.Code = -1
+ ret.Msg = "encrypted notebook locked"
+ return
+ }
blocks, matchedBlockCount, matchedRootCount, pageCount, docMode = model.FullTextSearchBlockInBox(query, boxes, paths, types, subTypes, method, orderBy, groupBy, page, pageSize, notebook)
} else {
blocks, matchedBlockCount, matchedRootCount, pageCount, docMode = model.FullTextSearchBlock(query, boxes, paths, types, subTypes, method, orderBy, groupBy, page, pageSize)