From f73362cab2408c50d6722fa7a1b5bec92d40b9be Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 27 Jul 2021 23:35:50 +0200 Subject: [PATCH] dffd --- .github/FUNDING.yml | 1 - drama/routes/comments.py | 80 ++++++++++++------------- drama/routes/posts.py | 4 -- drama/routes/settings.py | 48 +++++++-------- drama/templates/comments.html | 2 +- drama/templates/errors/banaward.html | 2 - drama/templates/errors/patron.html | 2 - drama/templates/header.html | 2 - drama/templates/settings_profile.html | 24 -------- drama/templates/submission.html | 4 +- drama/templates/submission_listing.html | 2 +- drama/templates/submit.html | 52 +++++++--------- pushcss.sh | 8 +-- 13 files changed, 88 insertions(+), 143 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 6747a83c0..c67eaf794 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,2 @@ github: Aevann1 -patreon: Aevann custom: ["https://rdrama.gumroad.com/l/tfcvri"] diff --git a/drama/routes/comments.py b/drama/routes/comments.py index cea52edbc..901bcacc4 100644 --- a/drama/routes/comments.py +++ b/drama/routes/comments.py @@ -384,20 +384,19 @@ def api_comment(v): ) g.db.add(c) g.db.flush() - if v.dramacoins >= 0: - if request.files.get("file"): - file=request.files["file"] - if not file.content_type.startswith('image/'): - return jsonify({"error": "That wasn't an image!"}), 400 - - name = f'comment/{c.base36id}/{secrets.token_urlsafe(8)}' - url = upload_file(name, file) - - body = request.form.get("body") + f"\n![]({url})" - body = body.replace("\n", "\n\n") - with CustomRenderer(post_id=parent_id) as renderer: - body_md = renderer.render(mistletoe.Document(body)) - body_html = sanitize(body_md, linkgen=True) + if request.files.get("file"): + file=request.files["file"] + if not file.content_type.startswith('image/'): + return jsonify({"error": "That wasn't an image!"}), 400 + + name = f'comment/{c.base36id}/{secrets.token_urlsafe(8)}' + url = upload_file(name, file) + + body = request.form.get("body") + f"\n![]({url})" + body = body.replace("\n", "\n\n") + with CustomRenderer(post_id=parent_id) as renderer: + body_md = renderer.render(mistletoe.Document(body)) + body_html = sanitize(body_md, linkgen=True) c_aux = CommentAux( id=c.id, @@ -738,35 +737,34 @@ def edit_comment(cid, v): g.db.commit() return jsonify({"error": "Too much spam!"}), 403 - if v.dramacoins >= 0: - if request.files.get("file"): - file=request.files["file"] - if not file.content_type.startswith('image/'): - return jsonify({"error": "That wasn't an image!"}), 400 - - name = f'comment/{c.base36id}/{secrets.token_urlsafe(8)}' - url = upload_file(name, file) + if request.files.get("file"): + file=request.files["file"] + if not file.content_type.startswith('image/'): + return jsonify({"error": "That wasn't an image!"}), 400 + + name = f'comment/{c.base36id}/{secrets.token_urlsafe(8)}' + url = upload_file(name, file) - body += f"\n![]({url})" - body = body.replace("\n", "\n\n") - with CustomRenderer(post_id=c.parent_submission) as renderer: - body_md = renderer.render(mistletoe.Document(body)) - body_html = sanitize(body_md, linkgen=True) + body += f"\n![]({url})" + body = body.replace("\n", "\n\n") + with CustomRenderer(post_id=c.parent_submission) as renderer: + body_md = renderer.render(mistletoe.Document(body)) + body_html = sanitize(body_md, linkgen=True) + + # #csam detection + # def del_function(): + # delete_file(name) + # c.is_banned=True + # g.db.add(c) + # g.db.commit() - # #csam detection - # def del_function(): - # delete_file(name) - # c.is_banned=True - # g.db.add(c) - # g.db.commit() - - # csam_thread=threading.Thread(target=check_csam_url, - # args=(f"https://s3.eu-central-1.amazonaws.com/i.ruqqus.ga/{name}", - # v, - # del_function - # ) - # ) - # csam_thread.start() + # csam_thread=threading.Thread(target=check_csam_url, + # args=(f"https://s3.eu-central-1.amazonaws.com/i.ruqqus.ga/{name}", + # v, + # del_function + # ) + # ) + # csam_thread.start() c.body = body c.body_html = body_html diff --git a/drama/routes/posts.py b/drama/routes/posts.py index fa065fdcc..2e6ca1047 100644 --- a/drama/routes/posts.py +++ b/drama/routes/posts.py @@ -867,10 +867,6 @@ def submit_post(v): # check for embeddable video domain = parsed_url.netloc - if request.files.get('file') and not v.dramacoins >= 0: - abort(403) - - new_post = Submission( private=bool(request.form.get("private","")), author_id=v.id, diff --git a/drama/routes/settings.py b/drama/routes/settings.py index 8fc625587..f26475ddf 100644 --- a/drama/routes/settings.py +++ b/drama/routes/settings.py @@ -324,45 +324,37 @@ def settings_log_out_others(v): @auth_required @validate_formkey def settings_images_profile(v): - if v.dramacoins >= 0: - if request.content_length > 16 * 1024 * 1024: - g.db.rollback() - abort(413) + if request.content_length > 16 * 1024 * 1024: + g.db.rollback() + abort(413) - v.profileurl = None - imageurl = upload_file(name=f"profile.gif", file=request.files["profile"], resize=(100, 100)) - if imageurl: - v.profileurl = imageurl - g.db.add(v) + v.profileurl = None + imageurl = upload_file(name=f"profile.gif", file=request.files["profile"], resize=(100, 100)) + if imageurl: + v.profileurl = imageurl + g.db.add(v) - return render_template("settings_profile.html", - v=v, msg="Profile picture successfully updated.") - - return render_template("settings_profile.html", v=v, - msg="Avatars require +0 dramacoins.") + return render_template("settings_profile.html", + v=v, msg="Profile picture successfully updated.") @app.route("/settings/images/banner", methods=["POST"]) @auth_required @validate_formkey def settings_images_banner(v): - if v.dramacoins >= 0: - if request.content_length > 16 * 1024 * 1024: - g.db.rollback() - abort(413) + if request.content_length > 16 * 1024 * 1024: + g.db.rollback() + abort(413) - v.bannerurl = None - imageurl = upload_file(name=f"banner.gif", file=request.files["banner"]) - if imageurl: - v.bannerurl = imageurl - g.db.add(v) + v.bannerurl = None + imageurl = upload_file(name=f"banner.gif", file=request.files["banner"]) + if imageurl: + v.bannerurl = imageurl + g.db.add(v) - return render_template("settings_profile.html", - v=v, msg="Banner successfully updated.") - - return render_template("settings_profile.html", v=v, - msg="Banners require +0 dramacoins.") + return render_template("settings_profile.html", + v=v, msg="Banner successfully updated.") @app.route("/settings/delete/profile", methods=["POST"]) diff --git a/drama/templates/comments.html b/drama/templates/comments.html index 5b4b560bb..dcf840383 100644 --- a/drama/templates/comments.html +++ b/drama/templates/comments.html @@ -192,7 +192,7 @@ Reported by: diff --git a/drama/templates/errors/banaward.html b/drama/templates/errors/banaward.html index 4c70e148d..91083cc67 100644 --- a/drama/templates/errors/banaward.html +++ b/drama/templates/errors/banaward.html @@ -14,8 +14,6 @@

401 Not Authorized

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

https://rdrama.gumroad.com/l/tfcvri -
- https://patreon.com/Aevann diff --git a/drama/templates/errors/patron.html b/drama/templates/errors/patron.html index 0d93876ca..606089c00 100644 --- a/drama/templates/errors/patron.html +++ b/drama/templates/errors/patron.html @@ -14,8 +14,6 @@

401 Not Authorized

This page is only available to patrons:

https://rdrama.gumroad.com/l/tfcvri -
- https://patreon.com/Aevann diff --git a/drama/templates/header.html b/drama/templates/header.html index d07cc5634..e7ebf81e8 100644 --- a/drama/templates/header.html +++ b/drama/templates/header.html @@ -107,7 +107,6 @@ Changelog Source code Discord - Patreon Gumroad Subreddit Archives Contact us @@ -163,7 +162,6 @@ - diff --git a/drama/templates/settings_profile.html b/drama/templates/settings_profile.html index b93884947..c4bf328f1 100644 --- a/drama/templates/settings_profile.html +++ b/drama/templates/settings_profile.html @@ -84,8 +84,6 @@
- {% if v.dramacoins >= 0 %} -
- {% else %} - -
You can add a custom avatar after earning 30 Dramacoins.{% if request.headers.get("cf-ipcountry")=="T1" and not v.is_activated %} Additionally, you must have a verified email address to upload images via Tor.{% endif %}
- - {% endif %} -
{% if v.profileurl %} @@ -112,12 +104,8 @@ - {% if v.dramacoins >= 0 %} -
JPG, PNG, GIF files are supported. Max file size is 16 MB.
- {% endif %} - @@ -139,8 +127,6 @@
- {% if v.dramacoins >= 0 %} -
- {% else %} - -
You can add a custom banner after earning 30 Dramacoins.{% if request.headers.get("cf-ipcountry")=="T1" and not v.is_activated %} Additionally, you must have a verified email address to upload images via Tor.{% endif %}
- - {% endif %} -
@@ -168,12 +148,8 @@
- {% if v.dramacoins >= 0 %} -
JPG, PNG, GIF files are supported. Max file size is 16 MB.
- {% endif %} - diff --git a/drama/templates/submission.html b/drama/templates/submission.html index a5b065202..559af91eb 100644 --- a/drama/templates/submission.html +++ b/drama/templates/submission.html @@ -494,7 +494,7 @@ Reported by: @@ -549,7 +549,7 @@ -