Core remove legacy patch (#1047)

Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
This commit is contained in:
Fabian Dill
2022-09-30 00:36:30 +02:00
committed by GitHub
parent 8ab0b410c3
commit 61e39f355d
22 changed files with 259 additions and 491 deletions

View File

@@ -1,6 +1,5 @@
import typing
import zipfile
import lzma
import json
import base64
import MultiServer
@@ -10,9 +9,10 @@ from io import BytesIO
from flask import request, flash, redirect, url_for, session, render_template
from pony.orm import flush, select
from WebHostLib import app, Seed, Room, Slot
from Utils import parse_yaml, VersionException, __version__
from Patch import preferred_endings, AutoPatchRegister
from . import app
from .models import Seed, Room, Slot
from Utils import VersionException, __version__
from worlds.Files import AutoPatchRegister
from NetUtils import NetworkSlot, SlotType
banned_zip_contents = (".sfc",)
@@ -38,17 +38,6 @@ def upload_zip_to_db(zfile: zipfile.ZipFile, owner=None, meta={"race": False}, s
player_name=patch.player_name,
player_id=patch.player,
game=patch.game))
elif file.filename.endswith(tuple(preferred_endings.values())):
data = zfile.open(file, "r").read()
yaml_data = parse_yaml(lzma.decompress(data).decode("utf-8-sig"))
if yaml_data["version"] < 2:
return "Old format cannot be uploaded (outdated .apbp)"
metadata = yaml_data["meta"]
slots.add(Slot(data=data,
player_name=metadata["player_name"],
player_id=metadata["player_id"],
game=yaml_data["game"]))
elif file.filename.endswith(".apmc"):
data = zfile.open(file, "r").read()