forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-01-11 22:42:35 +02:00
parent 53e6e546a0
commit aa6985279f
4 changed files with 21 additions and 19 deletions

View File

@ -1,4 +1,4 @@
from os import environ, listdir
from os import environ
import re
from copy import deepcopy
from json import loads
@ -21,15 +21,6 @@ del result
marseys = dict(sorted(marseys.items(), key=lambda x: x[1]))
if SITE == 'rdrama.net':
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 ",
' to ': " too ",
@ -775,6 +766,4 @@ NOTIFIED_USERS = {
'dong': DONGER_ID,
'dong': FARTBINN_ID,
'kippy': KIPPY_ID,
}
num_banners = len(listdir('files/assets/images/Drama/banners')) + 1
}

View File

@ -1,7 +1,8 @@
from files.__main__ import app
from .get import *
from files.helpers import const
from os import listdir, environ
num_banners = len(listdir('files/assets/images/Drama/banners')) + 1
@app.template_filter("full_link")
def full_link(url):
@ -26,5 +27,4 @@ def post_embed(id, v):
@app.context_processor
def inject_constants():
constants = [c for c in dir(const) if not c.startswith("_")]
return {c:getattr(const, c) for c in constants}
return {"num_banners":num_banners, "environ":environ}

View File

@ -8,7 +8,7 @@ from files.helpers.sanitize import *
from files.helpers.const import *
from files.mail import *
from flask import *
from files.__main__ import app, limiter
from files.__main__ import app, limiter, db_session
from pusher_push_notifications import PushNotifications
from collections import Counter
@ -16,7 +16,20 @@ site = environ.get("DOMAIN").strip()
beams_client = PushNotifications(instance_id=PUSHER_INSTANCE_ID, secret_key=PUSHER_KEY)
if True:
topmakers = {}
for k, val in marseys.items():
if val in topmakers: topmakers[val] += 1
else: topmakers[val] = 1
topmakers.pop('unknown','anton-d')
db = db_session()
topmakers2 = db.query(User).filter(func.lower(User.username).in_(topmakers.keys())).all()
topmakers3 = []
for user in topmakers2:
topmakers3.append((user, topmakers[user.username.lower()]))
topmakers = sorted(topmakers3, key=lambda x: x[1], reverse=True)[:25]
db.close()
@app.get("/grassed")
@auth_desired
@ -317,7 +330,7 @@ def leaderboard(v):
for user in users11: users12.append((user, badges[user.id]))
users12 = sorted(users12, key=lambda x: x[1], reverse=True)[:25]
if request.host == 'rdrama.net': users13 = topmakers
if True: users13 = topmakers
else: users13 = None
votes1 = g.db.query(Vote.user_id, func.count(Vote.user_id)).filter(Vote.vote_type==1).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).all()

View File

@ -296,7 +296,7 @@
{% 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><a style="color:#{{user[0].namecolor}}; font-weight:bold;" href="/@{{user[0].username}}"><img alt="@{{user[0].username}}'s profile picture" loading="lazy" src="/uid/{{user[0].id}}/pic" class="pp20"><span {% if user[0].patron %}class="patron" style="background-color:#{{user[0].namecolor}}"{% endif %}>{{user[0].username}}</span></a></td>
<td style="font-weight: bold">{{user[1]}}</td>
</tr>
{% endfor %}