master
Aevann1 2021-12-23 16:19:18 +02:00
parent 0907ea77c1
commit 0e6b412e25
5 changed files with 49 additions and 36 deletions

View File

@ -52,14 +52,6 @@ def distribute(v, cid):
g.db.commit()
return f"Each winner has received {coinsperperson} coins!"
@app.get("/truescore")
@auth_desired
def truescore(v):
users = g.db.query(User).order_by(User.truecoins.desc()).limit(25).all()
if not v or v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}truescore.html", v=v, users=users)
@app.post("/@<username>/revert_actions")
@limiter.limit("1/second")
@admin_level_required(3)

View File

@ -1028,6 +1028,7 @@ def submit_post(v):
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
file.save(name)
new_post.url = process_image(name)
new_post.thumburl = process_image(name, True)
elif file.content_type.startswith('video/'):
file.save("video.mp4")
@ -1042,8 +1043,7 @@ def submit_post(v):
if (new_post.url or request.files.get('file')) and request.headers.get('cf-ipcountry')!="T1":
gevent.spawn( thumbnail_thread, new_post.id)
if not new_post.thumburl and new_post.url and request.headers.get('cf-ipcountry')!="T1": gevent.spawn( thumbnail_thread, new_post.id)
if not new_post.private:

View File

@ -256,15 +256,17 @@ def transfer_coins(v, username):
@app.get("/leaderboard")
@auth_desired
def leaderboard(v):
if not v or v.oldsite: template = ''
else: template = 'CHRISTMAS/'
users = g.db.query(User)
users1 = users.order_by(User.coins.desc()).limit(25).all()
users2 = users.order_by(User.stored_subscriber_count.desc()).limit(15).all()
users3 = users.order_by(User.post_count.desc()).limit(10).all()
users4 = users.order_by(User.comment_count.desc()).limit(10).all()
users5 = users.order_by(User.received_award_count.desc()).limit(10).all()
users7 = users.order_by(User.coins_spent.desc()).limit(20).all()
users2 = users.order_by(User.stored_subscriber_count.desc()).limit(25).all()
users3 = users.order_by(User.post_count.desc()).limit(25).all()
users4 = users.order_by(User.comment_count.desc()).limit(25).all()
users5 = users.order_by(User.received_award_count.desc()).limit(25).all()
users7 = users.order_by(User.coins_spent.desc()).limit(25).all()
users10 = g.db.query(User).order_by(User.truecoins.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()
@ -279,20 +281,11 @@ def leaderboard(v):
users9 = sorted(users9, key=lambda x: x[1], reverse=True)[:25]
if 'pcmemes.net' == request.host:
users6 = users.order_by(User.basedcount.desc()).limit(10).all()
if not v or v.oldsite: template = ''
else: template = 'CHRISTMAS/'
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)
if not v or v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users7=users7, users9=users9)
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)
return render_template(f"{template}leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users7=users7, users9=users9, users10=users10)
@app.get("/@<username>/css")

View File

@ -24,7 +24,7 @@
<li><a href="/admin/users">Users Feed</a></li>
<li><a href="/admin/shadowbanned">Shadowbanned Users</a></li>
<li><a href="/admin/agendaposters">Users with Agendaposter Theme</a></li>
<li><a href="/admin/truescore">Users by True Score</a></li>
<li><a href="/admin/grassed">Currently Grassed Users</a></li>
</ul>
<h4>Safety</h4>

View File

@ -28,7 +28,7 @@
</pre>
<h5 style="font-weight:bold;text-align: center;">Top 20 by coins spent in shop</h5>
<h5 style="font-weight:bold;text-align: center;">Top 25 by coins spent in shop</h5>
<pre>
@ -56,7 +56,35 @@
</pre>
<h5 style="font-weight:bold;text-align: center;">Top 15 by followers</h5>
<h5 style="font-weight:bold;text-align: center;">Top 25 by truescore</h5>
<pre>
</pre>
<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">Truescore</th>
</tr>
</thead>
<tbody id="followers-table">
{% for user in users10 %}
<tr>
<td style="font-weight: bold">{{loop.index}}</td>
<td><a style="color:#{{user[0].namecolor}}; font-weight:bold;" href="/@{{user[0].username}}"><img 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; text-align:right;">{{user.truescore}}</td>
</tr>
{% endfor %}
</tbody>
</table>
<pre>
</pre>
<h5 style="font-weight:bold;text-align: center;">Top 25 by followers</h5>
<pre>
@ -81,7 +109,7 @@
</pre>
<h5 style="font-weight:bold;text-align: center;">Top 10 by post count</h5>
<h5 style="font-weight:bold;text-align: center;">top 25 by post count</h5>
<pre>
@ -106,7 +134,7 @@
</pre>
<h5 style="font-weight:bold;text-align: center;">Top 10 by comment count</h5>
<h5 style="font-weight:bold;text-align: center;">top 25 by comment count</h5>
<pre>
@ -133,7 +161,7 @@
</pre>
<h5 style="font-weight:bold;text-align: center;">Top 10 by received awards</h5>
<h5 style="font-weight:bold;text-align: center;">top 25 by received awards</h5>
<pre>
@ -193,7 +221,7 @@
</pre>
<h5 style="font-weight:bold;text-align: center;">Top 10 by based count</h5>
<h5 style="font-weight:bold;text-align: center;">top 25 by based count</h5>
<pre>