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}!"
|
WELCOME_MSG = f"Welcome to {SITE_NAME}!"
|
||||||
ROLES={}
|
ROLES={}
|
||||||
|
|
||||||
CASINO_ENABLED = True
|
|
||||||
LOTTERY_TICKET_COST = 12
|
LOTTERY_TICKET_COST = 12
|
||||||
LOTTERY_SINK_RATE = 3
|
LOTTERY_SINK_RATE = 3
|
||||||
LOTTERY_DURATION = 60 * 60 * 24 * 7
|
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)"
|
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_TICKET_COST = 12
|
||||||
LOTTERY_SINK_RATE = -8
|
LOTTERY_SINK_RATE = -8
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,7 @@ def inject_constants():
|
||||||
"PIZZASHILL_ID":PIZZASHILL_ID, "DEFAULT_COLOR":DEFAULT_COLOR,
|
"PIZZASHILL_ID":PIZZASHILL_ID, "DEFAULT_COLOR":DEFAULT_COLOR,
|
||||||
"COLORS":COLORS, "time":time, "PERMS":PERMS, "FEATURES":FEATURES,
|
"COLORS":COLORS, "time":time, "PERMS":PERMS, "FEATURES":FEATURES,
|
||||||
"HOLE_NAME":HOLE_NAME, "HOLE_STYLE_FLAIR":HOLE_STYLE_FLAIR, "HOLE_REQUIRED":HOLE_REQUIRED,
|
"HOLE_NAME":HOLE_NAME, "HOLE_STYLE_FLAIR":HOLE_STYLE_FLAIR, "HOLE_REQUIRED":HOLE_REQUIRED,
|
||||||
"CASINO_ENABLED":CASINO_ENABLED, "GUMROAD_LINK":GUMROAD_LINK,
|
"GUMROAD_LINK":GUMROAD_LINK, "DEFAULT_THEME":DEFAULT_THEME, "DESCRIPTION":DESCRIPTION,
|
||||||
"DEFAULT_THEME":DEFAULT_THEME, "DESCRIPTION":DESCRIPTION,
|
|
||||||
"has_sidebar":has_sidebar, "has_logo":has_logo, "has_app":has_app,
|
"has_sidebar":has_sidebar, "has_logo":has_logo, "has_app":has_app,
|
||||||
"FP":FP, "NOTIF_MODACTION_JL_MIN":NOTIF_MODACTION_JL_MIN, "cache":cache,
|
"FP":FP, "NOTIF_MODACTION_JL_MIN":NOTIF_MODACTION_JL_MIN, "cache":cache,
|
||||||
"ONLINE_STR":ONLINE_STR, "patron":patron, "DUES":DUES,
|
"ONLINE_STR":ONLINE_STR, "patron":patron, "DUES":DUES,
|
||||||
|
|
|
@ -93,14 +93,14 @@ def get_logged_in_user():
|
||||||
|
|
||||||
def auth_desired(f):
|
def auth_desired(f):
|
||||||
def wrapper(*args, **kwargs):
|
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))
|
return make_response(f(*args, v=v, **kwargs))
|
||||||
wrapper.__name__ = f.__name__
|
wrapper.__name__ = f.__name__
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
def auth_desired_with_logingate(f):
|
def auth_desired_with_logingate(f):
|
||||||
def wrapper(*args, **kwargs):
|
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 app.config['SETTINGS']['login_required'] and not v: abort(401)
|
||||||
|
|
||||||
if not v and not request.path.startswith('/logged_out'):
|
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 auth_required(f):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
v = kwargs.pop('v', get_logged_in_user())
|
v = get_logged_in_user()
|
||||||
if not v: abort(401)
|
if not v: abort(401)
|
||||||
|
|
||||||
return make_response(f(*args, v=v, **kwargs))
|
return make_response(f(*args, v=v, **kwargs))
|
||||||
|
@ -128,7 +128,7 @@ def auth_required(f):
|
||||||
|
|
||||||
def is_not_permabanned(f):
|
def is_not_permabanned(f):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
v = kwargs.pop('v', get_logged_in_user())
|
v = get_logged_in_user()
|
||||||
if not v: abort(401)
|
if not v: abort(401)
|
||||||
if v.is_suspended_permanently: abort(403)
|
if v.is_suspended_permanently: abort(403)
|
||||||
return make_response(f(*args, v=v, **kwargs))
|
return make_response(f(*args, v=v, **kwargs))
|
||||||
|
@ -138,10 +138,10 @@ def is_not_permabanned(f):
|
||||||
def admin_level_required(x):
|
def admin_level_required(x):
|
||||||
def wrapper_maker(f):
|
def wrapper_maker(f):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
v = kwargs.pop('v', get_logged_in_user())
|
v = get_logged_in_user()
|
||||||
if not v: abort(401)
|
if not v: abort(401)
|
||||||
if v.admin_level < x: abort(403)
|
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__
|
wrapper.__name__ = f.__name__
|
||||||
return wrapper
|
return wrapper
|
||||||
|
@ -150,18 +150,8 @@ def admin_level_required(x):
|
||||||
def feature_required(x):
|
def feature_required(x):
|
||||||
def wrapper_maker(f):
|
def wrapper_maker(f):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
v = kwargs.pop('v', get_logged_in_user())
|
|
||||||
if not FEATURES[x]: abort(404)
|
if not FEATURES[x]: abort(404)
|
||||||
return make_response(f(*args, v=v, **kwargs))
|
return make_response(f(*args, **kwargs))
|
||||||
wrapper.__name__ = f.__name__
|
wrapper.__name__ = f.__name__
|
||||||
return wrapper
|
return wrapper
|
||||||
return wrapper_maker
|
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")
|
@app.post("/lottery/end")
|
||||||
@admin_level_required(PERMS['LOTTERY_ADMIN'])
|
@admin_level_required(PERMS['LOTTERY_ADMIN'])
|
||||||
@casino_required
|
@feature_required('GAMBLING')
|
||||||
def lottery_end(v):
|
def lottery_end(v):
|
||||||
success, message = end_lottery_session()
|
success, message = end_lottery_session()
|
||||||
return {"message": message} if success else {"error": message}
|
return {"message": message} if success else {"error": message}
|
||||||
|
@ -17,7 +17,7 @@ def lottery_end(v):
|
||||||
|
|
||||||
@app.post("/lottery/start")
|
@app.post("/lottery/start")
|
||||||
@admin_level_required(PERMS['LOTTERY_ADMIN'])
|
@admin_level_required(PERMS['LOTTERY_ADMIN'])
|
||||||
@casino_required
|
@feature_required('GAMBLING')
|
||||||
def lottery_start(v):
|
def lottery_start(v):
|
||||||
start_new_lottery_session()
|
start_new_lottery_session()
|
||||||
return {"message": "Lottery started."}
|
return {"message": "Lottery started."}
|
||||||
|
@ -26,7 +26,7 @@ def lottery_start(v):
|
||||||
@app.post("/lottery/buy")
|
@app.post("/lottery/buy")
|
||||||
@limiter.limit("3/second;100/minute;500/hour;1000/day")
|
@limiter.limit("3/second;100/minute;500/hour;1000/day")
|
||||||
@auth_required
|
@auth_required
|
||||||
@casino_required
|
@feature_required('GAMBLING')
|
||||||
def lottery_buy(v):
|
def lottery_buy(v):
|
||||||
try: quantity = int(request.values.get("quantity"))
|
try: quantity = int(request.values.get("quantity"))
|
||||||
except: return {"error": "Invalid ticket quantity."}, 400
|
except: return {"error": "Invalid ticket quantity."}, 400
|
||||||
|
@ -44,7 +44,7 @@ def lottery_buy(v):
|
||||||
@app.get("/lottery/active")
|
@app.get("/lottery/active")
|
||||||
@limiter.limit("3/second;100/minute;500/hour;1000/day")
|
@limiter.limit("3/second;100/minute;500/hour;1000/day")
|
||||||
@auth_required
|
@auth_required
|
||||||
@casino_required
|
@feature_required('GAMBLING')
|
||||||
def lottery_active(v):
|
def lottery_active(v):
|
||||||
lottery, participants = get_active_lottery_stats()
|
lottery, participants = get_active_lottery_stats()
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ def lottery_active(v):
|
||||||
|
|
||||||
@app.get("/admin/lottery/participants")
|
@app.get("/admin/lottery/participants")
|
||||||
@admin_level_required(PERMS['LOTTERY_VIEW_PARTICIPANTS'])
|
@admin_level_required(PERMS['LOTTERY_VIEW_PARTICIPANTS'])
|
||||||
@casino_required
|
@feature_required('GAMBLING')
|
||||||
def lottery_admin(v):
|
def lottery_admin(v):
|
||||||
participants = get_users_participating_in_lottery()
|
participants = get_users_participating_in_lottery()
|
||||||
return render_template("admin/lottery.html", v=v, participants=participants)
|
return render_template("admin/lottery.html", v=v, participants=participants)
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{% if CASINO_ENABLED -%}
|
{% if FEATURES['GAMBLING'] -%}
|
||||||
<h4>Casino</h4>
|
<h4>Casino</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/admin/lottery/participants">Participants</a></li>
|
<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>
|
<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">
|
<a class="mobile-nav-icon d-md-none" href="/casino">
|
||||||
<i class="fas fa-cards align-middle text-gray-500 black"></i>
|
<i class="fas fa-cards align-middle text-gray-500 black"></i>
|
||||||
</a>
|
</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>
|
<a class="nav-link" href="/leaderboard" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Leaderboard"><i class="fas fa-trophy"></i></a>
|
||||||
</li>
|
</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">
|
<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>
|
<a class="nav-link" href="/casino" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Casino"><i class="fas fa-cards"></i></a>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in New Issue