alist/server/middlewares/account.go

16 lines
293 B
Go
Raw Normal View History

2021-12-07 07:56:43 +00:00
package middlewares
import (
"github.com/Xhofe/alist/model"
"github.com/Xhofe/alist/server/common"
"github.com/gin-gonic/gin"
)
func CheckAccount(c *gin.Context) {
if model.AccountsCount() == 0 {
2022-01-13 13:23:27 +00:00
common.ErrorStrResp(c, "No accounts,please add one first", 1001)
2021-12-07 07:56:43 +00:00
return
}
c.Next()
2022-01-13 13:23:27 +00:00
}