forked from rDrama/rDrama
fix emoji tags
parent
3b7eeffba5
commit
67d8bd4324
|
@ -220,7 +220,7 @@ def sanitize(sanitized, noimages=False):
|
||||||
for i in re.finditer('<p>:([^ ]{1,30}?):</p>', sanitized):
|
for i in re.finditer('<p>:([^ ]{1,30}?):</p>', sanitized):
|
||||||
emoji = i.group(1).lower()
|
emoji = i.group(1).lower()
|
||||||
if path.isfile(f'./files/assets/images/emojis/{emoji}.webp'):
|
if path.isfile(f'./files/assets/images/emojis/{emoji}.webp'):
|
||||||
sanitized = sanitized.replace(f'<p>:{emoji}:</p>', f'<p style="margin-bottom:0;"><img loading="lazy" data-toggle="tooltip" title="{emoji}" delay="0" height=60 src="https://{site}/assets/images/emojis/{emoji}.webp"</p>')
|
sanitized = sanitized.replace(f'<p>:{emoji}:</p>', f'<p style="margin-bottom:0;"><img loading="lazy" data-toggle="tooltip" title="{emoji}" delay="0" height=60 src="https://{site}/assets/images/emojis/{emoji}.webp"></p>')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if emoji in session["favorite_emojis"]: session["favorite_emojis"][emoji] += 1
|
if emoji in session["favorite_emojis"]: session["favorite_emojis"][emoji] += 1
|
||||||
|
@ -231,7 +231,7 @@ def sanitize(sanitized, noimages=False):
|
||||||
for i in re.finditer(':([^ ]{1,30}?):', sanitized):
|
for i in re.finditer(':([^ ]{1,30}?):', sanitized):
|
||||||
emoji = i.group(1).lower()
|
emoji = i.group(1).lower()
|
||||||
if path.isfile(f'./files/assets/images/emojis/{emoji}.webp'):
|
if path.isfile(f'./files/assets/images/emojis/{emoji}.webp'):
|
||||||
sanitized = sanitized.replace(f':{emoji}:', f'<img loading="lazy" data-toggle="tooltip" title="{emoji}" delay="0" height=30 src="https://{site}/assets/images/emojis/{emoji}.webp"<span>')
|
sanitized = sanitized.replace(f':{emoji}:', f'<img loading="lazy" data-toggle="tooltip" title="{emoji}" delay="0" height=30 src="https://{site}/assets/images/emojis/{emoji}.webp">')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if emoji in session["favorite_emojis"]: session["favorite_emojis"][emoji] += 1
|
if emoji in session["favorite_emojis"]: session["favorite_emojis"][emoji] += 1
|
||||||
|
@ -264,6 +264,6 @@ def sanitize(sanitized, noimages=False):
|
||||||
sanitized = sanitized.replace(rd, "https://old.reddit.com/")
|
sanitized = sanitized.replace(rd, "https://old.reddit.com/")
|
||||||
|
|
||||||
sanitized = re.sub(' (https:\/\/[^ <>]*)', r' <a target="_blank" rel="nofollow noopener noreferrer" href="\1">\1</a>', sanitized)
|
sanitized = re.sub(' (https:\/\/[^ <>]*)', r' <a target="_blank" rel="nofollow noopener noreferrer" href="\1">\1</a>', sanitized)
|
||||||
sanitized = re.sub('<p>(https:\/\/[^ <>]*)', r'<p><a target="_blank" rel="nofollow noopener noreferrer" href="\1">\1</a>', sanitized)
|
sanitized = re.sub('<p>(https:\/\/[^ <>]*)', r'<p><a target="_blank" rel="nofollow noopener noreferrer" href="\1">\1</a></p>', sanitized)
|
||||||
|
|
||||||
return sanitized
|
return sanitized
|
||||||
|
|
|
@ -439,7 +439,7 @@ def filter_title(title):
|
||||||
|
|
||||||
for i in re.finditer(':(.{1,30}?):', title):
|
for i in re.finditer(':(.{1,30}?):', title):
|
||||||
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.webp'):
|
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.webp'):
|
||||||
title = title.replace(f':{i.group(1)}:', f'<img loading="lazy" data-toggle="tooltip" title="{i.group(1)}" delay="0" height=20 src="https://{site}/assets/images/emojis/{i.group(1)}.webp"<span>')
|
title = title.replace(f':{i.group(1)}:', f'<img loading="lazy" data-toggle="tooltip" title="{i.group(1)}" delay="0" height=20 src="https://{site}/assets/images/emojis/{i.group(1)}.webp">')
|
||||||
|
|
||||||
return title
|
return title
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ def api_flag_post(pid, v):
|
||||||
|
|
||||||
for i in re.finditer(':(.{1,30}?):', reason):
|
for i in re.finditer(':(.{1,30}?):', reason):
|
||||||
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.webp'):
|
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.webp'):
|
||||||
reason = reason.replace(f':{i.group(1)}:', f'<img loading="lazy" data-toggle="tooltip" title="{i.group(1)}" delay="0" height=20 src="https://{site}/assets/images/emojis/{i.group(1)}.webp"<span>')
|
reason = reason.replace(f':{i.group(1)}:', f'<img loading="lazy" data-toggle="tooltip" title="{i.group(1)}" delay="0" height=20 src="https://{site}/assets/images/emojis/{i.group(1)}.webp">')
|
||||||
|
|
||||||
flag = Flag(post_id=post.id,
|
flag = Flag(post_id=post.id,
|
||||||
user_id=v.id,
|
user_id=v.id,
|
||||||
|
@ -52,7 +52,7 @@ def api_flag_comment(cid, v):
|
||||||
|
|
||||||
for i in re.finditer(':(.{1,30}?):', reason):
|
for i in re.finditer(':(.{1,30}?):', reason):
|
||||||
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.webp'):
|
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.webp'):
|
||||||
reason = reason.replace(f':{i.group(1)}:', f'<img loading="lazy" data-toggle="tooltip" title="{i.group(1)}" delay="0" height=20 src="https://{site}/assets/images/emojis/{i.group(1)}.webp"<span>')
|
reason = reason.replace(f':{i.group(1)}:', f'<img loading="lazy" data-toggle="tooltip" title="{i.group(1)}" delay="0" height=20 src="https://{site}/assets/images/emojis/{i.group(1)}.webp">')
|
||||||
|
|
||||||
flag = CommentFlag(comment_id=comment.id,
|
flag = CommentFlag(comment_id=comment.id,
|
||||||
user_id=v.id,
|
user_id=v.id,
|
||||||
|
|
Loading…
Reference in New Issue