From d4b6933891846a709286acd67fada3026a66199a Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Sun, 30 Sep 2018 05:38:13 +0700 Subject: [PATCH] Improved help message for URL upload * Hide notice about max size if it's equal to max size of regular uploads. * Show notice about DuckDuckGo's proxy if it's turned on. * Also updated description in config.sample.js to further emphasize about the limitation of using DuckDuckGo's proxy. --- config.sample.js | 3 ++- lolisafe.js | 4 +++- views/home.njk | 10 +++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/config.sample.js b/config.sample.js index 071258f..1a55d62 100644 --- a/config.sample.js +++ b/config.sample.js @@ -120,7 +120,8 @@ module.exports = { /* Use DuckDuckGo's proxy when fetching any URL uploads. This may be considered a hack and not supported by DuckDuckGo, so USE AT YOUR OWN RISK. - This have only been tested with pictures, GIFs, WEBMs and MP4s. + This should work with any type of URLs, but they have to be direct links, + since DuckDuckGo's proxy will not follow redirects. */ urlDuckDuckGoProxy: false, diff --git a/lolisafe.js b/lolisafe.js index 959374e..d76fc9f 100644 --- a/lolisafe.js +++ b/lolisafe.js @@ -68,8 +68,10 @@ for (const page of config.pages) { })) } else if (page === 'home') { safe.get('/', (req, res, next) => res.render('home', { + maxSize: config.uploads.maxSize, urlMaxSize: config.uploads.urlMaxSize, - gitHash: safe.get('git-hash') + gitHash: safe.get('git-hash'), + urlDuckDuckGoProxy: config.uploads.urlDuckDuckGoProxy })) } else if (page === 'faq') { const fileLength = config.uploads.fileLength diff --git a/views/home.njk b/views/home.njk index ad05dc6..a2dde6b 100644 --- a/views/home.njk +++ b/views/home.njk @@ -71,7 +71,15 @@
-

Maximum file size for URL upload is {{ urlMaxSize }}.

+

+ {% if urlMaxSize !== maxSize -%} + Maximum file size for URL upload is {{ urlMaxSize }}. + {%- endif %} + {%- if urlMaxSize and urlMaxSize !== maxSize and urlDuckDuckGoProxy %}
{% endif -%} + {%- if urlDuckDuckGoProxy %} + Since we're using DuckDuckGo's proxy, the URLs have to be direct links. + {% endif -%} +