constantify CASINO_RATELIMIT

master
Aevann 2023-02-18 20:22:48 +02:00
parent d2c2d313a2
commit d4913ce4ee
3 changed files with 29 additions and 30 deletions

View File

@ -57,10 +57,10 @@ class Service(Enum):
RDRAMA = auto()
CHAT = auto()
CLOUDFLARE_COOKIE_VALUE = "yes." # remember to change this in CloudFlare too
DEFAULT_RATELIMIT = "3/second;30/minute;200/hour;1000/day"
POST_RATELIMIT = '1/second;10/hour;20/day'
DEFAULT_RATELIMIT_SLOWER = "1/second;30/minute;200/hour;1000/day"
DEFAULT_RATELIMIT = "3/second;30/minute;200/hour;1000/day"
CASINO_RATELIMIT = "5/second;100/minute;2000/hour;12000/day"
PUSH_NOTIF_LIMIT = 1000
@ -586,7 +586,6 @@ ERROR_MARSEYS = {
EMOJI_SRCS = ['files/assets/emojis.json']
PIN_LIMIT = 3
POST_RATE_LIMIT = '1/second;10/hour;20/day'
POST_TITLE_LENGTH_LIMIT = 500 # do not make larger than 500 without altering the table
POST_TITLE_HTML_LENGTH_LIMIT = 1500 # do not make larger than 1500 without altering the table
POST_BODY_LENGTH_LIMIT = 20000 # do not make larger than 20000 without altering the table

View File

@ -12,8 +12,8 @@ from files.routes.wrappers import *
from files.__main__ import app, limiter
@app.get("/casino")
@limiter.limit("100/minute;2000/hour;12000/day")
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
@limiter.limit(CASINO_RATELIMIT)
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
@auth_required
def casino(v:User):
if v.rehab:
@ -23,8 +23,8 @@ def casino(v:User):
@app.get("/casino/<game>")
@limiter.limit("100/minute;2000/hour;12000/day")
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
@limiter.limit(CASINO_RATELIMIT)
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
@auth_required
def casino_game_page(v:User, game):
if v.rehab:
@ -53,8 +53,8 @@ def casino_game_page(v:User, game):
@app.get("/casino/<game>/feed")
@limiter.limit("100/minute;2000/hour;12000/day")
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
@limiter.limit(CASINO_RATELIMIT)
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
@auth_required
def casino_game_feed(v:User, game):
if v.rehab:
@ -68,8 +68,8 @@ def casino_game_feed(v:User, game):
# Lottershe
@app.get("/lottershe")
@limiter.limit("100/minute;2000/hour;12000/day")
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
@limiter.limit(CASINO_RATELIMIT)
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
@auth_required
def lottershe(v:User):
if v.rehab:
@ -80,8 +80,8 @@ def lottershe(v:User):
# Slots
@app.post("/casino/slots")
@limiter.limit("100/minute;2000/hour;12000/day")
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
@limiter.limit(CASINO_RATELIMIT)
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
@auth_required
def pull_slots(v:User):
if v.rehab:
@ -112,8 +112,8 @@ def pull_slots(v:User):
# 21
@app.post("/casino/twentyone/deal")
@limiter.limit("1/second;100/minute;2000/hour;12000/day")
@limiter.limit("1/second;100/minute;2000/hour;12000/day", key_func=get_ID)
@limiter.limit(CASINO_RATELIMIT)
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
@auth_required
def blackjack_deal_to_player(v:User):
if v.rehab:
@ -132,8 +132,8 @@ def blackjack_deal_to_player(v:User):
@app.post("/casino/twentyone/hit")
@limiter.limit("1/second;100/minute;2000/hour;12000/day")
@limiter.limit("1/second;100/minute;2000/hour;12000/day", key_func=get_ID)
@limiter.limit(CASINO_RATELIMIT)
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
@auth_required
def blackjack_player_hit(v:User):
if v.rehab:
@ -148,8 +148,8 @@ def blackjack_player_hit(v:User):
@app.post("/casino/twentyone/stay")
@limiter.limit("1/second;100/minute;2000/hour;12000/day")
@limiter.limit("1/second;100/minute;2000/hour;12000/day", key_func=get_ID)
@limiter.limit(CASINO_RATELIMIT)
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
@auth_required
def blackjack_player_stay(v:User):
if v.rehab:
@ -164,8 +164,8 @@ def blackjack_player_stay(v:User):
@app.post("/casino/twentyone/double-down")
@limiter.limit("1/second;100/minute;2000/hour;12000/day")
@limiter.limit("1/second;100/minute;2000/hour;12000/day", key_func=get_ID)
@limiter.limit(CASINO_RATELIMIT)
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
@auth_required
def blackjack_player_doubled_down(v:User):
if v.rehab:
@ -180,8 +180,8 @@ def blackjack_player_doubled_down(v:User):
@app.post("/casino/twentyone/buy-insurance")
@limiter.limit("1/second;100/minute;2000/hour;12000/day")
@limiter.limit("1/second;100/minute;2000/hour;12000/day", key_func=get_ID)
@limiter.limit(CASINO_RATELIMIT)
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
@auth_required
def blackjack_player_bought_insurance(v:User):
if v.rehab:
@ -196,8 +196,8 @@ def blackjack_player_bought_insurance(v:User):
# Roulette
@app.get("/casino/roulette/bets")
@limiter.limit("100/minute;2000/hour;12000/day")
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
@limiter.limit(CASINO_RATELIMIT)
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
@auth_required
def roulette_get_bets(v:User):
if v.rehab:
@ -209,8 +209,8 @@ def roulette_get_bets(v:User):
@app.post("/casino/roulette/place-bet")
@limiter.limit("100/minute;2000/hour;12000/day")
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
@limiter.limit(CASINO_RATELIMIT)
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
@auth_required
def roulette_player_placed_bet(v:User):
if v.rehab:

View File

@ -518,8 +518,8 @@ def is_repost():
@app.post("/submit")
@app.post("/h/<sub>/submit")
@limiter.limit(POST_RATE_LIMIT)
@limiter.limit(POST_RATE_LIMIT, key_func=get_ID)
@limiter.limit(POST_RATELIMIT)
@limiter.limit(POST_RATELIMIT, key_func=get_ID)
@auth_required
def submit_post(v:User, sub=None):
url = request.values.get("url", "").strip()