forked from rDrama/rDrama
remove unnecessary shit in wrappers
parent
5b3b56f246
commit
998b966f2b
|
@ -315,7 +315,6 @@ POLL_BET_COINS = 200
|
|||
WELCOME_MSG = f"Welcome to {SITE_NAME}!"
|
||||
ROLES={}
|
||||
|
||||
CASINO_ENABLED = True
|
||||
LOTTERY_TICKET_COST = 12
|
||||
LOTTERY_SINK_RATE = 3
|
||||
LOTTERY_DURATION = 60 * 60 * 24 * 7
|
||||
|
@ -410,7 +409,6 @@ elif SITE == 'pcmemes.net':
|
|||
|
||||
WELCOME_MSG = "Welcome to pcmemes.net! Don't forget to turn off the slur filter [here](/settings/content#slurreplacer)"
|
||||
|
||||
CASINO_ENABLED = False
|
||||
LOTTERY_TICKET_COST = 12
|
||||
LOTTERY_SINK_RATE = -8
|
||||
|
||||
|
|
|
@ -65,8 +65,7 @@ def inject_constants():
|
|||
"PIZZASHILL_ID":PIZZASHILL_ID, "DEFAULT_COLOR":DEFAULT_COLOR,
|
||||
"COLORS":COLORS, "time":time, "PERMS":PERMS, "FEATURES":FEATURES,
|
||||
"HOLE_NAME":HOLE_NAME, "HOLE_STYLE_FLAIR":HOLE_STYLE_FLAIR, "HOLE_REQUIRED":HOLE_REQUIRED,
|
||||
"CASINO_ENABLED":CASINO_ENABLED, "GUMROAD_LINK":GUMROAD_LINK,
|
||||
"DEFAULT_THEME":DEFAULT_THEME, "DESCRIPTION":DESCRIPTION,
|
||||
"GUMROAD_LINK":GUMROAD_LINK, "DEFAULT_THEME":DEFAULT_THEME, "DESCRIPTION":DESCRIPTION,
|
||||
"has_sidebar":has_sidebar, "has_logo":has_logo, "has_app":has_app,
|
||||
"FP":FP, "NOTIF_MODACTION_JL_MIN":NOTIF_MODACTION_JL_MIN, "cache":cache,
|
||||
"ONLINE_STR":ONLINE_STR, "patron":patron, "DUES":DUES,
|
||||
|
|
|
@ -93,14 +93,14 @@ def get_logged_in_user():
|
|||
|
||||
def auth_desired(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
v = kwargs.pop('v', get_logged_in_user())
|
||||
v = get_logged_in_user()
|
||||
return make_response(f(*args, v=v, **kwargs))
|
||||
wrapper.__name__ = f.__name__
|
||||
return wrapper
|
||||
|
||||
def auth_desired_with_logingate(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
v = kwargs.pop('v', get_logged_in_user())
|
||||
v = get_logged_in_user()
|
||||
if app.config['SETTINGS']['login_required'] and not v: abort(401)
|
||||
|
||||
if not v and not request.path.startswith('/logged_out'):
|
||||
|
@ -118,7 +118,7 @@ def auth_desired_with_logingate(f):
|
|||
|
||||
def auth_required(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
v = kwargs.pop('v', get_logged_in_user())
|
||||
v = get_logged_in_user()
|
||||
if not v: abort(401)
|
||||
|
||||
return make_response(f(*args, v=v, **kwargs))
|
||||
|
@ -128,7 +128,7 @@ def auth_required(f):
|
|||
|
||||
def is_not_permabanned(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
v = kwargs.pop('v', get_logged_in_user())
|
||||
v = get_logged_in_user()
|
||||
if not v: abort(401)
|
||||
if v.is_suspended_permanently: abort(403)
|
||||
return make_response(f(*args, v=v, **kwargs))
|
||||
|
@ -138,10 +138,10 @@ def is_not_permabanned(f):
|
|||
def admin_level_required(x):
|
||||
def wrapper_maker(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
v = kwargs.pop('v', get_logged_in_user())
|
||||
v = get_logged_in_user()
|
||||
if not v: abort(401)
|
||||
if v.admin_level < x: abort(403)
|
||||
return make_response(f(*args, v=v, **kwargs))
|
||||
return make_response(f(*args, **kwargs))
|
||||
|
||||
wrapper.__name__ = f.__name__
|
||||
return wrapper
|
||||
|
@ -150,18 +150,8 @@ def admin_level_required(x):
|
|||
def feature_required(x):
|
||||
def wrapper_maker(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
v = kwargs.pop('v', get_logged_in_user())
|
||||
if not FEATURES[x]: abort(404)
|
||||
return make_response(f(*args, v=v, **kwargs))
|
||||
return make_response(f(*args, **kwargs))
|
||||
wrapper.__name__ = f.__name__
|
||||
return wrapper
|
||||
return wrapper_maker
|
||||
|
||||
def casino_required(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
v = kwargs.pop('v', get_logged_in_user())
|
||||
if not CASINO_ENABLED: abort(404)
|
||||
return make_response(f(v=v))
|
||||
|
||||
wrapper.__name__ = f.__name__
|
||||
return wrapper
|
||||
|
|
|
@ -9,7 +9,7 @@ import requests
|
|||
|
||||
@app.post("/lottery/end")
|
||||
@admin_level_required(PERMS['LOTTERY_ADMIN'])
|
||||
@casino_required
|
||||
@feature_required('GAMBLING')
|
||||
def lottery_end(v):
|
||||
success, message = end_lottery_session()
|
||||
return {"message": message} if success else {"error": message}
|
||||
|
@ -17,7 +17,7 @@ def lottery_end(v):
|
|||
|
||||
@app.post("/lottery/start")
|
||||
@admin_level_required(PERMS['LOTTERY_ADMIN'])
|
||||
@casino_required
|
||||
@feature_required('GAMBLING')
|
||||
def lottery_start(v):
|
||||
start_new_lottery_session()
|
||||
return {"message": "Lottery started."}
|
||||
|
@ -26,7 +26,7 @@ def lottery_start(v):
|
|||
@app.post("/lottery/buy")
|
||||
@limiter.limit("3/second;100/minute;500/hour;1000/day")
|
||||
@auth_required
|
||||
@casino_required
|
||||
@feature_required('GAMBLING')
|
||||
def lottery_buy(v):
|
||||
try: quantity = int(request.values.get("quantity"))
|
||||
except: return {"error": "Invalid ticket quantity."}, 400
|
||||
|
@ -44,7 +44,7 @@ def lottery_buy(v):
|
|||
@app.get("/lottery/active")
|
||||
@limiter.limit("3/second;100/minute;500/hour;1000/day")
|
||||
@auth_required
|
||||
@casino_required
|
||||
@feature_required('GAMBLING')
|
||||
def lottery_active(v):
|
||||
lottery, participants = get_active_lottery_stats()
|
||||
|
||||
|
@ -52,7 +52,7 @@ def lottery_active(v):
|
|||
|
||||
@app.get("/admin/lottery/participants")
|
||||
@admin_level_required(PERMS['LOTTERY_VIEW_PARTICIPANTS'])
|
||||
@casino_required
|
||||
@feature_required('GAMBLING')
|
||||
def lottery_admin(v):
|
||||
participants = get_users_participating_in_lottery()
|
||||
return render_template("admin/lottery.html", v=v, participants=participants)
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
</ul>
|
||||
{%- endif %}
|
||||
|
||||
{% if CASINO_ENABLED -%}
|
||||
{% if FEATURES['GAMBLING'] -%}
|
||||
<h4>Casino</h4>
|
||||
<ul>
|
||||
<li><a href="/admin/lottery/participants">Participants</a></li>
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
|
||||
<a class="mobile-nav-icon d-md-none" href="/random_user"><i class="fas fa-music align-middle text-gray-500 black"></i></a>
|
||||
|
||||
{% if v and CASINO_ENABLED and FEATURES['GAMBLING'] %}
|
||||
{% if v and FEATURES['GAMBLING'] %}
|
||||
<a class="mobile-nav-icon d-md-none" href="/casino">
|
||||
<i class="fas fa-cards align-middle text-gray-500 black"></i>
|
||||
</a>
|
||||
|
@ -194,7 +194,7 @@
|
|||
<a class="nav-link" href="/leaderboard" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Leaderboard"><i class="fas fa-trophy"></i></a>
|
||||
</li>
|
||||
|
||||
{% if CASINO_ENABLED and FEATURES['GAMBLING'] %}
|
||||
{% if FEATURES['GAMBLING'] %}
|
||||
<li class="nav-item d-flex align-items-center justify-content-center text-center mx-1">
|
||||
<a class="nav-link" href="/casino" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Casino"><i class="fas fa-cards"></i></a>
|
||||
</li>
|
||||
|
|
Loading…
Reference in New Issue