mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-06 03:53:50 +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) {
|
s.engine.Use(func(c *gin.Context) {
|
||||||
auth := c.Request.Header.Get("Authorization")
|
auth := c.Request.Header.Get("Authorization")
|
||||||
switch {
|
switch {
|
||||||
case auth != "" && strings.SplitN(auth, " ", 2)[1] != authToken:
|
case auth != "":
|
||||||
c.AbortWithStatus(401)
|
if strings.SplitN(auth, " ", 2)[1] != authToken {
|
||||||
return
|
c.AbortWithStatus(401)
|
||||||
|
}
|
||||||
case c.Query("access_token") != authToken:
|
case c.Query("access_token") != authToken:
|
||||||
c.AbortWithStatus(401)
|
c.AbortWithStatus(401)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user