mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
Fix permission check of http.go
This commit is contained in:
parent
8094553bdb
commit
34d2d4fbe2
@ -4,14 +4,15 @@ import (
|
|||||||
"crypto/hmac"
|
"crypto/hmac"
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/Mrs4s/go-cqhttp/coolq"
|
"github.com/Mrs4s/go-cqhttp/coolq"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/guonaihong/gout"
|
"github.com/guonaihong/gout"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/tidwall/gjson"
|
"github.com/tidwall/gjson"
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type httpServer struct {
|
type httpServer struct {
|
||||||
@ -61,12 +62,12 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) {
|
|||||||
c.AbortWithStatus(401)
|
c.AbortWithStatus(401)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
} else if c.Query("access_token") != authToken {
|
||||||
if c.Query("access_token") != authToken {
|
|
||||||
c.AbortWithStatus(401)
|
c.AbortWithStatus(401)
|
||||||
return
|
return
|
||||||
|
} else {
|
||||||
|
c.Next()
|
||||||
}
|
}
|
||||||
c.Next()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user