mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-18 17:21:33 +00:00
Updated
Description in album public pages will no longer use h2 tag. Descriptions that can go up to 4000 chars kinda made no sense to use that tag. Use Nunjucks' built-in nl2br tag to replace newlines with <br> tag. Removed unused macro from faq.njk. Better extensions filter list in URL uploads tab. Updated config.sample.js with sample usage of the URL uploads extensions filter.
This commit is contained in:
parent
1ff1a4463c
commit
386787c6ce
@ -181,7 +181,7 @@ module.exports = {
|
|||||||
Disclaimer message that will be printed underneath the URL uploads form.
|
Disclaimer message that will be printed underneath the URL uploads form.
|
||||||
Supports HTML. Be safe though.
|
Supports HTML. Be safe though.
|
||||||
*/
|
*/
|
||||||
urlDisclaimerMessage: 'URL uploads are being proxied by <a href="https://duckduckgo.com/" target="_blank" rel="noopener">DuckDuckGo</a>. The proxy can only process direct links, and generally it can only proxy images.',
|
urlDisclaimerMessage: 'URL uploads are being proxied by <a href="https://duckduckgo.com/" target="_blank" rel="noopener">DuckDuckGo</a>.',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Filter mode for URL uploads.
|
Filter mode for URL uploads.
|
||||||
@ -190,7 +190,7 @@ module.exports = {
|
|||||||
The rest are paired with urlExtensionsFilter option below and should be self-explanatory.
|
The rest are paired with urlExtensionsFilter option below and should be self-explanatory.
|
||||||
When this is not set to any of the 3 values, this will fallback to 'inherit'.
|
When this is not set to any of the 3 values, this will fallback to 'inherit'.
|
||||||
*/
|
*/
|
||||||
urlExtensionsFilterMode: 'inherit',
|
urlExtensionsFilterMode: 'whitelist',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Mainly intended for URL proxies that only support certain extensions.
|
Mainly intended for URL proxies that only support certain extensions.
|
||||||
@ -199,7 +199,17 @@ module.exports = {
|
|||||||
Queries and segments in the URLs will be bypassed.
|
Queries and segments in the URLs will be bypassed.
|
||||||
NOTE: Can not be empty when using either 'blacklist' or 'whitelist' mode.
|
NOTE: Can not be empty when using either 'blacklist' or 'whitelist' mode.
|
||||||
*/
|
*/
|
||||||
urlExtensionsFilter: [],
|
urlExtensionsFilter: [
|
||||||
|
'.webp',
|
||||||
|
'.jpg',
|
||||||
|
'.jpeg',
|
||||||
|
'.bmp',
|
||||||
|
'.gif',
|
||||||
|
'.png',
|
||||||
|
'.tiff',
|
||||||
|
'.tif',
|
||||||
|
'.svg'
|
||||||
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
An array of allowed ages for uploads (in hours).
|
An array of allowed ages for uploads (in hours).
|
||||||
|
@ -76,10 +76,6 @@ routes.get('/a/:identifier', async (req, res, next) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
album.description = album.description
|
|
||||||
? album.description.replace(/\n/g, '<br>')
|
|
||||||
: null
|
|
||||||
|
|
||||||
album.downloadLink = album.download === 0
|
album.downloadLink = album.download === 0
|
||||||
? null
|
? null
|
||||||
: `api/album/zip/${album.identifier}?v=${album.editedAt}`
|
: `api/album/zip/${album.identifier}?v=${album.editedAt}`
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% set metaTitle %}
|
{% set metaTitle %}
|
||||||
{{- album.name | truncate(60, true, '…') + ' – ' + files.length + ' file' + ('s' if files.length !== 1) -}}
|
{{- album.name | truncate(60, true, '…') + ' – ' + files.length + ' file' + ('s' if files.length !== 1) -}}
|
||||||
{% endset %}
|
{% endset %}
|
||||||
{% set metaDesc = album.description | truncate(200, true, '…') %}
|
{% set metaDesc = album.description | striptags | truncate(200, true, '…') %}
|
||||||
{% set metaUrl = '/' + album.url %}
|
{% set metaUrl = '/' + album.url %}
|
||||||
|
|
||||||
{% set fileRoot = config.domain %}
|
{% set fileRoot = config.domain %}
|
||||||
@ -67,9 +67,9 @@
|
|||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
{% if album.description -%}
|
{% if album.description -%}
|
||||||
<h2 class="subtitle description">
|
<div class="subtitle description">
|
||||||
{{ album.description | safe }}
|
{{ album.description | nl2br | safe }}
|
||||||
</h2>
|
</div>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
@ -8,13 +8,6 @@
|
|||||||
{% set extensionsFilterMode = config.extensionsFilterMode %}
|
{% set extensionsFilterMode = config.extensionsFilterMode %}
|
||||||
{% set extensionsFilter = config.extensionsFilter %}
|
{% set extensionsFilter = config.extensionsFilter %}
|
||||||
|
|
||||||
{% macro extensions(obj) %}
|
|
||||||
{% set space = joiner(' ') %}
|
|
||||||
{% for id, val in obj -%}
|
|
||||||
{{ space() }}{{ id }}="{{ val }}"
|
|
||||||
{%- endfor %}
|
|
||||||
{% endmacro %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<section class="section">
|
<section class="section">
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
{% set urlDisclaimerMessage = config.uploads.urlDisclaimerMessage %}
|
{% set urlDisclaimerMessage = config.uploads.urlDisclaimerMessage %}
|
||||||
{% set urlExtensionsFilterMode = config.uploads.urlExtensionsFilterMode %}
|
{% set urlExtensionsFilterMode = config.uploads.urlExtensionsFilterMode %}
|
||||||
{% set urlExtensionsFilter = config.uploads.urlExtensionsFilter %}
|
{% set urlExtensionsFilter = config.uploads.urlExtensionsFilter %}
|
||||||
|
{% set urlExtensionsFilterEnabled = urlExtensionsFilterMode and urlExtensionsFilterMode !== 'inherit' and urlExtensionsFilter.length %}
|
||||||
{% set temporaryUploadAges = config.uploads.temporaryUploadAges %}
|
{% set temporaryUploadAges = config.uploads.temporaryUploadAges %}
|
||||||
|
|
||||||
{% block endmeta %}
|
{% block endmeta %}
|
||||||
@ -104,17 +105,23 @@
|
|||||||
<p class="help">
|
<p class="help">
|
||||||
{% if urlMaxSizeInt !== maxSizeInt -%}
|
{% if urlMaxSizeInt !== maxSizeInt -%}
|
||||||
Maximum file size per URL is <span id="urlMaxSize">{{ urlMaxSizeInt }} MB</span>.
|
Maximum file size per URL is <span id="urlMaxSize">{{ urlMaxSizeInt }} MB</span>.
|
||||||
{%- endif %}
|
{{- ' ' }}{% endif -%}
|
||||||
|
|
||||||
{% if urlExtensionsFilter.length and (urlExtensionsFilterMode === 'blacklist') -%}
|
{% if urlExtensionsFilterEnabled -%}
|
||||||
Blacklisted extensions: {{ urlExtensionsFilter | join(', ') }}.
|
{% if urlExtensionsFilterMode === 'blacklist' -%}
|
||||||
{%- elif urlExtensionsFilter.length and (urlExtensionsFilterMode === 'whitelist') -%}
|
Blacklist:
|
||||||
Whitelisted extensions: {{ urlExtensionsFilter | join(', ') }}.
|
{%- elif urlExtensionsFilterMode === 'whitelist' -%}
|
||||||
{%- endif %}
|
Whitelist:
|
||||||
|
{%- endif %}{{ ' ' -}}
|
||||||
|
{% set comma = joiner(', ') %}
|
||||||
|
{%- for extension in urlExtensionsFilter -%}
|
||||||
|
{{ comma() }}{{ extension | replace('.', '') | upper }}
|
||||||
|
{%- endfor %}.
|
||||||
|
{{- ' ' }}{% endif -%}
|
||||||
|
|
||||||
{%- if urlDisclaimerMessage %}
|
{%- if urlDisclaimerMessage -%}
|
||||||
{{ urlDisclaimerMessage | safe }}
|
{{ urlDisclaimerMessage | safe }}
|
||||||
{% endif -%}
|
{%- endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
Loading…
Reference in New Issue
Block a user