Skip to content

Commit

Permalink
Patch: Save patch file extension in archipelago.json (ArchipelagoMW#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alchav authored Sep 2, 2022
1 parent f7d107f commit b45d8bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import Utils

current_patch_version = 4
current_patch_version = 5


class AutoPatchRegister(type):
Expand Down Expand Up @@ -128,6 +128,7 @@ def get_manifest(self) -> dict:
manifest = super(APDeltaPatch, self).get_manifest()
manifest["base_checksum"] = self.hash
manifest["result_file_ending"] = self.result_file_ending
manifest["patch_file_ending"] = self.patch_file_ending
return manifest

@classmethod
Expand Down
7 changes: 5 additions & 2 deletions WebHostLib/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ def download_patch(room_id, patch_id):
new_zip.writestr("archipelago.json", json.dumps(manifest))
else:
new_zip.writestr(file.filename, zf.read(file), file.compress_type, 9)

if "patch_file_ending" in manifest:
patch_file_ending = manifest["patch_file_ending"]
else:
patch_file_ending = AutoPatchRegister.patch_types[patch.game].patch_file_ending
fname = f"P{patch.player_id}_{patch.player_name}_{app.jinja_env.filters['suuid'](room_id)}" \
f"{AutoPatchRegister.patch_types[patch.game].patch_file_ending}"
f"{patch_file_ending}"
new_file.seek(0)
return send_file(new_file, as_attachment=True, download_name=fname)
else:
Expand Down

0 comments on commit b45d8bf

Please sign in to comment.