forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-02-11 17:02:27 +02:00
parent f326ec34dc
commit 3bc88b8c06
6 changed files with 16 additions and 24 deletions

View File

@ -278,7 +278,7 @@ def submit_contact(v):
body = request.values.get("message") body = request.values.get("message")
if not body: abort(400) if not body: abort(400)
body = f'This message has been sent automatically to all admins via [/contact](/contact), user email is "{v.email}"\n\nMessage:\n\n' + body body = f'This message has been sent automatically to all admins via [/contact](/contact)\n\nMessage:\n\n' + body
body_html = sanitize(body, noimages=True) body_html = sanitize(body, noimages=True)
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1": if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":

View File

@ -7,7 +7,7 @@ from .front import frontlist
valid_sub_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$") valid_sub_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$")
@app.get("/s/<sub>/mods") @app.get("/s/<sub>/mods")
@auth_required @is_not_permabanned
def mods(v, sub): def mods(v, sub):
sub = g.db.query(Sub).filter_by(name=sub.lower()).one_or_none() sub = g.db.query(Sub).filter_by(name=sub.lower()).one_or_none()
if not sub: abort(404) if not sub: abort(404)
@ -18,7 +18,7 @@ def mods(v, sub):
@app.post("/s/<sub>/add_mod") @app.post("/s/<sub>/add_mod")
@auth_required @is_not_permabanned
def add_mod(v, sub): def add_mod(v, sub):
sub = g.db.query(Sub).filter_by(name=sub.lower()).one_or_none() sub = g.db.query(Sub).filter_by(name=sub.lower()).one_or_none()
if not sub: abort(404) if not sub: abort(404)
@ -43,13 +43,13 @@ def add_mod(v, sub):
@app.get("/create_sub") @app.get("/create_sub")
@auth_required @is_not_permabanned
def create_sub(v): def create_sub(v):
return render_template("sub/create_sub.html", v=v) return render_template("sub/create_sub.html", v=v)
@app.post("/create_sub") @app.post("/create_sub")
@auth_required @is_not_permabanned
def create_sub2(v): def create_sub2(v):
name = request.values.get('name') name = request.values.get('name')
if not name: abort(400) if not name: abort(400)
@ -77,7 +77,7 @@ def create_sub2(v):
return redirect(f'/s/{sub.name}') return redirect(f'/s/{sub.name}')
@app.post("/kick/<pid>") @app.post("/kick/<pid>")
@auth_required @is_not_permabanned
def kick(v, pid): def kick(v, pid):
try: pid = int(pid) try: pid = int(pid)
except: abort(400) except: abort(400)
@ -97,7 +97,7 @@ def kick(v, pid):
@app.get('/s/<sub>/settings') @app.get('/s/<sub>/settings')
@auth_required @is_not_permabanned
def sub_settings(v, sub): def sub_settings(v, sub):
sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none() sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none()
if not sub: abort(404) if not sub: abort(404)
@ -109,7 +109,7 @@ def sub_settings(v, sub):
@app.post('/s/<sub>/sidebar') @app.post('/s/<sub>/sidebar')
@limiter.limit("1/second;30/minute;200/hour;1000/day") @limiter.limit("1/second;30/minute;200/hour;1000/day")
@auth_required @is_not_permabanned
def post_sub_sidebar(v, sub): def post_sub_sidebar(v, sub):
sub = g.db.query(Sub).filter_by(name=sub.lower()).one_or_none() sub = g.db.query(Sub).filter_by(name=sub.lower()).one_or_none()
if not sub: abort(404) if not sub: abort(404)
@ -133,7 +133,7 @@ def post_sub_sidebar(v, sub):
@app.post("/s/<sub>/banner") @app.post("/s/<sub>/banner")
@limiter.limit("1/second;30/minute;200/hour;1000/day") @limiter.limit("1/second;30/minute;200/hour;1000/day")
@auth_required @is_not_permabanned
def sub_banner(v, sub): def sub_banner(v, sub):
if v and v.patron: if v and v.patron:
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 8 MB."}, 413 if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 8 MB."}, 413
@ -164,7 +164,7 @@ def sub_banner(v, sub):
@app.post("/s/<sub>/sidebar_image") @app.post("/s/<sub>/sidebar_image")
@limiter.limit("1/second;30/minute;200/hour;1000/day") @limiter.limit("1/second;30/minute;200/hour;1000/day")
@auth_required @is_not_permabanned
def sub_sidebar(v, sub): def sub_sidebar(v, sub):
if v and v.patron: if v and v.patron:
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 8 MB."}, 413 if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 8 MB."}, 413
@ -190,12 +190,4 @@ def sub_sidebar(v, sub):
g.db.add(sub) g.db.add(sub)
g.db.commit() g.db.commit()
return redirect(f'/s/{sub.name}/settings') return redirect(f'/s/{sub.name}/settings')
#mods id seq
#css
#exile
#guild mod log
#remove mod
#search sub

