master
Aevann1 2021-09-05 19:55:36 +02:00
parent 344b65183e
commit 333d1bd6da
2 changed files with 7 additions and 13 deletions

View File

@ -215,10 +215,17 @@ def sanitize(sanitized, noimages=False):
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.gif'):
sanitized = sanitized.replace(f'<p>:{i.group(1)}:</p>', f'<p><img loading="lazy" data-toggle="tooltip" title="{i.group(1)}" delay="0" height=60 src="https://{site}/assets/images/emojis/{i.group(1)}.gif"</p>')
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'<img loading="lazy" data-toggle="tooltip" title="{i.group(1)}" delay="0" height=30 src="https://{site}/assets/images/emojis/{i.group(1)}.gif"<span>')
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://")
for i in re.finditer('" target="_blank">(https://youtube.com/watch\?v\=.*?)</a>', sanitized):

View File

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