forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-02-21 08:45:01 +02:00
parent 5686fb8b3f
commit 4049c2fe34
7 changed files with 88 additions and 18 deletions

View File

@ -157,7 +157,7 @@ def unblock_sub(v, sub):
return {"message": "Sub unblocked successfully!"}
@app.get("/s/<sub>/mods")
@is_not_permabanned
@auth_required
def mods(v, sub):
sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none()
if not sub: abort(404)
@ -167,6 +167,29 @@ def mods(v, sub):
return render_template("sub/mods.html", v=v, sub=sub, users=users)
@app.get("/s/<sub>/exilees")
@auth_required
def exilees(v, sub):
sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none()
if not sub: abort(404)
users = g.db.query(User).join(Exile, Exile.user_id==User.id).filter_by(sub=sub.name).all()
return render_template("sub/exilees.html", v=v, sub=sub, users=users)
@app.get("/s/<sub>/blockers")
@auth_required
def blockers(v, sub):
sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none()
if not sub: abort(404)
users = g.db.query(User).join(SubBlock, SubBlock.user_id==User.id).filter_by(sub=sub.name).all()
return render_template("sub/blockers.html", v=v, sub=sub, users=users)
@app.post("/s/<sub>/add_mod")
@limiter.limit("1/second;5/day")
@is_not_permabanned
@ -342,6 +365,7 @@ def get_sub_css(sub):
resp.headers.add("Content-Type", "text/css")
return resp
@app.post("/s/<sub>/banner")
@limiter.limit("1/second;10/day")
@is_not_permabanned

View File

@ -88,13 +88,13 @@
{{sort | capitalize}}
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton2" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 31px, 0px);">
{% if sort != "hot" %}<a class="dropdown-item" href="?sort=hot&t={{t}}"><i class="fas fa-fire mr-2"></i>Hot</a>{% endif %}
{% if sort != "top" %}<a class="dropdown-item" href="?sort=top&t={{t}}"><i class="fas fa-arrow-alt-circle-up mr-2"></i>Top</a>{% endif %}
{% if sort != "bottom" %}<a class="dropdown-item" href="?sort=bottom&t={{t}}"><i class="fas fa-arrow-alt-circle-down mr-2"></i>Bottom</a>{% endif %}
{% if sort != "new" %}<a class="dropdown-item" href="?sort=new&t={{t}}"><i class="fas fa-sparkles mr-2"></i>New</a>{% endif %}
{% if sort != "old" %}<a class="dropdown-item" href="?sort=old&t={{t}}"><i class="fas fa-book mr-2"></i>Old</a>{% endif %}
{% if sort != "controversial" %}<a class="dropdown-item" href="?sort=controversial&t={{t}}"><i class="fas fa-bullhorn mr-2"></i>Controversial</a>{% endif %}
{% if sort != "comments" %}<a class="dropdown-item" href="?sort=comments&t={{t}}"><i class="fas fa-comments mr-2"></i>Comments</a>{% endif %}
{% if sort != "hot" %}<a class="dropdown-item" href="?sort=hot&t={{t}}&ccmode={{ccmode}}&subs={{subs}}"><i class="fas fa-fire mr-2"></i>Hot</a>{% endif %}
{% if sort != "top" %}<a class="dropdown-item" href="?sort=top&t={{t}}&ccmode={{ccmode}}&subs={{subs}}"><i class="fas fa-arrow-alt-circle-up mr-2"></i>Top</a>{% endif %}
{% if sort != "bottom" %}<a class="dropdown-item" href="?sort=bottom&t={{t}}&ccmode={{ccmode}}&subs={{subs}}"><i class="fas fa-arrow-alt-circle-down mr-2"></i>Bottom</a>{% endif %}
{% if sort != "new" %}<a class="dropdown-item" href="?sort=new&t={{t}}&ccmode={{ccmode}}&subs={{subs}}"><i class="fas fa-sparkles mr-2"></i>New</a>{% endif %}
{% if sort != "old" %}<a class="dropdown-item" href="?sort=old&t={{t}}&ccmode={{ccmode}}&subs={{subs}}"><i class="fas fa-book mr-2"></i>Old</a>{% endif %}
{% if sort != "controversial" %}<a class="dropdown-item" href="?sort=controversial&t={{t}}&ccmode={{ccmode}}&subs={{subs}}"><i class="fas fa-bullhorn mr-2"></i>Controversial</a>{% endif %}
{% if sort != "comments" %}<a class="dropdown-item" href="?sort=comments&t={{t}}&ccmode={{ccmode}}&subs={{subs}}"><i class="fas fa-comments mr-2"></i>Comments</a>{% endif %}
</div>
</div>
</div>

View File

