diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index f97463828b..183d1090a3 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -215,9 +215,16 @@ def sanitize(sanitized, noimages=False): if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.gif'): sanitized = sanitized.replace(f'
:{i.group(1)}:
', f'')
+ if session.get(i.group(1)): session[i.group(1)] += 1
+ else: session[i.group(1)] = 1
+
for i in re.finditer(':([^ ]{1,30}?):', sanitized):
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.gif'):
sanitized = sanitized.replace(f':{i.group(1)}:', f'
')
+
+ if session.get(i.group(1)): session[i.group(1)] += 1
+ else: session[i.group(1)] = 1
+
sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.", "https://").replace("https://m.", "https://")
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 93fbace37a..30ac2dfbc2 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -22,19 +22,6 @@ from files.helpers.discord import add_role
IMGUR_KEY = environ.get("IMGUR_KEY", "").strip()
-@app.get("/admin/received_awards")
-@admin_level_required(6)
-def received_awards(v):
- for u in g.db.query(User).options(lazyload('*')).all():
- posts_idlist = g.db.query(Submission.id).filter_by(author_id=u.id).subquery()
- comments_idlist = g.db.query(Comment.id).filter_by(author_id=u.id).subquery()
-
- post_awards = g.db.query(AwardRelationship).filter(AwardRelationship.submission_id.in_(posts_idlist)).count()
- comment_awards = g.db.query(AwardRelationship).filter(AwardRelationship.comment_id.in_(comments_idlist)).count()
- u.received_award_count = post_awards + comment_awards
- g.db.add(u)
- return "sex"
-
@app.get("/imgurcredits")
@admin_level_required(6)
def imgurcredits(v):