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

@ -56,4 +56,5 @@
{% block scripts %}
<script src="/static/edit.js"></script>
<script src="/static/content.js"></script>
{% endblock %}

View file

@ -7,7 +7,6 @@
<div class="nl-new">
<a href="/create/"><button class="submit-primary">{{ T('new-note') }}</button></a>
<a href="/upload/"><button class="submit-secondary">{{ T('upload-file') }}</button></a>
</div>
<h2>{{ T('latest-notes') }}</h2>
@ -31,8 +30,4 @@
<li><a href="/p/most_recent/">{{ T('show-all') }}</a></li>
</ul>
<h2>{{ T('latest-uploads') }}</h2>
{# TODO security flaw; find a way to do this in a more safe manner! #}
{{ gallery|safe }}
{% endblock %}

View file

@ -8,7 +8,6 @@
<ul>
<li>Number of pages: <strong>{{ notes_count }}</strong></li>
<li>Number of pages with URL set: <strong>{{ notes_with_url }}</strong></li>
<li>Number of uploads: <strong>{{ upload_count }}</strong></li>
<li>Number of revisions: <strong>{{ revision_count }}</strong></li>
<li>Average revisions per page: <strong>{{ (revision_count / notes_count)|round(2) }}</strong></li>
</ul>

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 %}

View file

@ -5,29 +5,32 @@
{% block json_info %}<script>window.page_info={{ p.js_info()|tojson|safe }};</script>{% endblock %}
{% block content %}
<h1 id="firstHeading">{{ p.title }}</h1>
<article>
<h1 id="firstHeading">{{ p.title }}</h1>
<div class="jump-to-actions">
<span>{{ T('last-changed') }} {{ rev.human_pub_date() }}</span> ·
<a href="#page-actions">{{ T('jump-to-actions') }}</a>
</div>
<div class="jump-to-actions">
<span>{{ T('last-changed') }} {{ rev.human_pub_date() }}</span> ·
<a href="#page-actions">{{ T('jump-to-actions') }}</a>
</div>
{% block history_nav %}{% endblock %}
{% block history_nav %}{% endblock %}
<div class="inner-content">
{{ rev.html()|safe }}
</div>
<div class="inner-content">
{{ rev.html()|safe }}
</div>
{% if p.tags %}
<div class="page-tags">
<p>{{ T('tags') }}:</p>
<ul>
{% for tag in p.tags %}
<li><a href="/tags/{{ tag.name }}/">#{{ tag.name }}</a> <span class="tag-count">({{ tag.popularity() }})</span></li>
{% endfor %}
</ul>
</div>
{% endif %}
</article>
{% if p.tags %}
<div class="page-tags">
<p>{{ T('tags') }}:</p>
<ul>
{% for tag in p.tags %}
<li><a href="/tags/{{ tag.name }}/">#{{ tag.name }}</a> <span class="tag-count">({{ tag.popularity() }})</span></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endblock %}
{% block actions %}
@ -36,3 +39,7 @@
{{ T('last-changed') }} <time datetime="{{ rev.pub_date.isoformat() }}">{{ rev.pub_date.strftime('%B %-d, %Y at %H:%M:%S') }}</time> -
{{ T('page-id') }}: {{ p.id }}
{% endblock %}
{% block scripts %}
<script src="/static/content.js"></script>
{% endblock %}