2020-06-14 21:23:57 +02:00
|
|
|
{% extends 'layouts/base.njk' %}
|
|
|
|
|
2021-03-29 12:55:05 +02:00
|
|
|
{% set title = app.name + ' - Upload file' %}
|
2020-06-14 21:23:57 +02:00
|
|
|
|
|
|
|
{% block scripts %}
|
|
|
|
<script src="/js/fm.js"></script>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block body %}
|
|
|
|
<h1>Upload files</h1>
|
|
|
|
<p>(except illegal ones)</p>
|
|
|
|
|
|
|
|
<div class="container">
|
|
|
|
<section class="panel">
|
2021-01-26 14:29:29 +01:00
|
|
|
<h2><i data-feather="upload"></i> Upload a file</h2>
|
2020-06-14 21:23:57 +02:00
|
|
|
|
2020-06-15 12:11:20 +02:00
|
|
|
<form action="{{ route('post-file-frontend') }}" method="POST" enctype="multipart/form-data"
|
|
|
|
id="upload-form">
|
2020-06-14 21:23:57 +02:00
|
|
|
{{ macros.field(_locals, 'file', 'upload', '', 'Choose wisely', 'The maximum upload size is ' + max_upload_size + 'MiB', validation_attributes='required') }}
|
|
|
|
|
|
|
|
{{ macros.field(_locals, 'number', 'expire_after_days', '30', 'How many days to delete this file after', null, validation_attributes='max="1825"') }}
|
|
|
|
{{ macros.field(_locals, 'checkbox', 'never_expire', '', 'Never delete this file') }}
|
|
|
|
|
2020-07-06 14:52:38 +02:00
|
|
|
{{ macros.field(_locals, 'text', 'slug', '', 'Custom url slug', 'Example: beautiful_image.jpg sets url to https://'+default_domain+'/beautiful_image.jpg', validation_attributes='disabled') }}
|
2020-06-14 21:23:57 +02:00
|
|
|
{{ macros.field(_locals, 'checkbox', 'autogen_url', '', 'Generate url automatically', null, validation_attributes='checked') }}
|
|
|
|
|
2020-11-22 15:19:58 +01:00
|
|
|
{{ macros.csrf(getCsrfToken) }}
|
2020-06-14 21:23:57 +02:00
|
|
|
|
|
|
|
<button type="submit"><i data-feather="upload"></i> Upload</button>
|
|
|
|
</form>
|
2020-06-15 12:11:20 +02:00
|
|
|
|
|
|
|
<div id="file-upload" class="hidden">
|
|
|
|
<div class="name">photo.jpg</div>
|
|
|
|
<div class="progress-bar" style="--progress: 50%;"><span class="content">50%</span></div>
|
|
|
|
<div class="status hidden"></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="file-upload-link" class="hidden copyable-text">
|
|
|
|
<div class="title">URL</div>
|
|
|
|
<div class="content"></div>
|
|
|
|
<button class="copy-button"><i data-feather="copy"></i></button>
|
|
|
|
</div>
|
2020-07-06 14:52:38 +02:00
|
|
|
|
|
|
|
{% set url = flash('url') %}
|
|
|
|
{% if url | length %}
|
|
|
|
<div class="copyable-text">
|
|
|
|
<div class="title">URL</div>
|
|
|
|
<div class="content">{{ url }}</div>
|
|
|
|
<button class="copy-button"><i data-feather="copy"></i></button>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2020-06-14 21:23:57 +02:00
|
|
|
</section>
|
|
|
|
|
2021-03-29 12:55:05 +02:00
|
|
|
|
|
|
|
<section class="panel">
|
|
|
|
<h2><i data-feather="folder"></i> File list</h2>
|
|
|
|
<table class="data-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>#</th>
|
|
|
|
<th class="table-col-grow">URL</th>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Size</th>
|
|
|
|
<th>Expires at</th>
|
|
|
|
<th>Actions</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
{% for file in files %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ file.id }}</td>
|
|
|
|
<td>
|
|
|
|
<div class="copyable-text">
|
|
|
|
<a class="content" href="{{ file.getURL() }}" target="_blank">{{ file.getURL() }}</a>
|
|
|
|
<button class="copy-button"><i data-feather="copy"></i></button>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
<td><pre>{{ file.real_name }}</pre></td>
|
|
|
|
<td>{{ (file.size / (1024 * 1024)).toFixed(2) }}MB</td>
|
|
|
|
{% set expires_at = file.getExpirationDate() %}
|
|
|
|
<td>{% if expires_at %}{{ expires_at.toISOString() }}{% else %}Never{% endif %}</td>
|
|
|
|
<td class="actions">
|
|
|
|
{% if file.shouldBeDeleted() %}
|
|
|
|
Pending deletion
|
|
|
|
{% else %}
|
|
|
|
<form action="{{ route('delete-file-frontend', file.slug) }}" method="post">
|
|
|
|
{{ macros.csrf(getCsrfToken) }}
|
|
|
|
<button class="button danger"><i data-feather="trash"></i> <span class="tip">Delete</span></button>
|
|
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</section>
|
|
|
|
</div>
|
2020-11-22 15:19:58 +01:00
|
|
|
{% endblock %}
|