filesafe/views/nojs.njk
Bobby Wibowo 8b4b0e79c5
Improved albums public page cache and more
Removed its dependency towards albums' editedAt property.
Editing album's metas (name, description, etc) will no longer update
its editedAt property.
Instead it will now ONLY be updated when adding/removing files to/from
it. Just like how it was meant to be, which was to be used to check
whether it's necessary to re-generate their downloadable ZIPs.

Albums public page cache will still be properly invalidated when
adding/removing files to/from it, as well as after editing their metas.

Added views/album-notice.njk to be used to render okay-ish notice when
an album's public page is still being generated.
I was originally thinking of using it for disabled albums as well, but
I refrained from it to reduce the possibility of disabled album IDs from
being easily scanned (as it just returns 404 now).

Removed invalidatedAt property from stats cache. Instead their caches
will immediately be nullified as they should (thus frees up memory
slightly as well).

Stats cache for albums will now only be cleared when truly necessary.
As in, adding/removing files to/from albums will no longer clear them.

Updated Nunjucks files to properly use h1, h2, h3 tags in actual
hierarchical orders.
Elements that don't need to use hX tags will now use P instead.
Nothing changes visually, only structurally.

Fixed some elements in Nunjucks using single quotes instead of
double quotes. They'd have worked the same, but consistency.

Added h1 title in FAQ page.

Make text for no JS warning a bit bigger, and improved the phrasing
a little bit.
2020-06-03 10:44:24 +07:00

98 lines
3.2 KiB
Plaintext

{% set metaTitle = "No-JS uploader" %}
{% set metaUrl = '/nojs' %}
{% extends "_layout.njk" %}
{% set private = config.private %}
{% set disabledMessage -%}
{%- if config.enableUserAccounts -%}
Anonymous upload is disabled. Log in to upload.
{%- else -%}
Running in private mode. Log in to upload.
{%- endif %}
{%- endset %}
{% set maxSizeInt = config.uploads.maxSize | int %}
{% set noJsMaxSizeInt = config.cloudflare.noJsMaxSize | int %}
{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" href="css/home.css{{ versions[1] }}">
{% endblock %}
{% block content %}
{{ super() }}
<section id="home" class="hero is-fullheight">
<div class="hero-body">
<div class="container has-text-centered">
<p id="b">
<img class="logo" alt="logo" src="images/logo_smol.png{{ versions[2] }}">
</p>
<h1 class="title">{{ globals.name }}</h1>
<h2 class="subtitle">{{ globals.home_subtitle | safe }}</h2>
<p class="subtitle" id="maxSize">
Maximum total size per upload attempt is {{ noJsMaxSizeInt or maxSizeInt }} MB
</p>
<div class="columns is-gapless">
<div class="column is-hidden-mobile"></div>
<div class="column">
{% if private -%}
<a class="button is-danger is-outlined is-fullwidth" href="auth">
{{ disabledMessage }}
</a>
{%- else -%}
<form id="form" class="field" action="" method="post" enctype="multipart/form-data">
<div class="field">
<p class="control">
<input type="file" class="is-fullwidth" name="files[]" multiple="multiple" required="required">
</p>
</div>
<div class="field">
<p class="control">
<input type="submit" class="button is-danger is-outlined is-fullwidth" value="Upload">
</p>
<p class="help">
Files uploaded through this form will not be associated with your account, if you have any.
</p>
</div>
</form>
{%- endif %}
{% if files -%}
<div class="field uploads nojs">
{% for file in files -%}
<div class="field">
<p class="name">{{ file.original }}</p>
{% if errorMessage -%}
<p class="error">{{ errorMessage }}</p>
{%- endif %}
{% if file.url -%}
<p class="link">
<a href="{{ file.url }}" target="_blank">{{ file.url }}</a>
</p>
{%- endif %}
</div>
{% endfor %}
</div>
{%- endif %}
</div>
<div class="column is-hidden-mobile"></div>
</div>
{% set plain_links = true %}
{% include "_partial/links.njk" %}
{% if gitHash -%}
<div class="git-commit columns is-gapless">
<div class="column is-hidden-mobile"></div>
<div class="column">
<span>Git commit: </span><a href="https://github.com/BobbyWibowo/lolisafe/commit/{{ gitHash }}" target="_blank" rel="noopener">{{ gitHash }}</a>
</div>
<div class="column is-hidden-mobile"></div>
</div>
{%- endif %}
</div>
</div>
</section>
{% endblock %}