fix: wechat verify

This commit is contained in:
Rogee
2025-01-10 19:44:24 +08:00
parent ab576706e7
commit 52c17b63bb
13 changed files with 83 additions and 92 deletions

View File

@@ -7,10 +7,14 @@ import (
)
func (m *Middlewares) CheckUA(ctx fiber.Ctx) error {
if m.app.IsDevMode() {
return ctx.Next()
}
keyword := strings.ToLower("MicroMessenger")
userAgent := ctx.GetReqHeaders()["User-Agent"][0]
if strings.Contains(userAgent, keyword) {
if !strings.Contains(userAgent, keyword) {
return ctx.SendString("")
}
return ctx.Next()