Files
OpenList/server/controllers/utils.go

27 lines
577 B
Go
Raw Normal View History

2020-12-29 13:37:58 +08:00
package controllers
import (
"github.com/Xhofe/alist/conf"
"github.com/gin-gonic/gin"
)
2021-02-04 10:02:34 +08:00
// handle info request
2020-12-29 13:37:58 +08:00
func Info(c *gin.Context) {
2021-01-11 16:53:48 +08:00
c.JSON(200, DataResponse(conf.Conf.Info))
2020-12-29 13:37:58 +08:00
}
2021-02-04 10:02:34 +08:00
// handle refresh_cache request
2020-12-29 13:37:58 +08:00
func RefreshCache(c *gin.Context) {
password:=c.Param("password")
if conf.Conf.Cache.Enable {
if password == conf.Conf.Cache.RefreshPassword {
conf.Cache.Flush()
2021-01-11 16:53:48 +08:00
c.JSON(200, MetaResponse(200,"flush success."))
2020-12-29 13:37:58 +08:00
return
}
2021-01-11 16:53:48 +08:00
c.JSON(200, MetaResponse(401,"wrong password."))
2020-12-29 13:37:58 +08:00
return
}
2021-01-11 16:53:48 +08:00
c.JSON(200, MetaResponse(400,"disabled cache."))
2020-12-29 13:37:58 +08:00
return
}