mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 19:43:49 +08:00
fix: #768
This commit is contained in:
parent
db63cbec82
commit
32bba9994b
@ -79,9 +79,10 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) {
|
||||
s.engine.Use(func(c *gin.Context) {
|
||||
auth := c.Request.Header.Get("Authorization")
|
||||
switch {
|
||||
case auth != "" && strings.SplitN(auth, " ", 2)[1] != authToken:
|
||||
c.AbortWithStatus(401)
|
||||
return
|
||||
case auth != "":
|
||||
if strings.SplitN(auth, " ", 2)[1] != authToken {
|
||||
c.AbortWithStatus(401)
|
||||
}
|
||||
case c.Query("access_token") != authToken:
|
||||
c.AbortWithStatus(401)
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user