fsdsf
This commit is contained in:
parent
61696e9ddb
commit
d09d7a0c64
8 changed files with 937 additions and 890 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,16 +1,31 @@
|
||||||
from os import environ, listdir
|
from os import environ, listdir
|
||||||
import re
|
import re
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
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()
|
||||||
|
|
||||||
marseys = []
|
import json
|
||||||
others = []
|
|
||||||
for x in sorted(x.replace('.webp','') for x in listdir("files/assets/images/emojis")):
|
with open("files/assets/js/emoji_modal.js", 'r') as file:
|
||||||
if x.startswith('mar') or x.endswith('sey'): marseys.append(x)
|
text = file.read().split('emojis: ')[1].split('cops police"},')[0] + '"}}'
|
||||||
else: others.append(x)
|
result = loads(text)
|
||||||
allemojis = marseys + others
|
|
||||||
|
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 = {
|
AJ_REPLACEMENTS = {
|
||||||
' your ': " you're ",
|
' your ': " you're ",
|
||||||
|
|
|
@ -17,12 +17,10 @@ site_name = environ.get("SITE_NAME").strip()
|
||||||
def privacy(v):
|
def privacy(v):
|
||||||
return render_template(f"privacy.html", v=v)
|
return render_template(f"privacy.html", v=v)
|
||||||
|
|
||||||
@app.get("/emojis")
|
@app.get("/marseys")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def emojis(v):
|
def emojis(v):
|
||||||
if not v or v.oldsite: template = ''
|
return render_template(f"marseys.html", v=v, marseys=marseys.items())
|
||||||
else: template = 'CHRISTMAS/'
|
|
||||||
return render_template(f"{template}emojis.html", v=v, emojis=allemojis)
|
|
||||||
|
|
||||||
@app.get('/sidebar')
|
@app.get('/sidebar')
|
||||||
@auth_desired
|
@auth_desired
|
||||||
|
|
|
@ -283,7 +283,7 @@ def leaderboard(v):
|
||||||
|
|
||||||
if 'pcmemes.net' == request.host: users6 = users.order_by(User.basedcount.desc()).limit(10).all()
|
if 'pcmemes.net' == request.host: users6 = users.order_by(User.basedcount.desc()).limit(10).all()
|
||||||
else: users6 = None
|
else: users6 = None
|
||||||
|
|
||||||
users7 = users.order_by(User.coins_spent.desc()).limit(25).all()
|
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()
|
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]))
|
for user in users11: users12.append((user, badges[user.id]))
|
||||||
users12 = sorted(users12, key=lambda x: x[1], reverse=True)[:25]
|
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")
|
@app.get("/@<username>/css")
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
</div>
|
</div>
|
||||||
</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>
|
<style>
|
||||||
a.emojitab {
|
a.emojitab {
|
||||||
|
|
|
@ -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 %}
|
|
|
@ -245,7 +245,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% if request.host == "pcmemes.net" %}
|
{% if users6 %}
|
||||||
<pre>
|
<pre>
|
||||||
|
|
||||||
|
|
||||||
|
@ -272,4 +272,36 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% 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 %}
|
{% endblock %}
|
28
files/templates/marseys.html
Normal file
28
files/templates/marseys.html
Normal 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 %}
|
Loading…
Add table
Add a link
Reference in a new issue