From c8d6250ada3fe0f12f34ab96c492de4ee3cde27c Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sat, 16 Oct 2021 20:11:26 +0200 Subject: [PATCH] WebHost: set default upload limit to 64 MB, as OoT is chonkers. WebHost: rename .multidata to .archipelago in a missed flash message WebHost: correctly parse Factorio slot names with "-" --- WebHostLib/__init__.py | 2 +- WebHostLib/upload.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WebHostLib/__init__.py b/WebHostLib/__init__.py index 6463540e..a471d4eb 100644 --- a/WebHostLib/__init__.py +++ b/WebHostLib/__init__.py @@ -28,7 +28,7 @@ app.config["SELFLAUNCH"] = True app.config["DEBUG"] = False app.config["PORT"] = 80 app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER -app.config['MAX_CONTENT_LENGTH'] = 4 * 1024 * 1024 # 4 megabyte limit +app.config['MAX_CONTENT_LENGTH'] = 64 * 1024 * 1024 # 64 megabyte limit # if you want to deploy, make sure you have a non-guessable secret key app.config["SECRET_KEY"] = bytes(socket.gethostname(), encoding="utf-8") # at what amount of worlds should scheduling be used, instead of rolling in the webthread diff --git a/WebHostLib/upload.py b/WebHostLib/upload.py index 8a4c1ce3..64537295 100644 --- a/WebHostLib/upload.py +++ b/WebHostLib/upload.py @@ -48,7 +48,7 @@ def upload_zip_to_db(zfile: zipfile.ZipFile, owner=None, meta={"race": False}, s elif file.filename.endswith(".zip"): # Factorio mods need a specific name or they do not function - _, seed_name, slot_id, slot_name = file.filename.rsplit("_", 1)[0].split("-") + _, seed_name, slot_id, slot_name = file.filename.rsplit("_", 1)[0].split("-", 3) slots.add(Slot(data=zfile.open(file, "r").read(), player_name=slot_name, player_id=int(slot_id[1:]), game="Factorio")) @@ -112,7 +112,7 @@ def uploads(): flush() # place into DB and generate ids return redirect(url_for("viewSeed", seed=seed.id)) else: - flash("Not recognized file format. Awaiting a .multidata file.") + flash("Not recognized file format. Awaiting a .archipelago file or .zip containing one.") return render_template("hostGame.html")