bb
This commit is contained in:
parent
00a59e869f
commit
d5122296a2
3 changed files with 18 additions and 15 deletions
|
@ -6,8 +6,6 @@ from json import loads
|
||||||
SITE = environ.get("DOMAIN", '').strip()
|
SITE = environ.get("DOMAIN", '').strip()
|
||||||
SITE_NAME = environ.get("SITE_NAME", '').strip()
|
SITE_NAME = environ.get("SITE_NAME", '').strip()
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
with open("files/assets/js/emoji_modal.js", 'r') as file:
|
with open("files/assets/js/emoji_modal.js", 'r') as file:
|
||||||
marseytext = file.read().split('emojis: ')[1].split('cops police"},')[0] + '"}}'
|
marseytext = file.read().split('emojis: ')[1].split('cops police"},')[0] + '"}}'
|
||||||
result = loads(marseytext)
|
result = loads(marseytext)
|
||||||
|
@ -19,8 +17,6 @@ for k, val in result.items():
|
||||||
|
|
||||||
del result
|
del result
|
||||||
|
|
||||||
marseys = dict(sorted(marseys.items(), key=lambda x: x[1]))
|
|
||||||
|
|
||||||
AJ_REPLACEMENTS = {
|
AJ_REPLACEMENTS = {
|
||||||
' your ': " you're ",
|
' your ': " you're ",
|
||||||
' to ': " too ",
|
' to ': " too ",
|
||||||
|
|
|
@ -18,9 +18,18 @@ def privacy(v):
|
||||||
return render_template("privacy.html", v=v)
|
return render_template("privacy.html", v=v)
|
||||||
|
|
||||||
@app.get("/marseys")
|
@app.get("/marseys")
|
||||||
@auth_required
|
@admin_level_required(3)
|
||||||
def emojis(v):
|
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")
|
@app.get("/terms")
|
||||||
@auth_required
|
@auth_required
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
{% extends "default.html" %}
|
|
||||||
{% block content %}
|
|
||||||
<pre>
|
<pre>
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,19 +8,19 @@
|
||||||
<th style="font-weight: bold">#</th>
|
<th style="font-weight: bold">#</th>
|
||||||
<th style="font-weight: bold">Name</th>
|
<th style="font-weight: bold">Name</th>
|
||||||
<th style="font-weight: bold">Marsey</th>
|
<th style="font-weight: bold">Marsey</th>
|
||||||
|
<th style="font-weight: bold">Usage</th>
|
||||||
<th style="font-weight: bold">Author</th>
|
<th style="font-weight: bold">Author</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="followers-table">
|
<tbody id="followers-table">
|
||||||
{% for marsey, author in marseys %}
|
{% for k in marseys %}
|
||||||
<tr>
|
<tr>
|
||||||
<td style="font-weight: bold">{{loop.index}}</td>
|
<td style="font-weight: bold">{{loop.index}}</td>
|
||||||
<td style="font-weight: bold">{{marsey}}</td>
|
<td style="font-weight: bold">{{k[0]}}</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><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>{% 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[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>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% endblock %}
|
|
Loading…
Add table
Add a link
Reference in a new issue