LGB: disable profile bio, banner, song.

master
Snakes 2022-07-19 21:16:59 -04:00
parent d06ea7d349
commit b4fdf248ef
9 changed files with 76 additions and 39 deletions

View File

@ -50,7 +50,9 @@ function popclick(e) {
popover.getElementsByClassName('pop-banner')[0].src = author["bannerurl"]
popover.getElementsByClassName('pop-picture')[0].src = author["profile_url"]
popover.getElementsByClassName('pop-username')[0].innerHTML = author["username"]
if (popover.getElementsByClassName('pop-bio').length > 0) {
popover.getElementsByClassName('pop-bio')[0].innerHTML = author["bio_html"]
}
popover.getElementsByClassName('pop-postcount')[0].innerHTML = author["post_count"]
popover.getElementsByClassName('pop-commentcount')[0].innerHTML = author["comment_count"]
popover.getElementsByClassName('pop-coins')[0].innerHTML = author["coins"]

View File

@ -592,8 +592,9 @@ class User(Base):
@property
@lazy
def banner_url(self):
if self.bannerurl: return self.bannerurl
else: return f"/i/{SITE_NAME}/site_preview.webp?v=3001"
if FEATURES['USERS_PROFILE_BANNER'] and self.bannerurl:
return self.bannerurl
return f"/i/{SITE_NAME}/site_preview.webp?v=3001"
@property
@lazy

View File

@ -151,8 +151,11 @@ FEATURES = {
'PRONOUNS': False,
'BADGES': True,
'HOUSES': False,
'USERS_SUICIDE': True,
'GAMBLING': True,
'USERS_PROFILE_BANNER': True,
'USERS_PROFILE_BODYTEXT': True,
'USERS_PROFILE_SONG': True,
'USERS_SUICIDE': True,
'MARKUP_COMMANDS': True,
}
@ -332,8 +335,11 @@ elif SITE == 'lgbdropthet.com':
FEATURES['AWARDS'] = False
FEATURES['CHAT'] = False
FEATURES['BADGES'] = False
FEATURES['USERS_SUICIDE'] = False
FEATURES['GAMBLING'] = False
FEATURES['USERS_PROFILE_BANNER'] = False
FEATURES['USERS_PROFILE_BODYTEXT'] = False
FEATURES['USERS_PROFILE_SONG'] = False
FEATURES['USERS_SUICIDE'] = False
FEATURES['MARKUP_COMMANDS'] = False
EMOJI_MARSEYS = False

View File

@ -144,7 +144,7 @@ def settings_profile_post(v):
elif request.values.get("friends"):
elif FEATURES['USERS_PROFILE_BODYTEXT'] and request.values.get("friends"):
friends = request.values.get("friends")[:500]
friends_html = sanitize(friends)
@ -170,7 +170,7 @@ def settings_profile_post(v):
msg="Your friends list has been updated.")
elif request.values.get("enemies"):
elif FEATURES['USERS_PROFILE_BODYTEXT'] and request.values.get("enemies"):
enemies = request.values.get("enemies")[:500]
enemies_html = sanitize(enemies)
@ -196,7 +196,8 @@ def settings_profile_post(v):
msg="Your enemies list has been updated.")
elif request.values.get("bio") or request.files.get('file'):
elif FEATURES['USERS_PROFILE_BODYTEXT'] and \
(request.values.get("bio") or request.files.get('file')):
bio = request.values.get("bio")[:1500]
bio += process_files()
@ -536,6 +537,9 @@ def settings_images_profile(v):
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
@auth_required
def settings_images_banner(v):
if not FEATURES['USERS_PROFILE_BANNER']:
abort(403)
if request.headers.get("cf-ipcountry") == "T1": return {"error":"Image uploads are not allowed through TOR."}, 403
file = request.files["banner"]
@ -746,6 +750,8 @@ def settings_name_change(v):
@limiter.limit("3/second;10/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
@auth_required
def settings_song_change_mp3(v):
if not FEATURES['USERS_PROFILE_SONG']:
abort(403)
file = request.files['file']
if file.content_type != 'audio/mpeg':
@ -776,6 +782,9 @@ def settings_song_change_mp3(v):
@limiter.limit("3/second;10/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
@auth_required
def settings_song_change(v):
if not FEATURES['USERS_PROFILE_SONG']:
abort(403)
song=request.values.get("song").strip()
if song == "" and v.song:

View File

@ -21,9 +21,12 @@
<h5 class="pop-username text-truncate text-black"></h5>
</div>
</div>
{% if FEATURES['USERS_PROFILE_BODYTEXT'] -%}
<div class="px-3">
<span class="pop-bio popover-bio text-black"></span>
</div>
{%- endif %}
{% if FEATURES['BADGES'] -%}
<div class="pop-badges ml-3 mr-3 my-2">

View File

@ -242,6 +242,8 @@
</div>
</div>
{% if FEATURES['USERS_PROFILE_BANNER'] -%}
<h2 class="h5">Profile Banner</h2>
<div class="settings-section rounded">
@ -275,6 +277,7 @@
</div>
</div>
{%- endif %}
<h2 class="h5" id="referral" name="referral">Referrals</h2>
@ -389,6 +392,8 @@
</div>
</div>
{% if FEATURES['USERS_PROFILE_SONG'] -%}
<div class="body d-lg-flex border-bottom">
<label class="text-black w-lg-25">Profile Anthem</label>
@ -422,6 +427,8 @@
</div>
</div>
{%- endif %}
<div class="body d-lg-flex border-bottom">
<label class="text-black w-lg-25">Name Color</label>
@ -599,7 +606,7 @@
{% endif %}
{% if FEATURES['USERS_PROFILE_BODYTEXT'] -%}
<div class="body d-lg-flex border-bottom">
<label class="text-black w-lg-25">Bio</label>
@ -671,6 +678,7 @@
</div>
</div>
{%- endif %}
{% if v.patron or v.id == MOOSE_ID %}

View File

@ -24,9 +24,12 @@
<h5 class="pop-username text-truncate text-black"></h5>
</div>
</div>
{% if FEATURES['USERS_PROFILE_BODYTEXT'] -%}
<div class="px-3">
<span class="pop-bio popover-bio text-black"></span>
</div>
{%- endif %}
{% if FEATURES['BADGES'] -%}
<div class="pop-badges ml-3 mr-3 my-2">

View File

@ -33,7 +33,7 @@
<div class="row d-none d-md-block">
<div class="col px-0">
<div class="jumbotron jumbotron-fluid jumbotron-guild d-none d-md-block" style="background-image: url({{u.banner_url}})">
<div class="jumbotron jumbotron-fluid jumbotron-guild d-none d-md-block" {% if FEATURES['USERS_PROFILE_BANNER'] %}style="background-image: url({{u.banner_url}})"{% endif %}>
<div class="jumbotron-overlay"></div>
<div class="w-100 my-3">
<div class="container-fluid nobackground">
@ -140,6 +140,7 @@
</div>
{% if u.basedcount %}<p class="text-muted" id="profile--based">Based Count: {{u.basedcount}}</p>{% endif %}
{% if FEATURES['USERS_PROFILE_BODYTEXT'] -%}
{% if u.bio_html %}
<pre></pre>
<div class="text-muted font-weight-bolder" id="profile--bio">{{u.bio_html | safe}}</div>
@ -156,6 +157,7 @@
<p class="text-muted font-weight-bold">Enemies:</p>
<div id="profile--enemies">{{u.enemies_html | safe}}</div>
{% endif %}
{%- endif %}
{% if u.received_awards and FEATURES['AWARDS'] %}
<div class="text-white rounded p-2 mb-3" id="profile--awards" style="background-color: rgba(50, 50, 50, 0.6); width: 30%;">
@ -249,7 +251,7 @@
<a href="/views" class="btn btn-secondary">Profile views</a>
{% endif %}
{% if u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
{% if FEATURES['USERS_PROFILE_SONG'] and u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
<a class="btn btn-secondary" role="button" onclick="toggle()">Toggle anthem</a>
{% endif %}
@ -458,6 +460,8 @@
<br><span id="profile-mobile--lastactive">last active <span id="profile-mobile--lastactive--time" data-bs-toggle="tooltip" data-bs-placement="bottom" onmouseover="timestamp('profile-mobile--lastactive--time','{{u.last_active}}')" class="font-weight-bold">{{u.last_active_date}}</span></span>
{%- endif %}
</div>
{% if FEATURES['USERS_PROFILE_BODYTEXT'] -%}
{% if u.bio_html %}
<div class="text-muted text-break" id="profile-mobile--bio">{{u.bio_html | safe}}</div>
{% endif %}
@ -471,6 +475,7 @@
<p class="text-muted font-weight-bold mt-3">Enemies:</p>
<div id="profile-mobile--enemies">{{u.enemies_html | safe}}</div>
{% endif %}
{%- endif %}
{% if u.received_awards and FEATURES['AWARDS'] %}
<div class="text-white rounded p-2 my-3 text-center" id="profile-mobile--awards" style="background-color: rgba(50, 50, 50, 0.6);">
@ -509,7 +514,7 @@
<a href="/views" class="btn btn-secondary">Profile views</a>
{% endif %}
{% if u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
{% if FEATURES['USERS_PROFILE_SONG'] and u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
<a class="btn btn-secondary" role="button" onclick="toggle()">Toggle anthem</a>
{% endif %}
@ -770,7 +775,7 @@
</div>
{% if u.song %}
{% if FEATURES['USERS_PROFILE_SONG'] and u.song %}
{% if v and v.id == u.id %}
<div id="v_username" class="d-none">{{v.username}}</div>
{% else %}

View File

@ -18,7 +18,7 @@ set CACHE_VER = {
'js/award_modal.js': 253,
'js/bootstrap.js': 275,
'js/comments+submission_listing.js': 264,
'js/comments+submission_listing.js': 265,
'js/submission_listing.js': 261,
'js/emoji_modal.js': 312,
'js/formatting.js': 240,