Skip to content

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

:technologist: Add an internal kernel API `/api/ui/reloadFiletree` https://github.com/siyuan-note/siyuan/issues/14493 Add an internal kernel API `/api/ui/reloadUI` https://github.com/siyuan-note/siyuan/issues/14494

Danield0ad863651b0
diff --git a/kernel/api/router.go b/kernel/api/router.go
index 91920117f7..119bb09a1e 100644
--- a/kernel/api/router.go
+++ b/kernel/api/router.go
@@ -473,6 +473,8 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/archive/zip", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, zip)
ginServer.Handle("POST", "/api/archive/unzip", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, unzip)
- ginServer.Handle("POST", "/api/editor/reloadAttributeView", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadAttributeView)
- ginServer.Handle("POST", "/api/editor/reloadProtyle", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadProtyle)
+ ginServer.Handle("POST", "/api/ui/reloadUI", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadUI)
+ ginServer.Handle("POST", "/api/ui/reloadAttributeView", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadAttributeView)
+ ginServer.Handle("POST", "/api/ui/reloadProtyle", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadProtyle)
+ ginServer.Handle("POST", "/api/ui/reloadFiletree", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadFiletree)
}
diff --git a/kernel/api/system.go b/kernel/api/system.go
index 5908cebb05..47d02a0f48 100644
--- a/kernel/api/system.go
+++ b/kernel/api/system.go
@@ -60,13 +60,6 @@ func ignoreAddMicrosoftDefenderExclusion(c *gin.Context) {
model.Conf.Save()
}
-func reloadUI(c *gin.Context) {
- ret := gulu.Ret.NewResult()
- defer c.JSON(http.StatusOK, ret)
-
- util.ReloadUI()
-}
-
func getWorkspaceInfo(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
diff --git a/kernel/api/editor.go b/kernel/api/ui.go
similarity index 84%
rename from kernel/api/editor.go
rename to kernel/api/ui.go
index daa0464cb5..f18ec86726 100644
--- a/kernel/api/editor.go
+++ b/kernel/api/ui.go
@@ -25,6 +25,13 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
+func reloadFiletree(c *gin.Context) {
+ ret := gulu.Ret.NewResult()
+ defer c.JSON(http.StatusOK, ret)
+
+ util.PushReloadFiletree()
+}
+
func reloadProtyle(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
@@ -50,3 +57,10 @@ func reloadAttributeView(c *gin.Context) {
id := arg["id"].(string)
model.ReloadAttrView(id)
}
+
+func reloadUI(c *gin.Context) {
+ ret := gulu.Ret.NewResult()
+ defer c.JSON(http.StatusOK, ret)
+
+ util.ReloadUI()
+}