diff --git a/files/routes/admin.py b/files/routes/admin.py index 1d73fd22c..4a82717bc 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -648,58 +648,6 @@ def admin_removed(v): -@app.post("/admin/image_ban") -@limiter.limit("1/second") -@admin_level_required(4) -@validate_formkey -def admin_image_ban(v): - if request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413 - - - i=request.files['file'] - - - tempname = f"admin_image_ban_{v.username}_{int(time.time())}" - - i.save(tempname) - - h=imagehash.phash(IMAGE.open(tempname)) - - value = int(str(h), 16) - bindigits = [] - - digit = (value % 2) - value //= 2 - bindigits.append(digit) - - while value > 0: - digit = (value % 2) - value //= 2 - bindigits.append(digit) - - h = ''.join([str(d) for d in bindigits]) - - badpic = g.db.query(BadPic).options(lazyload('*')).filter_by( - phash=h - ).first() - - remove(tempname) - - if badpic: - return render_template("admin/image_ban.html", v=v, existing=badpic) - - new_bp=BadPic( - phash=h, - ban_reason=request.values.get("ban_reason"), - ban_time=int(request.values.get("ban_length",0)) - ) - - g.db.add(new_bp) - - g.db.commit() - return render_template("admin/image_ban.html", v=v, success=True) - - @app.post("/agendaposter/") @admin_level_required(6) @validate_formkey diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index 0ed3097fa..ccf02398b 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -28,7 +28,6 @@

Safety

diff --git a/files/templates/admin/image_ban.html b/files/templates/admin/image_ban.html deleted file mode 100644 index 63c334a3d..000000000 --- a/files/templates/admin/image_ban.html +++ /dev/null @@ -1,42 +0,0 @@ -{% extends "default.html" %} - -{% block title %} -Image Ban - -{% endblock %} - -{% block content %} - -{% if existing %} -

Image already banned for: {{existing.ban_reason}}

-{% elif success %} -

Image banned.

-{% endif %} - -
-
-
-
-
-
Perceptive Hash Image Ban
-

Upload an image to add its hash to the ban list.

- -
- - - - - - - Enter the number of days to ban a user who attempts to upload this image - - -
- - -{% endblock %} \ No newline at end of file