mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-26 13:49:21 +00:00
Bring back manual unzip, remove automatic unzip on upload, and show only relevant controls for zip files
This commit is contained in:
parent
269b718ec7
commit
39bd6b7ee9
@ -134,6 +134,16 @@
|
||||
{% if file["name"] in attached_images %}
|
||||
<center>Attached!</center>
|
||||
{% else %}
|
||||
{% if file["name"].lower().endswith(archive_file_suffix) %}
|
||||
<form action="/files/unzip" method="post">
|
||||
<input type="hidden" name="image" value="{{file["name"]}}">
|
||||
<input type="submit" value="Unzip" />
|
||||
</form>
|
||||
<form action="/files/delete" method="post" onsubmit="return confirm('Delete file?')">
|
||||
<input type="hidden" name="image" value="{{file["name"]}}">
|
||||
<input type="submit" value="Delete" />
|
||||
</form>
|
||||
{% else %}
|
||||
<form action="/scsi/attach" method="post">
|
||||
<input type="hidden" name="file_name" value="{{file["name"]}}">
|
||||
<input type="hidden" name="file_size" value="{{file["size"]}}">
|
||||
@ -169,6 +179,7 @@
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@ -219,7 +230,7 @@
|
||||
<details>
|
||||
<summary>Upload File</summary>
|
||||
<ul>
|
||||
<li>Uploads file to <tt>{{base_dir}}</tt>. The largest file size accepted is {{max_file_size}} MB. Zip files will be unzipped.</li>
|
||||
<li>Uploads file to <tt>{{base_dir}}</tt>. The largest file size accepted is {{max_file_size}} MB.</li>
|
||||
<li>For unrecognized file types, try renaming hard drive images to '.hds' and CD-ROM images to '.iso' before uploading.</li>
|
||||
<li>Recognized file types: {{valid_file_suffix}}</li>
|
||||
</ul>
|
||||
|
@ -108,6 +108,7 @@ def index():
|
||||
device_types=device_types["device_types"],
|
||||
free_disk=int(disk["free"] / 1024 / 1024),
|
||||
valid_file_suffix=valid_file_suffix,
|
||||
archive_file_suffix=ARCHIVE_FILE_SUFFIX,
|
||||
removable_device_types=REMOVABLE_DEVICE_TYPES,
|
||||
)
|
||||
|
||||
@ -570,13 +571,10 @@ def upload_file():
|
||||
return make_response(("Transferred file corrupted!", 500))
|
||||
else:
|
||||
log.info(f"File {file.filename} has been uploaded successfully")
|
||||
if filename.lower().endswith(".zip"):
|
||||
unzip_file(filename)
|
||||
else:
|
||||
log.debug(f"Chunk {current_chunk + 1} of {total_chunks} "
|
||||
f"for file {file.filename} completed.")
|
||||
|
||||
|
||||
return make_response(("File upload successful!", 200))
|
||||
|
||||
|
||||
@ -636,6 +634,18 @@ def delete():
|
||||
return redirect(url_for("index"))
|
||||
|
||||
|
||||
@app.route("/files/unzip", methods=["POST"])
|
||||
def unzip():
|
||||
image = request.form.get("image")
|
||||
|
||||
if unzip_file(image):
|
||||
flash("Unzipped file " + image)
|
||||
return redirect(url_for("index"))
|
||||
else:
|
||||
flash("Failed to unzip " + image, "error")
|
||||
return redirect(url_for("index"))
|
||||
|
||||
|
||||
@app.route("/files/prop", methods=["POST"])
|
||||
def show_properties():
|
||||
file_name = request.form.get("image")
|
||||
|
Loading…
Reference in New Issue
Block a user