From b5f7bd78dab8cbca0c8fdb2476e544c35b5c7dd0 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 23 Jul 2021 21:28:25 +0200 Subject: [PATCH] sneed --- drama/routes/comments.py | 2 +- drama/routes/posts.py | 2 +- drama/routes/users.py | 2 +- drama/templates/comments.html | 12 +- drama/templates/errors/502.html | 146 ++++++++++++------------ drama/templates/errors/banaward.html | 74 ++++++++++++ drama/templates/errors/patron.html | 74 ++++++++++++ drama/templates/submission.html | 16 ++- drama/templates/submission_listing.html | 12 +- drama/templates/userpage.html | 2 + 10 files changed, 258 insertions(+), 84 deletions(-) create mode 100644 drama/templates/errors/banaward.html create mode 100644 drama/templates/errors/patron.html diff --git a/drama/routes/comments.py b/drama/routes/comments.py index b0a6f9b0d..4ed6aec16 100644 --- a/drama/routes/comments.py +++ b/drama/routes/comments.py @@ -25,7 +25,7 @@ beams_client = PushNotifications( @auth_required def banawardcomment(comment_id, v): - if v.banawards != 1 and v.banawards != 2: return jsonify({"error": "You must have a ban award to ban this user."}), 403 + if not v.banawards > 0: return render_template("errors/banaward.html", v=v) comment = g.db.query(Comment).filter_by(id=comment_id).first() if not comment: abort(400) diff --git a/drama/routes/posts.py b/drama/routes/posts.py index 6a73824b2..302a563a8 100644 --- a/drama/routes/posts.py +++ b/drama/routes/posts.py @@ -49,7 +49,7 @@ def resize(): @auth_required def postbanaward(post_id, v): - if v.banawards != 1 and v.banawards != 2: return jsonify({"error": "You must have a ban award to ban this user."}), 403 + if not v.banawards > 0: return render_template("errors/banaward.html", v=v) post = g.db.query(Submission).filter_by(id=post_id).first() if not post: abort(400) diff --git a/drama/routes/users.py b/drama/routes/users.py index 4c3fb2813..a10220247 100644 --- a/drama/routes/users.py +++ b/drama/routes/users.py @@ -215,7 +215,7 @@ def followers(username, v): @app.get("/views") @auth_required def visitors(v): - if v.admin_level < 1 and not v.patron: abort(502) + if v.admin_level < 1 and not v.patron: return render_template("errors/patron.html", v=v) viewers=sorted(v.viewers, key = lambda x: x.last_view_utc) return render_template("viewers.html", v=v, viewers=viewers) diff --git a/drama/templates/comments.html b/drama/templates/comments.html index adf0ca06c..4e54a0cb1 100644 --- a/drama/templates/comments.html +++ b/drama/templates/comments.html @@ -243,7 +243,11 @@
  • Votes
  • {% if v and v.id!=c.author_id and v.admin_level == 0 %} -
  • Ban user
  • + {% if v.banawards > 0 %} +
  • Ban user
  • + {% else %} +
  • Ban user
  • + {% endif %} {% endif %} {% if v and c.id in v.saved_comment_idlist() %} @@ -452,7 +456,11 @@
  • Votes
  • {% if v and v.id!=c.author_id and v.admin_level == 0 %} -
  • Ban user
  • + {% if v.banawards > 0 %} +
  • Ban user
  • + {% else %} +
  • Ban user
  • + {% endif %} {% endif %} {% if v and c.id in v.saved_comment_idlist() %} diff --git a/drama/templates/errors/502.html b/drama/templates/errors/502.html index 4f51413ca..322e03e95 100644 --- a/drama/templates/errors/502.html +++ b/drama/templates/errors/502.html @@ -1,74 +1,74 @@ - - - - -403 Unauthorized - - - - - - - - - - - - - - - - - - - -{% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} -{% else %} - -{% endif %} - - - - - - - - -
    -
    -
    -
    -
    -
    - -

    403 Unauthorized

    -

    This page is only available to patrons:

    -

    https://rdrama.gumroad.com/l/tfcvri

    -

    https://patreon.com/Aevann

    -
    -
    -
    -
    - -
    -
    - - - - - - - - - \ No newline at end of file + + + + + 502 Bad Gateway + + + + + + + + + + + + + + + + + + + + {% if v %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} + {% else %} + + {% endif %} + + + + + + + + +
    +
    +
    +
    +
    +
    + +

    502 Bad Gateway

    +

    Don't go this way, stranger. The gate is closed, and the guards are saying:

    +

    "We're restarting the server right now, try again in a few moments."

    +

    Reload

    +
    +
    +
    +
    + +
    +
    + + + + + + + + + \ No newline at end of file diff --git a/drama/templates/errors/banaward.html b/drama/templates/errors/banaward.html new file mode 100644 index 000000000..5915f18af --- /dev/null +++ b/drama/templates/errors/banaward.html @@ -0,0 +1,74 @@ + + + + + +403 Unauthorized + + + + + + + + + + + + + + + + + + + +{% if v %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} +{% else %} + +{% endif %} + + + + + + + + +
    +
    +
    +
    +
    +
    + +

    403 Unauthorized

    +

    You have 0 ban awards (they're a patron perk):

    +

    https://rdrama.gumroad.com/l/tfcvri

    +

    https://patreon.com/Aevann

    +
    +
    +
    +
    + +
    +
    + + + + + + + + + \ No newline at end of file diff --git a/drama/templates/errors/patron.html b/drama/templates/errors/patron.html new file mode 100644 index 000000000..4f51413ca --- /dev/null +++ b/drama/templates/errors/patron.html @@ -0,0 +1,74 @@ + + + + + +403 Unauthorized + + + + + + + + + + + + + + + + + + + +{% if v %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} +{% else %} + +{% endif %} + + + + + + + + +
    +
    +
    +
    +
    +
    + +

    403 Unauthorized

    +

    This page is only available to patrons:

    +

    https://rdrama.gumroad.com/l/tfcvri

    +

    https://patreon.com/Aevann

    +
    +
    +
    +
    + +
    +
    + + + + + + + + + \ No newline at end of file diff --git a/drama/templates/submission.html b/drama/templates/submission.html index da804bc18..17536858c 100644 --- a/drama/templates/submission.html +++ b/drama/templates/submission.html @@ -132,8 +132,12 @@ - {% if v and v.id!=p.author_id and v.admin_level == 0 %} - + {% if v and v.id!=p.author_id and v.admin_level == 0 %} + {% if v.banawards > 0 %} + + {% else %} + + {% endif %} {% endif %} {% if v and p.id in v.subscribed_idlist() %} @@ -323,9 +327,13 @@ {% endif %}
  • Votes
  • - + {% if v and v.id!=p.author_id and v.admin_level == 0 %} -
  • Ban user
  • + {% if v.banawards > 0 %} +
  • Ban user
  • + {% else %} +
  • Ban user
  • + {% endif %} {% endif %}
  • Copy link
  • diff --git a/drama/templates/submission_listing.html b/drama/templates/submission_listing.html index 19a9b4ca8..b60523b16 100644 --- a/drama/templates/submission_listing.html +++ b/drama/templates/submission_listing.html @@ -195,7 +195,11 @@
  • Votes
  • {% if v and v.id!=p.author_id and v.admin_level == 0 %} -
  • Ban user
  • + {% if v.banawards > 0 %} +
  • Ban user
  • + {% else %} +
  • Ban user
  • + {% endif %} {% endif %}
  • Copy link
  • @@ -379,7 +383,11 @@
  • Block user
  • {% if v and v.id!=p.author_id and v.admin_level == 0 %} - + {% if v.banawards > 0 %} + + {% else %} + + {% endif %} {% endif %} {% if v and p.id in v.subscribed_idlist() %} diff --git a/drama/templates/userpage.html b/drama/templates/userpage.html index d014afa72..0d1641801 100644 --- a/drama/templates/userpage.html +++ b/drama/templates/userpage.html @@ -155,6 +155,7 @@ {% elif v and v.id == u.id %} Edit profile + Profile views {% endif %} {% if v and v.id != u.id and v.admin_level > 0 and u.admin_level == 0 %}

    @@ -306,6 +307,7 @@ {% if v and v.id == u.id %} Edit profile + Profile views {% endif %} {% if v and v.id != u.id %} Unfollow