From 58b76e89265166a055b1398bdef40016dad4368d Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 8 Mar 2024 10:39:14 +0800 Subject: [PATCH] :art: Support listing database mirror blocks in a floating window https://github.com/siyuan-note/siyuan/issues/10538 --- kernel/api/av.go | 13 +++++++++++++ kernel/api/router.go | 1 + 2 files changed, 14 insertions(+) diff --git a/kernel/api/av.go b/kernel/api/av.go index a875428da..0a036c8e0 100644 --- a/kernel/api/av.go +++ b/kernel/api/av.go @@ -26,6 +26,19 @@ import ( "github.com/siyuan-note/siyuan/kernel/util" ) +func getMirrorDatabaseBlocks(c *gin.Context) { + ret := gulu.Ret.NewResult() + defer c.JSON(http.StatusOK, ret) + + arg, ok := util.JsonArg(c, ret) + if !ok { + return + } + + avID := arg["avID"].(string) + ret.Data = av.GetMirrorBlockIDs(avID) +} + func searchTableView(c *gin.Context) { ret := gulu.Ret.NewResult() defer c.JSON(http.StatusOK, ret) diff --git a/kernel/api/router.go b/kernel/api/router.go index 61e048f11..0b1d5490e 100644 --- a/kernel/api/router.go +++ b/kernel/api/router.go @@ -414,6 +414,7 @@ func ServeAPI(ginServer *gin.Engine) { ginServer.Handle("POST", "/api/av/getAttributeViewPrimaryKeyValues", model.CheckAuth, model.CheckReadonly, getAttributeViewPrimaryKeyValues) ginServer.Handle("POST", "/api/av/setDatabaseBlockView", model.CheckAuth, model.CheckReadonly, setDatabaseBlockView) ginServer.Handle("POST", "/api/av/searchTableView", model.CheckAuth, model.CheckReadonly, searchTableView) + ginServer.Handle("POST", "/api/av/getMirrorDatabaseBlocks", model.CheckAuth, model.CheckReadonly, getMirrorDatabaseBlocks) ginServer.Handle("POST", "/api/ai/chatGPT", model.CheckAuth, chatGPT) ginServer.Handle("POST", "/api/ai/chatGPTWithAction", model.CheckAuth, chatGPTWithAction)