From d9dbd36b7af45837cf633b1ad6d17b0350ccc258 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 26 May 2022 23:16:49 +0200 Subject: [PATCH 1/5] fds --- files/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/__main__.py b/files/__main__.py index 7b7dbe242f..3f0a61e254 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -86,7 +86,7 @@ mail = Mail(app) def before_request(): g.agent = request.headers.get("User-Agent") - if not g.agent: abort(403) + if not g.agent: return 'Please use a "User-Agent" header!', 403 ua = g.agent.lower() From 22aacf86ec610c71afaed9a2db30e2a7a1276d45 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 27 May 2022 00:23:16 +0200 Subject: [PATCH 2/5] vf --- files/templates/chat.html | 2 +- files/templates/default.html | 2 +- files/templates/login.html | 2 +- files/templates/settings.html | 2 +- files/templates/settings2.html | 2 +- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submit.html | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/files/templates/chat.html b/files/templates/chat.html index 94cc03112f..49900f195f 100644 --- a/files/templates/chat.html +++ b/files/templates/chat.html @@ -105,7 +105,7 @@ - + {% include "header.html" %} diff --git a/files/templates/default.html b/files/templates/default.html index ad790c2cda..fb20a2f490 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -4,7 +4,7 @@ - + {% if v %} diff --git a/files/templates/login.html b/files/templates/login.html index 5ed98da441..11e90e72c9 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -6,7 +6,7 @@ - + diff --git a/files/templates/settings.html b/files/templates/settings.html index a0bcd370dd..1290cfc109 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -5,7 +5,7 @@ - + diff --git a/files/templates/settings2.html b/files/templates/settings2.html index 0db64f156c..973261a561 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -6,7 +6,7 @@ - + diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 5c0a67e3a4..c2386b0926 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -5,7 +5,7 @@ - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index 00e80e3c4a..dff546bf77 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -6,7 +6,7 @@ - + diff --git a/files/templates/submit.html b/files/templates/submit.html index fb377e0f2d..5dc6f17ff9 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -4,7 +4,7 @@ - + From 8eee22565d6c0bca85911ac06c1d66c4b135addc Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 27 May 2022 00:39:11 +0200 Subject: [PATCH 3/5] fds --- files/templates/api.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/templates/api.html b/files/templates/api.html index 1de23a226a..de0bbf53bd 100644 --- a/files/templates/api.html +++ b/files/templates/api.html @@ -28,7 +28,7 @@

Python example:

	import requests
 
-	headers={"Authorization": "access_token_goes_here"}
+	headers={"User-Agent": "bot for comments", "Authorization": "access_token_goes_here"}
 
 	url="{{SITE_FULL}}/?sort=comments"
 
@@ -43,7 +43,7 @@
 

Aother python example:

	import requests
 
-	headers={"Authorization": "access_token_goes_here"}
+	headers={"User-Agent": "bot for comments", "Authorization": "access_token_goes_here"}
 
 	url="{{SITE_FULL}}/unread"
 
@@ -85,7 +85,7 @@
 

Python example:

	import requests
 
-	headers={"Authorization": "access_token_goes_here"}
+	headers={"User-Agent": "bot for comments", "Authorization": "access_token_goes_here"}
 
 	url="{{SITE_FULL}}/?sort=comments"
 
@@ -100,7 +100,7 @@
 

Aother python example:

	import requests
 
-	headers={"Authorization": "access_token_goes_here"}
+	headers={"User-Agent": "bot for comments", "Authorization": "access_token_goes_here"}
 
 	url="{{SITE_FULL}}/unread"
 

From 66b3efab36f4337e0b9095f5e566cb54b321e8e2 Mon Sep 17 00:00:00 2001
From: Aevann1 
Date: Fri, 27 May 2022 01:08:23 +0200
Subject: [PATCH 4/5] award refactor

---
 files/classes/comment.py                 |   6 +-
 files/routes/admin.py                    |  10 +-
 files/routes/awards.py                   | 304 +++--------------------
 files/routes/comments.py                 |  20 +-
 files/routes/posts.py                    |  22 +-
 files/templates/comments.html            |  24 +-
 files/templates/post_actions.html        |   2 +-
 files/templates/post_actions_mobile.html |   2 +-
 schema.sql                               |   4 +-
 9 files changed, 77 insertions(+), 317 deletions(-)

