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

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

No files matched your search

+2 -2
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
}