This commit is contained in:
Liang Ding 2022-07-15 10:38:01 +08:00
parent bf2e2123b7
commit fafd4f8513
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 63 additions and 0 deletions

View file

@ -28,6 +28,20 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func renameAsset(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
oldName := arg["oldName"].(string)
newName := arg["newName"].(string)
model.RenameAsset(oldName, newName)
}
func getDocImageAssets(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)

View file

@ -185,6 +185,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/asset/removeUnusedAsset", model.CheckAuth, model.CheckReadonly, removeUnusedAsset)
ginServer.Handle("POST", "/api/asset/removeUnusedAssets", model.CheckAuth, model.CheckReadonly, removeUnusedAssets)
ginServer.Handle("POST", "/api/asset/getDocImageAssets", model.CheckAuth, model.CheckReadonly, getDocImageAssets)
ginServer.Handle("POST", "/api/asset/renameAsset", model.CheckAuth, model.CheckReadonly, renameAsset)
ginServer.Handle("POST", "/api/export/batchExportMd", model.CheckAuth, batchExportMd)
ginServer.Handle("POST", "/api/export/exportMd", model.CheckAuth, exportMd)