From c6ad62cfc836ec8b8fc67db0be46404ee8329a63 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 7 Jan 2022 23:03:14 +0200 Subject: [PATCH] sfd --- files/assets/images/emojis/marseymutt2.webp | Bin 0 -> 6908 bytes files/assets/js/emoji_modal.js | 1 + files/classes/comment.py | 4 ++-- files/helpers/discord.py | 4 ++-- files/helpers/get.py | 2 +- files/routes/admin.py | 6 +++--- files/routes/awards.py | 8 +++---- files/routes/comments.py | 8 +++---- files/routes/discord.py | 2 +- files/routes/front.py | 2 +- files/routes/login.py | 22 ++++++++++---------- files/routes/oauth.py | 6 +++--- files/routes/posts.py | 10 ++++----- files/routes/reporting.py | 4 ++-- files/routes/settings.py | 16 +++++++------- files/routes/static.py | 4 ++-- files/routes/users.py | 14 ++++++------- 17 files changed, 57 insertions(+), 56 deletions(-) create mode 100644 files/assets/images/emojis/marseymutt2.webp diff --git a/files/assets/images/emojis/marseymutt2.webp b/files/assets/images/emojis/marseymutt2.webp new file mode 100644 index 0000000000000000000000000000000000000000..df9279183e7273a6bbb857988d9c0e1db6cb6281 GIT binary patch literal 6908 zcmVm+xBlWT<+YumO?*0ybXH(cAcb=S6cW9KAurhdQg_m7_GsqU&ed;LVj1epH@ zU0d^WpvNC4oqYKvCv4Qejn{9|Q?o2dE`4pUPHl>sLF*rNT-C>Hx$erp=f($%cQlfZydJKfNq28%l&!h)1S5s_pEV&8GrkiVCvS7-}r3WzWeUG@1!$- zWY|N~<8@}M2-w$6VcBq5MnV5%P*4gp81Ih<2BpV8B6dT&pp01%v2#pNCoYVa>>rkf zo8vX>4`DF}#_N&JKNn6jf!$VO_2byk{H-Nc*VKh(^iPpmv9$?pr)MMebg$sl-W{jq z+ney76Q>8e2Wa)hF`B=g32?_}Vst@$h|F0LdTFQ$^4iOyGk1Lx=B|%L=iA=}%Ir{# z&5FH3)$O6E=#O{r-WV$L_XROoymJQ=?z(9);VlgTGZSXVWa(NVtGOX2yt`A#CP&2{ z6tLCjMTH*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slh)e4D zT9r#7b=ZJ=TmgSHn4(d|6?>a2T{5XCz#Xt*nZI#c{zg$Byz%PF7hw zO?!-^&MuZ|m>X-90MyW5`w!3h#M4us5zz8Y!BjG+SDRqca-x(OJM?BC8HIpsuljos zY+jOP)uY`Uo2ZPgN{mj4LkMT@w*j2}?9y#;)bD%0kACV(sKr>xss5=FpDMOep#1D0 z06VuIM6&OQGyk)^F=9Hz=ep|s@lF63h*#6%!aq8<{4$!C;$=2: data['parent_comment_id']= self.parent_comment_id, + if self.level>=2: data['parent_comment_id']= self.parent_comment_id if "replies" in self.__dict__: data['replies']=[x.json_core for x in self.replies] @@ -386,7 +386,7 @@ class Comment(Base): if not v: return False - if v.filter_words and self.body and any([x in self.body for x in v.filter_words]): return True + if v.filter_words and self.body and any(x in self.body for x in v.filter_words): return True if self.is_banned: return True diff --git a/files/helpers/discord.py b/files/helpers/discord.py index 7ebacadca..7486574b9 100644 --- a/files/helpers/discord.py +++ b/files/helpers/discord.py @@ -60,5 +60,5 @@ def set_nick(user, nick): def send_discord_message(message): headers = {"Authorization": f"Bot {BOT_TOKEN}"} data={"content": message} - requests.post(f"https://discordapp.com/api/channels/924485611715452940/messages", headers=headers, data=data, timeout=5) - requests.post(f"https://discordapp.com/api/channels/924486091795484732/messages", headers=headers, data=data, timeout=5) \ No newline at end of file + requests.post("https://discordapp.com/api/channels/924485611715452940/messages", headers=headers, data=data, timeout=5) + requests.post("https://discordapp.com/api/channels/924486091795484732/messages", headers=headers, data=data, timeout=5) \ No newline at end of file diff --git a/files/helpers/get.py b/files/helpers/get.py index 3d7119490..2816b5876 100644 --- a/files/helpers/get.py +++ b/files/helpers/get.py @@ -276,7 +276,7 @@ def get_comments(cids, v=None, load_parent=False): def get_domain(s): parts = s.split(".") - domain_list = set([]) + domain_list = set() for i in range(len(parts)): new_domain = parts[i] for j in range(i + 1, len(parts)): diff --git a/files/routes/admin.py b/files/routes/admin.py index 954f36b66..01271102a 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -354,11 +354,11 @@ def admin_home(v): with open('disablesignups', 'r') as f: x = f.read() - if not v or v.oldsite: return render_template(f"admin/admin_home.html", v=v, x=x) + if not v or v.oldsite: return render_template("admin/admin_home.html", v=v, x=x) actions = g.db.query(ModAction).order_by(ModAction.id.desc()).limit(10).all() - return render_template(f"CHRISTMAS/admin/admin_home.html", actions=actions, v=v, x=x) + return render_template("CHRISTMAS/admin/admin_home.html", actions=actions, v=v, x=x) @app.post("/admin/disablesignups") @admin_level_required(2) @@ -679,7 +679,7 @@ def agendaposter(user_id, v): if badge: g.db.delete(badge) if user.agendaposter: send_repeatable_notification(user.id, f"You have been marked by an admin as an agendaposter ({note}).") - else: send_repeatable_notification(user.id, f"You have been unmarked by an admin as an agendaposter.") + else: send_repeatable_notification(user.id, "You have been unmarked by an admin as an agendaposter.") g.db.commit() if user.agendaposter: return redirect(user.url) diff --git a/files/routes/awards.py b/files/routes/awards.py index 764eafc45..ce4ed3809 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -233,12 +233,12 @@ def award_post(pid, v): if author.unban_utc - time.time() > 86400: author.unban_utc -= 86400 - send_repeatable_notification(author.id, f"Your ban duration has been reduced by 1 day!") + send_repeatable_notification(author.id, "Your ban duration has been reduced by 1 day!") else: author.unban_utc = 0 author.is_banned = 0 author.ban_evade = 0 - send_repeatable_notification(author.id, f"You have been unbanned!") + send_repeatable_notification(author.id, "You have been unbanned!") elif kind == "grass": author.is_banned = AUTOJANNY_ID author.ban_reason = f"grass award used by @{v.username} on /post/{post.id}" @@ -418,12 +418,12 @@ def award_comment(cid, v): if author.unban_utc - time.time() > 86400: author.unban_utc -= 86400 - send_repeatable_notification(author.id, f"Your ban duration has been reduced by 1 day!") + send_repeatable_notification(author.id, "Your ban duration has been reduced by 1 day!") else: author.unban_utc = 0 author.is_banned = 0 author.ban_evade = 0 - send_repeatable_notification(author.id, f"You have been unbanned!") + send_repeatable_notification(author.id, "You have been unbanned!") elif kind == "grass": author.is_banned = AUTOJANNY_ID author.ban_reason = f"grass award used by @{v.username} on /comment/{c.id}" diff --git a/files/routes/comments.py b/files/routes/comments.py index 144b3bbd9..3b0966b0c 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -65,7 +65,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): post = get_post(pid, v=v) if post.over_18 and not (v and v.over_18) and not session.get('over_18', 0) >= int(time.time()): - if request.headers.get("Authorization"): return {'error': f'This content is not suitable for some users and situations.'} + if request.headers.get("Authorization"): return {'error': 'This content is not suitable for some users and situations.'} else: render_template(f"{template2}errors/nsfw.html", v=v) try: context = int(request.values.get("context", 0)) @@ -208,7 +208,7 @@ def api_comment(v): except: return {"error": "Imgur error"}, 400 if url.endswith('.'): url += 'mp4' body += f"\n\n{url}" - else: return {"error": f"Image/Video files only"}, 400 + else: return {"error": "Image/Video files only"}, 400 if v.agendaposter and not v.marseyawarded: body = torture_ap(body, v.username) @@ -618,7 +618,7 @@ def edit_comment(cid, v): if ban.reason: reason += f" {ban.reason}" - if request.headers.get("Authorization"): return {'error': f'A blacklisted domain was used.'}, 400 + if request.headers.get("Authorization"): return {'error': 'A blacklisted domain was used.'}, 400 if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}comment_failed.html", @@ -675,7 +675,7 @@ def edit_comment(cid, v): except: return {"error": "Imgur error"}, 400 if url.endswith('.'): url += 'mp4' body += f"\n\n{url}" - else: return {"error": f"Image/Video files only"}, 400 + else: return {"error": "Image/Video files only"}, 400 body_md = CustomRenderer().render(mistletoe.Document(body)) body_html = sanitize(body_md) diff --git a/files/routes/discord.py b/files/routes/discord.py index 640a6da5c..13be049f5 100644 --- a/files/routes/discord.py +++ b/files/routes/discord.py @@ -20,7 +20,7 @@ def join_discord(v): if v.shadowbanned: return {"error": "Internal server error"} if SITE_NAME == 'Drama' and v.admin_level == 0 and v.patron == 0 and v.truecoins < 150: - return f"You must receive 150 upvotes/downvotes from other users before being able to join the Discord server." + return "You must receive 150 upvotes/downvotes from other users before being able to join the Discord server." now=int(time.time()) diff --git a/files/routes/front.py b/files/routes/front.py index eeb350eab..6f2094243 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -245,7 +245,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' ) if not (v and v.changelogsub): - posts=posts.filter(not_(Submission.title.ilike(f'[changelog]%'))) + posts=posts.filter(not_(Submission.title.ilike('[changelog]%'))) if v and filter_words: for word in filter_words: diff --git a/files/routes/login.py b/files/routes/login.py index b6344b353..4d8d6c229 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -325,8 +325,8 @@ def sign_up_post(v): email=email, created_utc=int(time.time()), referred_by=ref_id or None, - ban_evade = int(any([(x.is_banned or x.shadowbanned) and not x.unban_utc for x in g.db.query(User).filter(User.id.in_(tuple(session.get("history", [])))).all() if x])), - agendaposter = any([x.agendaposter for x in g.db.query(User).filter(User.id.in_(tuple(session.get("history", [])))).all() if x]) + ban_evade = int(any((x.is_banned or x.shadowbanned) and not x.unban_utc for x in g.db.query(User).filter(User.id.in_(tuple(session.get("history", [])))).all() if x)), + agendaposter = any(x.agendaposter for x in g.db.query(User).filter(User.id.in_(tuple(session.get("history", [])))).all() if x) ) g.db.add(new_user) @@ -350,7 +350,7 @@ def sign_up_post(v): @app.get("/forgot") def get_forgot(): - return render_template(f"forgot_password.html") + return render_template("forgot_password.html") @app.post("/forgot") @@ -376,7 +376,7 @@ def post_forgot(): v=user) ) - return render_template(f"forgot_password.html", + return render_template("forgot_password.html", msg="If the username and email matches an account, you will be sent a password reset email. You have ten minutes to complete the password reset process.") @@ -391,7 +391,7 @@ def get_reset(): now = int(time.time()) if now - timestamp > 600: - return render_template(f"message.html", + return render_template("message.html", title="Password reset link expired", error="That password reset link has expired.") @@ -405,7 +405,7 @@ def get_reset(): reset_token = generate_hash(f"{user.id}+{timestamp}+reset+{user.login_nonce}") - return render_template(f"reset_password.html", + return render_template("reset_password.html", v=user, token=reset_token, time=timestamp, @@ -479,7 +479,7 @@ def request_2fa_disable(): username=request.values.get("username") user=get_user(username, graceful=True) if not user or not user.email or not user.mfa_secret: - return render_template(f"message.html", + return render_template("message.html", title="Removal request received", message="If username, password, and email match, we will send you an email.") @@ -488,7 +488,7 @@ def request_2fa_disable(): password =request.values.get("password") if not user.verifyPass(password): - return render_template(f"message.html", + return render_template("message.html", title="Removal request received", message="If username, password, and email match, we will send you an email.") @@ -504,7 +504,7 @@ def request_2fa_disable(): v=user) ) - return render_template(f"message.html", + return render_template("message.html", title="Removal request received", message="If username, password, and email match, we will send you an email.") @@ -515,7 +515,7 @@ def reset_2fa(): t=int(request.values.get("t")) if now > t+3600*24: - return render_template(f"message.html", + return render_template("message.html", title="Expired Link", error="That link has expired.") @@ -533,6 +533,6 @@ def reset_2fa(): g.db.commit() - return render_template(f"message_success.html", + return render_template("message_success.html", title="Two-factor authentication removed.", message="Login normally to access your account.") diff --git a/files/routes/oauth.py b/files/routes/oauth.py index 69b97dfd7..f52a454b4 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -134,7 +134,7 @@ def admin_app_approve(v, aid): g.db.commit() - return {"message": f"Application approved"} + return {"message": "Application approved"} @app.post("/admin/app/revoke/") @@ -160,7 +160,7 @@ def admin_app_revoke(v, aid): g.db.commit() - return {"message": f"App revoked"} + return {"message": "App revoked"} @app.post("/admin/app/reject/") @@ -186,7 +186,7 @@ def admin_app_reject(v, aid): g.db.commit() - return {"message": f"App rejected"} + return {"message": "App rejected"} @app.get("/admin/app/") diff --git a/files/routes/posts.py b/files/routes/posts.py index a13f5e6c8..1c23514db 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -453,7 +453,7 @@ def edit_post(pid, v): except: return {"error": "Imgur error"}, 400 if url.endswith('.'): url += 'mp4' body += f"\n\n{url}" - else: return {"error": f"Image/Video files only"}, 400 + else: return {"error": "Image/Video files only"}, 400 if body != p.body: for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): @@ -734,7 +734,7 @@ def submit_post(v): fragment=parsed_url.fragment) else: qd = parse_qs(parsed_url.query) - filtered = dict((k, val) for k, val in qd.items() if not k.startswith('utm_') and not k.startswith('ref_')) + filtered = {k: val for k, val in qd.items() if not k.startswith('utm_') and not k.startswith('ref_')} new_url = ParseResult(scheme="https", netloc=parsed_url.netloc, @@ -916,7 +916,7 @@ def submit_post(v): if url.endswith('.'): url += 'mp4' body += f"\n\n{url}" else: - if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400 + if request.headers.get("Authorization"): return {"error": "Image/Video files only"}, 400 if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}submit.html", v=v, error=f"Image/Video files only."), 400 @@ -1013,8 +1013,8 @@ def submit_post(v): if url.endswith('.'): url += 'mp4' new_post.url = url else: - if request.headers.get("Authorization"): return {"error": f"File type not allowed"}, 400 - return render_template(f"{template}submit.html", v=v, error=f"File type not allowed.", title=title, body=request.values.get("body", "")), 400 + if request.headers.get("Authorization"): return {"error": "File type not allowed"}, 400 + return render_template(f"{template}submit.html", v=v, error="File type not allowed.", title=title, body=request.values.get("body", "")), 400 if not new_post.thumburl and new_post.url and request.headers.get('cf-ipcountry')!="T1": gevent.spawn( thumbnail_thread, new_post.id) diff --git a/files/routes/reporting.py b/files/routes/reporting.py index 3ade3971e..54d1d67fe 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -22,7 +22,7 @@ def api_flag_post(pid, v): reason = filter_emojis_only(reason) - if len(reason) > 350: return {"error": f"Too long."} + if len(reason) > 350: return {"error": "Too long."} if reason.startswith('!') and v.admin_level > 1: post.flair = reason[1:] @@ -51,7 +51,7 @@ def api_flag_comment(cid, v): reason = request.values.get("reason", "").strip()[:100] reason = filter_emojis_only(reason) - if len(reason) > 350: return {"error": f"Too long."} + if len(reason) > 350: return {"error": "Too long."} flag = CommentFlag(comment_id=comment.id, user_id=v.id, reason=reason) diff --git a/files/routes/settings.py b/files/routes/settings.py index fd40a41d0..c92db4469 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -306,10 +306,10 @@ def settings_profile_post(v): if url.endswith('.'): url += 'mp4' bio += f"\n\n{url}" else: - if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400 + if request.headers.get("Authorization"): return {"error": "Image/Video files only"}, 400 if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' - return render_template(f"{template}settings_profile.html", v=v, error=f"Image/Video files only."), 400 + return render_template(f"{template}settings_profile.html", v=v, error="Image/Video files only."), 400 bio_html = CustomRenderer().render(mistletoe.Document(bio)) bio_html = sanitize(bio_html) @@ -951,7 +951,7 @@ def settings_name_change(v): else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, - error=f"This isn't a valid username.") + error="This isn't a valid username.") name=new_name.replace('_','\_') @@ -1004,7 +1004,7 @@ def settings_song_change(v): else: if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' - return render_template(f"{template}settings_profile.html", v=v, error=f"Not a youtube link.") + return render_template(f"{template}settings_profile.html", v=v, error="Not a youtube link.") if "?" in id: id = id.split("?")[0] if "&" in id: id = id.split("&")[0] @@ -1021,19 +1021,19 @@ def settings_song_change(v): if duration == 'P0D': if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' - return render_template(f"{template}settings_profile.html", v=v, error=f"Can't use a live youtube video!") + return render_template(f"{template}settings_profile.html", v=v, error="Can't use a live youtube video!") if "H" in duration: if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' - return render_template(f"{template}settings_profile.html", v=v, error=f"Duration of the video must not exceed 10 minutes.") + return render_template(f"{template}settings_profile.html", v=v, error="Duration of the video must not exceed 10 minutes.") if "M" in duration: duration = int(duration.split("PT")[1].split("M")[0]) if duration > 10: if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' - return render_template(f"{template}settings_profile.html", v=v, error=f"Duration of the video must not exceed 10 minutes.") + return render_template(f"{template}settings_profile.html", v=v, error="Duration of the video must not exceed 10 minutes.") if v.song and path.isfile(f"/songs/{v.song}.mp3") and g.db.query(User.id).filter_by(song=v.song).count() == 1: @@ -1057,7 +1057,7 @@ def settings_song_change(v): else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, - error=f"Age-restricted videos aren't allowed.") + error="Age-restricted videos aren't allowed.") files = os.listdir("/songs/") paths = [path.join("/songs/", basename) for basename in files] diff --git a/files/routes/static.py b/files/routes/static.py index 57e30f9e3..136aa8ece 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -15,12 +15,12 @@ site_name = environ.get("SITE_NAME").strip() @app.get("/privacy") @auth_desired def privacy(v): - return render_template(f"privacy.html", v=v) + return render_template("privacy.html", v=v) @app.get("/marseys") @auth_desired def emojis(v): - return render_template(f"marseys.html", v=v, marseys=marseys.items()) + return render_template("marseys.html", v=v, marseys=marseys.items()) @app.get('/sidebar') @auth_desired diff --git a/files/routes/users.py b/files/routes/users.py index 77d054fd3..762ebdf6d 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -155,19 +155,19 @@ def steal(v): u.coins -= 700 g.db.add(u) send_repeatable_notification(u.id, f"Some [grubby little rentoid](/@{v.username}) has absconded with 700 of your hard-earned coins to fuel his Funko Pop addiction. Stop being so trusting.") - send_repeatable_notification(v.id, f"You have successfully shorted your heroic landlord 700 coins in rent. You're slightly less materially poor, but somehow even moreso morally. Are you proud of yourself?") + send_repeatable_notification(v.id, "You have successfully shorted your heroic landlord 700 coins in rent. You're slightly less materially poor, but somehow even moreso morally. Are you proud of yourself?") g.db.commit() return {"message": "Attempt successful!"} else: if random.random() < 0.15: send_repeatable_notification(u.id, f"You caught [this sniveling little renthog](/@{v.username}) trying to rob you. After beating him within an inch of his life, you sold his Nintendo Switch for 500 coins and called the cops. He was sentenced to one (1) day in renthog prison.") - send_repeatable_notification(v.id, f"The ever-vigilant landchad has caught you trying to steal his hard-earned rent money. The police take you away and laugh as you impotently stutter A-ACAB :sob: You are fined 500 coins and sentenced to one (1) day in renthog prison.") + send_repeatable_notification(v.id, "The ever-vigilant landchad has caught you trying to steal his hard-earned rent money. The police take you away and laugh as you impotently stutter A-ACAB :sob: You are fined 500 coins and sentenced to one (1) day in renthog prison.") v.ban(days=1, reason="Jailed thief") v.fail_utc = int(time.time()) else: send_repeatable_notification(u.id, f"You caught [this sniveling little renthog](/@{v.username}) trying to rob you. After beating him within an inch of his life, you showed mercy in exchange for a 500 dramacoin tip. This time.") - send_repeatable_notification(v.id, f"The ever-vigilant landchad has caught you trying to steal his hard-earned rent money. You were able to convince him to spare your life with a 500 dramacoin tip. This time.") + send_repeatable_notification(v.id, "The ever-vigilant landchad has caught you trying to steal his hard-earned rent money. You were able to convince him to spare your life with a 500 dramacoin tip. This time.") v.fail2_utc = int(time.time()) v.coins -= 500 g.db.add(v) @@ -271,9 +271,9 @@ def transfer_bux(v, username): amount = request.values.get("amount", "").strip() amount = int(amount) if amount.isdigit() else None - if not amount or amount < 0: return {"error": f"Invalid amount of marseybux."}, 400 - if v.procoins < amount: return {"error": f"You don't have enough marseybux"}, 400 - if amount < 100: return {"error": f"You have to gift at least 100 marseybux."}, 400 + if not amount or amount < 0: return {"error": "Invalid amount of marseybux."}, 400 + if v.procoins < amount: return {"error": "You don't have enough marseybux"}, 400 + if amount < 100: return {"error": "You have to gift at least 100 marseybux."}, 400 receiver.procoins += amount v.procoins -= amount @@ -284,7 +284,7 @@ def transfer_bux(v, username): g.db.commit() return {"message": f"{amount} marseybux transferred!"}, 200 - return {"message": f"You can't transfer marseybux to yourself!"}, 400 + return {"message": "You can't transfer marseybux to yourself!"}, 400 @app.get("/leaderboard")