remotes/1693045480750635534/spooky-22
Aevann1 2022-02-23 07:17:03 +02:00
parent 5d4b09ef62
commit 6681ca4236
8 changed files with 12 additions and 12 deletions

View File

@ -40,7 +40,7 @@ class Badge(Base):
ti = self.user.agendaposter ti = self.user.agendaposter
if ti: text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S') if ti: text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
else: text = self.badge.description + " permanently" else: text = self.badge.description + " permanently"
elif self.badge_id in (94,95,96,97,98,109): elif self.badge_id in {94,95,96,97,98,109}:
if self.badge_id == 94: ti = self.user.progressivestack if self.badge_id == 94: ti = self.user.progressivestack
elif self.badge_id == 95: ti = self.user.bird elif self.badge_id == 95: ti = self.user.bird
elif self.badge_id == 96: ti = self.user.flairchanged elif self.badge_id == 96: ti = self.user.flairchanged

View File

@ -141,7 +141,7 @@ AGENDAPOSTER_MSG = """Hi @{username},\n\nYour {type} has been automatically remo
included. \n\n*This is an automated message; if you need help, included. \n\n*This is an automated message; if you need help,
you can message us [here](/contact).*""" you can message us [here](/contact).*"""
if SITE in ('rdrama.net','devrama.xyz','ruqqus.us'): if SITE in {'rdrama.net','devrama.xyz','ruqqus.us'}:
NOTIFICATIONS_ID = 1046 NOTIFICATIONS_ID = 1046
AUTOJANNY_ID = 2360 AUTOJANNY_ID = 2360
SNAPPY_ID = 261 SNAPPY_ID = 261

View File

@ -89,7 +89,7 @@ no_images = ['b',
def sanitize_marquee(tag, name, value): def sanitize_marquee(tag, name, value):
if name in allowed_attributes['*'] or name in ['direction', 'behavior', 'scrollamount']: return True if name in allowed_attributes['*'] or name in ['direction', 'behavior', 'scrollamount']: return True
if name in ['height', 'width']: if name in {'height', 'width'}:
try: value = int(value.replace('px', '')) try: value = int(value.replace('px', ''))
except: return False except: return False
if 0 < value <= 250: return True if 0 < value <= 250: return True

View File

@ -510,7 +510,7 @@ def badge_grant_post(v):
try: badge_id = int(request.values.get("badge_id")) try: badge_id = int(request.values.get("badge_id"))
except: abort(400) except: abort(400)
if badge_id in (94,95,96,97,98,109): abort(403) if badge_id in {94,95,96,97,98,109}: abort(403)
if user.has_badge(badge_id): if user.has_badge(badge_id):
return render_template("admin/badge_grant.html", v=v, badge_types=badges, error="User already has that badge.") return render_template("admin/badge_grant.html", v=v, badge_types=badges, error="User already has that badge.")

View File

@ -108,7 +108,7 @@ def discord_redirect(v):
x=requests.put(url, headers=headers, json=data, timeout=5) x=requests.put(url, headers=headers, json=data, timeout=5)
if x.status_code in [201, 204]: if x.status_code in {201, 204}:
if v.admin_level > 2: if v.admin_level > 2:
add_role(v, "owner") add_role(v, "owner")

View File

@ -1378,7 +1378,7 @@ def submit_post(v, sub=None):
send_discord_message(new_post.permalink) send_discord_message(new_post.permalink)
cache.delete_memoized(changeloglist) cache.delete_memoized(changeloglist)
if v.id in (PIZZASHILL_ID, HIL_ID): if v.id in {PIZZASHILL_ID, HIL_ID}:
autovote = Vote(user_id=CARP_ID, submission_id=new_post.id, vote_type=1) autovote = Vote(user_id=CARP_ID, submission_id=new_post.id, vote_type=1)
g.db.add(autovote) g.db.add(autovote)
autovote = Vote(user_id=AEVANN_ID, submission_id=new_post.id, vote_type=1) autovote = Vote(user_id=AEVANN_ID, submission_id=new_post.id, vote_type=1)

View File

@ -301,7 +301,7 @@ def settings_profile_post(v):
frontsize = request.values.get("frontsize") frontsize = request.values.get("frontsize")
if frontsize: if frontsize:
if frontsize in ["25", "50", "100"]: if frontsize in {"25", "50", "100"}:
v.frontsize = int(frontsize) v.frontsize = int(frontsize)
updated = True updated = True
cache.delete_memoized(frontlist) cache.delete_memoized(frontlist)
@ -309,28 +309,28 @@ def settings_profile_post(v):
defaultsortingcomments = request.values.get("defaultsortingcomments") defaultsortingcomments = request.values.get("defaultsortingcomments")
if defaultsortingcomments: if defaultsortingcomments:
if defaultsortingcomments in ["new", "old", "controversial", "top", "bottom"]: if defaultsortingcomments in {"new", "old", "controversial", "top", "bottom"}:
v.defaultsortingcomments = defaultsortingcomments v.defaultsortingcomments = defaultsortingcomments
updated = True updated = True
else: abort(400) else: abort(400)
defaultsorting = request.values.get("defaultsorting") defaultsorting = request.values.get("defaultsorting")
if defaultsorting: if defaultsorting:
if defaultsorting in ["hot", "new", "old", "comments", "controversial", "top", "bottom"]: if defaultsorting in {"hot", "new", "old", "comments", "controversial", "top", "bottom"}:
v.defaultsorting = defaultsorting v.defaultsorting = defaultsorting
updated = True updated = True
else: abort(400) else: abort(400)
defaulttime = request.values.get("defaulttime") defaulttime = request.values.get("defaulttime")
if defaulttime: if defaulttime:
if defaulttime in ["hour", "day", "week", "month", "year", "all"]: if defaulttime in {"hour", "day", "week", "month", "year", "all"}:
v.defaulttime = defaulttime v.defaulttime = defaulttime
updated = True updated = True
else: abort(400) else: abort(400)
theme = request.values.get("theme") theme = request.values.get("theme")
if theme: if theme:
if theme in ["dramblr","classic","classic_dark","transparent", "win98", "dark", "light", "coffee", "tron", "4chan", "midnight"]: if theme in {"dramblr","classic","classic_dark","transparent", "win98", "dark", "light", "coffee", "tron", "4chan", "midnight"}:
if theme == "transparent" and not v.background: if theme == "transparent" and not v.background:
return {"error": "You need to set a background to use the transparent theme!"} return {"error": "You need to set a background to use the transparent theme!"}
v.theme = theme v.theme = theme

View File

@ -125,7 +125,7 @@ def api_vote_comment(comment_id, new, v):
comment = get_comment(comment_id) comment = get_comment(comment_id)
if comment.author_id in (AUTOPOLLER_ID,AUTOBETTER_ID,AUTOCHOICE_ID): return {"error": "forbidden."}, 403 if comment.author_id in {AUTOPOLLER_ID,AUTOBETTER_ID,AUTOCHOICE_ID}: return {"error": "forbidden."}, 403
existing = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).one_or_none() existing = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).one_or_none()