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: 改进内核只读模式 https://github.com/siyuan-note/siyuan/issues/7615
Liang Ding883898f05349
diff --git a/kernel/api/router.go b/kernel/api/router.goindex 902d24f7be..6e02101aa1 100644--- a/kernel/api/router.go+++ b/kernel/api/router.go@@ -52,14 +52,14 @@ func ServeAPI(ginServer *gin.Engine) {ginServer.Handle("POST", "/api/system/setAppearanceMode", model.CheckAuth, setAppearanceMode)ginServer.Handle("POST", "/api/system/getSysFonts", model.CheckAuth, getSysFonts)ginServer.Handle("POST", "/api/system/exit", model.CheckAuth, exit)- ginServer.Handle("POST", "/api/system/setUILayout", model.CheckAuth, model.CheckReadonly, setUILayout)+ ginServer.Handle("POST", "/api/system/setUILayout", model.CheckAuth, setUILayout)ginServer.Handle("POST", "/api/system/getConf", model.CheckAuth, getConf)ginServer.Handle("POST", "/api/system/checkUpdate", model.CheckAuth, checkUpdate)ginServer.Handle("POST", "/api/system/exportLog", model.CheckAuth, exportLog)- ginServer.Handle("POST", "/api/storage/setLocalStorage", model.CheckAuth, model.CheckReadonly, setLocalStorage)+ ginServer.Handle("POST", "/api/storage/setLocalStorage", model.CheckAuth, setLocalStorage)ginServer.Handle("POST", "/api/storage/getLocalStorage", model.CheckAuth, getLocalStorage)- ginServer.Handle("POST", "/api/storage/setLocalStorageVal", model.CheckAuth, model.CheckReadonly, setLocalStorageVal)+ ginServer.Handle("POST", "/api/storage/setLocalStorageVal", model.CheckAuth, setLocalStorageVal)ginServer.Handle("POST", "/api/storage/removeLocalStorageVal", model.CheckAuth, model.CheckReadonly, removeLocalStorageVal)ginServer.Handle("POST", "/api/storage/setCriterion", model.CheckAuth, model.CheckReadonly, setCriterion)ginServer.Handle("POST", "/api/storage/getCriteria", model.CheckAuth, getCriteria)diff --git a/kernel/api/system.go b/kernel/api/system.goindex a77659434c..41c8def7b2 100644--- a/kernel/api/system.go+++ b/kernel/api/system.go@@ -171,6 +171,10 @@ func setUILayout(c *gin.Context) {ret := gulu.Ret.NewResult()defer c.JSON(http.StatusOK, ret)+ if util.ReadOnly {+ return+ }+arg, ok := util.JsonArg(c, ret)if !ok {returndiff --git a/kernel/model/storage.go b/kernel/model/storage.goindex 1e88067805..8b91f4c509 100644--- a/kernel/model/storage.go+++ b/kernel/model/storage.go@@ -325,6 +325,10 @@ func GetLocalStorage() (ret map[string]interface{}, err error) {}func setLocalStorage(val interface{}) (err error) {+ if util.ReadOnly {+ return+ }+dirPath := filepath.Join(util.DataDir, "storage")if err = os.MkdirAll(dirPath, 0755); nil != err {logging.LogErrorf("create storage [local] dir failed: %s", err)