fix 自定义域名验证逻辑

This commit is contained in:
Sakurasan
2023-03-31 18:21:57 +08:00
parent 8c75f9575b
commit b2f5d73348
2 changed files with 5 additions and 6 deletions

View File

@@ -231,15 +231,14 @@ func GenerateToken() string {
func HandleProy(c *gin.Context) {
var localuser bool
auth := c.Request.Header.Get("Authorization")
if auth[:7] == "Bearer " {
if len(auth) > 7 && auth[:7] == "Bearer " {
if len(auth[7:]) < 1 {
c.JSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"})
return
}
if !store.IsExistAuthCache(auth[7:]) {
localuser = false
if store.IsExistAuthCache(auth[7:]) {
localuser = true
}
localuser = true
}
client := http.DefaultClient
tr := &http.Transport{