mirror of
https://github.com/akuker/RASCSI.git
synced 2024-06-01 04:41:38 +00:00
dd00547f92
- New utility method for the web app, which sorts image files into dicts where the subdir is the key - In the web ui, display each subdir in a table nested in a details tag. - Allow for picking destination subdir when uploading files - Style the expandable details blocks in the images table - Add a check for ~ paths to the is_safe_path() utility method
74 lines
3.3 KiB
HTML
74 lines
3.3 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<h2>{{ _("Upload File from Local Computer") }}</h2>
|
|
<ul>
|
|
<li>{{ _("The largest file size accepted in this form is %(max_file_size)s MiB. Use other file transfer means for larger files.", max_file_size=max_file_size) }}</li>
|
|
<li>{{ _("You have to manually clean up partially uploaded files, as a result of cancelling the upload or closing this page.") }}</li>
|
|
<li>{{ _("Disk Images") }} = {{ env["image_dir"] }}</li>
|
|
<li>{{ _("Shared Files") }} = {{ FILE_SERVER_DIR }}</li>
|
|
<li>{{ _("PiSCSI Config") }} = {{ CFG_DIR }}</li>
|
|
</ul>
|
|
|
|
<h3>{{ _("Destination") }}</h3>
|
|
<form name="dropper" action="/files/upload" method="post" class="dropzone dz-clickable" enctype="multipart/form-data" id="dropper">
|
|
<input type="radio" name="destination" id="disk_images" value="disk_images" checked="checked">
|
|
<label for="disk_images">{{ _("Disk Images") }}</label>
|
|
<select name="subdir" id="subdir">
|
|
<option value="">images/</option>
|
|
{% for subdir, group in formatted_image_files.items() %}
|
|
{% if subdir != "/" %}
|
|
<option value="{{subdir}}">images/{{subdir}}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
<input type="radio" name="destination" id="shared_files" value="shared_files">
|
|
<label for="shared_files">{{ _("Shared Files") }}</label>
|
|
<input type="radio" name="destination" id="piscsi_config" value="piscsi_config">
|
|
<label for="piscsi_config">{{ _("PiSCSI Config") }}</label>
|
|
</form>
|
|
|
|
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.js"></script>
|
|
|
|
<script type="application/javascript">
|
|
Dropzone.options.dropper = {
|
|
paramName: 'file',
|
|
url: '/files/upload',
|
|
maxFilesize: {{ max_file_size }}, // max allowed file size in MiB
|
|
chunking: true,
|
|
forceChunking: true,
|
|
parallelChunkUploads: false,
|
|
chunkSize: 1048576, // 1 MiB
|
|
retryChunks: true,
|
|
retryChunksLimit: 3,
|
|
createImageThumbnails: false,
|
|
addRemoveLinks: true,
|
|
dictDefaultMessage: "{{ _("Drop files here to upload") }}",
|
|
dictFallbackMessage: "{{ _("Your browser does not support drag'n'drop file uploads.") }}",
|
|
dictFallbackText: "{{ _("Please use the fallback form below to upload your files like in the olden days.") }}",
|
|
dictFileTooBig: "{{ _("File is too big: {{filesize}}MiB. Max filesize: {{maxFilesize}}MiB.") }}",
|
|
dictInvalidFileType: "{{ _("You can't upload files of this type.") }}",
|
|
dictResponseError: "{{ _("Server responded with code: {{statusCode}}") }}",
|
|
dictCancelUpload:" {{ _("Cancel upload") }}",
|
|
dictUploadCanceled: "{{ _("Upload canceled.") }}",
|
|
dictCancelUploadConfirmation: "{{ _("Are you sure you want to cancel this upload?") }}",
|
|
dictRemoveFile: "{{ _("Dismiss") }}",
|
|
dictMaxFilesExceeded: "{{ _("You can not upload any more files.") }}",
|
|
dictFileSizeUnits: {
|
|
tb: "{{ _("TiB") }}",
|
|
gb: "{{ _("GiB") }}",
|
|
mb: "{{ _("MiB") }}",
|
|
kb: "{{ _("KiB") }}",
|
|
b: "{{ _("B") }}"
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<noscript>
|
|
<div class="noscriptmsg">
|
|
{{ _("The file uploading functionality requires JavaScript.") }}
|
|
</div>
|
|
</noscript>
|
|
|
|
{% endblock content %}
|