Make post rate limit site-specific.

remotes/1693045480750635534/spooky-22
Snakes 2022-06-02 22:10:59 -04:00
parent 692a9adb99
commit 843ff51ace
2 changed files with 4 additions and 2 deletions

View File

@ -129,6 +129,7 @@ AGENDAPOSTER_PHRASE = 'trans lives matter'
AGENDAPOSTER_MSG = """Hi @{username},\n\nYour {type} has been automatically removed because you forgot to include `{AGENDAPOSTER_PHRASE}`.\n\nDon't worry, we're here to help! We won't let you post or comment anything that doesn't express your love and acceptance towards the trans community. Feel free to resubmit your {type} with `{AGENDAPOSTER_PHRASE}` included. \n\n*This is an automated message; if you need help, you can message us [here](/contact).*"""
PIN_LIMIT = 3
POST_RATE_LIMIT = "1/second;2/minute;10/hour;50/day"
if SITE in {'rdrama.net','devrama.xyz'}:
HOLE_COST = 200000
@ -179,6 +180,7 @@ if SITE in {'rdrama.net','devrama.xyz'}:
elif SITE == "pcmemes.net":
HOLE_COST = 10000
PIN_LIMIT = 6
POST_RATE_LIMIT = "1/second;4/minute;20/hour;100/day"
NOTIFICATIONS_ID = 1046
AUTOJANNY_ID = 1050
SNAPPY_ID = 261

View File

@ -852,8 +852,8 @@ def api_is_repost():
@app.post("/submit")
@app.post("/h/<sub>/submit")
@limiter.limit("1/second;2/minute;10/hour;50/day")
@limiter.limit("1/second;2/minute;10/hour;50/day", key_func=lambda:f'{request.host}-{session.get("lo_user")}')
@limiter.limit(POST_RATE_LIMIT)
@limiter.limit(POST_RATE_LIMIT, key_func=lambda:f'{request.host}-{session.get("lo_user")}')
@auth_required
def submit_post(v, sub=None):