* You can now disable using icons in home's footer links by setting "home_icons" to false in _globals.njk.

* Renamed "meta" block to "opengraph" in _layout.njk, since the block only represents opengraph tags anyways.

* Moved noscript warning to its own file at views/_partial/noscript.njk. It's also now being included in dashboard and auth pages.

* No-JS uploader will no longer use icons in its footer links. It will also no longer load fontello.css.

* Updated static files' version string in _globals.njk.

* Some other tweaks, mainly to get no-icons mode to work properly.
This commit is contained in:
Bobby Wibowo 2018-04-24 02:58:44 +07:00
parent c854e416ae
commit e5f5fb1038
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
11 changed files with 48 additions and 22 deletions

View File

@ -42,7 +42,7 @@ const init = function (db) {
table.integer('enabled')
table.integer('timestamp')
}).then(() => {
db.table('users').where({username: 'root'}).then((user) => {
db.table('users').where({ username: 'root' }).then((user) => {
if (user.length > 0) { return }
require('bcrypt').hash('root', 10, function (error, hash) {

View File

@ -161,3 +161,8 @@ img[data-dz-thumbnail] {
padding-left: 0.25rem;
padding-right: 0.25rem;
}
#linksColumn>span {
padding: 0 0.3rem;
color: #7f8c8d;
}

View File

@ -7,14 +7,17 @@
{% set home_subtitle = "A <strong>modern</strong> self-hosted file upload service" %}
{#
This will be appended to all CSS and JS files, and should be changed on every updates to make sure clients load the very latest version of them.
This will be appended to all CSS and JS files,
and should be changed on every updates to make sure clients load the very latest version of them.
#}
{% set v = "hEmd7tjh6Q" %}
{% set v = "8HSPG0eoRX" %}
{#
These will be the links in the homepage and the No-JS uploader.
You may remove icons by removing "icon" property. It will then automatically use "attrs.title" as the display text.
You may remove icons by changing "home_icons" to false.
It will then automatically use "attrs.title" as the display text.
#}
{% set home_icons = true %}
{% set home_links = [
{
attrs: {

View File

@ -15,7 +15,7 @@
<link rel="stylesheet" type="text/css" href="css/style.css?v={{ globals.v }}">
{% endblock %}
{% block meta %}
{% block opengraph %}
<!-- Open Graph tags -->
<meta property="og:url" content="{{ globals.root }}" />
<meta property="og:type" content="website" />
@ -51,6 +51,7 @@
</head>
<body>
{% block content %}{% endblock %}
{% block scripts %}
<!-- Scripts -->
{% endblock %}

View File

@ -1,3 +1,7 @@
{% if plain_links or not globals.home_icons %}
{% set separator = (joiner('<span>|</span>')) %}
{% endif %}
{% macro attrs(obj) %}
{% set space = joiner(' ') %}
{% for id, val in obj -%}
@ -8,16 +12,17 @@
<div class="columns is-gapless">
<div class="column is-hidden-mobile"></div>
<div class="column">
<div id="linksColumn" class="columns is-mobile is-multiline is-centered">
<div id="linksColumn" class="columns is-mobile is-multiline is-centered {{ "is-gapless" if separator }}">
{% for link in globals.home_links -%}
{{ (separator() | safe) if separator }}
<div class="column is-narrow">
<a {{ attrs(link.attrs) | trim }}>
{% if link.icon -%}
{% if separator -%}
{{ link.attrs.title }}
{%- else -%}
<span class="icon is-medium">
<i class="{{ link.icon }}"></i>
</span>
{%- else -%}
{{ link.attrs.title }}
{%- endif %}
</a>
</div>

View File

@ -0,0 +1,18 @@
{#
I thought of making a redirect with http-equiv="refresh", but it's too quick that people
barely have any time to read the message which explains why the redirect is necessary.
So yeah, I decided to stick with making people click on the link which leads to
the No-JS uploader, if they really want to use the service.
#}
<noscript>
<style>body > section { display: none !important; }</style>
<section class="hero is-fullheight has-text-centered">
<div class="hero-body section">
<div class="container">
<p>You have JavaScript disabled, but this page requires JavaScript to function.</p>
<p>Please <a href="nojs">click here</a> if you want to try out our No-JS uploader.</p>
</div>
</div>
</section>
</noscript>

View File

@ -15,7 +15,7 @@
</style>
{% endblock %}
{% block meta %}
{% block opengraph %}
<!-- Open Graph tags -->
<meta property="og:type" content="website" />
<meta property="og:title" content="{{ title }} &#8211; {{ count }} files" />

View File

@ -61,4 +61,6 @@
</div>
</div>
</section>
{% include "_partial/noscript.njk" %}
{% endblock %}

View File

@ -96,4 +96,6 @@
</div>
<button class="modal-close is-large" aria-label="close" onclick="panel.closeModal()"></button>
</div>
{% include "_partial/noscript.njk" %}
{% endblock %}

View File

@ -77,15 +77,5 @@
</div>
</section>
<noscript>
<style>#home { display: none !important; }</style>
<section class="hero is-fullheight has-text-centered">
<div class="hero-body section">
<div class="container">
<p>You have JavaScript disabled, but this page requires JavaScript to function.</p>
<p>Please <a href="nojs">click here</a> if you want to try out our No-JS uploader.</p>
</div>
</div>
</section>
</noscript>
{% include "_partial/noscript.njk" %}
{% endblock %}

View File

@ -2,7 +2,6 @@
{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" type="text/css" href="libs/fontello/fontello.css?v={{ globals.v }}">
<link rel="stylesheet" type="text/css" href="css/home.css?v={{ globals.v }}">
{% endblock %}
@ -68,6 +67,7 @@
</div>
{%- endif %}
{% set plain_links = true %}
{% include "_partial/links.njk" %}
</div>
</div>