From d0f21e80787426bb819cb0e1244037172fb279c2 Mon Sep 17 00:00:00 2001
From: timvisee
Date: Wed, 23 Apr 2025 10:07:40 +0200
Subject: [PATCH 1/4] Add customizable notice on main page and in downloads
list
---
app/ui/home.js | 13 +++++++++++++
app/ui/intro.js | 12 ++++++++++++
server/clientConstants.js | 2 ++
server/config.js | 10 ++++++++++
4 files changed, 37 insertions(+)
diff --git a/app/ui/home.js b/app/ui/home.js
index cfa38564..6431aeab 100644
--- a/app/ui/home.js
+++ b/app/ui/home.js
@@ -1,4 +1,5 @@
const html = require('choo/html');
+const raw = require('choo/html/raw');
const { list } = require('../utils');
const archiveTile = require('./archiveTile');
const modal = require('./modal');
@@ -16,7 +17,19 @@ module.exports = function(state, emit) {
} else {
left = archiveTile.empty(state, emit);
}
+
+ if (archives.length > 0 && state.WEB_UI.DOWNLOAD_LIST_NOTICE_HTML) {
+ archives.push(html`
+
+ ${raw(state.WEB_UI.DOWNLOAD_LIST_NOTICE_HTML)}
+
+ `);
+ }
+
archives.reverse();
+
const right =
archives.length === 0
? intro(state)
diff --git a/app/ui/intro.js b/app/ui/intro.js
index c9181837..dc1a1627 100644
--- a/app/ui/intro.js
+++ b/app/ui/intro.js
@@ -1,6 +1,17 @@
const html = require('choo/html');
+const raw = require('choo/html/raw');
module.exports = function intro(state) {
+ const notice = state.WEB_UI.MAIN_NOTICE_HTML
+ ? html`
+
+ ${raw(state.WEB_UI.MAIN_NOTICE_HTML)}
+
+ `
+ : '';
+
return html`
${state.translate('introDescription')}
+ ${notice}
`;
diff --git a/server/clientConstants.js b/server/clientConstants.js
index 4786bcff..dc77ac0e 100644
--- a/server/clientConstants.js
+++ b/server/clientConstants.js
@@ -15,7 +15,9 @@ module.exports = {
FOOTER_SOURCE_URL: config.footer_source_url,
CUSTOM_FOOTER_TEXT: config.custom_footer_text,
CUSTOM_FOOTER_URL: config.custom_footer_url,
+ MAIN_NOTICE_HTML: config.main_notice_html,
UPLOAD_AREA_WARNING_HTML: config.upload_area_warning_html,
+ DOWNLOAD_LIST_NOTICE_HTML: config.download_list_notice_html,
DOWNLOAD_WARNING_HTML: config.download_warning_html,
COLORS: {
PRIMARY: config.ui_color_primary,
diff --git a/server/config.js b/server/config.js
index ffab7bd3..fdf42886 100644
--- a/server/config.js
+++ b/server/config.js
@@ -264,11 +264,21 @@ const conf = convict({
default: '',
env: 'CUSTOM_FOOTER_URL'
},
+ main_notice_html: {
+ format: String,
+ default: '',
+ env: 'SEND_MAIN_NOTICE_HTML'
+ },
upload_area_warning_html: {
format: String,
default: '',
env: 'SEND_UPLOAD_AREA_WARNING_HTML'
},
+ download_list_notice_html: {
+ format: String,
+ default: '',
+ env: 'SEND_DOWNLOAD_LIST_NOTICE_HTML'
+ },
download_warning_html: {
format: String,
default: '',
From 1fb2f45285c6b2db352ef74745c44bfd0ebe40f6 Mon Sep 17 00:00:00 2001
From: timvisee
Date: Wed, 23 Apr 2025 10:08:11 +0200
Subject: [PATCH 2/4] Rename existing warnings to notices
---
app/ui/archiveTile.js | 12 ++++++------
server/clientConstants.js | 4 ++--
server/config.js | 8 ++++----
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/app/ui/archiveTile.js b/app/ui/archiveTile.js
index 9a22cdf5..fb14e54a 100644
--- a/app/ui/archiveTile.js
+++ b/app/ui/archiveTile.js
@@ -486,12 +486,12 @@ module.exports.empty = function(state, emit) {
})}
`;
- const warning = state.WEB_UI.UPLOAD_AREA_WARNING_HTML
+ const uploadNotice = state.WEB_UI.UPLOAD_AREA_NOTICE_HTML
? html`
- ${raw(state.WEB_UI.UPLOAD_AREA_WARNING_HTML)}
+ ${raw(state.WEB_UI.UPLOAD_AREA_NOTICE_HTML)}
`
: '';
@@ -536,7 +536,7 @@ module.exports.empty = function(state, emit) {
>
${state.translate('addFilesButton')}
- ${upsell} ${warning}
+ ${upsell} ${uploadNotice}
`;
@@ -569,12 +569,12 @@ module.exports.preview = function(state, emit) {
${archiveDetails(state.translate, archive)}
`;
- const warning = state.WEB_UI.DOWNLOAD_WARNING_HTML
+ const notice = state.WEB_UI.DOWNLOAD_NOTICE_HTML
? html`
- ${raw(state.WEB_UI.DOWNLOAD_WARNING_HTML)}
+ ${raw(state.WEB_UI.DOWNLOAD_NOTICE_HTML)}
`
: '';
@@ -594,7 +594,7 @@ module.exports.preview = function(state, emit) {
>
${state.translate('downloadButtonLabel')}
- ${warning}
+ ${notice}
`;
diff --git a/server/clientConstants.js b/server/clientConstants.js
index dc77ac0e..48e0964e 100644
--- a/server/clientConstants.js
+++ b/server/clientConstants.js
@@ -16,9 +16,9 @@ module.exports = {
CUSTOM_FOOTER_TEXT: config.custom_footer_text,
CUSTOM_FOOTER_URL: config.custom_footer_url,
MAIN_NOTICE_HTML: config.main_notice_html,
- UPLOAD_AREA_WARNING_HTML: config.upload_area_warning_html,
+ UPLOAD_AREA_NOTICE_HTML: config.upload_area_notice_html,
DOWNLOAD_LIST_NOTICE_HTML: config.download_list_notice_html,
- DOWNLOAD_WARNING_HTML: config.download_warning_html,
+ DOWNLOAD_NOTICE_HTML: config.download_notice_html,
COLORS: {
PRIMARY: config.ui_color_primary,
ACCENT: config.ui_color_accent
diff --git a/server/config.js b/server/config.js
index fdf42886..0c71d9c1 100644
--- a/server/config.js
+++ b/server/config.js
@@ -269,20 +269,20 @@ const conf = convict({
default: '',
env: 'SEND_MAIN_NOTICE_HTML'
},
- upload_area_warning_html: {
+ upload_area_notice_html: {
format: String,
default: '',
- env: 'SEND_UPLOAD_AREA_WARNING_HTML'
+ env: 'SEND_UPLOAD_AREA_NOTICE_HTML'
},
download_list_notice_html: {
format: String,
default: '',
env: 'SEND_DOWNLOAD_LIST_NOTICE_HTML'
},
- download_warning_html: {
+ download_notice_html: {
format: String,
default: '',
- env: 'SEND_DOWNLOAD_WARNING_HTML'
+ env: 'SEND_DOWNLOAD_NOTICE_HTML'
},
ui_color_primary: {
format: String,
From 11aad6eac54872f08c8c5a7b700d1747eb2d8d1a Mon Sep 17 00:00:00 2001
From: timvisee
Date: Wed, 23 Apr 2025 10:09:51 +0200
Subject: [PATCH 3/4] Rename downloads list to uploads list
---
app/ui/home.js | 4 ++--
server/clientConstants.js | 2 +-
server/config.js | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/ui/home.js b/app/ui/home.js
index 6431aeab..63238266 100644
--- a/app/ui/home.js
+++ b/app/ui/home.js
@@ -18,12 +18,12 @@ module.exports = function(state, emit) {
left = archiveTile.empty(state, emit);
}
- if (archives.length > 0 && state.WEB_UI.DOWNLOAD_LIST_NOTICE_HTML) {
+ if (archives.length > 0 && state.WEB_UI.UPLOADS_LIST_NOTICE_HTML) {
archives.push(html`
- ${raw(state.WEB_UI.DOWNLOAD_LIST_NOTICE_HTML)}
+ ${raw(state.WEB_UI.UPLOADS_LIST_NOTICE_HTML)}
`);
}
diff --git a/server/clientConstants.js b/server/clientConstants.js
index 48e0964e..6df763ec 100644
--- a/server/clientConstants.js
+++ b/server/clientConstants.js
@@ -17,7 +17,7 @@ module.exports = {
CUSTOM_FOOTER_URL: config.custom_footer_url,
MAIN_NOTICE_HTML: config.main_notice_html,
UPLOAD_AREA_NOTICE_HTML: config.upload_area_notice_html,
- DOWNLOAD_LIST_NOTICE_HTML: config.download_list_notice_html,
+ UPLOADS_LIST_NOTICE_HTML: config.uploads_list_notice_html,
DOWNLOAD_NOTICE_HTML: config.download_notice_html,
COLORS: {
PRIMARY: config.ui_color_primary,
diff --git a/server/config.js b/server/config.js
index 0c71d9c1..1df07bad 100644
--- a/server/config.js
+++ b/server/config.js
@@ -274,10 +274,10 @@ const conf = convict({
default: '',
env: 'SEND_UPLOAD_AREA_NOTICE_HTML'
},
- download_list_notice_html: {
+ uploads_list_notice_html: {
format: String,
default: '',
- env: 'SEND_DOWNLOAD_LIST_NOTICE_HTML'
+ env: 'SEND_UPLOADS_LIST_NOTICE_HTML'
},
download_notice_html: {
format: String,
From 0088a4ccc0b7dedddde9a37e85cb36b8b151d7c0 Mon Sep 17 00:00:00 2001
From: timvisee
Date: Wed, 23 Apr 2025 10:10:22 +0200
Subject: [PATCH 4/4] Add class to underline text
---
app/main.css | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/main.css b/app/main.css
index db3852fc..e9f17be4 100644
--- a/app/main.css
+++ b/app/main.css
@@ -167,6 +167,10 @@ footer li a:hover {
width: auto;
}
+.text-underline {
+ text-decoration: underline;
+}
+
.main {
display: flex;
position: relative;