Change system for hanayo requests

This commit is contained in:
Howl
2016-08-09 23:06:23 +02:00
parent 4f217781cc
commit af691bee1c
3 changed files with 8 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ func initialCaretaker(c *gin.Context, f func(md common.MethodData) common.CodeMe
}
// requests from hanayo should not be rate limited.
if ip != "127.0.0.1" || c.Request.UserAgent() != "hanayo" {
if !(c.Request.Header.Get("H-Key") == cf.HanayoKey && c.Request.UserAgent() == "hanayo") {
perUserRequestLimiter(md.ID(), c.ClientIP())
}

View File

@@ -13,11 +13,15 @@ import (
"github.com/gin-gonic/gin"
)
var db *sql.DB
var (
db *sql.DB
cf common.Conf
)
// Start begins taking HTTP connections.
func Start(conf common.Conf, dbO *sql.DB) *gin.Engine {
db = dbO
cf = conf
setUpLimiter()