remotes/1693045480750635534/spooky-22
Aevann1 2022-01-07 23:03:14 +02:00
parent e5571bc680
commit d0f3ae65e5
15 changed files with 56 additions and 56 deletions

View File

@ -288,7 +288,7 @@ class Comment(Base):
data=self.json_raw
if self.level>=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

View File

@ -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)
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)

View File

@ -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)):

View File

@ -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)

View File

@ -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}"

View File

@ -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)

View File

@ -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())

View File

@ -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:

View File

@ -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.")

View File

@ -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/<aid>")
@ -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/<aid>")
@ -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/<aid>")

View File

@ -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)

View File

@ -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)

View File

@ -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]

View File

@ -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

View File

@ -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")