Webhost race support as a non-breaking change
This commit is contained in:
parent
5f535012f3
commit
aab3a3496a
|
@ -37,9 +37,10 @@ def download_raw_patch(seed_id, player_id):
|
||||||
return "Patch not found"
|
return "Patch not found"
|
||||||
else:
|
else:
|
||||||
import io
|
import io
|
||||||
|
if patch.seed.multidata:
|
||||||
pname = patch.seed.multidata["names"][0][patch.player - 1]
|
pname = patch.seed.multidata["names"][0][patch.player - 1]
|
||||||
|
else:
|
||||||
|
pname = "unknown"
|
||||||
patch_data = update_patch_data(patch.data, server="")
|
patch_data = update_patch_data(patch.data, server="")
|
||||||
patch_data = io.BytesIO(patch_data)
|
patch_data = io.BytesIO(patch_data)
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ def gen_game(gen_options, race=False, owner=None, sid=None):
|
||||||
del (erargs.progression_balancing)
|
del (erargs.progression_balancing)
|
||||||
ERmain(erargs, seed)
|
ERmain(erargs, seed)
|
||||||
|
|
||||||
return upload_to_db(target.name, owner, sid)
|
return upload_to_db(target.name, owner, sid, race)
|
||||||
except BaseException:
|
except BaseException:
|
||||||
if sid:
|
if sid:
|
||||||
with db_session:
|
with db_session:
|
||||||
|
@ -181,9 +181,10 @@ def wait_seed_api(seed: UUID):
|
||||||
return {"text": "Generation running"}, 202
|
return {"text": "Generation running"}, 202
|
||||||
|
|
||||||
|
|
||||||
def upload_to_db(folder, owner, sid):
|
def upload_to_db(folder, owner, sid, race:bool):
|
||||||
patches = set()
|
patches = set()
|
||||||
spoiler = ""
|
spoiler = ""
|
||||||
|
|
||||||
multidata = None
|
multidata = None
|
||||||
for file in os.listdir(folder):
|
for file in os.listdir(folder):
|
||||||
file = os.path.join(folder, file)
|
file = os.path.join(folder, file)
|
||||||
|
@ -193,11 +194,17 @@ def upload_to_db(folder, owner, sid):
|
||||||
elif file.endswith(".txt"):
|
elif file.endswith(".txt"):
|
||||||
spoiler = open(file, "rt").read()
|
spoiler = open(file, "rt").read()
|
||||||
elif file.endswith("multidata"):
|
elif file.endswith("multidata"):
|
||||||
|
multidata = file
|
||||||
|
|
||||||
|
if not race or len(patches) > 1:
|
||||||
try:
|
try:
|
||||||
multidata = json.loads(zlib.decompress(open(file, "rb").read()))
|
multidata = json.loads(zlib.decompress(open(multidata, "rb").read()))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
flash(e)
|
flash(e)
|
||||||
if multidata:
|
raise e
|
||||||
|
else:
|
||||||
|
multidata = {}
|
||||||
|
|
||||||
with db_session:
|
with db_session:
|
||||||
if sid:
|
if sid:
|
||||||
seed = Seed(multidata=multidata, spoiler=spoiler, patches=patches, owner=owner, id=sid)
|
seed = Seed(multidata=multidata, spoiler=spoiler, patches=patches, owner=owner, id=sid)
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
You can also upload a .zip with multiple YAMLs.
|
You can also upload a .zip with multiple YAMLs.
|
||||||
A proper menu is in the works.
|
A proper menu is in the works.
|
||||||
{% if race -%}
|
{% if race -%}
|
||||||
Race Mode means the spoiler log will be unavailable.
|
Race Mode means the spoiler log will be unavailable, roms will be encrypted and single-player has no multidata.
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
You can go to <a href="{{ url_for("generate", race=True) }}">Race Mode</a> to create a game without
|
You can go to <a href="{{ url_for("generate", race=True) }}">Race Mode</a> to create a game without
|
||||||
spoiler log.
|
spoiler log and with encryption.
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
<div id="view-seed-wrapper">
|
<div id="view-seed-wrapper">
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<h3>Seed Info</h3>
|
<h3>Seed Info</h3>
|
||||||
|
{% if not seed.multidata and not seed.spoiler %}
|
||||||
|
<h4>
|
||||||
|
Single Player Race Rom: No spoiler or multidata exists, parts of the rom are encrypted and rooms cannot be created.
|
||||||
|
</h4>
|
||||||
|
{% endif %}
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -27,6 +32,7 @@
|
||||||
<td><a href="{{ url_for("download_spoiler", seed_id=seed.id) }}">Download</a></td>
|
<td><a href="{{ url_for("download_spoiler", seed_id=seed.id) }}">Download</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if seed.multidata %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>Players: </td>
|
<td>Players: </td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -55,6 +61,23 @@
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
<td>Patches: </td>
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
{% for patch in seed.patches %}
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="{{ url_for("download_raw_patch", seed_id=seed.id, player_id=patch.player) }}">Player {{ patch.player }}</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue