diff --git a/files/assets/js/comments+submission_listing.js b/files/assets/js/comments+submission_listing.js index c081efc81..7642585db 100644 --- a/files/assets/js/comments+submission_listing.js +++ b/files/assets/js/comments+submission_listing.js @@ -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"] - popover.getElementsByClassName('pop-bio')[0].innerHTML = author["bio_html"] + 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"] diff --git a/files/classes/user.py b/files/classes/user.py index 74a75fe28..e39d29cf8 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -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 diff --git a/files/helpers/const.py b/files/helpers/const.py index a58254c37..168f9e962 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -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 diff --git a/files/routes/settings.py b/files/routes/settings.py index 24f65a49c..fd76b9db2 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -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: diff --git a/files/templates/comments.html b/files/templates/comments.html index 1cc43559c..94bf92506 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -21,9 +21,12 @@
+ + {% if FEATURES['USERS_PROFILE_BODYTEXT'] -%}Based Count: {{u.basedcount}}
{% endif %} - {% if u.bio_html %} - -No bio...
- {% endif %} + {% if FEATURES['USERS_PROFILE_BODYTEXT'] -%} + {% if u.bio_html %} + +No bio...
+ {% endif %} - {% if u.friends_html %} -Friends:
-Friends:
+Enemies:
-Enemies:
+Friends:
-Enemies:
-Friends:
+Enemies:
+