df
This commit is contained in:
parent
05a0effc69
commit
7940782e61
6 changed files with 11 additions and 11 deletions
|
@ -12,15 +12,15 @@ function markdown(first, second) {
|
||||||
var remoji = emoji.replace(/:/g,'').toLowerCase();
|
var remoji = emoji.replace(/:/g,'').toLowerCase();
|
||||||
if (remoji.startsWith("!#") || remoji.startsWith("#!"))
|
if (remoji.startsWith("!#") || remoji.startsWith("#!"))
|
||||||
{
|
{
|
||||||
input = input.replace(emoji, "<img class='emoji-lg mirrored' src='/e/" + remoji.substring(2) + "'>")
|
input = input.replace(emoji, "<img class='emoji-lg mirrored' src='/e/" + remoji.substring(2) + ".webp'>")
|
||||||
} else if (remoji.startsWith("#"))
|
} else if (remoji.startsWith("#"))
|
||||||
{
|
{
|
||||||
input = input.replace(emoji, "<img class='emoji-lg' src='/e/" + remoji.substring(1) + "'>")
|
input = input.replace(emoji, "<img class='emoji-lg' src='/e/" + remoji.substring(1) + ".webp'>")
|
||||||
} else if (remoji.startsWith("!"))
|
} else if (remoji.startsWith("!"))
|
||||||
{
|
{
|
||||||
input = input.replace(emoji, "<img height=30 class='emoji mirrored' src='/e/" + remoji.substring(1) + "'>")
|
input = input.replace(emoji, "<img height=30 class='emoji mirrored' src='/e/" + remoji.substring(1) + ".webp'>")
|
||||||
} else {
|
} else {
|
||||||
input = input.replace(emoji, "<img height=30 class='emoji' src='/e/" + remoji + "'>")
|
input = input.replace(emoji, "<img height=30 class='emoji' src='/e/" + remoji + ".webp'>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,7 +248,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
||||||
elif remoji.endswith('pat') and path.isfile(f"files/assets/images/emojis/{remoji.replace('pat','')}.webp"):
|
elif remoji.endswith('pat') and path.isfile(f"files/assets/images/emojis/{remoji.replace('pat','')}.webp"):
|
||||||
pat(remoji.replace('pat',''))
|
pat(remoji.replace('pat',''))
|
||||||
new = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" class="{classes}" src="/e/{remoji}.webp">', new, flags=re.I|re.A)
|
new = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" class="{classes}" src="/e/{remoji}.webp">', new, flags=re.I|re.A)
|
||||||
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/e/{emoji}", f"https://{request.host}/e/{emoji}.webp"]}, timeout=5)
|
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/e/{emoji}.webp"]}, timeout=5)
|
||||||
|
|
||||||
|
|
||||||
sanitized = sanitized.replace(old, new)
|
sanitized = sanitized.replace(old, new)
|
||||||
|
@ -285,7 +285,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
||||||
elif emoji.endswith('pat') and path.isfile(f"files/assets/images/emojis/{emoji.replace('pat','')}.webp"):
|
elif emoji.endswith('pat') and path.isfile(f"files/assets/images/emojis/{emoji.replace('pat','')}.webp"):
|
||||||
pat(emoji.replace('pat',''))
|
pat(emoji.replace('pat',''))
|
||||||
sanitized = re.sub(f'(?<!"):{i.group(1).lower()}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{old}:" title=":!{old}:" class="{classes}" src="/e/{emoji}.webp">', sanitized, flags=re.I|re.A)
|
sanitized = re.sub(f'(?<!"):{i.group(1).lower()}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{old}:" title=":!{old}:" class="{classes}" src="/e/{emoji}.webp">', sanitized, flags=re.I|re.A)
|
||||||
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/e/{emoji}", f"https://{request.host}/e/{emoji}.webp"]}, timeout=5)
|
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/e/{emoji}.webp"]}, timeout=5)
|
||||||
|
|
||||||
|
|
||||||
for rd in ["://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it"]:
|
for rd in ["://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it"]:
|
||||||
|
@ -384,7 +384,7 @@ def filter_emojis_only(title, edit=False, graceful=False):
|
||||||
elif emoji.endswith('pat') and path.isfile(f"files/assets/images/emojis/{emoji.replace('pat','')}.webp"):
|
elif emoji.endswith('pat') and path.isfile(f"files/assets/images/emojis/{emoji.replace('pat','')}.webp"):
|
||||||
pat(emoji.replace('pat',''))
|
pat(emoji.replace('pat',''))
|
||||||
title = re.sub(f'(?<!"):{old}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{old}:" title=":{old}:" class="{classes}" src="/e/{emoji}.webp">', title, flags=re.I|re.A)
|
title = re.sub(f'(?<!"):{old}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{old}:" title=":{old}:" class="{classes}" src="/e/{emoji}.webp">', title, flags=re.I|re.A)
|
||||||
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/e/{emoji}", f"https://{request.host}/e/{emoji}.webp"]}, timeout=5)
|
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/e/{emoji}.webp"]}, timeout=5)
|
||||||
|
|
||||||
|
|
||||||
title = strikethrough_regex.sub(r'<del>\1</del>', title)
|
title = strikethrough_regex.sub(r'<del>\1</del>', title)
|
||||||
|
|
|
@ -351,7 +351,7 @@ def archives(path):
|
||||||
@app.get('/e/<emoji>')
|
@app.get('/e/<emoji>')
|
||||||
@limiter.exempt
|
@limiter.exempt
|
||||||
def emoji(emoji):
|
def emoji(emoji):
|
||||||
if not emoji.endswith('.webp'): emoji += '.webp'
|
if not emoji.endswith('.webp'): abort(404)
|
||||||
resp = make_response(send_from_directory('assets/images/emojis', emoji))
|
resp = make_response(send_from_directory('assets/images/emojis', emoji))
|
||||||
resp.headers.remove("Cache-Control")
|
resp.headers.remove("Cache-Control")
|
||||||
resp.headers.add("Cache-Control", "public, max-age=3153600")
|
resp.headers.add("Cache-Control", "public, max-age=3153600")
|
||||||
|
|
|
@ -842,7 +842,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<script src="/static/assets/js/marked.js?v=249"></script>
|
<script src="/static/assets/js/marked.js?v=250"></script>
|
||||||
<script src="/static/assets/js/comments_v.js?v=263"></script>
|
<script src="/static/assets/js/comments_v.js?v=263"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,7 @@
|
||||||
checkForRequired()
|
checkForRequired()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="/static/assets/js/marked.js?v=249"></script>
|
<script src="/static/assets/js/marked.js?v=250"></script>
|
||||||
<script src="/static/assets/js/formatting.js?v=240"></script>
|
<script src="/static/assets/js/formatting.js?v=240"></script>
|
||||||
<script src="/static/assets/js/submit.js?v=251"></script>
|
<script src="/static/assets/js/submit.js?v=251"></script>
|
||||||
{% include "emoji_modal.html" %}
|
{% include "emoji_modal.html" %}
|
||||||
|
|
|
@ -767,7 +767,7 @@
|
||||||
</nav>
|
</nav>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script src="/static/assets/js/marked.js?v=249"></script>
|
<script src="/static/assets/js/marked.js?v=250"></script>
|
||||||
|
|
||||||
|
|
||||||
{% if v and v.id != u.id and '/comments' not in request.path %}
|
{% if v and v.id != u.id and '/comments' not in request.path %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue