mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
✨ Support for searching asset content https://github.com/siyuan-note/siyuan/issues/8874
This commit is contained in:
parent
b753630c20
commit
e66676598f
3 changed files with 45 additions and 0 deletions
|
|
@ -145,6 +145,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/search/searchAsset", model.CheckAuth, searchAsset)
|
||||
ginServer.Handle("POST", "/api/search/findReplace", model.CheckAuth, model.CheckReadonly, findReplace)
|
||||
ginServer.Handle("POST", "/api/search/fullTextSearchAssetContent", model.CheckAuth, fullTextSearchAssetContent)
|
||||
ginServer.Handle("POST", "/api/search/getAssetContent", model.CheckAuth, getAssetContent)
|
||||
|
||||
ginServer.Handle("POST", "/api/block/getBlockInfo", model.CheckAuth, getBlockInfo)
|
||||
ginServer.Handle("POST", "/api/block/getBlockDOM", model.CheckAuth, getBlockDOM)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,25 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func getAssetContent(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
id := arg["id"].(string)
|
||||
query := arg["query"].(string)
|
||||
queryMethod := int(arg["queryMethod"].(float64))
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"assetContent": model.GetAssetContent(id, query, queryMethod),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func fullTextSearchAssetContent(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue