mirror of
https://github.com/Rayzggz/server_torii.git
synced 2025-06-16 12:11:22 +08:00
fix: CAPTCHA ERROR cause by Undefined UA
This commit is contained in:
@ -3,10 +3,14 @@ package utils
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/mssola/useragent"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func GetClearanceUserAgent(inputUA string) string {
|
||||
if len(inputUA) < 8 || inputUA[:8] != "Mozilla/" {
|
||||
if inputUA == "" || regexp.MustCompile(`^\s*$`).MatchString(inputUA) {
|
||||
return "undefined"
|
||||
}
|
||||
return inputUA
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user