From 60284daa8e8633ea4acf9125e62519525a3681fe Mon Sep 17 00:00:00 2001 From: justcool393 Date: Sat, 15 Oct 2022 11:11:43 -0700 Subject: [PATCH 1/5] replace all of the duplicated age strings with make_age_string --- files/classes/comment.py | 56 ++---------------------------- files/classes/mod_logs.py | 33 ++---------------- files/classes/sub_logs.py | 32 ++--------------- files/classes/submission.py | 57 ++----------------------------- files/classes/views.py | 31 ++--------------- files/helpers/jinja2.py | 29 +--------------- files/helpers/sorting_and_time.py | 28 +++++++++++++++ 7 files changed, 41 insertions(+), 225 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 85e2ad3a6..e7c2fcc6a 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -120,64 +120,12 @@ class Comment(Base): if notif_utc: timestamp = notif_utc elif self.created_utc: timestamp = self.created_utc else: return None - - age = int(time.time()) - timestamp - - if age < 60: - return "just now" - elif age < 3600: - minutes = int(age / 60) - return f"{minutes}m ago" - elif age < 86400: - hours = int(age / 3600) - return f"{hours}hr ago" - elif age < 2678400: - days = int(age / 86400) - return f"{days}d ago" - - now = time.gmtime() - ctd = time.gmtime(timestamp) - - months = now.tm_mon - ctd.tm_mon + 12 * (now.tm_year - ctd.tm_year) - if now.tm_mday < ctd.tm_mday: - months -= 1 - - if months < 12: - return f"{months}mo ago" - else: - years = int(months / 12) - return f"{years}yr ago" + return make_age_string(timestamp) @property @lazy def edited_string(self): - - age = int(time.time()) - self.edited_utc - - if age < 60: - return "just now" - elif age < 3600: - minutes = int(age / 60) - return f"{minutes}m ago" - elif age < 86400: - hours = int(age / 3600) - return f"{hours}hr ago" - elif age < 2678400: - days = int(age / 86400) - return f"{days}d ago" - - now = time.gmtime() - ctd = time.gmtime(self.edited_utc) - - months = now.tm_mon - ctd.tm_mon + 12 * (now.tm_year - ctd.tm_year) - if now.tm_mday < ctd.tm_mday: - months -= 1 - - if months < 12: - return f"{months}mo ago" - else: - years = int(months / 12) - return f"{years}yr ago" + return make_age_string(self.edited_utc) @property @lazy diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index 9a8bec5e4..e5f360508 100644 --- a/files/classes/mod_logs.py +++ b/files/classes/mod_logs.py @@ -6,6 +6,7 @@ from files.helpers.lazy import lazy from copy import deepcopy from files.helpers.const import * from files.helpers.regex import censor_slurs +from files.helpers.sorting_and_time import make_age_string class ModAction(Base): __tablename__ = "modactions" @@ -32,37 +33,10 @@ class ModAction(Base): @property @lazy def age_string(self): - - age = int(time.time()) - self.created_utc - - if age < 60: - return "just now" - elif age < 3600: - minutes = int(age / 60) - return f"{minutes}m ago" - elif age < 86400: - hours = int(age / 3600) - return f"{hours}hr ago" - elif age < 2678400: - days = int(age / 86400) - return f"{days}d ago" - - now = time.gmtime() - ctd = time.gmtime(self.created_utc) - - months = now.tm_mon - ctd.tm_mon + 12 * (now.tm_year - ctd.tm_year) - if now.tm_mday < ctd.tm_mday: - months -= 1 - - if months < 12: - return f"{months}mo ago" - else: - years = int(months / 12) - return f"{years}yr ago" + return make_age_string(self.created_utc) @property def note(self): - if self.kind=="ban_user": if self.target_post: return f'for post' elif self.target_comment_id: return f'for comment' @@ -73,11 +47,8 @@ class ModAction(Base): @property @lazy def string(self): - output = ACTIONTYPES[self.kind]["str"].format(self=self, cc=CC_TITLE) - if self.note: output += f" ({self.note})" - return output @property diff --git a/files/classes/sub_logs.py b/files/classes/sub_logs.py index 0b3ddc8a4..51ecf2dae 100644 --- a/files/classes/sub_logs.py +++ b/files/classes/sub_logs.py @@ -5,6 +5,7 @@ import time from files.helpers.lazy import lazy from files.helpers.const import * from files.helpers.regex import censor_slurs +from files.helpers.sorting_and_time import make_age_string class SubAction(Base): __tablename__ = "subactions" @@ -32,42 +33,13 @@ class SubAction(Base): @property @lazy def age_string(self): - - age = int(time.time()) - self.created_utc - - if age < 60: - return "just now" - elif age < 3600: - minutes = int(age / 60) - return f"{minutes}m ago" - elif age < 86400: - hours = int(age / 3600) - return f"{hours}hr ago" - elif age < 2678400: - days = int(age / 86400) - return f"{days}d ago" - - now = time.gmtime() - ctd = time.gmtime(self.created_utc) - - months = now.tm_mon - ctd.tm_mon + 12 * (now.tm_year - ctd.tm_year) - if now.tm_mday < ctd.tm_mday: - months -= 1 - - if months < 12: - return f"{months}mo ago" - else: - years = int(months / 12) - return f"{years}yr ago" + return make_age_string(self.created_utc) @property @lazy def string(self): - output = ACTIONTYPES[self.kind]["str"].format(self=self, cc=CC_TITLE) - if self._note: output += f" ({self._note})" - return output @property diff --git a/files/classes/submission.py b/files/classes/submission.py index 4b09fd004..90702b80c 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -9,6 +9,7 @@ from files.__main__ import Base from files.helpers.const import * from files.helpers.regex import * from files.helpers.lazy import lazy +from files.helpers.sorting_and_time import make_age_string from .flags import Flag from .comment import Comment, normalize_urls_runtime from .saves import SaveRelationship @@ -100,64 +101,12 @@ class Submission(Base): @property @lazy def age_string(self): - - age = int(time.time()) - self.created_utc - - if age < 60: - return "just now" - elif age < 3600: - minutes = int(age / 60) - return f"{minutes}m ago" - elif age < 86400: - hours = int(age / 3600) - return f"{hours}hr ago" - elif age < 2678400: - days = int(age / 86400) - return f"{days}d ago" - - now = time.gmtime() - ctd = time.gmtime(self.created_utc) - - months = now.tm_mon - ctd.tm_mon + 12 * (now.tm_year - ctd.tm_year) - if now.tm_mday < ctd.tm_mday: - months -= 1 - - if months < 12: - return f"{months}mo ago" - else: - years = int(months / 12) - return f"{years}yr ago" + return make_age_string(self.created_utc) @property @lazy def edited_string(self): - - age = int(time.time()) - self.edited_utc - - if age < 60: - return "just now" - elif age < 3600: - minutes = int(age / 60) - return f"{minutes}m ago" - elif age < 86400: - hours = int(age / 3600) - return f"{hours}hr ago" - elif age < 2678400: - days = int(age / 86400) - return f"{days}d ago" - - now = time.gmtime() - ctd = time.gmtime(self.edited_utc) - months = now.tm_mon - ctd.tm_mon + 12 * (now.tm_year - ctd.tm_year) - if now.tm_mday < ctd.tm_mday: - months -= 1 - - if months < 12: - return f"{months}mo ago" - else: - years = int(months / 12) - return f"{years}yr ago" - + return make_age_string(self.edited_utc) @property @lazy diff --git a/files/classes/views.py b/files/classes/views.py index b3007003d..2d8d1fee3 100644 --- a/files/classes/views.py +++ b/files/classes/views.py @@ -4,6 +4,8 @@ from files.__main__ import Base from files.helpers.lazy import * import time +from files.helpers.sorting_and_time import make_age_string + class ViewerRelationship(Base): __tablename__ = "viewers" @@ -26,36 +28,9 @@ class ViewerRelationship(Base): @property @lazy def last_view_since(self): - return int(time.time()) - self.last_view_utc @property @lazy def last_view_string(self): - - age = self.last_view_since - - if age < 60: - return "just now" - elif age < 3600: - minutes = int(age / 60) - return f"{minutes}m ago" - elif age < 86400: - hours = int(age / 3600) - return f"{hours}hr ago" - elif age < 2678400: - days = int(age / 86400) - return f"{days}d ago" - - now = time.gmtime() - ctd = time.gmtime(self.last_view_utc) - - months = now.tm_mon - ctd.tm_mon + 12 * (now.tm_year - ctd.tm_year) - if now.tm_mday < ctd.tm_mday: - months -= 1 - - if months < 12: - return f"{months}mo ago" - else: - years = int(months / 12) - return f"{years}yr ago" + return make_age_string(self.last_view_since) diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py index deebac7aa..836b64ca8 100644 --- a/files/helpers/jinja2.py +++ b/files/helpers/jinja2.py @@ -29,34 +29,7 @@ def template_asset_siteimg(asset_path): @app.template_filter("timestamp") def timestamp(timestamp): - - age = int(time.time()) - timestamp - - if age < 60: - return "just now" - elif age < 3600: - minutes = int(age / 60) - return f"{minutes}m ago" - elif age < 86400: - hours = int(age / 3600) - return f"{hours}hr ago" - elif age < 2678400: - days = int(age / 86400) - return f"{days}d ago" - - now = time.gmtime() - ctd = time.gmtime(timestamp) - - months = now.tm_mon - ctd.tm_mon + 12 * (now.tm_year - ctd.tm_year) - if now.tm_mday < ctd.tm_mday: - months -= 1 - - if months < 12: - return f"{months}mo ago" - else: - years = int(months / 12) - return f"{years}yr ago" - + return make_age_string(timestamp) @app.context_processor def inject_constants(): diff --git a/files/helpers/sorting_and_time.py b/files/helpers/sorting_and_time.py index 0dc6691e3..5895aa4e5 100644 --- a/files/helpers/sorting_and_time.py +++ b/files/helpers/sorting_and_time.py @@ -1,4 +1,5 @@ import time +from typing import Optional from files.helpers.const import * from sqlalchemy.sql import func @@ -44,3 +45,30 @@ def sort_objects(sort, objects, cls, include_shadowbanned=False): return objects.order_by(cls.upvotes - cls.downvotes, cls.created_utc.desc()) else: return objects.order_by(cls.downvotes - cls.upvotes, cls.created_utc.desc()) + +def make_age_string(compare:Optional[int]) -> str: + if not compare: return "never" + age = int(time.time()) - compare + + if age < 60: + return "just now" + elif age < 3600: + minutes = int(age / 60) + return f"{minutes}m ago" + elif age < 86400: + hours = int(age / 3600) + return f"{hours}hr ago" + elif age < 2678400: + days = int(age / 86400) + return f"{days}d ago" + + now = time.gmtime() + ctd = time.gmtime(compare) + months = now.tm_mon - ctd.tm_mon + 12 * (now.tm_year - ctd.tm_year) + if now.tm_mday < ctd.tm_mday: + months -= 1 + if months < 12: + return f"{months}mo ago" + else: + years = int(months / 12) + return f"{years}yr ago" From 6138c94a1078493e40551d57021a5c6765c8ca3d Mon Sep 17 00:00:00 2001 From: justcool393 Date: Sat, 15 Oct 2022 11:52:10 -0700 Subject: [PATCH 2/5] unduplicated alt adding code * should probably be part of the Alt or User class at some point but this is for a diff day --- files/routes/login.py | 54 +++++++++++++------------------------------ 1 file changed, 16 insertions(+), 38 deletions(-) diff --git a/files/routes/login.py b/files/routes/login.py index 04ff71d2d..73ddc2766 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -21,7 +21,7 @@ def login_get(v): return render_template("login.html", failed=False, redirect=redir) -def check_for_alts(current): +def check_for_alts(current:User): current_id = current.id if current_id in (1691,6790,7069,36152): session["history"] = [] @@ -29,8 +29,15 @@ def check_for_alts(current): ids = [x[0] for x in g.db.query(User.id).all()] past_accs = set(session.get("history", [])) + def add_alt(user1:int, user2:int): + li = [user1, user2] + existing = g.db.query(Alt).filter(Alt.user1.in_(li), Alt.user2.in_(li)).one_or_none() + if not existing: + new_alt = Alt(user1=user1, user2=user2) + g.db.add(new_alt) + g.db.flush() + for past_id in list(past_accs): - if past_id not in ids: past_accs.remove(past_id) continue @@ -39,46 +46,17 @@ def check_for_alts(current): if past_id == current_id: continue li = [past_id, current_id] - existing = g.db.query(Alt).filter(Alt.user1.in_(li), Alt.user2.in_(li)).one_or_none() - - if not existing: - new_alt = Alt(user1=past_id, user2=current_id) - g.db.add(new_alt) - g.db.flush() - - otheralts = g.db.query(Alt).filter(Alt.user1.in_(li), Alt.user2.in_(li)).all() - for a in otheralts: + add_alt(past_id, current_id) + other_alts = g.db.query(Alt).filter(Alt.user1.in_(li), Alt.user2.in_(li)).all() + for a in other_alts: if a.user1 != past_id: - li = [a.user1, past_id] - existing = g.db.query(Alt).filter(Alt.user1.in_(li), Alt.user2.in_(li)).one_or_none() - if not existing: - new_alt = Alt(user1=a.user1, user2=past_id) - g.db.add(new_alt) - g.db.flush() - + add_alt(a.user1, past_id) if a.user1 != current_id: - li = [a.user1, current_id] - existing = g.db.query(Alt).filter(Alt.user1.in_(li), Alt.user2.in_(li)).one_or_none() - if not existing: - new_alt = Alt(user1=a.user1, user2=current_id) - g.db.add(new_alt) - g.db.flush() - + add_alt(a.user1, current_id) if a.user2 != past_id: - li = [a.user2, past_id] - existing = g.db.query(Alt).filter(Alt.user1.in_(li), Alt.user2.in_(li)).one_or_none() - if not existing: - new_alt = Alt(user1=a.user2, user2=past_id) - g.db.add(new_alt) - g.db.flush() - + add_alt(a.user2, past_id) if a.user2 != current_id: - li = [a.user2, current_id] - existing = g.db.query(Alt).filter(Alt.user1.in_(li), Alt.user2.in_(li)).one_or_none() - if not existing: - new_alt = Alt(user1=a.user2, user2=current_id) - g.db.add(new_alt) - g.db.flush() + add_alt(a.user2, current_id) past_accs.add(current_id) session["history"] = list(past_accs) From 32a4693da93b5b8ca04c6be8ffaa5a621ce6605a Mon Sep 17 00:00:00 2001 From: justcool393 Date: Sat, 15 Oct 2022 04:02:02 -0700 Subject: [PATCH 3/5] fix a couple of potentially rare 500s --- files/classes/user.py | 2 +- files/helpers/actions.py | 1 + files/routes/admin.py | 13 ++++++++----- files/routes/posts.py | 2 +- files/routes/reporting.py | 2 -- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index ececb839f..478d372ab 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -815,7 +815,7 @@ class User(Base): - def ban(self, admin=None, reason=None, days=0): + def ban(self, admin=None, reason=None, days=0.0): if days: self.unban_utc = int(time.time()) + (days * 86400) g.db.add(self) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index ff98459c7..201984f6d 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -62,6 +62,7 @@ def execute_snappy(post, v): else: SNAPPY_CHOICES = SNAPPY_QUOTES elif SNAPPY_MARSEYS: SNAPPY_CHOICES = SNAPPY_MARSEYS elif SNAPPY_QUOTES: SNAPPY_CHOICES = SNAPPY_QUOTES + else: SNAPPY_CHOICES = [""] body = random.choice(SNAPPY_CHOICES).strip() if body.startswith('▼'): diff --git a/files/routes/admin.py b/files/routes/admin.py index 03faa40af..5d2b98b9c 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -993,7 +993,11 @@ def ban_user(user_id, v): if user.admin_level > v.admin_level: abort(403) - days = float(request.values.get("days")) if request.values.get('days') else 0 + days = 0.0 + try: + days = float(request.values.get("days")) + except: + pass reason = request.values.get("reason").strip()[:256] reason = filter_emojis_only(reason) @@ -1009,8 +1013,11 @@ def ban_user(user_id, v): continue x.ban(admin=v, reason=reason, days=days) + duration = "permanently" if days: days_txt = str(days).rstrip('.0') + duration = f"for {days_txt} day" + if days != 1: duration += "s" if reason: text = f"@{v.username} (Admin) has banned you for **{days_txt}** days for the following reason:\n\n> {reason}" else: text = f"@{v.username} (Admin) has banned you for **{days_txt}** days." else: @@ -1018,10 +1025,6 @@ def ban_user(user_id, v): else: text = f"@{v.username} (Admin) has banned you permanently." send_repeatable_notification(user.id, text) - - if days == 0: duration = "permanently" - elif days == 1: duration = "for 1 day" - else: duration = f"for {days_txt} days" note = f'reason: "{reason}", duration: {duration}' ma=ModAction( diff --git a/files/routes/posts.py b/files/routes/posts.py index 2f3fdadf0..406861a41 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -843,8 +843,8 @@ def submit_post(v, sub=None): if len(url) > 2048: return error("There's a 2048 character limit for URLs.") + bets = [] if v and v.admin_level >= PERMS['POST_BETS']: - bets = [] for i in bet_regex.finditer(body): bets.append(i.group(1)) body = body.replace(i.group(0), "") diff --git a/files/routes/reporting.py b/files/routes/reporting.py index dc7d2baa3..509e84af8 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -11,9 +11,7 @@ from files.helpers.sanitize import filter_emojis_only @limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}') @auth_required def flag_post(pid, v): - post = get_post(pid) - reason = request.values.get("reason", "").strip() if blackjack and any(i in reason.lower() for i in blackjack.split()): From 78fffccef4df5e79d8f92edbba9e21a956d80a71 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 15 Oct 2022 20:00:05 +0000 Subject: [PATCH 4/5] sneed --- files/assets/images/rDrama/sidebar/824.webp | Bin 0 -> 6928 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 files/assets/images/rDrama/sidebar/824.webp diff --git a/files/assets/images/rDrama/sidebar/824.webp b/files/assets/images/rDrama/sidebar/824.webp new file mode 100644 index 0000000000000000000000000000000000000000..fec21a793813fa53c293586e926f9d17913c2b93 GIT binary patch literal 6928 zcmV+r8}H;&Nk&Ep8vp=TMM6+kP&gp`8UO$gjR2hiDv$x+06vjGoJ%F6qa`GgOMtKv z31<;mrwbq(Ir;A?ggPySdvkpMEy2Ia`E7hZA05XW@OpBa(Kezjkl9z|de`C~$v zZFY-%d-UAJ32nu8L&3tTuW{C2i#mkY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bB0(0&z-XqEIh#Ao*Y;42r;@*(f}JN*^S zGX!m&4p+p@%jBB$bmkoN8L9~9&>*c14LaLs6V10l9xI28r;U)H33Q9AI-vYbEh{(eqOrGdX@Z=6HEHx$ z&k@$lkZzRDA7Vy+gOnXps4aXxqqmc*S29~^IF0_e{P}+mg+M>}sO<#g*zM3nbRjPa_G~&FYYS53d1evZ8k{(@HP9H_sU2NW35wWR& zoAyQ1>zm)&(GD$v&?$KKmRMDP_f|v~lFo3LWJkF@@)iS)yzz(>xyH+4;*maXv=Qvp zsXbU39@p{O>P_+bMM4tBoyH4q%@NDMaS6vza7fYu8+l$i0XFy!6$77E%fRa^&ddZD zXV;3>b{{#()fJqWL;gEP=CCXEqvr8m`wtn>vwZiVjK4vEkN<1Y&1eKjw( z!ZB?4js$h}23cM@LYqum+aBqp!`MU@jUr-J+oil%;_kviio9BpaPEm1t^lpUyEE(P zGIge7Xd%@aC;~Y=b!JHDZw{VM9KSup9XJPij8U-EKEud2#{Ip<6i z&tAktquufh!QUcnF*Lo904v?f{CAIIKR4r0y7&h&!jRDzS8VBVAPuV^R|WVQU92zt z#tUmk&_B7D=)!jiGkNIC&g6EHQ|7@W2bz&=hj5g#-=ZA7c7?%z#+Tj!oG zY-|T Date: Sat, 15 Oct 2022 23:57:55 -0700 Subject: [PATCH 5/5] fix "52yr ago" bug --- files/helpers/sorting_and_time.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/helpers/sorting_and_time.py b/files/helpers/sorting_and_time.py index 5895aa4e5..2cefff115 100644 --- a/files/helpers/sorting_and_time.py +++ b/files/helpers/sorting_and_time.py @@ -47,7 +47,7 @@ def sort_objects(sort, objects, cls, include_shadowbanned=False): return objects.order_by(cls.downvotes - cls.upvotes, cls.created_utc.desc()) def make_age_string(compare:Optional[int]) -> str: - if not compare: return "never" + if not compare or compare < 1577865600: return "" age = int(time.time()) - compare if age < 60: