* Added globals.v3 to _globals.njk, which will be used for CSS/JS files of libs (bulma, lazyload, etc.). globals.v1 will now only be used for lolisafe's JS and CSS files.
Since CSS/JS files of libs receive much less updates than lolisafe's (mainly since I push updates a lot), this will decrease the amount of files that users need to re-fetch on every updates.

* Added public/js/album.js which will be used by album.njk (albums public link). I'm going to disable inline scripts in safe.fiery.me.

* Better FAQ. Some points will now dynamically changes depending on the settings you have in your config.js. It's not perfect but certainly much better than before.
This commit is contained in:
Bobby Wibowo 2018-05-12 23:34:19 +07:00
parent 7f23734d67
commit c4eed6e478
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
9 changed files with 100 additions and 39 deletions

View File

@ -54,9 +54,23 @@ safe.use('/api', api)
for (const page of config.pages) {
if (fs.existsSync(`./pages/custom/${page}.html`)) {
safe.get(`/${page}`, (req, res, next) => res.sendFile(`${page}.html`, { root: './pages/custom/' }))
safe.get(`/${page}`, (req, res, next) => res.sendFile(`${page}.html`, {
root: './pages/custom/'
}))
} else if (page === 'home') {
safe.get('/', (req, res, next) => res.render('home', { urlMaxSize: config.uploads.urlMaxSize }))
safe.get('/', (req, res, next) => res.render('home', {
urlMaxSize: config.uploads.urlMaxSize
}))
} else if (page === 'faq') {
const fileLength = config.uploads.fileLength
safe.get('/faq', (req, res, next) => res.render('faq', {
filterBlacklist: config.filterBlacklist,
extensionsFilter: config.extensionsFilter,
fileLength,
tooShort: (fileLength.max - fileLength.default) > (fileLength.default - fileLength.min),
noJsMaxSize: parseInt(config.cloudflare.noJsMaxSize) < parseInt(config.uploads.maxSize),
chunkSize: config.uploads.chunkSize
}))
} else {
safe.get(`/${page}`, (req, res, next) => res.render(page))
}

7
public/js/album.js Normal file
View File

@ -0,0 +1,7 @@
/* global LazyLoad */
const page = {}
window.onload = () => {
page.lazyLoad = new LazyLoad()
}

View File

@ -7,13 +7,15 @@
{% set home_subtitle = "A <strong>modern</strong> self-hosted file upload service" %}
{#
This will be appended to the URLs of static files (CSS, JS, images, etcetera),
This will be appended to the URLs of static files (CSS, JS, images, etc),
and should be changed on every updates to make sure clients load the very latest version of them.
v1: CSS and JS files.
v2: Images and config files (manifest.json, browserconfig.xml, etcetera).
v1: CSS and JS files (lolisafe).
v2: Images and config files (manifest.json, browserconfig.xml, etc).
v3: CSS and JS files (libs such as bulma, lazyload, etc).
#}
{% set v1 = "HrvcYD3KTh" %}
{% set v2 = "Ii3JYKIhb0" %}
{% set v3 = "HrvcYD3KTh" %}
{#
These will be the links in the homepage and the No-JS uploader.

View File

@ -11,7 +11,7 @@
{% block stylesheets %}
<!-- Stylesheets -->
<link rel="stylesheet" type="text/css" href="libs/bulma/bulma.min.css?v={{ globals.v1 }}">
<link rel="stylesheet" type="text/css" href="libs/bulma/bulma.min.css?v={{ globals.v3 }}">
<link rel="stylesheet" type="text/css" href="css/style.css?v={{ globals.v1 }}">
{% endblock %}

View File

@ -2,14 +2,14 @@
{% block stylesheets %}
<!-- Stylesheets -->
<link rel="stylesheet" type="text/css" href="../libs/bulma/bulma.min.css?v={{ globals.v1 }}">
<link rel="stylesheet" type="text/css" href="../libs/bulma/bulma.min.css?v={{ globals.v3 }}">
<link rel="stylesheet" type="text/css" href="../css/style.css?v={{ globals.v1 }}">
<link rel="stylesheet" type="text/css" href="../css/album.css?v={{ globals.v1 }}">
{% endblock %}
{% block scripts %}
<script type="text/javascript" src="../libs/lazyload/lazyload.min.js?v={{ globals.v1 }}"></script>
<script>var lazyLoad = new LazyLoad();</script>
<script type="text/javascript" src="../libs/lazyload/lazyload.min.js?v={{ globals.v3 }}"></script>
<script type="text/javascript" src="../js/album.js?v={{ globals.v1 }}"></script>
{% endblock %}
{% block opengraph %}

View File

@ -2,15 +2,15 @@
{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" type="text/css" href="libs/fontello/fontello.css?v={{ globals.v1 }}">
<link rel="stylesheet" type="text/css" href="libs/fontello/fontello.css?v={{ globals.v3 }}">
<link rel="stylesheet" type="text/css" href="css/sweetalert.css?v={{ globals.v1 }}">
<link rel="stylesheet" type="text/css" href="css/auth.css?v={{ globals.v1 }}">
{% endblock %}
{% block scripts %}
{{ super() }}
<script type="text/javascript" src="libs/sweetalert/sweetalert.min.js?v={{ globals.v1 }}"></script>
<script type="text/javascript" src="libs/axios/axios.min.js?v={{ globals.v1 }}"></script>
<script type="text/javascript" src="libs/sweetalert/sweetalert.min.js?v={{ globals.v3 }}"></script>
<script type="text/javascript" src="libs/axios/axios.min.js?v={{ globals.v3 }}"></script>
<script type="text/javascript" src="js/auth.js?v={{ globals.v1 }}"></script>
{% endblock %}

View File

@ -2,17 +2,17 @@
{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" type="text/css" href="libs/fontello/fontello.css?v={{ globals.v1 }}">
<link rel="stylesheet" type="text/css" href="libs/fontello/fontello.css?v={{ globals.v3 }}">
<link rel="stylesheet" type="text/css" href="css/sweetalert.css?v={{ globals.v1 }}">
<link rel="stylesheet" type="text/css" href="css/dashboard.css?v={{ globals.v1 }}">
{% endblock %}
{% block scripts %}
{{ super() }}
<script type="text/javascript" src="libs/sweetalert/sweetalert.min.js?v={{ globals.v1 }}"></script>
<script type="text/javascript" src="libs/axios/axios.min.js?v={{ globals.v1 }}"></script>
<script type="text/javascript" src="libs/clipboard.js/clipboard.min.js?v={{ globals.v1 }}"></script>
<script type="text/javascript" src="libs/lazyload/lazyload.min.js?v={{ globals.v1 }}"></script>
<script type="text/javascript" src="libs/sweetalert/sweetalert.min.js?v={{ globals.v3 }}"></script>
<script type="text/javascript" src="libs/axios/axios.min.js?v={{ globals.v3 }}"></script>
<script type="text/javascript" src="libs/clipboard.js/clipboard.min.js?v={{ globals.v3 }}"></script>
<script type="text/javascript" src="libs/lazyload/lazyload.min.js?v={{ globals.v3 }}"></script>
<script type="text/javascript" src="js/dashboard.js?v={{ globals.v1 }}"></script>
{% endblock %}

View File

@ -24,7 +24,7 @@
<h2 class='subtitle'>What is safe.fiery.me?</h2>
<article class="message">
<div class="message-body">
safe.fiery.me is merely another clone of <a href="https://github.com/WeebDev/lolisafe" target="_blank" rel="noopener">lolisafe</a>. We accept your files, photos, documents, anything, and give you back a shareable link for you to send to others.
safe.fiery.me is a fork of <a href="https://github.com/WeebDev/lolisafe" target="_blank" rel="noopener">lolisafe</a>. You can check out the fork <a href="https://github.com/BobbyWibowo/lolisafe" target="_blank" rel="noopener">here</a>.
</div>
</article>
@ -39,24 +39,17 @@
<article class="message">
<div class="message-body">
Simply create a user on the site and every upload will be associated with your account, granting you access to your uploaded files through our dashboard.<br>
By having an account, you will also be able to set file name length for your new
uploads!
</div>
</article>
<h2 class='subtitle'>Do you have any No-JS uploader?</h2>
<article class="message">
<div class="message-body">
Yes, check out <a href="nojs" target="_blank" rel="noopener">this page</a>.<br>
Unfortunately you will not be able to associate your uploads to your account, if you have any.<br>
Then again, if you want to use the No-JS uploader, then it's very likely that you will not use the Dashboard anyways.
</div>
</article>
<h2 class='subtitle'>What are albums?</h2>
<article class="message">
<div class="message-body">
Albums are a simple way of sorting uploads together. Right now you can create albums through the dashboard, then afterwards you can use them through the homepage uploader or with <a href="https://chrome.google.com/webstore/detail/loli-safe-uploader/enkkmplljfjppcdaancckgilmgoiofnj" rel="noopener">our chrome extension</a>, which will enable you to <strong>right click -> send to lolisafe</strong> or to a desired album if you have any. You will probably have to change some things involving <b>https://safe.fiery.me/api/upload</b> if you want to use the extension though.
Albums are a simple way of sorting uploads together.<br>
Right now you can create albums through the dashboard (and the homepage if you are logged in),<br>
then afterwards you can use them with our <a href="https://chrome.google.com/webstore/detail/loli-safe-uploader/enkkmplljfjppcdaancckgilmgoiofnj" target="_blank" rel="noopener">Chrome extension</a> or <a href="https://github.com/BobbyWibowo/loli-safe-extension/releases" target="_blank" rel="noopener">Firefox extension</a>,<br>
which will enable you to <strong>right click -> send to safe</strong> or to a desired album if you have any.<br>
You will have to set the domain in the extension's settings to <strong>https://safe.fiery.me</strong> though.
</div>
</article>
@ -67,19 +60,64 @@
</div>
</article>
<h2 class='subtitle'>I saw something too illegal for my tastes here, what do?</h2>
<h2 class='subtitle'>I saw something too illegal for my tastes here, what should I do?</h2>
<article class="message">
<div class="message-body">
Send a strongly worded email to <a href="mailto:bobby@fiery.me">bobby@fiery.me</a> and I will try to get back to you within 24 hours.
</div>
</article>
<h2 class='subtitle'>Do you support chunked uploads?</h2>
<h2 class='subtitle'>Do you have a No-JS uploader form?</h2>
<article class="message">
<div class="message-body">
Yes, the homepage uploader will chunk your uploads into 10 MB pieces by default. If you want to utilize chunked uploads with the API, then feel free to inspect the HTTP requests.
Yes, check out <a href="nojs" target="_blank" rel="noopener">this page</a>.<br>
Unfortunately you will not be able to associate your uploads to your account, if you have any.
</div>
</article>
{% if chunkSize -%}
<h2 class='subtitle'>Does your API support chunked uploads?</h2>
<article class="message">
<div class="message-body">
Yes, the homepage uploader will chunk your uploads into {{ chunkSize }} pieces by default.<br>
If you want to utilize chunked uploads with the API, then feel free to inspect the HTTP requests.
</div>
</article>
{%- endif %}
<h2 class='subtitle'>What are the allowed extensions here?</h2>
<article class="message">
<div class="message-body">
{% if extensionsFilter.length and filterBlacklist -%}
We support any file extensions except the following: {{ extensionsFilter | join(', ') }}.
{%- elif extensionsFilter.length and not filterBlacklist -%}
We only support the following extensions: {{ extensionsFilter | join(', ') }}.
{%- else -%}
We support any file extensions.
{%- endif %}
</div>
</article>
<h2 class='subtitle'>How are the file URLs going to be determined?</h2>
<article class="message">
<div class="message-body">
Random {{ fileLength.default }}-letter strings will automatically be generated for your uploads.
{% if fileLength.userChangeable %}<br>
If you think that is too {{ "short" if tooShort else "long" }}, you can create an account, which will let you to set a preferred length.<br>
At the moment you can choose from {{ fileLength.min }} to {{ fileLength.max }} letters.
{%- endif %}
</div>
</article>
{% if noJsMaxSize and chunkSize -%}
<h2 class='subtitle'>Why is the maximum file size in the No-JS uploader form smaller?</h2>
<article class="message">
<div class="message-body">
This site is using Cloudflare, which limits the maximum upload size.<br>
The homepage uploader will automatically chunk your uploads into {{ chunkSize }} pieces, so it is possible to increase the maximum file size there, but not in the No-JS uploader form.
</div>
</article>
{%- endif %}
</div>
</div>
</section>

View File

@ -2,18 +2,18 @@
{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" type="text/css" href="libs/fontello/fontello.css?v={{ globals.v1 }}">
<link rel="stylesheet" type="text/css" href="libs/fontello/fontello.css?v={{ globals.v3 }}">
<link rel="stylesheet" type="text/css" href="css/sweetalert.css?v={{ globals.v1 }}">
<link rel="stylesheet" type="text/css" href="css/home.css?v={{ globals.v1 }}">
{% endblock %}
{% block scripts %}
{{ super() }}
<script type="text/javascript" src="libs/sweetalert/sweetalert.min.js?v={{ globals.v1 }}"></script>
<script type="text/javascript" src="libs/dropzone/dropzone.min.js?v={{ globals.v1 }}"></script>
<script type="text/javascript" src="libs/axios/axios.min.js?v={{ globals.v1 }}"></script>
<script type="text/javascript" src="libs/clipboard.js/clipboard.min.js?v={{ globals.v1 }}"></script>
<script type="text/javascript" src="libs/lazyload/lazyload.min.js?v={{ globals.v1 }}"></script>
<script type="text/javascript" src="libs/sweetalert/sweetalert.min.js?v={{ globals.v3 }}"></script>
<script type="text/javascript" src="libs/dropzone/dropzone.min.js?v={{ globals.v3 }}"></script>
<script type="text/javascript" src="libs/axios/axios.min.js?v={{ globals.v3 }}"></script>
<script type="text/javascript" src="libs/clipboard.js/clipboard.min.js?v={{ globals.v3 }}"></script>
<script type="text/javascript" src="libs/lazyload/lazyload.min.js?v={{ globals.v3 }}"></script>
<script type="text/javascript" src="js/home.js?v={{ globals.v1 }}"></script>
{% endblock %}