faf948b037
- 60 requests per minute for requests without a valid API token - 2000 requests per minute per user for requests with a valid API token
20 lines
449 B
Go
20 lines
449 B
Go
package app
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// PeppyMethod generates a method for the peppyapi
|
|
func PeppyMethod(a func(c *gin.Context, db *sql.DB)) gin.HandlerFunc {
|
|
return func(c *gin.Context) {
|
|
rateLimiter()
|
|
perUserRequestLimiter(0, c.Request.Header.Get("X-Real-IP"))
|
|
|
|
// I have no idea how, but I manged to accidentally string the first 4
|
|
// letters of the alphabet into a single function call.
|
|
a(c, db)
|
|
}
|
|
}
|