master
Aevann1 2022-01-12 03:46:16 +02:00
parent b5762b2e86
commit 1ed3410bee
3 changed files with 18 additions and 15 deletions

View File

@ -6,8 +6,6 @@ from json import loads
SITE = environ.get("DOMAIN", '').strip()
SITE_NAME = environ.get("SITE_NAME", '').strip()
import json
with open("files/assets/js/emoji_modal.js", 'r') as file:
marseytext = file.read().split('emojis: ')[1].split('cops police"},')[0] + '"}}'
result = loads(marseytext)
@ -19,8 +17,6 @@ for k, val in result.items():
del result
marseys = dict(sorted(marseys.items(), key=lambda x: x[1]))
AJ_REPLACEMENTS = {
' your ': " you're ",
' to ': " too ",

View File

@ -18,9 +18,18 @@ def privacy(v):
return render_template("privacy.html", v=v)
@app.get("/marseys")
@auth_required
@admin_level_required(3)
def emojis(v):
return render_template("marseys.html", v=v, marseys=marseys.items())
sorted_marseys = []
for k, val in marseys.items():
count = g.db.query(Comment.id).where(Comment.body.like(f'%:{k}:%')).count()
sorted_marseys.append((k, val, count))
sorted_marseys = sorted(sorted_marseys, key=lambda x: x[2])
text = render_template("marseys.html", v=v, marseys=sorted_marseys)
with open(f'files/templates/marseys.html', 'w+') as f: f.write(text)
return text
@app.get("/terms")
@auth_required

View File

@ -1,5 +1,3 @@
{% extends "default.html" %}
{% block content %}
<pre>
@ -10,19 +8,19 @@
<th style="font-weight: bold">#</th>
<th style="font-weight: bold">Name</th>
<th style="font-weight: bold">Marsey</th>
<th style="font-weight: bold">Usage</th>
<th style="font-weight: bold">Author</th>
</tr>
</thead>
<tbody id="followers-table">
{% for marsey, author in marseys %}
{% for k in marseys %}
<tr>
<td style="font-weight: bold">{{loop.index}}</td>
<td style="font-weight: bold">{{marsey}}</td>
<td><img loading="lazy" data-bs-toggle="tooltip" alt=":{{marsey}}:" title=":{{marsey}}:" delay="0" src="/static/assets/images/emojis/{{marsey}}.webp?a=1001" ></td>
<td>{% if author in ('anton-d','unknown') %}{{author}}{% else %}<a style="font-weight:bold;" href="/@{{author}}"><img alt="@{{author}}'s profile picture" loading="lazy" src="/@{{author}}/pic" class="pp20">{{author}}</a>{% endif %}</td>
<td style="font-weight: bold">{{k[0]}}</td>
<td><img 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 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>
{% endfor %}
</tbody>
</table>
{% endblock %}
</table>