gfgffg
This commit is contained in:
parent
a0ca03fc0c
commit
e5370d4017
3 changed files with 6 additions and 7 deletions
|
@ -312,7 +312,7 @@ def api_comment(v):
|
||||||
)
|
)
|
||||||
g.db.add(c)
|
g.db.add(c)
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
if request.files.get("file"):
|
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
|
||||||
file=request.files["file"]
|
file=request.files["file"]
|
||||||
if not file.content_type.startswith('image/'):
|
if not file.content_type.startswith('image/'):
|
||||||
return jsonify({"error": "That wasn't an image!"}), 400
|
return jsonify({"error": "That wasn't an image!"}), 400
|
||||||
|
@ -660,7 +660,7 @@ def edit_comment(cid, v):
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
return {"error": "Too much spam!"}, 403
|
return {"error": "Too much spam!"}, 403
|
||||||
|
|
||||||
if request.files.get("file"):
|
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
|
||||||
file=request.files["file"]
|
file=request.files["file"]
|
||||||
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
|
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
|
||||||
|
|
||||||
|
|
|
@ -803,7 +803,7 @@ def submit_post(v):
|
||||||
g.db.refresh(new_post)
|
g.db.refresh(new_post)
|
||||||
|
|
||||||
# check for uploaded image
|
# check for uploaded image
|
||||||
if request.files.get('file'):
|
if request.files.get('file') and request.headers.get("cf-ipcountry") != "T1":
|
||||||
|
|
||||||
#check file size
|
#check file size
|
||||||
if request.content_length > 16 * 1024 * 1024:
|
if request.content_length > 16 * 1024 * 1024:
|
||||||
|
@ -816,7 +816,6 @@ def submit_post(v):
|
||||||
else: return render_template("submit.html", v=v, error=f"Image files only.", title=title, body=request.form.get("body", "")), 400
|
else: return render_template("submit.html", v=v, error=f"Image files only.", title=title, body=request.form.get("body", "")), 400
|
||||||
|
|
||||||
|
|
||||||
name = f'post/{new_post.id}/{secrets.token_urlsafe(8)}'
|
|
||||||
new_post.url = upload_file(file)
|
new_post.url = upload_file(file)
|
||||||
new_post.domain_ref = 1 # id of i.ruqqus.ga domain
|
new_post.domain_ref = 1 # id of i.ruqqus.ga domain
|
||||||
g.db.add(new_post)
|
g.db.add(new_post)
|
||||||
|
|
|
@ -331,6 +331,7 @@ def settings_images_profile(v):
|
||||||
g.db.rollback()
|
g.db.rollback()
|
||||||
abort(413)
|
abort(413)
|
||||||
|
|
||||||
|
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403
|
||||||
imageurl = upload_file(request.files["profile"], True)
|
imageurl = upload_file(request.files["profile"], True)
|
||||||
if not imageurl: abort(400)
|
if not imageurl: abort(400)
|
||||||
highres = upload_file()
|
highres = upload_file()
|
||||||
|
@ -339,8 +340,7 @@ def settings_images_profile(v):
|
||||||
v.profileurl = imageurl
|
v.profileurl = imageurl
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
||||||
return render_template("settings_profile.html",
|
return render_template("settings_profile.html", v=v, msg="Profile picture successfully updated.")
|
||||||
v=v, msg="Profile picture successfully updated.")
|
|
||||||
|
|
||||||
|
|
||||||
@app.post("/settings/images/banner")
|
@app.post("/settings/images/banner")
|
||||||
|
@ -351,7 +351,7 @@ def settings_images_banner(v):
|
||||||
g.db.rollback()
|
g.db.rollback()
|
||||||
abort(413)
|
abort(413)
|
||||||
|
|
||||||
v.bannerurl = None
|
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403
|
||||||
imageurl = upload_file(request.files["banner"])
|
imageurl = upload_file(request.files["banner"])
|
||||||
if imageurl:
|
if imageurl:
|
||||||
v.bannerurl = imageurl
|
v.bannerurl = imageurl
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue