use /settings/personal instead of /settings/profile

master
justcool393 2022-11-06 06:30:07 -06:00
parent 78c53c1954
commit edc969e2cd
3 changed files with 25 additions and 32 deletions

View File

@ -36,7 +36,7 @@ def remove_background(v):
g.db.add(v) g.db.add(v)
return {"message": "Background removed!"} return {"message": "Background removed!"}
@app.post("/settings/profile") @app.post("/settings/personal")
@limiter.limit("1/second;30/minute;200/hour;1000/day") @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")}') @limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
@auth_required @auth_required
@ -326,7 +326,7 @@ def namecolor(v):
v.namecolor = color v.namecolor = color
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/personal")
@app.post("/settings/themecolor") @app.post("/settings/themecolor")
@limiter.limit("1/second;30/minute;200/hour;1000/day") @limiter.limit("1/second;30/minute;200/hour;1000/day")
@ -342,7 +342,7 @@ def themecolor(v):
v.themecolor = themecolor v.themecolor = themecolor
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/personal")
@app.post("/settings/gumroad") @app.post("/settings/gumroad")
@limiter.limit("1/second;30/minute;200/hour;1000/day") @limiter.limit("1/second;30/minute;200/hour;1000/day")
@ -393,7 +393,7 @@ def titlecolor(v):
return render_template("settings_personal.html", v=v, error="Invalid color hex code") return render_template("settings_personal.html", v=v, error="Invalid color hex code")
v.titlecolor = titlecolor v.titlecolor = titlecolor
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/personal")
@app.post("/settings/verifiedcolor") @app.post("/settings/verifiedcolor")
@limiter.limit("1/second;30/minute;200/hour;1000/day") @limiter.limit("1/second;30/minute;200/hour;1000/day")
@ -405,7 +405,7 @@ def verifiedcolor(v):
if len(verifiedcolor) != 6: return render_template("settings_personal.html", v=v, error="Invalid color hex code") if len(verifiedcolor) != 6: return render_template("settings_personal.html", v=v, error="Invalid color hex code")
v.verifiedcolor = verifiedcolor v.verifiedcolor = verifiedcolor
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/personal")
@app.post("/settings/security") @app.post("/settings/security")
@limiter.limit("1/second;30/minute;200/hour;1000/day") @limiter.limit("1/second;30/minute;200/hour;1000/day")
@ -700,9 +700,7 @@ def settings_name_change(v):
v.name_changed_utc=int(time.time()) v.name_changed_utc=int(time.time())
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/personal")
@app.post("/settings/song_change_mp3") @app.post("/settings/song_change_mp3")
@limiter.limit("3/second;10/day") @limiter.limit("3/second;10/day")
@ -732,9 +730,7 @@ def settings_song_change_mp3(v):
v.song = song v.song = song
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/personal")
@app.post("/settings/song_change") @app.post("/settings/song_change")
@limiter.limit("3/second;10/day") @limiter.limit("3/second;10/day")
@ -751,7 +747,7 @@ def settings_song_change(v):
os.remove(f"/songs/{v.song}.mp3") os.remove(f"/songs/{v.song}.mp3")
v.song = None v.song = None
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/personal")
song = song.replace("https://music.youtube.com", "https://youtube.com") song = song.replace("https://music.youtube.com", "https://youtube.com")
if song.startswith(("https://www.youtube.com/watch?v=", "https://youtube.com/watch?v=", "https://m.youtube.com/watch?v=")): if song.startswith(("https://www.youtube.com/watch?v=", "https://youtube.com/watch?v=", "https://m.youtube.com/watch?v=")):
@ -767,7 +763,7 @@ def settings_song_change(v):
if path.isfile(f'/songs/{id}.mp3'): if path.isfile(f'/songs/{id}.mp3'):
v.song = id v.song = id
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/personal")
req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={id}&key={YOUTUBE_KEY}&part=contentDetails", timeout=5).json() req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={id}&key={YOUTUBE_KEY}&part=contentDetails", timeout=5).json()
@ -812,9 +808,7 @@ def settings_song_change(v):
v.song = id v.song = id
g.db.add(v) g.db.add(v)
return redirect("/settings/personal")
return redirect("/settings/profile")
@app.post("/settings/title_change") @app.post("/settings/title_change")
@limiter.limit("1/second;30/minute;200/hour;1000/day") @limiter.limit("1/second;30/minute;200/hour;1000/day")
@ -840,7 +834,7 @@ def settings_title_change(v):
v.customtitle = customtitle v.customtitle = customtitle
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/personal")
@app.post("/settings/pronouns_change") @app.post("/settings/pronouns_change")
@ -869,7 +863,7 @@ def settings_pronouns_change(v):
v.pronouns = pronouns v.pronouns = pronouns
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/personal")
@app.post("/settings/checkmark_text") @app.post("/settings/checkmark_text")
@ -883,4 +877,4 @@ def settings_checkmark_text(v):
if new_name == v.verified: return render_template("settings_personal.html", v=v, error="You didn't change anything") if new_name == v.verified: return render_template("settings_personal.html", v=v, error="You didn't change anything")
v.verified = new_name v.verified = new_name
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/personal")

View File

@ -5,7 +5,7 @@
</div> </div>
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="{{id}}" name="{{name}}"{% if flag %} checked{% endif %} {% if disabled %}disabled=""{% else %}onchange="postToastSwitch(this,'/settings/profile?{{name}}='+document.getElementById('{{id}}').checked)"{% endif %}> <input autocomplete="off" type="checkbox" class="custom-control-input" id="{{id}}" name="{{name}}"{% if flag %} checked{% endif %} {% if disabled %}disabled=""{% else %}onchange="postToastSwitch(this,'/settings/personal?{{name}}='+document.getElementById('{{id}}').checked)"{% endif %}>
<label class="custom-control-label" for="{{id}}"></label> <label class="custom-control-label" for="{{id}}"></label>
</div> </div>
{% if below_text %} {% if below_text %}

View File

@ -34,7 +34,7 @@
</div> </div>
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="input-group mb2"> <div class="input-group mb2">
<select autocomplete="off" id='theme' class="form-control" form="profile-settings" name="theme" onchange="postToastReload(this,'/settings/profile?theme='+document.getElementById('theme').value)"> <select autocomplete="off" id='theme' class="form-control" form="profile-settings" name="theme" onchange="postToastReload(this,'/settings/personal?theme='+document.getElementById('theme').value)">
{% for entry in THEMES %} {% for entry in THEMES %}
<option value="{{entry}}" {% if v.theme==entry %} selected {% endif %}> <option value="{{entry}}" {% if v.theme==entry %} selected {% endif %}>
{{entry}} {{entry}}
@ -90,7 +90,7 @@
<p>Join a house (cost: {{cost}} coins or marseybux).</p> <p>Join a house (cost: {{cost}} coins or marseybux).</p>
{% endif %} {% endif %}
<div class="input-group mb2"> <div class="input-group mb2">
<select {% if v.coins < cost and v.procoins < cost or v.bite %}disabled{% endif %} autocomplete="off" id='house' class="form-control" form="profile-settings" name="house" onchange="postToastReload(this,'/settings/profile?house='+document.getElementById('house').value)"> <select {% if v.coins < cost and v.procoins < cost or v.bite %}disabled{% endif %} autocomplete="off" id='house' class="form-control" form="profile-settings" name="house" onchange="postToastReload(this,'/settings/personal?house='+document.getElementById('house').value)">
{% for entry in HOUSES %} {% for entry in HOUSES %}
<option value="{{entry}}" {% if v.house == entry %} selected {% endif %}> <option value="{{entry}}" {% if v.house == entry %} selected {% endif %}>
{{entry}} {{entry}}
@ -200,10 +200,10 @@
</div> </div>
{%- endif %} {%- endif %}
{# common.text_area_section(id, form_action, form_name, section_title, contents, below_text, placeholder_text, show_extras, show_file_upload, maxlength, show_if) #} {# common.text_area_section(id, form_action, form_name, section_title, contents, below_text, placeholder_text, show_extras, show_file_upload, maxlength, show_if) #}
{{common.text_area_section('profile-bio', '/settings/profile', 'bio', 'Bio', v.bio, 'Limit of 1500 characters', 'Tell the community a bit about yourself.', true, true, 1500, FEATURES['USERS_PROFILE_BODYTEXT'])}} {{common.text_area_section('profile-bio', '/settings/personal', 'bio', 'Bio', v.bio, 'Limit of 1500 characters', 'Tell the community a bit about yourself.', true, true, 1500, FEATURES['USERS_PROFILE_BODYTEXT'])}}
{{common.text_area_section('profile-friends', '/settings/profile', 'friends', 'Friends', v.friends, 'Limit of 500 characters', 'Enter your friends on the site...', false, false, 500, true)}} {{common.text_area_section('profile-friends', '/settings/personal', 'friends', 'Friends', v.friends, 'Limit of 500 characters', 'Enter your friends on the site...', false, false, 500, true)}}
{{common.text_area_section('profile-enemies', '/settings/profile', 'enemies', 'Enemies', v.enemies, 'Limit of 500 characters', 'Enter your enemies on the site...', false, false, 500, true)}} {{common.text_area_section('profile-enemies', '/settings/personal', 'enemies', 'Enemies', v.enemies, 'Limit of 500 characters', 'Enter your enemies on the site...', false, false, 500, true)}}
{{common.text_area_section('profile-signature', '/settings/profile', 'sig', 'Signature', v.sig, 'Limit of 200 characters', 'Enter a signature...', true, false, 200, v.patron or v.sig)}} {{common.text_area_section('profile-signature', '/settings/personal', 'sig', 'Signature', v.sig, 'Limit of 200 characters', 'Enter a signature...', true, false, 200, v.patron or v.sig)}}
{{common.toggle_section('Private Mode', 'privateswitch', 'private', v.is_private, 'This will hide your post and comment history from others. We will also ask search engines to not index your profile page. (Your content will still be accessible via direct link.)')}} {{common.toggle_section('Private Mode', 'privateswitch', 'private', v.is_private, 'This will hide your post and comment history from others. We will also ask search engines to not index your profile page. (Your content will still be accessible via direct link.)')}}
{{common.toggle_section('Spider', 'spiderswitch', 'spider', v.spider, 'Have a spider friend accompany you during your journey on the site.')}} {{common.toggle_section('Spider', 'spiderswitch', 'spider', v.spider, 'Have a spider friend accompany you during your journey on the site.')}}
</div> </div>
@ -262,7 +262,7 @@
{% if FEATURES['USERS_PERMANENT_WORD_FILTERS'] -%} {% if FEATURES['USERS_PERMANENT_WORD_FILTERS'] -%}
<div class="modal fade" id="modal-{{id}}" tabindex="-1" role="dialog" aria-labelledby="{{id}}modal" aria-hidden="true"> <div class="modal fade" id="modal-{{id}}" tabindex="-1" role="dialog" aria-labelledby="{{id}}modal" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-dialog modal-dialog-centered" role="document">
<form class="m-auto" action="{{form_action}}" id="{{form}}-form" method="post"> <form class="m-auto" action="{{form_action}}" id="{{id}}-form" method="post">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Make {{friendly_name}} Permanent</h5> <h5 class="modal-title">Make {{friendly_name}} Permanent</h5>
@ -273,10 +273,9 @@
<div class="modal-body"> <div class="modal-body">
<input type="hidden" name="{{field}}" value="true"> <input type="hidden" name="{{field}}" value="true">
<input type="hidden" name="permanent" value="true"> <input type="hidden" name="permanent" value="true">
<input type="hidden" name="rendered" value="true">
<input type="hidden" name="formkey" value="{{v.formkey}}"> <input type="hidden" name="formkey" value="{{v.formkey}}">
<p>This form will permanently enable the filter for you. You will receive the {{badge_name}} badge and will not be able to disable the filter.<br>Type your username to continue.</p> <p>This form will permanently enable the filter for you. You will receive the {{badge_name}} badge and <strong>will not</strong> be able to disable the filter.<br>Type your username to continue.</p>
<input autocomplete="off" type="text" name="username" placeholder="Enter your username in order to make this permanent change" id="username-{{id}}" class="form-control" pattern="{{v.username}}" required> <input autocomplete="off" type="text" name="username" placeholder="Enter your username to confirm" id="username-{{id}}" class="form-control" pattern="{{v.username}}" required>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button> <button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
@ -289,9 +288,9 @@
{%- endif %} {%- endif %}
{% endmacro %} {% endmacro %}
{% if v.slurreplacer %} {% if v.slurreplacer %}
{{permanent_filter_modal('slurreplacer', '/settings/profile', 'slurreplacer', 'Slur Replacer', 'Social Justice Berserker')}} {{permanent_filter_modal('slurreplacer', '/settings/personal', 'slurreplacer', 'Slur Replacer', 'Social Justice Berserker')}}
{% endif %} {% endif %}
{% if v.profanityreplacer %} {% if v.profanityreplacer %}
{{permanent_filter_modal('profanityreplacer', '/settings/profile', 'profanityreplacer', 'Profanity Replacer', 'Soapy-Mouthed Angel')}} {{permanent_filter_modal('profanityreplacer', '/settings/personal', 'profanityreplacer', 'Profanity Replacer', 'Soapy-Mouthed Angel')}}
{% endif %} {% endif %}
{% endblock %} {% endblock %}