Add file download for job models
- GET /files/{filename}: serves file from STL_UPLOAD_DIR with path-traversal guard
- Download button in File & Geometry card header (always visible when file attached)
- Download button also appears at the top of the Start Job modal
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -98,12 +98,19 @@
|
||||
<div class="card h-100">
|
||||
<div class="card-header border-secondary d-flex align-items-center justify-content-between" style="border-color:#21262d">
|
||||
<span class="text-secondary small text-uppercase fw-normal">File & Geometry</span>
|
||||
{% if job.file_name and not job.file_name.endswith('.gcode') %}
|
||||
<form method="POST" action="/jobs/{{ job.id }}/analyse">
|
||||
<button type="submit" class="btn btn-outline-secondary btn-sm py-0 px-2" style="font-size:.75rem">
|
||||
<i class="bi bi-cpu me-1"></i>Compute now
|
||||
</button>
|
||||
</form>
|
||||
{% if job.file_name %}
|
||||
<div class="d-flex gap-2">
|
||||
<a href="/files/{{ job.file_name }}" class="btn btn-outline-primary btn-sm py-0 px-2" style="font-size:.75rem" download>
|
||||
<i class="bi bi-download me-1"></i>Download
|
||||
</a>
|
||||
{% if not job.file_name.endswith('.gcode') %}
|
||||
<form method="POST" action="/jobs/{{ job.id }}/analyse">
|
||||
<button type="submit" class="btn btn-outline-secondary btn-sm py-0 px-2" style="font-size:.75rem">
|
||||
<i class="bi bi-cpu me-1"></i>Compute now
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@@ -350,6 +357,13 @@
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
{% if job.file_name %}
|
||||
<div class="mb-3">
|
||||
<a href="/files/{{ job.file_name }}" class="btn btn-outline-primary btn-sm w-100" download>
|
||||
<i class="bi bi-download me-1"></i>Download {{ job.file_name }}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if available_printers %}
|
||||
<label class="form-label text-secondary small">Select printer <span class="text-danger">*</span></label>
|
||||
<select name="printer_id" class="form-select bg-dark border-secondary text-white" required>
|
||||
|
||||
Reference in New Issue
Block a user