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