@ -7,15 +7,12 @@
{% set image = "/static/" + path + "/" + listdir('files/' + path)|random() + '?a=33' %}
{% endif %}
<a role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" data-bs-url="{{image}}" onclick="expandDesktopImage('{{image}}')">
<img loading="lazy" src="{{image}}" width=100%>
</a>
<img class="mb-4" alt="sidebar image" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{image}}')" loading="lazy" src="{{image}}" width=100%>
{% if sub %}
{% if sub.sidebar_html %}
<div class="mt-4">{{sub.sidebar_html|safe}}</div>
<div class="my-4">{{sub.sidebar_html|safe}}</div>
{% endif %}
<a class="btn btn-primary btn-block mt-4" href="/s/{{sub.name}}/mods">MODS</a>
{% if v and v.mods(sub.name) %}
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/settings">SUB SETTINGS</a>
{% endif %}
@ -23,6 +20,9 @@
<a class="btn btn-primary btn-block {% if v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/s/{{sub.name}}/block','block-sub','unblock-sub');this.classList.toggle('d-none');nextElementSibling.classList.toggle('d-none')">BLOCK SUB</a>
<a class="btn btn-primary btn-block {% if not v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/s/{{sub.name}}/unblock','block-sub','unblock-sub');this.classList.toggle('d-none');previousElementSibling.classList.toggle('d-none')">UNBLOCK SUB</a>
{% endif %}
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/mods">MODS</a>
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/exilees">EXILEES</a>
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/blockers">BLOCKERS</a>
{% else %}
<a class="btn btn-primary btn-block mt-4" href="/post/16583">EMOJI MEGATHREAD</a>
<a class="btn btn-primary btn-block" href="/post/18459">BUGS/SUGGESTIONS MEGATHREAD</a>

View File

@ -2,9 +2,8 @@
{% if sub %}
{% if sub.sidebar_html %}
<div class="mt-4">{{sub.sidebar_html|safe}}</div>
<div class="my-4">{{sub.sidebar_html|safe}}</div>
{% endif %}
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/mods">MODS</a>
{% if v and v.mods(sub.name) %}
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/settings">SUB SETTINGS</a>
{% endif %}
@ -12,6 +11,9 @@
<a class="btn btn-primary btn-block {% if v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/s/{{sub.name}}/block','block-sub','unblock-sub');this.classList.toggle('d-none');nextElementSibling.classList.toggle('d-none')">BLOCK SUB</a>
<a class="btn btn-primary btn-block {% if not v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/s/{{sub.name}}/unblock','block-sub','unblock-sub');this.classList.toggle('d-none');previousElementSibling.classList.toggle('d-none')">UNBLOCK SUB</a>
{% endif %}
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/mods">MODS</a>
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/exilees">EXILEES</a>
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/blockers">BLOCKERS</a>
{% endif %}
<a class="btn btn-primary btn-block" href="/create_sub">CREATE SUB</a>

View File

@ -5,13 +5,12 @@
{% set image='/static/assets/images/' + SITE_NAME + '/sidebar.webp?a=1041' %}
{% endif %}
<img alt="sidebar image" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{image}}')" loading="lazy" src="{{image}}" width=100%>
<img class="mb-4" alt="sidebar image" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{image}}')" loading="lazy" src="{{image}}" width=100%>
{% if sub %}
{% if sub.sidebar_html %}
<div class="mt-4">{{sub.sidebar_html|safe}}</div>
<div class="my-4">{{sub.sidebar_html|safe}}</div>
{% endif %}
<a class="btn btn-primary btn-block mt-4" href="/s/{{sub.name}}/mods">MODS</a>
{% if v and v.mods(sub.name) %}
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/settings">SUB SETTINGS</a>
{% endif %}
@ -19,6 +18,9 @@
<a class="btn btn-primary btn-block {% if v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/s/{{sub.name}}/block','block-sub','unblock-sub');this.classList.toggle('d-none');nextElementSibling.classList.toggle('d-none')">BLOCK SUB</a>
<a class="btn btn-primary btn-block {% if not v.blocks(sub.name) %}d-none{% endif %}" onclick="post_toast(this,'/s/{{sub.name}}/unblock','block-sub','unblock-sub');this.classList.toggle('d-none');previousElementSibling.classList.toggle('d-none')">UNBLOCK SUB</a>
{% endif %}
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/mods">MODS</a>
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/exilees">EXILEES</a>
<a class="btn btn-primary btn-block" href="/s/{{sub.name}}/blockers">BLOCKERS</a>
{% else %}
<p class="mt-4">Rules: No doxxing, No CP or other clearly illegal shit. Also no nazis, go to communities.win. Thanks!</p>
{% endif %}

View File

@ -0,0 +1,21 @@
{% extends "default.html" %}
{% block content %}
<pre></pre>
<h5>Users blocking /s/{{sub.name}}</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>
</tr>
</thead>
{% for user in users %}
<tr>
<td style="font-weight: bold">{{loop.index}}</td>
<td><a style="color:#{{user.namecolor}}; font-weight:bold;" href="/@{{user.username}}"><img alt="@{{user.username}}'s profile picture" loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.namecolor}}"{% endif %}>{{user.username}}</span></a></td>
</tr>
{% endfor %}
</table>
{% endblock %}

View File

@ -0,0 +1,21 @@
{% extends "default.html" %}
{% block content %}
<pre></pre>
<h5>Users exiled from /s/{{sub.name}}</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>
</tr>
</thead>
{% for user in users %}
<tr>
<td style="font-weight: bold">{{loop.index}}</td>
<td><a style="color:#{{user.namecolor}}; font-weight:bold;" href="/@{{user.username}}"><img alt="@{{user.username}}'s profile picture" loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.namecolor}}"{% endif %}>{{user.username}}</span></a></td>
</tr>
{% endfor %}
</table>
{% endblock %}