socket 断线自动重连,文件上传功能

This commit is contained in:
undefined committed 2020-07-14 16:36:03 +08:00
1 parent 95bfd98b43
commit 10956f1fee
18 files changed
+157 -50

No files matched your search

+4 -6
View File
@@ -5,19 +5,17 @@
<p>{{ _('ID') }}: {{ fdoc['_id'] }}</p>
<p>{{ _('Userfile doc_id') }}: {{ ufid }}</p>
<p>{{ _('MD5') }}: {{ fdoc['md5'] }}</p>
<p>{{ _('Secret (keep it secret)') }}: {{ fdoc['metadata']['secret'] }}</p>
<p>{{ _('URL') }}: {{ reverse_url('fs_get', domain_id=vj4.model.builtin.DOMAIN_ID_SYSTEM, secret=fdoc['metadata']['secret']) }}</p>
<p>{{ _('Image Markdown') }}: <pre>![{{ _('Description') }}](vijos:/{{ reverse_url('fs_get', domain_id=vj4.model.builtin.DOMAIN_ID_SYSTEM, secret=fdoc['metadata']['secret']) }})</pre></p>
<p>{{ _('URL') }}: {{ model.file.url(fdoc) }}</p>
{% endif %}
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<p>
{{ _('New file') }}:
<input type="text" name="desc" placeholder="{{ _('Description') }}">
<input type="text" name="title" placeholder="{{ _('Description') }}">
<input type="file" name="file">
<input type="submit" value="{{ _('Upload') }}" class="rounded primary button">
</p>
<p>{{ _('Note: file size should be less than or equal to {0}, and file type should be in {1}. Empty files are not allowed.').format(vj4.handler.fs.FILE_MAX_LENGTH|format_size, vj4.handler.fs.ALLOWED_MIMETYPE_PREFIX) }}</p>
<p>{{ _('Usage: {0}, Quota: {1}').format(usage|format_size, quota|format_size) }}</p>
<p>{{ _('Note: file size should be less than or equal to {0}, and file type should be in {1}. Empty files are not allowed.').format(size(FILE_MAX_LENGTH), ALLOWED_MIMETYPE_PREFIX) }}</p>
<p>{{ _('Usage: {0}, Quota: {1}').format(size(usage), size(quota)) }}</p>
</form>
{% endblock %}
+6 -8
View File
@@ -4,8 +4,8 @@
<div class="section__header">
<h1 class="section__title">{{ _('My Files') }}</h1>
<div class="section__tools">
{% if handler.has_priv(vj4.model.builtin.PRIV_CREATE_FILE) %}
<a class="primary rounded button" href="{{ reverse_url('fs_upload') }}" target="_blank"><span class="icon icon-add"></span> {{ _('Upload File') }}</a>
{% if handler.user.hasPriv(model.builtin.PRIV.PRIV_CREATE_FILE) %}
<a class="primary rounded button" href="{{ url('file_upload') }}" target="_blank"><span class="icon icon-add"></span> {{ _('Upload File') }}</a>
{% endif %}
<a class="tool-button" href="{{ url('wiki', page='help', anchor='file') }}"><span class="icon icon-help"></span> {{ _("What's file?") }}</a>
</div>
@@ -28,14 +28,12 @@
</thead>
<tbody>
{% for ufdoc in ufdocs %}
{% with fdoc = fdict.get(ufdoc['file_id'], {}) %}
<tr>
<td class="col--desc">{{ ufdoc['content'] }}</td>
<td class="col--length">{{ fdoc['length']|format_size if fdoc['length'] else '?' }}</td>
<td class="col--hash">{{ fdoc['md5']|default('?') }}</td>
<td class="col--action"><a class="typo-a" href="{{ handler.file_url(fdoc) if 'metadata' in fdoc else '#' }}">{{ _('Download') }}</a> · <a class="typo-a" href="#">{{ _('Code') }}</a></td>
<td class="col--desc">{{ ufdoc.filename }}</td>
<td class="col--length">{{ size(ufdoc.size) if ufdoc.size else '?' }}</td>
<td class="col--hash">{{ ufdoc.md5|default('?') }}</td>
<td class="col--action"><a class="typo-a" href="{{ model.file.url(ufdoc) }}">{{ _('Download') }}</a></td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
+11
View File
@@ -51,6 +51,17 @@
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="{{ url('home_file') }}" class="menu__link">
<span class="icon icon-file"></span> {{ _('My Files') }}
</a>
</li>
<li class="menu__item">
<a href="{{ url('home_domain') }}" class="menu__link">
<span class="icon icon-web"></span> {{ _('My Domains') }}
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="{{ url('user_logout') }}" class="menu__link" name="nav_logout">
<span class="icon icon-logout"></span> {{ _('Logout') }}