Skip to content

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

:art: 改进内核只读模式 https://github.com/siyuan-note/siyuan/issues/7615

Liang Dingf816d897c57e
diff --git a/kernel/api/router.go b/kernel/api/router.go
index 6e02101aa1..6e56ac4886 100644
--- a/kernel/api/router.go
+++ b/kernel/api/router.go
@@ -183,8 +183,8 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/ref/getBackmentionDoc", model.CheckAuth, getBackmentionDoc)
ginServer.Handle("POST", "/api/attr/getBookmarkLabels", model.CheckAuth, getBookmarkLabels)
- ginServer.Handle("POST", "/api/attr/resetBlockAttrs", model.CheckAuth, model.CheckReadonly, model.CheckReadonly, resetBlockAttrs)
- ginServer.Handle("POST", "/api/attr/setBlockAttrs", model.CheckAuth, model.CheckReadonly, model.CheckReadonly, setBlockAttrs)
+ ginServer.Handle("POST", "/api/attr/resetBlockAttrs", model.CheckAuth, model.CheckReadonly, resetBlockAttrs)
+ ginServer.Handle("POST", "/api/attr/setBlockAttrs", model.CheckAuth, setBlockAttrs)
ginServer.Handle("POST", "/api/attr/getBlockAttrs", model.CheckAuth, getBlockAttrs)
ginServer.Handle("POST", "/api/cloud/getCloudSpace", model.CheckAuth, getCloudSpace)
diff --git a/kernel/model/blockial.go b/kernel/model/blockial.go
index a5e322c3ee..cf42e2ed63 100644
--- a/kernel/model/blockial.go
+++ b/kernel/model/blockial.go
@@ -93,6 +93,10 @@ func SetBlockReminder(id string, timed string) (err error) {
}
func SetBlockAttrs(id string, nameValues map[string]string) (err error) {
+ if util.ReadOnly {
+ return
+ }
+
WaitForWritingFiles()
tree, err := loadTreeByBlockID(id)