✨ clear cache
This commit is contained in:
15
server/cache.go
Normal file
15
server/cache.go
Normal file
@ -0,0 +1,15 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/Xhofe/alist/conf"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func ClearCache(ctx *fiber.Ctx) error {
|
||||
err := conf.Cache.Clear(conf.Ctx)
|
||||
if err != nil {
|
||||
return ErrorResp(ctx,err,500)
|
||||
}else {
|
||||
return SuccessResp(ctx)
|
||||
}
|
||||
}
|
@ -43,6 +43,9 @@ func Path(ctx *fiber.Ctx) error {
|
||||
return ErrorResp(ctx, err, 500)
|
||||
}
|
||||
if file != nil {
|
||||
if account.Type == "Native" {
|
||||
file.Url = fmt.Sprintf("%s://%s/p%s",ctx.Protocol(),ctx.Hostname(),req.Path)
|
||||
}
|
||||
return ctx.JSON(Resp{
|
||||
Code: 200,
|
||||
Message: "file",
|
||||
@ -75,7 +78,7 @@ func Link(ctx *fiber.Ctx) error {
|
||||
}
|
||||
if account.Type == "Native" {
|
||||
return SuccessResp(ctx, fiber.Map{
|
||||
"url":"",
|
||||
"url":fmt.Sprintf("%s://%s/p%s",ctx.Protocol(),ctx.Hostname(),rawPath),
|
||||
})
|
||||
} else {
|
||||
return SuccessResp(ctx,fiber.Map{
|
||||
|
@ -33,5 +33,6 @@ func InitApiRouter(app *fiber.App) {
|
||||
admin.Get("/accounts", GetAccounts)
|
||||
admin.Delete("/account", DeleteAccount)
|
||||
admin.Get("/drivers", GetDrivers)
|
||||
admin.Get("/clear_cache",ClearCache)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user