🎇 refresh one folder

pull/661/head
Xhofe 2022-02-23 19:16:33 +08:00
parent aa79f49e25
commit cae7f36531
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,30 @@
package file
import (
"github.com/Xhofe/alist/drivers/base"
"github.com/Xhofe/alist/server/common"
"github.com/gin-gonic/gin"
)
type RefreshReq struct {
Path string `json:"path"`
}
func RefreshFolder(c *gin.Context) {
var req RefreshReq
if err := c.ShouldBind(&req); err != nil {
common.ErrorResp(c, err, 400)
return
}
account, path_, _, err := common.ParsePath(req.Path)
if err != nil {
common.ErrorResp(c, err, 500)
return
}
err = base.DeleteCache(path_, account)
if err != nil {
common.ErrorResp(c, err, 500)
return
}
common.SuccessResp(c)
}

View File

@ -58,6 +58,7 @@ func InitApiRouter(r *gin.Engine) {
admin.POST("/move", file.Move)
admin.POST("/copy", file.Copy)
admin.POST("/folder", file.Folder)
admin.POST("/refresh", file.RefreshFolder)
}
WebDav(r)
Static(r)