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.
|
||||
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.
|
||||
@ -190,7 +190,7 @@ module.exports = {
|
||||
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'.
|
||||
*/
|
||||
urlExtensionsFilterMode: 'inherit',
|
||||
urlExtensionsFilterMode: 'whitelist',
|
||||
|
||||
/*
|
||||
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.
|
||||
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).
|
||||
|
@ -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
|
||||
? null
|
||||
: `api/album/zip/${album.identifier}?v=${album.editedAt}`
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% set metaTitle %}
|
||||
{{- album.name | truncate(60, true, '…') + ' – ' + files.length + ' file' + ('s' if files.length !== 1) -}}
|
||||
{% endset %}
|
||||
{% set metaDesc = album.description | truncate(200, true, '…') %}
|
||||
{% set metaDesc = album.description | striptags | truncate(200, true, '…') %}
|
||||
{% set metaUrl = '/' + album.url %}
|
||||
|
||||
{% set fileRoot = config.domain %}
|
||||
@ -67,9 +67,9 @@
|
||||
</nav>
|
||||
|
||||
{% if album.description -%}
|
||||
<h2 class="subtitle description">
|
||||
{{ album.description | safe }}
|
||||
</h2>
|
||||
<div class="subtitle description">
|
||||
{{ album.description | nl2br | safe }}
|
||||
</div>
|
||||
{%- endif %}
|
||||
<hr>
|
||||
|
||||
|
@ -8,13 +8,6 @@
|
||||
{% set extensionsFilterMode = config.extensionsFilterMode %}
|
||||
{% set extensionsFilter = config.extensionsFilter %}
|
||||
|
||||
{% macro extensions(obj) %}
|
||||
{% set space = joiner(' ') %}
|
||||
{% for id, val in obj -%}
|
||||
{{ space() }}{{ id }}="{{ val }}"
|
||||
{%- endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
{% block content %}
|
||||
{{ super() }}
|
||||
<section class="section">
|
||||
|
@ -5,6 +5,7 @@
|
||||
{% set urlDisclaimerMessage = config.uploads.urlDisclaimerMessage %}
|
||||
{% set urlExtensionsFilterMode = config.uploads.urlExtensionsFilterMode %}
|
||||
{% set urlExtensionsFilter = config.uploads.urlExtensionsFilter %}
|
||||
{% set urlExtensionsFilterEnabled = urlExtensionsFilterMode and urlExtensionsFilterMode !== 'inherit' and urlExtensionsFilter.length %}
|
||||
{% set temporaryUploadAges = config.uploads.temporaryUploadAges %}
|
||||
|
||||
{% block endmeta %}
|
||||
@ -104,17 +105,23 @@
|
||||
<p class="help">
|
||||
{% if urlMaxSizeInt !== maxSizeInt -%}
|
||||
Maximum file size per URL is <span id="urlMaxSize">{{ urlMaxSizeInt }} MB</span>.
|
||||
{%- endif %}
|
||||
{{- ' ' }}{% endif -%}
|
||||
|
||||
{% if urlExtensionsFilter.length and (urlExtensionsFilterMode === 'blacklist') -%}
|
||||
Blacklisted extensions: {{ urlExtensionsFilter | join(', ') }}.
|
||||
{%- elif urlExtensionsFilter.length and (urlExtensionsFilterMode === 'whitelist') -%}
|
||||
Whitelisted extensions: {{ urlExtensionsFilter | join(', ') }}.
|
||||
{%- endif %}
|
||||
{% if urlExtensionsFilterEnabled -%}
|
||||
{% if urlExtensionsFilterMode === 'blacklist' -%}
|
||||
Blacklist:
|
||||
{%- elif urlExtensionsFilterMode === 'whitelist' -%}
|
||||
Whitelist:
|
||||
{%- endif %}{{ ' ' -}}
|
||||
{% set comma = joiner(', ') %}
|
||||
{%- for extension in urlExtensionsFilter -%}
|
||||
{{ comma() }}{{ extension | replace('.', '') | upper }}
|
||||
{%- endfor %}.
|
||||
{{- ' ' }}{% endif -%}
|
||||
|
||||
{%- if urlDisclaimerMessage %}
|
||||
{%- if urlDisclaimerMessage -%}
|
||||
{{ urlDisclaimerMessage | safe }}
|
||||
{% endif -%}
|
||||
{%- endif %}
|
||||
</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
Loading…
Reference in New Issue
Block a user