mirror of
https://github.com/csd4ni3l/grass_touching_captcha.git
synced 2026-01-01 12:33:45 +01:00
fix png not working because of removing too many bytes of data url header
This commit is contained in:
7
main.py
7
main.py
@@ -17,8 +17,6 @@ login_manager.init_app(app)
|
|||||||
|
|
||||||
os.makedirs("uploads", exist_ok=True)
|
os.makedirs("uploads", exist_ok=True)
|
||||||
|
|
||||||
users = {}
|
|
||||||
|
|
||||||
class User(flask_login.UserMixin):
|
class User(flask_login.UserMixin):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -57,9 +55,12 @@ def resize_image_file(path, max_side=256, fmt="JPEG"):
|
|||||||
@app.route("/upload", methods=["POST"])
|
@app.route("/upload", methods=["POST"])
|
||||||
def upload():
|
def upload():
|
||||||
try:
|
try:
|
||||||
image_type, image_data = request.json["image_type"], request.json["image_data"].encode("utf-8")
|
image_type, image_data = request.json["username"], request.json["image_type"], request.json["image_data"].encode("utf-8")
|
||||||
|
|
||||||
|
if image_type == "jpeg":
|
||||||
image_data = image_data[23:] # data:image/jpeg;base64,
|
image_data = image_data[23:] # data:image/jpeg;base64,
|
||||||
|
else:
|
||||||
|
image_data = image_data[22:]
|
||||||
|
|
||||||
image_uuid = uuid.uuid4()
|
image_uuid = uuid.uuid4()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user