diff --git a/files/classes/comment.py b/files/classes/comment.py
index 0d892e25b7..4e1156b795 100644
--- a/files/classes/comment.py
+++ b/files/classes/comment.py
@@ -34,8 +34,8 @@ class Comment(Base):
 	top_comment_id = Column(Integer)
 	over_18 = Column(Boolean, default=False)
 	is_bot = Column(Boolean, default=False)
-	is_pinned = Column(String)
-	is_pinned_utc = Column(Integer)
+	stickied = Column(String)
+	stickied_utc = Column(Integer)
 	sentto = Column(Integer, ForeignKey("users.id"))
 	app_id = Column(Integer, ForeignKey("oauth_apps.id"))
 	upvotes = Column(Integer, default=1)
@@ -278,7 +278,7 @@ class Comment(Base):
 			'deleted_utc': self.deleted_utc,
 			'is_nsfw': self.over_18,
 			'permalink': f'/comment/{self.id}',
-			'is_pinned': self.is_pinned,
+			'stickied': self.stickied,
 			'distinguish_level': self.distinguish_level,
 			'post_id': self.post.id if self.post else 0,
 			'score': self.score,
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 1230e72ef9..686dea0fff 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -1443,8 +1443,8 @@ def sticky_comment(cid, v):
 	
 	comment = get_comment(cid, v=v)
 
-	if not comment.is_pinned:
-		comment.is_pinned = v.username
+	if not comment.stickied:
+		comment.stickied = v.username
 		g.db.add(comment)
 
 		ma=ModAction(
@@ -1468,10 +1468,10 @@ def unsticky_comment(cid, v):
 	
 	comment = get_comment(cid, v=v)
 	
-	if comment.is_pinned:
-		if comment.is_pinned.endswith("(pin award)"): return {"error": "Can't unpin award pins!"}, 403
+	if comment.stickied:
+		if comment.stickied.endswith("(pin award)"): return {"error": "Can't unpin award pins!"}, 403
 
-		comment.is_pinned = None
+		comment.stickied = None
 		g.db.add(comment)
 
 		ma=ModAction(
diff --git a/files/routes/awards.py b/files/routes/awards.py
index 4c43ff2e46..9729f7e173 100644
--- a/files/routes/awards.py
+++ b/files/routes/awards.py
@@ -124,11 +124,17 @@ def buy(v, award):
 
 	return {"message": "Award bought!"}
 
-@app.post("/award_post/")
+@app.post("/award//")
 @limiter.limit("1/second;30/minute;200/hour;1000/day")
 @limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{request.host}-{session.get("lo_user")}')
 @is_not_permabanned
-def award_post(pid, v):
+def award_thing(v, thing_type, id):
+
+	if thing_type == 'post': thing = g.db.query(Submission).filter_by(id=id).one_or_none()
+	else: thing = g.db.query(Comment).filter_by(id=id).one_or_none()
+
+	if not thing: return {"error": f"That {thing_type} doesn't exist."}, 404
+
 	if v.shadowbanned: return render_template('errors/500.html', err=True, v=v), 500
 	
 	kind = request.values.get("kind", "").strip()
@@ -136,27 +142,24 @@ def award_post(pid, v):
 	if kind not in AWARDS:
 		return {"error": "That award doesn't exist."}, 404
 
-	post_award = g.db.query(AwardRelationship).filter(
+	award = g.db.query(AwardRelationship).filter(
 		AwardRelationship.kind == kind,
 		AwardRelationship.user_id == v.id,
 		AwardRelationship.submission_id == None,
 		AwardRelationship.comment_id == None
 	).first()
 
-	if not post_award:
+	if not award:
 		return {"error": "You don't have that award."}, 404
 
-	post = g.db.query(Submission).filter_by(id=pid).one_or_none()
+	if thing_type == 'post': award.submission_id = thing.id
+	else: award.comment_id = thing.id
 
-	if not post:
-		return {"error": "That post doesn't exist."}, 404
-
-	post_award.submission_id = post.id
-	g.db.add(post_award)
+	g.db.add(award)
 
 	note = request.values.get("note", "").strip()
 
-	author = post.author
+	author = thing.author
 
 	if author.id in (PIZZASHILL_ID, DAD_ID) and v.id not in (PIZZASHILL_ID, DAD_ID):
 		return {"error": "This user is immune to awards."}, 403
@@ -166,21 +169,21 @@ def award_post(pid, v):
 
 	if v.id != author.id:
 		if author.deflector and AWARDS[kind]['price'] > 500 and kind not in ('pin','unpin','benefactor'):
-			msg = f"@{v.username} has tried to give your [post]({post.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"
+			msg = f"@{v.username} has tried to give your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"
 			send_repeatable_notification(author.id, msg)
 			msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you :marseytroll:"
 			send_repeatable_notification(v.id, msg)
 			author = v
 		else:
-			msg = f"@{v.username} has given your [post]({post.shortlink}) the {AWARDS[kind]['title']} Award!"
+			msg = f"@{v.username} has given your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award!"
 			if note: msg += f"\n\n> {note}"
 			send_repeatable_notification(author.id, msg)
 
 	if kind == "ban":
-		link = f"[this post]({post.shortlink})"
+		link = f"[this {thing_type}]({thing.shortlink})"
 
 		if not author.is_suspended:
-			author.ban(reason=f"1-Day ban award used by @{v.username} on /post/{post.id}", days=1)
+			author.ban(reason=f"1-Day ban award used by @{v.username} on /{thing_type}/{thing.id}", days=1)
 			send_repeatable_notification(author.id, f"Your account has been banned for **a day** for {link}. It sucked and you should feel bad.")
 		elif author.unban_utc:
 			author.unban_utc += 86400
@@ -200,29 +203,29 @@ def award_post(pid, v):
 			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}"
+		author.ban_reason = f"grass award used by @{v.username} on /{thing_type}/{thing.id}"
 		author.unban_utc = int(time.time()) + 30 * 86400
-		link = f"[this post]({post.shortlink})"
+		link = f"[this {thing_type}]({thing.shortlink})"
 		send_repeatable_notification(author.id, f"Your account has been banned permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass/snow/sand/ass to get unbanned!")
 		if request.host == 'rdrama.net' and v.id == CARP_ID:
 			send_repeatable_notification(AEVANN_ID, link)
 	elif kind == "pin":
-		if post.stickied and post.stickied_utc:
-			post.stickied_utc += 3600
+		if thing.stickied and thing.stickied_utc:
+			thing.stickied_utc += 3600
 		else:
-			post.stickied = f'{v.username} (pin award)'
-			post.stickied_utc = int(time.time()) + 3600
-		g.db.add(post)
+			thing.stickied = f'{v.username} (pin award)'
+			thing.stickied_utc = int(time.time()) + 3600
+		g.db.add(thing)
 		cache.delete_memoized(frontlist)
 	elif kind == "unpin":
-		if not post.stickied_utc: abort(403)
-		t = post.stickied_utc - 3600
+		if not thing.stickied_utc: abort(403)
+		t = thing.stickied_utc - 3600
 		if time.time() > t:
-			post.stickied = None
-			post.stickied_utc = None
+			thing.stickied = None
+			thing.stickied_utc = None
 			cache.delete_memoized(frontlist)
-		else: post.stickied_utc = t
-		g.db.add(post)
+		else: thing.stickied_utc = t
+		g.db.add(thing)
 	elif kind == "agendaposter" and not (author.agendaposter and author.agendaposter == 0):
 		if author.marseyawarded:
 			return {"error": "This user is the under the effect of a conflicting award: Marsey award."}, 404
@@ -365,254 +368,11 @@ def award_post(pid, v):
 
 	g.db.commit()
 	if request.referrer and len(request.referrer) > 1:
-		if request.referrer == f'{SITE_FULL}/submit': return redirect(post.permalink)
+		if request.referrer == f'{SITE_FULL}/submit': return redirect(thing.permalink)
 		elif request.referrer.startswith(f'{SITE_FULL}/'): return redirect(request.referrer)
 	return redirect(SITE_FULL)
 
 
-@app.post("/award_comment/")
-@limiter.limit("1/second;30/minute;200/hour;1000/day")
-@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{request.host}-{session.get("lo_user")}')
-@is_not_permabanned
-def award_comment(cid, v):
-	if v.shadowbanned: return render_template('errors/500.html', err=True, v=v), 500
-
-	kind = request.values.get("kind", "").strip()
-
-	if kind not in AWARDS:
-		return {"error": "That award doesn't exist."}, 404
-
-	comment_award = g.db.query(AwardRelationship).filter(
-		AwardRelationship.kind == kind,
-		AwardRelationship.user_id == v.id,
-		AwardRelationship.submission_id == None,
-		AwardRelationship.comment_id == None
-	).first()
-
-	if not comment_award:
-		return {"error": "You don't have that award."}, 404
-
-	c = g.db.query(Comment).filter_by(id=cid).one_or_none()
-
-	if not c:
-		return {"error": "That comment doesn't exist."}, 404
-
-	comment_award.comment_id = c.id
-	g.db.add(comment_award)
-
-	note = request.values.get("note", "").strip()
-
-	author = c.author
-
-	if author.id in (PIZZASHILL_ID, DAD_ID) and v.id not in (PIZZASHILL_ID, DAD_ID):
-		return {"error": "This user is immune to awards."}, 403
-
-	if v.id != author.id:
-		if author.deflector and AWARDS[kind]['price'] > 500 and kind not in ('pin','unpin','benefactor'):
-			msg = f"@{v.username} has tried to give your [comment]({c.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"
-			send_repeatable_notification(author.id, msg)
-			msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you :marseytroll:"
-			send_repeatable_notification(v.id, msg)
-			author = v
-		else:
-			msg = f"@{v.username} has given your [comment]({c.shortlink}) the {AWARDS[kind]['title']} Award!"
-			if note: msg += f"\n\n> {note}"
-			send_repeatable_notification(author.id, msg)
-
-	if kind == "benefactor" and author.id == v.id:
-		return {"error": "You can't use this award on yourself."}, 400
-
-	if author.deflector: author = v
-
-	if kind == "ban":
-		link = f"[this comment]({c.shortlink})"
-
-		if not author.is_suspended:
-			author.ban(reason=f"1-Day ban award used by @{v.username} on /comment/{c.id}", days=1)
-			send_repeatable_notification(author.id, f"Your account has been banned for **a day** for {link}. It sucked and you should feel bad.")
-		elif author.unban_utc:
-			author.unban_utc += 86400
-			send_repeatable_notification(author.id, f"Your account has been banned for **yet another day** for {link}. Seriously man?")
-		if request.host == 'rdrama.net' and v.id == CARP_ID:
-			send_repeatable_notification(AEVANN_ID, link)
-
-	elif kind == "unban":
-		if not author.is_suspended or not author.unban_utc or time.time() > author.unban_utc: abort(403)
-
-		if author.unban_utc - time.time() > 86400:
-			author.unban_utc -= 86400
-			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, "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}"
-		author.unban_utc = int(time.time()) + 30 * 86400
-		link = f"[this comment]({c.shortlink})"
-		send_repeatable_notification(author.id, f"Your account has been banned permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass/snow/sand/ass to get unbanned!")
-		if request.host == 'rdrama.net' and v.id == CARP_ID:
-			send_repeatable_notification(AEVANN_ID, link)
-	elif kind == "pin":
-		if c.is_pinned and c.is_pinned_utc: c.is_pinned_utc += 3600
-		else:
-			c.is_pinned = f'{v.username} (pin award)'
-			c.is_pinned_utc = int(time.time()) + 3600
-		g.db.add(c)
-	elif kind == "unpin":
-		if not c.is_pinned_utc: abort(403)
-		t = c.is_pinned_utc - 3600
-		if time.time() > t:
-			c.is_pinned = None
-			c.is_pinned_utc = None
-		else: c.is_pinned_utc = t
-		g.db.add(c)
-	elif kind == "agendaposter" and not (author.agendaposter and author.agendaposter == 0):
-		if author.marseyawarded:
-			return {"error": "This user is the under the effect of a conflicting award: Marsey award."}, 404
-
-		if author.agendaposter and time.time() < author.agendaposter: author.agendaposter += 86400
-		else: author.agendaposter = int(time.time()) + 86400
-		
-		if not author.has_badge(28):
-			badge = Badge(user_id=author.id, badge_id=28)
-			g.db.add(badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
-	elif kind == "flairlock":
-		new_name = note[:100].replace("𒐪","")
-		if not new_name and author.flairchanged:
-			author.flairchanged += 86400
-		else:
-			author.customtitleplain = new_name
-			author.customtitle = filter_emojis_only(new_name)
-			if len(author.customtitle) > 1000: abort(403)
-			author.flairchanged = int(time.time()) + 86400
-			if not author.has_badge(96):
-				badge = Badge(user_id=author.id, badge_id=96)
-				g.db.add(badge)
-				g.db.flush()
-				send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
-	elif kind == "pause":
-		author.mute = True
-		if not author.has_badge(68):
-			new_badge = Badge(badge_id=68, user_id=author.id)
-			g.db.add(new_badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
-	elif kind == "unpausable":
-		author.unmutable = True
-		if not author.has_badge(67):
-			new_badge = Badge(badge_id=67, user_id=author.id)
-			g.db.add(new_badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
-	elif kind == "marsey":
-		if author.marseyawarded: author.marseyawarded += 86400
-		else: author.marseyawarded = int(time.time()) + 86400
-		if not author.has_badge(98):
-			badge = Badge(user_id=author.id, badge_id=98)
-			g.db.add(badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
-	elif kind == "pizzashill":
-		if author.bird:
-			return {"error": "This user is the under the effect of a conflicting award: Bird Site award."}, 404
-		if author.longpost: author.longpost += 86400
-		else: author.longpost = int(time.time()) + 86400
-		if not author.has_badge(97):
-			badge = Badge(user_id=author.id, badge_id=97)
-			g.db.add(badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
-	elif kind == "bird":
-		if author.longpost:
-			return {"error": "This user is the under the effect of a conflicting award: Pizzashill award."}, 404
-		if author.bird: author.bird += 86400
-		else: author.bird = int(time.time()) + 86400
-		if not author.has_badge(95):
-			badge = Badge(user_id=author.id, badge_id=95)
-			g.db.add(badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
-	elif kind == "eye":
-		author.eye = True
-		if not author.has_badge(83):
-			new_badge = Badge(badge_id=83, user_id=author.id)
-			g.db.add(new_badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
-	elif kind == "alt":
-		author.alt = True
-		if not author.has_badge(84):
-			new_badge = Badge(badge_id=84, user_id=author.id)
-			g.db.add(new_badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
-	elif kind == "unblockable":
-		author.unblockable = True
-		if not author.has_badge(87):
-			new_badge = Badge(badge_id=87, user_id=author.id)
-			g.db.add(new_badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
-		for block in g.db.query(UserBlock).filter_by(target_id=author.id).all(): g.db.delete(block)
-	elif kind == "fish":
-		author.fish = True
-		if not author.has_badge(90):
-			new_badge = Badge(badge_id=90, user_id=author.id)
-			g.db.add(new_badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
-	elif kind == "progressivestack":
-		if author.progressivestack: author.progressivestack += 21600
-		else: author.progressivestack = int(time.time()) + 21600
-		if not author.has_badge(94):
-			badge = Badge(user_id=author.id, badge_id=94)
-			g.db.add(badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
-	elif kind == "benefactor":
-		author.patron = 1
-		if author.patron_utc: author.patron_utc += 2629746
-		else: author.patron_utc = int(time.time()) + 2629746
-		author.procoins += 2500
-		if author.discord_id: add_role(author, "1")
-		if not v.has_badge(103):
-			badge = Badge(user_id=v.id, badge_id=103)
-			g.db.add(badge)
-			g.db.flush()
-			send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
-	elif kind == "rehab":
-		if author.rehab: author.rehab += 86400
-		else: author.rehab = int(time.time()) + 86400
-		if not author.has_badge(109):
-			badge = Badge(user_id=author.id, badge_id=109)
-			g.db.add(badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
-	elif kind == "deflector":
-		if author.deflector: author.deflector += 36000
-		else: author.deflector = int(time.time()) + 36000
-	elif kind == "beano":
-		if not author.has_badge(128):
-			badge = Badge(user_id=author.id, badge_id=128)
-			g.db.add(badge)
-			g.db.flush()
-			send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
-	elif kind == "checkmark":
-		author.verified = "Verified"
-
-	if author.received_award_count: author.received_award_count += 1
-	else: author.received_award_count = 1
-	g.db.add(author)
-
-	g.db.commit()
-	if request.referrer and len(request.referrer) > 1 and request.referrer.startswith(f'{SITE_FULL}/'):
-		return redirect(request.referrer)
-	return redirect(SITE_FULL)
 
 @app.get("/admin/awards")
 @admin_level_required(2)
diff --git a/files/routes/comments.py b/files/routes/comments.py
index 86648c6614..0836e4f5cf 100644
--- a/files/routes/comments.py
+++ b/files/routes/comments.py
@@ -896,11 +896,11 @@ def pin_comment(cid, v):
 	
 	comment = get_comment(cid, v=v)
 	
-	if not comment.is_pinned:
+	if not comment.stickied:
 		if v.id != comment.post.author_id: abort(403)
 		
-		if comment.post.ghost: comment.is_pinned = "(OP)"
-		else: comment.is_pinned = v.username + " (OP)"
+		if comment.post.ghost: comment.stickied = "(OP)"
+		else: comment.stickied = v.username + " (OP)"
 
 		g.db.add(comment)
 
@@ -919,13 +919,13 @@ def unpin_comment(cid, v):
 	
 	comment = get_comment(cid, v=v)
 	
-	if comment.is_pinned:
+	if comment.stickied:
 		if v.id != comment.post.author_id: abort(403)
 
-		if not comment.is_pinned.endswith(" (OP)"): 
+		if not comment.stickied.endswith(" (OP)"): 
 			return {"error": "You can only unpin comments you have pinned!"}
 
-		comment.is_pinned = None
+		comment.stickied = None
 		g.db.add(comment)
 
 		if v.id != comment.author_id:
@@ -941,10 +941,10 @@ def mod_pin(cid, v):
 	
 	comment = get_comment(cid, v=v)
 	
-	if not comment.is_pinned:
+	if not comment.stickied:
 		if not (comment.post.sub and v.mods(comment.post.sub)): abort(403)
 		
-		comment.is_pinned = v.username + " (Mod)"
+		comment.stickied = v.username + " (Mod)"
 
 		g.db.add(comment)
 
@@ -962,10 +962,10 @@ def mod_unpin(cid, v):
 	
 	comment = get_comment(cid, v=v)
 	
-	if comment.is_pinned:
+	if comment.stickied:
 		if not (comment.post.sub and v.mods(comment.post.sub)): abort(403)
 
-		comment.is_pinned = None
+		comment.stickied = None
 		g.db.add(comment)
 
 		if v.id != comment.author_id:
diff --git a/files/routes/posts.py b/files/routes/posts.py
index 29046f2ff2..6623ddc23e 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -181,9 +181,9 @@ def post_id(pid, anything=None, v=None, sub=None):
 			comment.is_blocked = c[3] or 0
 			output.append(comment)
 		
-		pinned = [c[0] for c in comments.filter(Comment.is_pinned != None).all()]
+		pinned = [c[0] for c in comments.filter(Comment.stickied != None).all()]
 		
-		comments = comments.filter(Comment.level == 1, Comment.is_pinned == None)
+		comments = comments.filter(Comment.level == 1, Comment.stickied == None)
 
 		if sort == "new":
 			comments = comments.order_by(Comment.created_utc.desc())
@@ -200,9 +200,9 @@ def post_id(pid, anything=None, v=None, sub=None):
 		second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None, Comment.wordle_result != None), func.length(Comment.body_html) <= 100).all()]
 		comments = first + second
 	else:
-		pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.is_pinned != None).all()
+		pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.stickied != None).all()
 
-		comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.level == 1, Comment.is_pinned == None)
+		comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.level == 1, Comment.stickied == None)
 
 		if sort == "new":
 			comments = comments.order_by(Comment.created_utc.desc())
@@ -243,9 +243,9 @@ def post_id(pid, anything=None, v=None, sub=None):
 		comments = comments2
 
 	for pin in pinned:
-		if pin.is_pinned_utc and int(time.time()) > pin.is_pinned_utc:
-			pin.is_pinned = None
-			pin.is_pinned_utc = None
+		if pin.stickied_utc and int(time.time()) > pin.stickied_utc:
+			pin.stickied = None
+			pin.stickied_utc = None
 			g.db.add(pin)
 			pinned.remove(pin)
 
@@ -285,7 +285,7 @@ def viewmore(v, pid, sort, offset):
 			votes.c.vote_type,
 			blocking.c.target_id,
 			blocked.c.target_id,
-		).filter(Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.is_pinned == None, Comment.id.notin_(ids))
+		).filter(Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.stickied == None, Comment.id.notin_(ids))
 		
 		if not (v and v.shadowbanned) and not (v and v.admin_level > 2):
 			comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None)
@@ -329,7 +329,7 @@ def viewmore(v, pid, sort, offset):
 		second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None, Comment.wordle_result != None), func.length(Comment.body_html) <= 100).all()]
 		comments = first + second
 	else:
-		comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.level == 1, Comment.is_pinned == None, Comment.id.notin_(ids))
+		comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.level == 1, Comment.stickied == None, Comment.id.notin_(ids))
 
 		if sort == "new":
 			comments = comments.order_by(Comment.created_utc.desc())
@@ -532,7 +532,7 @@ def edit_post(pid, v):
 				over_18=False,
 				is_bot=True,
 				app_id=None,
-				is_pinned='AutoJanny',
+				stickied='AutoJanny',
 				distinguish_level=6,
 				body_html=body_jannied_html,
 				ghost=p.ghost
@@ -1224,7 +1224,7 @@ def submit_post(v, sub=None):
 			over_18=False,
 			is_bot=True,
 			app_id=None,
-			is_pinned='AutoJanny',
+			stickied='AutoJanny',
 			distinguish_level=6,
 			body_html=body_jannied_html,
 		)
diff --git a/files/templates/comments.html b/files/templates/comments.html
index 1e1818a8bd..2f124c5bbc 100644
--- a/files/templates/comments.html
+++ b/files/templates/comments.html
@@ -186,8 +186,8 @@
 				{% if c.active_flags(v) %}{{c.active_flags(v)}} Reports{% endif %}
 				{% if c.over_18 %}+18{% endif %}
 				{% if v and v.admin_level > 1 and c.author.shadowbanned %}{% endif %}
-				{% if c.is_pinned %}
-					
+				{% if c.stickied %}
+					
 				{% endif %}
 				{% if c.distinguish_level and not c.ghost %}{% endif %}
 				{% if c.is_op %}{% endif %}
@@ -441,7 +441,7 @@
 
 							
 
-							
+							
 							
 							
 							
@@ -486,9 +486,9 @@
 {% endif %}
 
 {% if url != "" %}
-	
+	
 		
-	
+	
 {% endif %}
 {% endif %}
 
@@ -641,7 +641,7 @@
 					{% if v %}
 						Report
 
-						Give Award
+						Give Award
 
 						Save
 
@@ -675,11 +675,11 @@
 
 						{% if v.admin_level < 2 %}
 							{% if c.post and v.id == c.post.author_id %}
-								Pin
-								Unpin
+								Pin
+								Unpin
 							{% elif c.post.sub and v.mods(c.post.sub) %}
-								Pin
-								Unpin
+								Pin
+								Unpin
 							{% endif %}
 						{% endif %}
 
@@ -720,8 +720,8 @@
 								Undistinguish
 							{% endif %}
 
-							Pin
-							Unpin
+							Pin
+							Unpin
 
 							Mark +18
 							Unmark +18
diff --git a/files/templates/post_actions.html b/files/templates/post_actions.html
index 806a6ec2da..e9d5cc72de 100644
--- a/files/templates/post_actions.html
+++ b/files/templates/post_actions.html
@@ -9,7 +9,7 @@
 {% if not p.ghost or v.id == AEVANN_ID %}Votes{% endif %}
 
 {% if v %}
-	Give Award
+	Give Award
 {% endif %}
 
 Copy link
diff --git a/files/templates/post_actions_mobile.html b/files/templates/post_actions_mobile.html
index 782a591b62..d60a35e7fb 100644
--- a/files/templates/post_actions_mobile.html
+++ b/files/templates/post_actions_mobile.html
@@ -12,7 +12,7 @@
 
 
 
-
+
 
 
 
diff --git a/schema.sql b/schema.sql
index ba21c97c6c..c498cbe7f9 100644
--- a/schema.sql
+++ b/schema.sql
@@ -273,13 +273,13 @@ CREATE TABLE public.comments (
     app_id integer,
     sentto integer,
     bannedfor boolean,
-    is_pinned character varying(40),
+    stickied character varying(40),
     body character varying(10000),
     body_html character varying(40000),
     ban_reason character varying(25),
     realupvotes integer DEFAULT 1 NOT NULL,
     top_comment_id integer,
-    is_pinned_utc integer,
+    stickied_utc integer,
     ghost boolean DEFAULT false NOT NULL,
     slots_result character varying(32),
     blackjack_result character varying(860),

From 27c3d89b5fc421ddd3767aa3a9bf470e5d38256c Mon Sep 17 00:00:00 2001
From: Aevann1 
Date: Fri, 27 May 2022 01:12:43 +0200
Subject: [PATCH 5/5] sfd

---
 files/templates/default.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/files/templates/default.html b/files/templates/default.html
index fb20a2f490..c2f2bf9b6c 100644
--- a/files/templates/default.html
+++ b/files/templates/default.html
@@ -99,7 +99,7 @@
 	
 
 	
-		
+