fix: issues
This commit is contained in:
@@ -7,23 +7,21 @@ import (
|
||||
"quyun/app/models"
|
||||
|
||||
"github.com/gofiber/fiber/v3"
|
||||
"github.com/gofiber/fiber/v3/log"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func (f *Middlewares) Auth(ctx fiber.Ctx) error {
|
||||
if strings.HasPrefix(ctx.Path(), "/MP_verify_") {
|
||||
return ctx.Next()
|
||||
}
|
||||
|
||||
if strings.HasPrefix(ctx.Path(), "/auth/") {
|
||||
if strings.HasPrefix(ctx.Path(), "/v1/auth/") {
|
||||
return ctx.Next()
|
||||
}
|
||||
|
||||
uu, err := models.Users.GetByID(ctx.Context(), 1)
|
||||
if err != nil {
|
||||
log.WithError(err).Error("failed to get user")
|
||||
return ctx.SendString("NOT OK")
|
||||
}
|
||||
ctx.Locals("user", uu)
|
||||
log.Infof("set ctx user: %d", uu.ID)
|
||||
return ctx.Next()
|
||||
|
||||
fullUrl := string(ctx.Request().URI().FullURI())
|
||||
|
||||
Reference in New Issue
Block a user