Rate limits should be per-method, not per-resource string.

This commit is contained in:
🐙PiperYxzzy
2022-10-12 22:43:05 +02:00
parent 2922793427
commit 2ada2b5936
3 changed files with 11 additions and 11 deletions

View File

@@ -125,7 +125,7 @@ func UnauthRateLimit() gin.HandlerFunc {
ip := c.ClientIP()
if !unauthed.take(ip, "") {
if !unauthed.take(ip, c.Request.Method+":"+c.FullPath()) {
c.AbortWithStatus(http.StatusTooManyRequests)
return
}
@@ -156,7 +156,7 @@ func AuthedRateLimit() gin.HandlerFunc {
return
}
if !authed.take(p.Uid.String(), c.FullPath()) {
if !authed.take(p.Uid.String(), c.Request.Method+":"+c.FullPath()) {
c.AbortWithStatus(http.StatusTooManyRequests)
return
}