This commit is contained in:
Aevann1 2022-01-18 02:32:07 +02:00
parent 73eee35c71
commit 7145628359
12 changed files with 46 additions and 24 deletions

View file

@ -4769,3 +4769,14 @@ table {
margin-bottom: 7px; margin-bottom: 7px;
} }
} }
@keyframes golden {
from {filter: sepia(100%) saturate(2) drop-shadow(-1px 1px 1px gold)}
to {filter: sepia(100%) saturate(3) drop-shadow(-1px 1px 12px gold)}
}
img.golden {
animation-name: golden !important;
animation-duration: 1s !important;
animation-iteration-count: infinite !important;
animation-direction: alternate !important;
animation-timing-function: linear !important;
}

View file

@ -7,6 +7,7 @@ from os import path, environ
import re import re
from mistletoe import markdown from mistletoe import markdown
from json import loads, dump from json import loads, dump
from random import random
site = environ.get("DOMAIN").strip() site = environ.get("DOMAIN").strip()
@ -189,20 +190,22 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False):
for i in re.finditer('(?<!"):([!#A-Za-z0-9]{1,30}?):', new): for i in re.finditer('(?<!"):([!#A-Za-z0-9]{1,30}?):', new):
emoji = i.group(1).lower() emoji = i.group(1).lower()
if emoji.startswith("#!") or emoji.startswith("!#"): if emoji.startswith("#!") or emoji.startswith("!#"):
classes = 'class="emoji-lg mirrored" ' classes = 'emoji-lg mirrored'
remoji = emoji[2:] remoji = emoji[2:]
elif emoji.startswith("#"): elif emoji.startswith("#"):
classes = 'class="emoji-lg" ' classes = 'emoji-lg'
remoji = emoji[1:] remoji = emoji[1:]
elif emoji.startswith("!"): elif emoji.startswith("!"):
classes = 'class="emoji-md mirrored" ' classes = 'emoji-md mirrored'
remoji = emoji[1:] remoji = emoji[1:]
else: else:
classes = 'class="emoji-md" ' classes = 'emoji-md'
remoji = emoji remoji = emoji
if random() < 0.01: classes += ' golden'
if path.isfile(f'files/assets/images/emojis/{remoji}.webp'): if path.isfile(f'files/assets/images/emojis/{remoji}.webp'):
new = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" {classes}src="/static/assets/images/emojis/{remoji}.webp" >', new, flags=re.I) new = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{remoji}.webp" >', new, flags=re.I)
if comment: marseys_used.add(emoji) if comment: marseys_used.add(emoji)
sanitized = sanitized.replace(old, new) sanitized = sanitized.replace(old, new)
@ -212,12 +215,16 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False):
emoji = i.group(1).lower() emoji = i.group(1).lower()
if emoji.startswith("!"): if emoji.startswith("!"):
emoji = emoji[1:] emoji = emoji[1:]
classes = 'emoji mirrored'
if random() < 0.01: classes += ' golden'
if path.isfile(f'files/assets/images/emojis/{emoji}.webp'): if path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
sanitized = re.sub(f'(?<!"):!{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{emoji}:" title=":!{emoji}:" delay="0" class="emoji mirrored" src="/static/assets/images/emojis/{emoji}.webp">', sanitized, flags=re.I) sanitized = re.sub(f'(?<!"):!{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{emoji}:" title=":!{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', sanitized, flags=re.I)
if comment: marseys_used.add(emoji) if comment: marseys_used.add(emoji)
elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'): elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
sanitized = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="emoji" src="/static/assets/images/emojis/{emoji}.webp">', sanitized, flags=re.I) classes = 'emoji'
if random() < 0.01: classes += ' golden'
sanitized = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', sanitized, flags=re.I)
if comment: marseys_used.add(emoji) if comment: marseys_used.add(emoji)
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.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube") 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.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube")
@ -268,11 +275,15 @@ def filter_emojis_only(title):
if emoji.startswith("!"): if emoji.startswith("!"):
emoji = emoji[1:] emoji = emoji[1:]
classes = 'emoji mirrored'
if random() < 0.01: classes += ' golden'
if path.isfile(f'files/assets/images/emojis/{emoji}.webp'): if path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
title = re.sub(f'(?<!"):!{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{emoji}:" title=":!{emoji}:" delay="0" src="/static/assets/images/emojis/{emoji}.webp" class="emoji mirrored">', title, flags=re.I) title = re.sub(f'(?<!"):!{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{emoji}:" title=":!{emoji}:" delay="0" src="/static/assets/images/emojis/{emoji}.webp" class="{classes}">', title, flags=re.I)
elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'): elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
title = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="emoji" src="/static/assets/images/emojis/{emoji}.webp">', title, flags=re.I) classes = 'emoji mirrored'
if random() < 0.01: classes += ' golden'
title = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', title, flags=re.I)
if len(title) > 1500: abort(400) if len(title) > 1500: abort(400)
else: return title else: return title

View file

@ -15,7 +15,7 @@
{% if v %} {% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style> <style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
{% if v.agendaposter %} {% if v.agendaposter %}
<style> <style>
html { html {
@ -39,7 +39,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style> <style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
{% endif %} {% endif %}
</head> </head>

View file

@ -7,7 +7,7 @@
<script src="/static/assets/js/bootstrap.js?a=202"></script> <script src="/static/assets/js/bootstrap.js?a=202"></script>
{% if v %} {% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style> <style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84">
<link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11"> <link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
{% if v.agendaposter %} {% if v.agendaposter %}
<style> <style>
@ -32,7 +32,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style> <style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
{% endif %} {% endif %}
<meta charset="utf-8"> <meta charset="utf-8">

View file

@ -6,7 +6,7 @@
{% block content %} {% block content %}
{% if v %} {% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style> <style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
{% if v.agendaposter %} {% if v.agendaposter %}
<style> <style>
html { html {
@ -30,7 +30,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style> <style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
{% endif %} {% endif %}
<div class="row justify-content-around"> <div class="row justify-content-around">

View file

@ -18,7 +18,7 @@
{% endblock %} {% endblock %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style> <style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84">
<link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3"> <link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
</head> </head>

View file

@ -14,7 +14,7 @@
<title>2-Step Login - {{SITE_NAME}}</title> <title>2-Step Login - {{SITE_NAME}}</title>
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style> <style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
</head> </head>

View file

@ -34,7 +34,7 @@
<style>:root{--primary:#{{v.themecolor}}}</style> <style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
{% if v.agendaposter %} {% if v.agendaposter %}
<style> <style>
html { html {

View file

@ -39,10 +39,10 @@
{% if v %} {% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style> <style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
{% else %} {% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style> <style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
{% endif %} {% endif %}
</head> </head>

View file

@ -31,7 +31,7 @@
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %}</title> <title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %}</title>
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style> <style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
</head> </head>

View file

@ -32,7 +32,7 @@
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title> <title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style> <style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
</head> </head>

View file

@ -26,7 +26,7 @@
{% block stylesheets %} {% block stylesheets %}
{% if v %} {% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style> <style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
{% if v.agendaposter %} {% if v.agendaposter %}
<style> <style>
html { html {
@ -50,7 +50,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style> <style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=83"> <link rel="stylesheet" href="/static/assets/css/main.css?a=84">
<link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3"> <link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
{% endif %} {% endif %}
{% endblock %} {% endblock %}