mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 Add internal kernel API /api/setting/addVirtualBlockRefInclude and addVirtualBlockRefExclude https://github.com/siyuan-note/siyuan/issues/9909
This commit is contained in:
parent
65fbfc5a1f
commit
32ce33d0fb
3 changed files with 78 additions and 0 deletions
|
|
@ -308,6 +308,8 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/setting/setAI", model.CheckAuth, model.CheckReadonly, setAI)
|
||||
ginServer.Handle("POST", "/api/setting/setBazaar", model.CheckAuth, model.CheckReadonly, setBazaar)
|
||||
ginServer.Handle("POST", "/api/setting/refreshVirtualBlockRef", model.CheckAuth, model.CheckReadonly, refreshVirtualBlockRef)
|
||||
ginServer.Handle("POST", "/api/setting/addVirtualBlockRefInclude", model.CheckAuth, model.CheckReadonly, addVirtualBlockRefInclude)
|
||||
ginServer.Handle("POST", "/api/setting/addVirtualBlockRefExclude", model.CheckAuth, model.CheckReadonly, addVirtualBlockRefExclude)
|
||||
|
||||
ginServer.Handle("POST", "/api/graph/resetGraph", model.CheckAuth, model.CheckReadonly, resetGraph)
|
||||
ginServer.Handle("POST", "/api/graph/resetLocalGraph", model.CheckAuth, model.CheckReadonly, resetLocalGraph)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,46 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func addVirtualBlockRefExclude(c *gin.Context) {
|
||||
// Add internal kernel API `/api/setting/addVirtualBlockRefExclude` https://github.com/siyuan-note/siyuan/issues/9909
|
||||
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
keywordsArg := arg["keywords"]
|
||||
var keywords []string
|
||||
for _, k := range keywordsArg.([]interface{}) {
|
||||
keywords = append(keywords, k.(string))
|
||||
}
|
||||
|
||||
model.AddVirtualBlockRefExclude(keywords)
|
||||
}
|
||||
|
||||
func addVirtualBlockRefInclude(c *gin.Context) {
|
||||
// Add internal kernel API `/api/setting/addVirtualBlockRefInclude` https://github.com/siyuan-note/siyuan/issues/9909
|
||||
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
keywordsArg := arg["keywords"]
|
||||
var keywords []string
|
||||
for _, k := range keywordsArg.([]interface{}) {
|
||||
keywords = append(keywords, k.(string))
|
||||
}
|
||||
|
||||
model.AddVirtualBlockRefInclude(keywords)
|
||||
}
|
||||
|
||||
func refreshVirtualBlockRef(c *gin.Context) {
|
||||
// Add internal kernel API `/api/setting/refreshVirtualBlockRef` https://github.com/siyuan-note/siyuan/issues/9829
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue