bbb
|
@ -4527,6 +4527,7 @@ blockquote p {
|
|||
border-radius: 0.2rem !important;
|
||||
margin-top: 0.5rem !important;
|
||||
margin-bottom: 0.5rem !important;
|
||||
cursor: pointer;
|
||||
}
|
||||
.embedvid {
|
||||
max-height: 20rem !important;
|
||||
|
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 7.9 KiB |
|
@ -61,25 +61,6 @@ def add_notif(cid, uid):
|
|||
g.db.add(notif)
|
||||
|
||||
|
||||
def send_admin(vid, text):
|
||||
|
||||
text_html = sanitize(text, noimages=True)
|
||||
|
||||
new_comment = Comment(author_id=vid,
|
||||
parent_submission=None,
|
||||
level=1,
|
||||
sentto=0,
|
||||
body_html=text_html,
|
||||
)
|
||||
g.db.add(new_comment)
|
||||
g.db.flush()
|
||||
|
||||
admins = g.db.query(User).filter(User.admin_level > 2).all()
|
||||
for admin in admins:
|
||||
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
||||
g.db.add(notif)
|
||||
|
||||
|
||||
def NOTIFY_USERS(text, v):
|
||||
notify_users = set()
|
||||
for word, id in NOTIFIED_USERS.items():
|
||||
|
|
|
@ -154,22 +154,14 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False):
|
|||
for tag in soup.find_all("img"):
|
||||
|
||||
if tag.get("src") and "pp20" not in tag.get("class", ""):
|
||||
|
||||
if site not in tag["src"] and not tag["src"].startswith('/'): tag["rel"] = "nofollow noopener noreferrer"
|
||||
tag["class"] = "in-comment-image"
|
||||
tag["loading"] = "lazy"
|
||||
tag["data-src"] = tag["src"]
|
||||
tag["src"] = "/static/assets/images/loading.webp"
|
||||
tag['alt'] = f''
|
||||
|
||||
link = soup.new_tag("a")
|
||||
link["href"] = tag["data-src"]
|
||||
if site not in link["href"] and not link["href"].startswith('/'): link["rel"] = "nofollow noopener noreferrer"
|
||||
link["onclick"] = f"expandDesktopImage('{tag['data-src']}');"
|
||||
link["data-bs-toggle"] = "modal"
|
||||
link["data-bs-target"] = "#expandImageModal"
|
||||
|
||||
tag.wrap(link)
|
||||
tag["onclick"] = f"expandDesktopImage(this.data-src);"
|
||||
tag["data-bs-toggle"] = "modal"
|
||||
tag["data-bs-target"] = "#expandImageModal"
|
||||
|
||||
for tag in soup.find_all("a"):
|
||||
if tag.get("href"):
|
||||
|
|
|
@ -50,7 +50,23 @@ def request_api_keys(v):
|
|||
|
||||
g.db.add(new_app)
|
||||
|
||||
send_admin(NOTIFICATIONS_ID, f"{v.username} has requested API keys for `{request.values.get('name')}`. You can approve or deny the request [here](/admin/apps).")
|
||||
text = f"{v.username} has requested API keys for `{request.values.get('name')}`. You can approve or deny the request [here](/admin/apps)."
|
||||
|
||||
text_html = sanitize(text, noimages=True)
|
||||
|
||||
new_comment = Comment(author_id=NOTIFICATIONS_ID,
|
||||
parent_submission=None,
|
||||
level=1,
|
||||
sentto=0,
|
||||
body_html=text_html,
|
||||
)
|
||||
g.db.add(new_comment)
|
||||
g.db.flush()
|
||||
|
||||
admins = g.db.query(User).filter(User.admin_level > 2).all()
|
||||
for admin in admins:
|
||||
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
||||
g.db.add(notif)
|
||||
|
||||
g.db.commit()
|
||||
|
||||
|
|
|
@ -280,8 +280,42 @@ def contact(v):
|
|||
@limiter.limit("6/hour")
|
||||
@auth_required
|
||||
def submit_contact(v):
|
||||
message = f'This message has been sent automatically to all admins via [/contact](/contact), user email is "{v.email}"\n\nMessage:\n\n' + request.values.get("message", "")
|
||||
send_admin(v.id, message)
|
||||
body = request.values.get("message")
|
||||
if not body: abort(400)
|
||||
|
||||
body = f'This message has been sent automatically to all admins via [/contact](/contact), user email is "{v.email}"\n\nMessage:\n\n' + body
|
||||
body_html = sanitize(body, noimages=True)
|
||||
|
||||
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
|
||||
file=request.files["file"]
|
||||
if file.content_type.startswith('image/'):
|
||||
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
file.save(name)
|
||||
url = process_image(name)
|
||||
body_html += f'<img data-bs-target="#expandImageModal" data-bs-toggle="modal" onclick="expandDesktopImage(this.src)" class="in-comment-image" src="{url}" loading="lazy">'
|
||||
elif file.content_type.startswith('video/'):
|
||||
file.save("video.mp4")
|
||||
with open("video.mp4", 'rb') as f:
|
||||
try: url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
|
||||
except: return {"error": "Imgur error"}, 400
|
||||
if url.endswith('.'): url += 'mp4'
|
||||
body_html += f"<p>{url}</p>"
|
||||
else: return {"error": "Image/Video files only"}, 400
|
||||
|
||||
new_comment = Comment(author_id=v.id,
|
||||
parent_submission=None,
|
||||
level=1,
|
||||
sentto=0,
|
||||
body_html=body_html,
|
||||
)
|
||||
g.db.add(new_comment)
|
||||
g.db.flush()
|
||||
|
||||
admins = g.db.query(User).filter(User.admin_level > 2).all()
|
||||
for admin in admins:
|
||||
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
||||
g.db.add(notif)
|
||||
|
||||
g.db.commit()
|
||||
if not v or v.oldsite: template = ''
|
||||
else: template = 'CHRISTMAS/'
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -39,7 +39,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
{% endif %}
|
||||
|
||||
</head>
|
||||
|
|
|
@ -26,13 +26,16 @@
|
|||
<label class="mt-3">Your Email</label>
|
||||
<input autocomplete="off" class="form-control" value="{{v.email}}" readonly="readonly" disabled>
|
||||
|
||||
<form id="contactform" action="/send_admin" method="post">
|
||||
<form id="contactform" action="/send_admin" method="post" enctype="multipart/form-data">
|
||||
|
||||
<label for="input-message" class="mt-3">Your message</label>
|
||||
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<textarea autocomplete="off" maxlength="10000" id="input-message" form="contactform" name="message" class="form-control" required></textarea>
|
||||
<label class="btn btn-secondary m-0 mt-3" for="file-upload">
|
||||
<div id="filename"><i class="far fa-image"></i></div>
|
||||
<input autocomplete="off" id="file-upload" type="file" name="file" accept="image/*, video/*" {% if request.headers.get('cf-ipcountry')=="T1" %}disabled{% endif %} onchange="document.getElementById('filename').innerHTML='image/video';" hidden>
|
||||
</label>
|
||||
<input autocomplete="off" type="submit" value="Submit" class="btn btn-primary mt-3">
|
||||
|
||||
</form>
|
||||
|
||||
<pre>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<script src="/static/assets/js/bootstrap.js?a=3"></script>
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
|
@ -32,7 +32,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
{% endif %}
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{% block content %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -30,7 +30,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
{% endif %}
|
||||
|
||||
<div class="row justify-content-around">
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{% endblock %}
|
||||
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
|
||||
</head>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<title>2-Step Login - {{SITE_NAME}}</title>
|
||||
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<tr>
|
||||
<td style="font-weight: bold">{{loop.index}}</td>
|
||||
<td style="font-weight: bold">{{k[0]}}</td>
|
||||
<td><img class="marsey" loading="lazy" data-bs-toggle="tooltip" alt=":{{k[0]}}:" title=":{{k[0]}}:" delay="0" src="/static/assets/images/emojis/{{k[0]}}.webp?a=1001" ></td>
|
||||
<td><img class="marsey" loading="lazy" data-bs-toggle="tooltip" alt=":{{k[0]}}:" title=":{{k[0]}}:" delay="0" src="/static/assets/images/emojis/{{k[0]}}.webp?a=1002" ></td>
|
||||
<td style="font-weight: bold">{{k[2]}}</td>
|
||||
<td>{% if k[1] in ('anton-d','unknown') %}{{k[1]}}{% else %}<a style="font-weight:bold;" href="/@{{k[1]}}"><img alt="@{{k[1]}}'s profile picture" loading="lazy" src="/@{{k[1]}}/pic" class="pp20">{{k[1]}}</a>{% endif %}</td>
|
||||
</tr>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
{% endif %}
|
||||
</head>
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<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>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<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>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
{% block stylesheets %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -50,7 +50,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=75">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=76">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|