mirror of https://github.com/Xhofe/alist
🎇 refresh one folder
parent
aa79f49e25
commit
cae7f36531
|
@ -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)
|
||||
}
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue