remotes/1693045480750635534/spooky-22
Aevann1 2022-01-02 22:20:13 +02:00
parent 47bd01eaa6
commit 62be362806
7 changed files with 90 additions and 40 deletions

View File

@ -1,16 +1,31 @@
from os import environ, listdir
import re
from copy import deepcopy
from json import loads
SITE = environ.get("DOMAIN", '').strip()
SITE_NAME = environ.get("SITE_NAME", '').strip()
marseys = []
others = []
for x in sorted(x.replace('.webp','') for x in listdir("files/assets/images/emojis")):
if x.startswith('mar') or x.endswith('sey'): marseys.append(x)
else: others.append(x)
allemojis = marseys + others
import json
with open("files/assets/js/emoji_modal.js", 'r') as file:
text = file.read().split('emojis: ')[1].split('cops police"},')[0] + '"}}'
result = loads(text)
marseys = {}
for k, val in result.items():
marseys[k] = val['author']
del result
topmakers = {}
for k, val in marseys.items():
if val in topmakers: topmakers[val] += 1
else: topmakers[val] = 1
topmakers.pop('unknown')
topmakers = sorted(topmakers.items(), key=lambda x: x[1], reverse=True)[:25]
AJ_REPLACEMENTS = {
' your ': " you're ",

View File

@ -17,12 +17,10 @@ site_name = environ.get("SITE_NAME").strip()
def privacy(v):
return render_template(f"privacy.html", v=v)
@app.get("/emojis")
@app.get("/marseys")
@auth_desired
def emojis(v):
if not v or v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}emojis.html", v=v, emojis=allemojis)
return render_template(f"marseys.html", v=v, marseys=marseys.items())
@app.get('/sidebar')
@auth_desired

View File

@ -283,7 +283,7 @@ def leaderboard(v):
if 'pcmemes.net' == request.host: users6 = users.order_by(User.basedcount.desc()).limit(10).all()
else: users6 = None
users7 = users.order_by(User.coins_spent.desc()).limit(25).all()
votes1 = g.db.query(Submission.author_id, func.count(Submission.author_id)).join(Vote, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1).group_by(Submission.author_id).order_by(func.count(Submission.author_id).desc()).all()
@ -304,7 +304,10 @@ def leaderboard(v):
for user in users11: users12.append((user, badges[user.id]))
users12 = sorted(users12, key=lambda x: x[1], reverse=True)[:25]
return render_template(f"{template}leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users6=users6, users7=users7, users9=users9, users10=users10, users12=users12)
if True: users13 = topmakers
else: users13 = None
return render_template(f"{template}leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users6=users6, users7=users7, users9=users9, users10=users10, users12=users12, users13=users13)
@app.get("/@<username>/css")

View File

@ -80,7 +80,7 @@
</div>
</div>
<script src="/static/assets/js/emoji_modal.js?a=16"></script>
<script src="/static/assets/js/emoji_modal.js?a=17"></script>
<style>
a.emojitab {

View File

@ -1,26 +0,0 @@
{% extends "default.html" %}
{% block content %}
<pre>
</pre>
<div class="overflow-x-auto"><table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th style="font-weight: bold">#</th>
<th style="font-weight: bold">Name</th>
<th style="font-weight: bold">Emoji</th>
</tr>
</thead>
<tbody id="followers-table">
{% for emoji in emojis %}
<tr>
<td style="font-weight: bold">{{loop.index}}</td>
<td style="font-weight: bold">{{emoji}}</td>
<td><img loading="lazy" data-bs-toggle="tooltip" alt=":{{emoji}}:" title=":{{emoji}}:" delay="0" src="/static/assets/images/emojis/{{emoji}}.webp" ></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@ -245,7 +245,7 @@
{% if request.host == "pcmemes.net" %}
{% if users6 %}
<pre>
@ -272,4 +272,36 @@
{% endfor %}
</table>
{% endif %}
{% if users13 %}
<pre>
</pre>
<h5 style="font-weight:bold;text-align: center;">Top 25 by marseys made</h5>
<pre>
</pre>
<div class="overflow-x-auto"><table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th style="font-weight: bold">#</th>
<th style="font-weight: bold">Name</th>
<th style="font-weight: bold">Marseys</th>
</tr>
</thead>
<tbody id="followers-table">
{% for user in users13 %}
<tr>
<td style="font-weight: bold">{{loop.index}}</td>
<td>{% if user[0]=='anton-d' %}{{user[0]}}{% else %}<a style="font-weight:bold;" href="/@{{user[0]}}"><img alt="@{{user[0]}}'s profile picture" loading="lazy" src="/@{{user[0]}}/pic" class="pp20">{{user[0]}}</a>{% endif %}</td>
<td style="font-weight: bold">{{user[1]}}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,28 @@
{% extends "default.html" %}
{% block content %}
<pre>
</pre>
<div class="overflow-x-auto"><table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<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">Author</th>
</tr>
</thead>
<tbody id="followers-table">
{% for marsey, author 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" ></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>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}