View File

@ -225,7 +225,7 @@
</a> </a>
{% elif sub %} {% elif sub %}
<a href="/"> <a href="/">
<img alt="sub banner" src="{{sub.banner_url}}" max-height=190px width=100% style="object-fit:cover"> <img alt="/s/{[sub.name]} banner" src="{{sub.banner_url}}" max-height=190px width=100% style="object-fit:cover">
</a> </a>
{% else %} {% else %}
<a href="/"> <a href="/">
@ -276,7 +276,7 @@
{% endblock %} {% endblock %}
</div> </div>
{% if home %} {% if home or sub and (request.path.startswith('/post') or request.path.startswith('/comment')) %}
{% block sidebar %} {% block sidebar %}
{% include "sidebar_" + SITE_NAME + ".html" %} {% include "sidebar_" + SITE_NAME + ".html" %}
{% endblock %} {% endblock %}

View File

@ -35,7 +35,7 @@
{% set icon = ('marseyblm','marseykween','marseydynamite','marseyblack','marseymyeisha','marseyetika','marseyobama','marseyblackcop','marseysosa','marseyblackface')|random() %} {% set icon = ('marseyblm','marseykween','marseydynamite','marseyblack','marseymyeisha','marseyetika','marseyobama','marseyblackcop','marseysosa','marseyblackface')|random() %}
<img alt="header icon" height=33 src="/static/assets/images/emojis/{{icon}}.webp?a=1008"> <img alt="header icon" height=33 src="/static/assets/images/emojis/{{icon}}.webp?a=1008">
{% else %} {% else %}
<img alt="header icon" height=33 src="/static/assets/images/{{SITE_NAME}}/headericon.webp?a=1010"> <img alt="header icon" height=33 src="/static/assets/images/{{SITE_NAME}}/headericon.webp?a=1011">
{% endif %} {% endif %}
{% if SITE_NAME == 'Drama' %} {% if SITE_NAME == 'Drama' %}

View File

@ -57,7 +57,7 @@
<div class="d-flex"> <div class="d-flex">
<div class="title w-lg-75 text-md-center"> <div class="title w-lg-75 text-md-center">
<img loading="lazy" alt="sub banner" src="{{sub.banner_url}}" class="banner-pic-135"> <img loading="lazy" alt="/s/{[sub.name]} banner" src="{{sub.banner_url}}" class="banner-pic-135">
</div> </div>
<div class="body w-lg-100 my-auto"> <div class="body w-lg-100 my-auto">

View File

@ -296,7 +296,7 @@
{% if p.sub and v.mods(p.sub) %} {% if p.sub and v.mods(p.sub) %}
<a class="list-inline-item text-danger" role="button" onclick="post_toast('/kick/{{p.id}}')"><i class="fas fa-sign-out text-danger"></i>Kick</a> <a class="dropdown-item list-inline-item text-danger" role="button" onclick="post_toast('/kick/{{p.id}}')"><i class="fas fa-sign-out text-danger"></i>Kick</a>
{% endif %} {% endif %}