From f73c6d46df66e81c51186437c2a4d81f48672fe7 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 2 Nov 2022 08:31:04 +0200 Subject: [PATCH] accomodate rdrama.com users --- files/classes/comment.py | 2 +- files/classes/submission.py | 2 +- files/helpers/const.py | 4 ++-- files/helpers/stats.py | 2 +- files/routes/admin.py | 2 +- files/routes/awards.py | 2 +- files/routes/chat.py | 2 +- files/routes/static.py | 4 ++-- files/routes/users.py | 2 +- files/templates/comments.html | 4 ++-- files/templates/hats.html | 4 ++-- files/templates/html_head.html | 2 +- files/templates/marseys.html | 4 ++-- files/templates/post_actions.html | 2 +- files/templates/post_actions_mobile.html | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 366ba88e3..a96aff206 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -89,7 +89,7 @@ class Comment(Base): @lazy def can_see(self, v): - if SITE != 'rdrama.net': return True + if SITE not in ('rdrama.net','rdrama.com'): return True if not self.parent_submission: return True if self.post.sub != 'chudrama': return True if v: diff --git a/files/classes/submission.py b/files/classes/submission.py index 55b9774cc..7f075ccc5 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -79,7 +79,7 @@ class Submission(Base): @lazy def can_see(self, v): - if SITE != 'rdrama.net': return True + if SITE not in ('rdrama.net','rdrama.com'): return True if self.sub != 'chudrama': return True if v: if v.can_see_chudrama: return True diff --git a/files/helpers/const.py b/files/helpers/const.py index 1790bc092..9664cd8e8 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -402,7 +402,7 @@ ANTISPAM_BYPASS_IDS = () PAGE_SIZE = 25 LEADERBOARD_LIMIT = PAGE_SIZE -if SITE == 'rdrama.net': +if SITE in ('rdrama.net','rdrama.com'): FEATURES['PRONOUNS'] = True FEATURES['HOUSES'] = True PERMS['ADMIN_ADD'] = 4 @@ -1228,7 +1228,7 @@ if len(SITE_NAME) > 5: if SITE != 'localhost': REDDIT_NOTIFS_SITE.add(SITE) -if SITE == 'rdrama.net': +if SITE in ('rdrama.net','rdrama.com'): REDDIT_NOTIFS_SITE.add('marsey') REDDIT_NOTIFS_SITE.add('"r/Drama"') REDDIT_NOTIFS_SITE.add('justice4darrell') diff --git a/files/helpers/stats.py b/files/helpers/stats.py index e445984c0..72c18133c 100644 --- a/files/helpers/stats.py +++ b/files/helpers/stats.py @@ -24,7 +24,7 @@ def chart(kind, site): now.tm_wday, now.tm_yday, 0)) today_cutoff = calendar.timegm(midnight_this_morning) - if SITE == 'rdrama.net': + if SITE in ('rdrama.net','rdrama.com'): time_diff = time.time() - 1619827200 num_of_weeks = int(time_diff / 604800) chart_width = int(num_of_weeks/1.4) diff --git a/files/routes/admin.py b/files/routes/admin.py index fb0fe0942..276c73217 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -159,7 +159,7 @@ def merge_all(v, id): @app.post("/@/make_admin") @admin_level_required(PERMS['ADMIN_ADD']) def make_admin(v, username): - if SITE == 'rdrama.net': abort(403) + if SITE in ('rdrama.net','rdrama.com'): abort(403) user = get_user(username) diff --git a/files/routes/awards.py b/files/routes/awards.py index ebc9baf34..2339f1c3e 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -158,7 +158,7 @@ def award_thing(v, thing_type, id): author = thing.author if author.shadowbanned: abort(404) - if SITE == 'rdrama.net' and author.id in (PIZZASHILL_ID, CARP_ID): + if SITE in ('rdrama.net','rdrama.com') and author.id in (PIZZASHILL_ID, CARP_ID): abort(403, "This user is immune to awards.") if kind == "benefactor" and author.id == v.id: diff --git a/files/routes/chat.py b/files/routes/chat.py index c68773d69..a84096f0c 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -56,7 +56,7 @@ def speak(data, v): global messages, total - if SITE == 'rdrama.net': text = data['message'][:200].strip() + if SITE in ('rdrama.net','rdrama.com'): text = data['message'][:200].strip() else: text = data['message'][:1000].strip() if not text: return '', 403 diff --git a/files/routes/static.py b/files/routes/static.py index defefd274..7ac34f3e6 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -22,7 +22,7 @@ def rdrama(id, title): @app.get("/marseys") @auth_required def marseys(v): - if SITE == 'rdrama.net': + if SITE in ('rdrama.net','rdrama.com'): marseys = g.db.query(Marsey, User).join(User, Marsey.author_id == User.id).filter(Marsey.submitter_id==None) sort = request.values.get("sort", "usage") if sort == "usage": @@ -56,7 +56,7 @@ def marsey_list(): if EMOJI_MARSEYS: emojis = [{ "name": emoji.name, - "author": author if SITE == 'rdrama.net' or author == "anton-d" else None, + "author": author if SITE in ('rdrama.net','rdrama.com') or author == "anton-d" else None, # yikes, I don't really like this DB schema. Next time be better "tags": emoji.tags.split(" ") + [emoji.name[len("marsey"):] \ if emoji.name.startswith("marsey") else emoji.name], diff --git a/files/routes/users.py b/files/routes/users.py index 0a7ce9416..760a36868 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -422,7 +422,7 @@ def message2(v, username): body_html = sanitize(message) - if not (SITE == 'rdrama.net' and user.id == BLACKJACKBTZ_ID): + if not (SITE in ('rdrama.net','rdrama.com') and user.id == BLACKJACKBTZ_ID): existing = g.db.query(Comment.id).filter(Comment.author_id == v.id, Comment.sentto == user.id, Comment.body_html == body_html, diff --git a/files/templates/comments.html b/files/templates/comments.html index 1e5f1d035..651e36dbf 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -399,7 +399,7 @@ Context - + {% if v %} {% if not c.deleted_utc %} @@ -608,7 +608,7 @@ Context - + {% if v %} diff --git a/files/templates/hats.html b/files/templates/hats.html index 8fee32d63..39c278b80 100644 --- a/files/templates/hats.html +++ b/files/templates/hats.html @@ -84,7 +84,7 @@ Hat Name Description - {% if SITE == 'rdrama.net' %} + {% if SITE in ('rdrama.net','rdrama.com') %} {% if request.values.get("sort") == 'author_asc' %} Author {% else %} @@ -114,7 +114,7 @@ {{hat.name}} {{hat.censored_description(v)}} - {% if SITE == 'rdrama.net' %} + {% if SITE in ('rdrama.net','rdrama.com') %} {% include "user_in_table.html" %} {% endif %} {{hat.number_sold}} diff --git a/files/templates/html_head.html b/files/templates/html_head.html index 0e7f4fbbc..5c200d4bb 100644 --- a/files/templates/html_head.html +++ b/files/templates/html_head.html @@ -35,7 +35,7 @@ {% endmacro %} {% macro cf_2fa_verify() %} - {% if SITE == 'rdrama.net' %} + {% if SITE in ('rdrama.net','rdrama.com') %} {% elif SITE == 'watchpeopledie.tv' %} diff --git a/files/templates/marseys.html b/files/templates/marseys.html index 690d159ac..e6337d574 100644 --- a/files/templates/marseys.html +++ b/files/templates/marseys.html @@ -7,7 +7,7 @@ Name Marsey Usage - {% if SITE == 'rdrama.net' %} + {% if SITE in ('rdrama.net','rdrama.com') %} Author Added on Original File @@ -15,7 +15,7 @@ -{% if SITE == 'rdrama.net' %} +{% if SITE in ('rdrama.net','rdrama.com') %} {% for marsey, user in marseys %} {{loop.index}} diff --git a/files/templates/post_actions.html b/files/templates/post_actions.html index 9ad462af1..3b13d6877 100644 --- a/files/templates/post_actions.html +++ b/files/templates/post_actions.html @@ -12,7 +12,7 @@ {% endif %} - + {% if v %} diff --git a/files/templates/post_actions_mobile.html b/files/templates/post_actions_mobile.html index 52a37a951..beb68f641 100644 --- a/files/templates/post_actions_mobile.html +++ b/files/templates/post_actions_mobile.html @@ -8,7 +8,7 @@ {% if v and ((not p.ghost and v.admin_level >= PERMS['VOTES_VISIBLE']) or v.id == AEVANN_ID) %}{% endif %} - +