From 0a6bf39353036b6f1ea2359b7212725ac67529a2 Mon Sep 17 00:00:00 2001 From: timvisee Date: Mon, 30 Jun 2025 23:12:54 +0200 Subject: [PATCH] Add Thunderbird sponsorship banner to home, uploads and download page --- app/main.css | 4 +++ app/ui/archiveTile.js | 25 +++++++++++++- app/ui/home.js | 25 ++++++++++++++ app/ui/intro.js | 26 +++++++++++++++ assets/thunderbird-icon.svg | 65 +++++++++++++++++++++++++++++++++++++ server/clientConstants.js | 1 + server/config.js | 5 +++ 7 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 assets/thunderbird-icon.svg diff --git a/app/main.css b/app/main.css index e9f17be4..0b9bf723 100644 --- a/app/main.css +++ b/app/main.css @@ -171,6 +171,10 @@ footer li a:hover { text-decoration: underline; } +.d-block { + display: block; +} + .main { display: flex; position: relative; diff --git a/app/ui/archiveTile.js b/app/ui/archiveTile.js index fb14e54a..39ec82b3 100644 --- a/app/ui/archiveTile.js +++ b/app/ui/archiveTile.js @@ -578,6 +578,29 @@ module.exports.preview = function(state, emit) {

` : ''; + const sponsor = state.WEB_UI.SHOW_THUNDERBIRD_SPONSOR + ? html` + + + + + Sponsored by Thunderbird + + ` + : ''; return html` ${state.translate('downloadButtonLabel')} - ${notice} + ${notice} ${sponsor} `; diff --git a/app/ui/home.js b/app/ui/home.js index 63238266..4215fcb1 100644 --- a/app/ui/home.js +++ b/app/ui/home.js @@ -4,6 +4,7 @@ const { list } = require('../utils'); const archiveTile = require('./archiveTile'); const modal = require('./modal'); const intro = require('./intro'); +const assets = require('../../common/assets'); module.exports = function(state, emit) { const archives = state.storage.files @@ -30,6 +31,30 @@ module.exports = function(state, emit) { archives.reverse(); + if (archives.length > 0 && state.WEB_UI.SHOW_THUNDERBIRD_SPONSOR) { + archives.push(html` + + + + + Sponsored by Thunderbird + + `); + } + const right = archives.length === 0 ? intro(state) diff --git a/app/ui/intro.js b/app/ui/intro.js index dbdd3dc1..6fdbfd43 100644 --- a/app/ui/intro.js +++ b/app/ui/intro.js @@ -1,5 +1,6 @@ const html = require('choo/html'); const raw = require('choo/html/raw'); +const assets = require('../../common/assets'); module.exports = function intro(state) { const notice = state.WEB_UI.MAIN_NOTICE_HTML @@ -12,6 +13,30 @@ module.exports = function intro(state) { ` : ''; + const sponsor = state.WEB_UI.SHOW_THUNDERBIRD_SPONSOR + ? html` + + + + + Sponsored by Thunderbird + + ` + : ''; + return html` + ${sponsor} `; }; diff --git a/assets/thunderbird-icon.svg b/assets/thunderbird-icon.svg new file mode 100644 index 00000000..4f555086 --- /dev/null +++ b/assets/thunderbird-icon.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/server/clientConstants.js b/server/clientConstants.js index 6df763ec..b340f585 100644 --- a/server/clientConstants.js +++ b/server/clientConstants.js @@ -19,6 +19,7 @@ module.exports = { UPLOAD_AREA_NOTICE_HTML: config.upload_area_notice_html, UPLOADS_LIST_NOTICE_HTML: config.uploads_list_notice_html, DOWNLOAD_NOTICE_HTML: config.download_notice_html, + SHOW_THUNDERBIRD_SPONSOR: config.show_thunderbird_sponsor, COLORS: { PRIMARY: config.ui_color_primary, ACCENT: config.ui_color_accent diff --git a/server/config.js b/server/config.js index 1df07bad..07b94d61 100644 --- a/server/config.js +++ b/server/config.js @@ -284,6 +284,11 @@ const conf = convict({ default: '', env: 'SEND_DOWNLOAD_NOTICE_HTML' }, + show_thunderbird_sponsor: { + format: Boolean, + default: false, + env: 'SHOW_THUNDERBIRD_SPONSOR' + }, ui_color_primary: { format: String, default: '#0a84ff',