fix: retry critical writes and allow super login

This commit is contained in:
2026-01-08 17:37:42 +08:00
parent 8ac82aaeb0
commit 3c159a2e0f
4 changed files with 233 additions and 156 deletions

View File

@@ -62,6 +62,9 @@ func (m *Middlewares) Auth(ctx fiber.Ctx) error {
}
func (m *Middlewares) SuperAuth(ctx fiber.Ctx) error {
if isSuperPublicRoute(ctx) {
return ctx.Next()
}
authHeader := ctx.Get("Authorization")
if authHeader == "" {
return errorx.ErrUnauthorized.WithMsg("Missing token")
@@ -130,3 +133,14 @@ func isPublicRoute(ctx fiber.Ctx) bool {
return false
}
func isSuperPublicRoute(ctx fiber.Ctx) bool {
path := ctx.Path()
method := ctx.Method()
if method == fiber.MethodPost && path == "/super/v1/auth/login" {
return true
}
return false
}