forked from MarseyWorld/MarseyWorld
add patronage message and message for when it's enabled permanently
parent
06736dfb75
commit
c2350d36bf
|
@ -54,7 +54,7 @@ def settings_personal_post(v):
|
|||
if not request.values.get(request_name): return False
|
||||
current_value = getattr(v, column_name)
|
||||
if FEATURES['USERS_PERMANENT_WORD_FILTERS'] and current_value > 1:
|
||||
abort(403, f"Cannot disable the {{friendly_name}} after you've already set it permanently!")
|
||||
abort(403, f"Cannot change the {friendly_name} setting after you've already set it permanently!")
|
||||
request_flag = int(request.values.get(request_name, '') == 'true')
|
||||
if current_value and request_flag and request.values.get("permanent", '') == 'true' and request.values.get("username") == v.username:
|
||||
if v.client: abort(403, "Cannot set filters permanently from the API")
|
||||
|
@ -309,37 +309,32 @@ def filters(v):
|
|||
return render_template("settings_filters.html", v=v, msg="Your custom filters have been updated.")
|
||||
|
||||
|
||||
def set_color(v:User, attr:str, color:Optional[str]):
|
||||
current = getattr(v, attr)
|
||||
color = color.strip().lower() if color else None
|
||||
if color:
|
||||
if color.startswith('#'): color = color[1:]
|
||||
if not color_regex.fullmatch(color):
|
||||
return render_template("settings_personal.html", v=v, error="Invalid color hex code")
|
||||
if color and current != color:
|
||||
setattr(v, attr, color)
|
||||
g.db.add(v)
|
||||
return redirect("/settings/personal")
|
||||
|
||||
|
||||
@app.post("/settings/namecolor")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
|
||||
@auth_required
|
||||
def namecolor(v):
|
||||
|
||||
color = request.values.get("color", "").strip().lower()
|
||||
if color.startswith('#'): color = color[1:]
|
||||
|
||||
if not color_regex.fullmatch(color):
|
||||
return render_template("settings_personal.html", v=v, error="Invalid color hex code")
|
||||
|
||||
v.namecolor = color
|
||||
g.db.add(v)
|
||||
return redirect("/settings/personal")
|
||||
return set_color(v, "namecolor", request.values.get("color"))
|
||||
|
||||
@app.post("/settings/themecolor")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
|
||||
@auth_required
|
||||
def themecolor(v):
|
||||
|
||||
themecolor = str(request.values.get("themecolor", "")).strip()
|
||||
if themecolor.startswith('#'): themecolor = themecolor[1:]
|
||||
|
||||
if not color_regex.fullmatch(themecolor):
|
||||
return render_template("settings_personal.html", v=v, error="Invalid color hex code")
|
||||
|
||||
v.themecolor = themecolor
|
||||
g.db.add(v)
|
||||
return redirect("/settings/personal")
|
||||
return set_color(v, "themecolor", request.values.get("themecolor"))
|
||||
|
||||
@app.post("/settings/gumroad")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
|
@ -382,27 +377,15 @@ def gumroad(v):
|
|||
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
|
||||
@auth_required
|
||||
def titlecolor(v):
|
||||
|
||||
titlecolor = request.values.get("titlecolor", "").strip().lower()
|
||||
if titlecolor.startswith('#'): titlecolor = titlecolor[1:]
|
||||
|
||||
if not color_regex.fullmatch(titlecolor):
|
||||
return render_template("settings_personal.html", v=v, error="Invalid color hex code")
|
||||
v.titlecolor = titlecolor
|
||||
g.db.add(v)
|
||||
return redirect("/settings/personal")
|
||||
return set_color(v, "title", request.values.get("titlecolor"))
|
||||
|
||||
@app.post("/settings/verifiedcolor")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
|
||||
@auth_required
|
||||
def verifiedcolor(v):
|
||||
verifiedcolor = str(request.values.get("verifiedcolor", "")).strip()
|
||||
if verifiedcolor.startswith('#'): verifiedcolor = verifiedcolor[1:]
|
||||
if len(verifiedcolor) != 6: return render_template("settings_personal.html", v=v, error="Invalid color hex code")
|
||||
v.verifiedcolor = verifiedcolor
|
||||
g.db.add(v)
|
||||
return redirect("/settings/personal")
|
||||
if not v.verified: abort(403, "You don't have a checkmark")
|
||||
return set_color(v, "verifiedcolor", "verifiedcolor")
|
||||
|
||||
@app.post("/settings/security")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
|
|
|
@ -25,7 +25,14 @@
|
|||
<label for="patron-status">{{patron}} Status</label>
|
||||
</div>
|
||||
<div class="body w-lg-100">
|
||||
Internal patron level for logged in user: {{v.patron}}<br>Don't put this in production lol<br>Example text until we figure out what to put here. Dude bussy lmao
|
||||
{% if v.patron %}
|
||||
<p>You're a {{patron}}!</p>
|
||||
{% else %}
|
||||
<p>You're a freeloader!</p>
|
||||
{% endif %}
|
||||
{% if not v.patron and v.truescore >= TRUESCORE_DONATE_LIMIT %}
|
||||
<p class="font-italic">To stop freeloading, first <a href="/settings/security#new_email">verify your email</a>, support us on <a href="{{GUMROAD_LINK}}">Gumroad</a> with the same email, and click "Claim {{patron}} Rewards"</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-lg-flex border-bottom">
|
||||
|
@ -214,10 +221,18 @@
|
|||
{% set ns = namespace(slurtext='Enable if you would like to automatically replace slurs.', profanitytext='Enable if you would like to automatically replace slurs.') %}
|
||||
{# toggle_section(title, id, name, flag, below_text, disabled) #}
|
||||
{% if FEATURES['USERS_PERMANENT_WORD_FILTERS'] and v.slurreplacer %}
|
||||
{% set ns.slurtext = 'Enable if you would like to automatically replace slurs. <a href="#" class="text-primary" data-bs-toggle="modal" data-bs-target="#modal-slurreplacer">Make filter permanent for a badge!</a>' %}
|
||||
{% if v.slurreplacer == 1 %}
|
||||
{% set ns.slurtext = 'Enable if you would like to automatically replace slurs. <a href="#" class="text-primary" data-bs-toggle="modal" data-bs-target="#modal-slurreplacer">Make filter permanent for a badge!</a>' %}
|
||||
{% else %}
|
||||
{% set ns.slurttext = "You've enabled the slur replacer permanently! ✊🏿" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if FEATURES['USERS_PERMANENT_WORD_FILTERS'] and v.profanityreplacer %}
|
||||
{% set ns.profanitytext = 'Enable if you would like to automatically replace profanities. <a href="#" class="text-primary" data-bs-toggle="modal" data-bs-target="#modal-profanityreplacer">Make filter permanent for a badge!</a>' %}
|
||||
{% if v.profanityreplacer == 1 %}
|
||||
{% set ns.profanitytext = 'Enable if you would like to automatically replace profanities. <a href="#" class="text-primary" data-bs-toggle="modal" data-bs-target="#modal-profanityreplacer">Make filter permanent for a badge!</a>' %}
|
||||
{% else %}
|
||||
{% set ns.profanitytext = "You've enabled the profanity replacer permanently! 😇" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{{common.toggle_section("Slur Replacer", "slurreplacer", 'slurreplacer', v.slurreplacer, ns.slurtext, FEATURES['USERS_PERMANENT_WORD_FILTERS'] and v.slurreplacer > 1)}}
|
||||
{{common.toggle_section("Profanity Replacer", "profanityreplacer", 'profanityreplacer', v.profanityreplacer, ns.profanitytext, FEATURES['USERS_PERMANENT_WORD_FILTERS'] and v.profanityreplacer > 1)}}
|
||||
|
@ -287,10 +302,10 @@
|
|||
</div>
|
||||
{%- endif %}
|
||||
{% endmacro %}
|
||||
{% if v.slurreplacer %}
|
||||
{% if v.slurreplacer == 1 -%}
|
||||
{{permanent_filter_modal('slurreplacer', '/settings/personal', 'slurreplacer', 'Slur Replacer', 'Social Justice Berserker')}}
|
||||
{% endif %}
|
||||
{% if v.profanityreplacer %}
|
||||
{%- endif %}
|
||||
{% if v.profanityreplacer == 1 -%}
|
||||
{{permanent_filter_modal('profanityreplacer', '/settings/personal', 'profanityreplacer', 'Profanity Replacer', 'Soapy-Mouthed Angel')}}
|
||||
{% endif %}
|
||||
{%- endif %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue