gf
This commit is contained in:
parent
dd68d2e3c7
commit
96984143a9
2 changed files with 7 additions and 13 deletions
|
@ -215,9 +215,16 @@ def sanitize(sanitized, noimages=False):
|
||||||
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.gif'):
|
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>')
|
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):
|
for i in re.finditer(':([^ ]{1,30}?):', sanitized):
|
||||||
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.gif'):
|
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>')
|
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://")
|
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://")
|
||||||
|
|
||||||
|
|
|
@ -22,19 +22,6 @@ from files.helpers.discord import add_role
|
||||||
|
|
||||||
IMGUR_KEY = environ.get("IMGUR_KEY", "").strip()
|
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")
|
@app.get("/imgurcredits")
|
||||||
@admin_level_required(6)
|
@admin_level_required(6)
|
||||||
def imgurcredits(v):
|
def imgurcredits(v):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue