forked from rDrama/rDrama
constantify CASINO_RATELIMIT
parent
d2c2d313a2
commit
d4913ce4ee
|
@ -57,10 +57,10 @@ class Service(Enum):
|
||||||
RDRAMA = auto()
|
RDRAMA = auto()
|
||||||
CHAT = auto()
|
CHAT = auto()
|
||||||
|
|
||||||
CLOUDFLARE_COOKIE_VALUE = "yes." # remember to change this in CloudFlare too
|
POST_RATELIMIT = '1/second;10/hour;20/day'
|
||||||
|
|
||||||
DEFAULT_RATELIMIT = "3/second;30/minute;200/hour;1000/day"
|
|
||||||
DEFAULT_RATELIMIT_SLOWER = "1/second;30/minute;200/hour;1000/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
|
PUSH_NOTIF_LIMIT = 1000
|
||||||
|
|
||||||
|
@ -586,7 +586,6 @@ ERROR_MARSEYS = {
|
||||||
EMOJI_SRCS = ['files/assets/emojis.json']
|
EMOJI_SRCS = ['files/assets/emojis.json']
|
||||||
|
|
||||||
PIN_LIMIT = 3
|
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_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_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
|
POST_BODY_LENGTH_LIMIT = 20000 # do not make larger than 20000 without altering the table
|
||||||
|
|
|
@ -12,8 +12,8 @@ from files.routes.wrappers import *
|
||||||
from files.__main__ import app, limiter
|
from files.__main__ import app, limiter
|
||||||
|
|
||||||
@app.get("/casino")
|
@app.get("/casino")
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day")
|
@limiter.limit(CASINO_RATELIMIT)
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
|
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def casino(v:User):
|
def casino(v:User):
|
||||||
if v.rehab:
|
if v.rehab:
|
||||||
|
@ -23,8 +23,8 @@ def casino(v:User):
|
||||||
|
|
||||||
|
|
||||||
@app.get("/casino/<game>")
|
@app.get("/casino/<game>")
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day")
|
@limiter.limit(CASINO_RATELIMIT)
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
|
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def casino_game_page(v:User, game):
|
def casino_game_page(v:User, game):
|
||||||
if v.rehab:
|
if v.rehab:
|
||||||
|
@ -53,8 +53,8 @@ def casino_game_page(v:User, game):
|
||||||
|
|
||||||
|
|
||||||
@app.get("/casino/<game>/feed")
|
@app.get("/casino/<game>/feed")
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day")
|
@limiter.limit(CASINO_RATELIMIT)
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
|
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def casino_game_feed(v:User, game):
|
def casino_game_feed(v:User, game):
|
||||||
if v.rehab:
|
if v.rehab:
|
||||||
|
@ -68,8 +68,8 @@ def casino_game_feed(v:User, game):
|
||||||
|
|
||||||
# Lottershe
|
# Lottershe
|
||||||
@app.get("/lottershe")
|
@app.get("/lottershe")
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day")
|
@limiter.limit(CASINO_RATELIMIT)
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
|
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def lottershe(v:User):
|
def lottershe(v:User):
|
||||||
if v.rehab:
|
if v.rehab:
|
||||||
|
@ -80,8 +80,8 @@ def lottershe(v:User):
|
||||||
|
|
||||||
# Slots
|
# Slots
|
||||||
@app.post("/casino/slots")
|
@app.post("/casino/slots")
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day")
|
@limiter.limit(CASINO_RATELIMIT)
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
|
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def pull_slots(v:User):
|
def pull_slots(v:User):
|
||||||
if v.rehab:
|
if v.rehab:
|
||||||
|
@ -112,8 +112,8 @@ def pull_slots(v:User):
|
||||||
|
|
||||||
# 21
|
# 21
|
||||||
@app.post("/casino/twentyone/deal")
|
@app.post("/casino/twentyone/deal")
|
||||||
@limiter.limit("1/second;100/minute;2000/hour;12000/day")
|
@limiter.limit(CASINO_RATELIMIT)
|
||||||
@limiter.limit("1/second;100/minute;2000/hour;12000/day", key_func=get_ID)
|
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def blackjack_deal_to_player(v:User):
|
def blackjack_deal_to_player(v:User):
|
||||||
if v.rehab:
|
if v.rehab:
|
||||||
|
@ -132,8 +132,8 @@ def blackjack_deal_to_player(v:User):
|
||||||
|
|
||||||
|
|
||||||
@app.post("/casino/twentyone/hit")
|
@app.post("/casino/twentyone/hit")
|
||||||
@limiter.limit("1/second;100/minute;2000/hour;12000/day")
|
@limiter.limit(CASINO_RATELIMIT)
|
||||||
@limiter.limit("1/second;100/minute;2000/hour;12000/day", key_func=get_ID)
|
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def blackjack_player_hit(v:User):
|
def blackjack_player_hit(v:User):
|
||||||
if v.rehab:
|
if v.rehab:
|
||||||
|
@ -148,8 +148,8 @@ def blackjack_player_hit(v:User):
|
||||||
|
|
||||||
|
|
||||||
@app.post("/casino/twentyone/stay")
|
@app.post("/casino/twentyone/stay")
|
||||||
@limiter.limit("1/second;100/minute;2000/hour;12000/day")
|
@limiter.limit(CASINO_RATELIMIT)
|
||||||
@limiter.limit("1/second;100/minute;2000/hour;12000/day", key_func=get_ID)
|
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def blackjack_player_stay(v:User):
|
def blackjack_player_stay(v:User):
|
||||||
if v.rehab:
|
if v.rehab:
|
||||||
|
@ -164,8 +164,8 @@ def blackjack_player_stay(v:User):
|
||||||
|
|
||||||
|
|
||||||
@app.post("/casino/twentyone/double-down")
|
@app.post("/casino/twentyone/double-down")
|
||||||
@limiter.limit("1/second;100/minute;2000/hour;12000/day")
|
@limiter.limit(CASINO_RATELIMIT)
|
||||||
@limiter.limit("1/second;100/minute;2000/hour;12000/day", key_func=get_ID)
|
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def blackjack_player_doubled_down(v:User):
|
def blackjack_player_doubled_down(v:User):
|
||||||
if v.rehab:
|
if v.rehab:
|
||||||
|
@ -180,8 +180,8 @@ def blackjack_player_doubled_down(v:User):
|
||||||
|
|
||||||
|
|
||||||
@app.post("/casino/twentyone/buy-insurance")
|
@app.post("/casino/twentyone/buy-insurance")
|
||||||
@limiter.limit("1/second;100/minute;2000/hour;12000/day")
|
@limiter.limit(CASINO_RATELIMIT)
|
||||||
@limiter.limit("1/second;100/minute;2000/hour;12000/day", key_func=get_ID)
|
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def blackjack_player_bought_insurance(v:User):
|
def blackjack_player_bought_insurance(v:User):
|
||||||
if v.rehab:
|
if v.rehab:
|
||||||
|
@ -196,8 +196,8 @@ def blackjack_player_bought_insurance(v:User):
|
||||||
|
|
||||||
# Roulette
|
# Roulette
|
||||||
@app.get("/casino/roulette/bets")
|
@app.get("/casino/roulette/bets")
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day")
|
@limiter.limit(CASINO_RATELIMIT)
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
|
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def roulette_get_bets(v:User):
|
def roulette_get_bets(v:User):
|
||||||
if v.rehab:
|
if v.rehab:
|
||||||
|
@ -209,8 +209,8 @@ def roulette_get_bets(v:User):
|
||||||
|
|
||||||
|
|
||||||
@app.post("/casino/roulette/place-bet")
|
@app.post("/casino/roulette/place-bet")
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day")
|
@limiter.limit(CASINO_RATELIMIT)
|
||||||
@limiter.limit("100/minute;2000/hour;12000/day", key_func=get_ID)
|
@limiter.limit(CASINO_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def roulette_player_placed_bet(v:User):
|
def roulette_player_placed_bet(v:User):
|
||||||
if v.rehab:
|
if v.rehab:
|
||||||
|
|
|
@ -518,8 +518,8 @@ def is_repost():
|
||||||
|
|
||||||
@app.post("/submit")
|
@app.post("/submit")
|
||||||
@app.post("/h/<sub>/submit")
|
@app.post("/h/<sub>/submit")
|
||||||
@limiter.limit(POST_RATE_LIMIT)
|
@limiter.limit(POST_RATELIMIT)
|
||||||
@limiter.limit(POST_RATE_LIMIT, key_func=get_ID)
|
@limiter.limit(POST_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def submit_post(v:User, sub=None):
|
def submit_post(v:User, sub=None):
|
||||||
url = request.values.get("url", "").strip()
|
url = request.values.get("url", "").strip()
|
||||||
|
|
Loading…
Reference in New Issue