Remove magic words and uploads, deprecate upload endpoints, style changes, version advance

This commit is contained in:
Yusur 2022-05-10 22:35:21 +02:00
parent 5d18cee75e
commit 733ea8cce1
8 changed files with 87 additions and 156 deletions

View file

@ -3,41 +3,19 @@
{% block content %}
<h1>Upload new file</h1>
<p>Types supported: <strong>.jpeg</strong>, <strong>.jpg</strong>, <strong>.png</strong>.</p>
<p>Uploads are no more supported. Please use this syntax instead for external images: <code>![alt text](https://www.example.com/path/to/image.jpg)</code>.</p>
<form method="POST" enctype="multipart/form-data">
<div>
<label for="name">Name: </label>
<input type="text" id="name-input" name="name" required maxlength="256">
<input type="text" id="name-input" name="name" required maxlength="256" disabled="">
</div>
<div>
<label for="file">File: </label>
<input type="file" id="file-input" name="file" accept="image/jpeg, image/png">
<input type="file" id="file-input" name="file" accept="image/jpeg, image/png" disabled="">
</div>
<div>
<input type="submit" class="submit-primary" value="Upload">
<input type="submit" value="Upload" disabled="">
</div>
</form>
{% endblock %}
{% block scripts %}
<script>
(function(){
function last(a){
return a[a.length-1];
}
var fileInput = document.getElementById('file-input');
var nameInput = document.getElementById('name-input');
fileInput.onchange = function(){
var name = last(fileInput.value.split(/[\/\\]/));
if(name.indexOf('.') >= 0){
name = name.replace(/\..*$/, '');
}
nameInput.value = name;
// TODO: add image preview
}
})();
</script>
{% endblock %}