From 2f491fac8661c1baf7c5035d5cd0a8b338d27280 Mon Sep 17 00:00:00 2001 From: Dylan Derr Date: Sat, 8 Feb 2025 12:37:18 -0600 Subject: [PATCH] Added the following ENVIRONMENT VARIABLES > send.ftl - if not set it will use translate(). CUSTOM_INTRO_TITLE > introTitle CUSTOM_INTRO_DESCRIPTION: > introDescription CUSTOM_DOWNLOAD_DESCRIPTION: downloadDescription CUSTOM_TRY_SEND_DESCRIPTION: trySendDescription CUSTOM_SEND_YOUR_FILES_LINK: sendYourFilesLink CUSTOM_INTRO_TITLE: "Secure & Simple" CUSTOM_INTRO_DESCRIPTION: "Share files with end-to-end encryption and a link that expires." CUSTOM_DOWNLOAD_DESCRIPTION: "Shared with end-to-end encryption and a link that expires." CUSTOM_TRY_SEND_DESCRIPTION: "Secure, Simple file sharing" CUSTOM_SEND_YOUR_FILES_LINK: "Upload Files" --- app/ui/download.js | 5 ++++- app/ui/downloadCompleted.js | 15 ++++++++++++--- app/ui/downloadPassword.js | 6 ++++-- app/ui/error.js | 15 ++++++++++++--- app/ui/intro.js | 9 +++++++-- app/ui/notFound.js | 15 ++++++++++++--- server/clientConstants.js | 5 +++++ server/config.js | 28 +++++++++++++++++++++++++++- 8 files changed, 83 insertions(+), 15 deletions(-) diff --git a/app/ui/download.js b/app/ui/download.js index b397fa8e..18d0b56f 100644 --- a/app/ui/download.js +++ b/app/ui/download.js @@ -34,6 +34,9 @@ function preview(state, emit) { if (!state.capabilities.streamDownload && state.fileInfo.size > BIG_SIZE) { return noStreams(state, emit); } + const downloadDescription = + state.WEB_UI.CUSTOM_DOWNLOAD_DESCRIPTION || + state.translate('downloadDescription'); return html`
- ${state.translate('downloadDescription')} + ${downloadDescription}

${archiveTile.preview(state, emit)}
diff --git a/app/ui/downloadCompleted.js b/app/ui/downloadCompleted.js index acdd3044..b4342052 100644 --- a/app/ui/downloadCompleted.js +++ b/app/ui/downloadCompleted.js @@ -2,7 +2,14 @@ const html = require('choo/html'); const assets = require('../../common/assets'); module.exports = function(state) { - const btnText = state.user.loggedIn ? 'okButton' : 'sendYourFilesLink'; + const btnText = state.WEB_UI.CUSTOM_SEND_YOUR_FILES_LINK + ? state.WEB_UI.CUSTOM_SEND_YOUR_FILES_LINK + : state.user.loggedIn + ? 'okButton' + : 'sendYourFilesLink'; + const trySendDescription = + state.WEB_UI.CUSTOM_TRY_SEND_DESCRIPTION || + state.translate('trySendDescription'); return html`
- ${state.translate('trySendDescription')} + ${trySendDescription}

${state.translate(btnText)}${state.WEB_UI.CUSTOM_SEND_YOUR_FILES_LINK + ? btnText + : state.translate(btnText)}

diff --git a/app/ui/downloadPassword.js b/app/ui/downloadPassword.js index 99bbf434..5cc65b8f 100644 --- a/app/ui/downloadPassword.js +++ b/app/ui/downloadPassword.js @@ -3,7 +3,9 @@ const html = require('choo/html'); module.exports = function(state, emit) { const fileInfo = state.fileInfo; const invalid = fileInfo.password === null; - + const downloadDescription = + state.WEB_UI.CUSTOM_DOWNLOAD_DESCRIPTION || + state.translate('downloadDescription'); const div = html`
- ${state.translate('downloadDescription')} + ${downloadDescription}

${state.modal && modal(state, emit)} @@ -22,11 +29,13 @@ module.exports = function(state, emit) { ? 'hidden' : ''}" > - ${state.translate('trySendDescription')} + ${trySendDescription}

${state.translate(btnText)}${state.WEB_UI.CUSTOM_SEND_YOUR_FILES_LINK + ? btnText + : state.translate(btnText)}

diff --git a/app/ui/intro.js b/app/ui/intro.js index c9181837..74d8c97a 100644 --- a/app/ui/intro.js +++ b/app/ui/intro.js @@ -1,16 +1,21 @@ const html = require('choo/html'); module.exports = function intro(state) { + const introTitle = + state.WEB_UI.CUSTOM_INTRO_TITLE || state.translate('introTitle'); + const introDescription = + state.WEB_UI.CUSTOM_INTRO_DESCRIPTION || + state.translate('introDescription'); return html`

- ${state.translate('introTitle')} + ${introTitle}

- ${state.translate('introDescription')} + ${introDescription}

diff --git a/app/ui/notFound.js b/app/ui/notFound.js index 5cf1ce64..18dad622 100644 --- a/app/ui/notFound.js +++ b/app/ui/notFound.js @@ -3,7 +3,14 @@ const assets = require('../../common/assets'); const modal = require('./modal'); module.exports = function(state, emit) { - const btnText = state.user.loggedIn ? 'okButton' : 'sendYourFilesLink'; + const btnText = state.WEB_UI.CUSTOM_SEND_YOUR_FILES_LINK + ? state.WEB_UI.CUSTOM_SEND_YOUR_FILES_LINK + : state.user.loggedIn + ? 'okButton' + : 'sendYourFilesLink'; + const trySendDescription = + state.WEB_UI.CUSTOM_TRY_SEND_DESCRIPTION || + state.translate('trySendDescription'); return html`
${state.modal && modal(state, emit)} @@ -22,11 +29,13 @@ module.exports = function(state, emit) { ? 'hidden' : ''}" > - ${state.translate('trySendDescription')} + ${trySendDescription}

${state.translate(btnText)}${state.WEB_UI.CUSTOM_SEND_YOUR_FILES_LINK + ? btnText + : state.translate(btnText)}

diff --git a/server/clientConstants.js b/server/clientConstants.js index 37c69be9..ac86fe4c 100644 --- a/server/clientConstants.js +++ b/server/clientConstants.js @@ -15,6 +15,11 @@ module.exports = { FOOTER_SOURCE_URL: config.footer_source_url, CUSTOM_FOOTER_TEXT: config.custom_footer_text, CUSTOM_FOOTER_URL: config.custom_footer_url, + CUSTOM_INTRO_TITLE: config.custom_intro_title, + CUSTOM_INTRO_DESCRIPTION: config.custom_intro_description, + CUSTOM_DOWNLOAD_DESCRIPTION: config.custom_download_description, + CUSTOM_TRY_SEND_DESCRIPTION: config.custom_try_send_description, + CUSTOM_SEND_YOUR_FILES_LINK: config.custom_send_your_files_link, COLORS: { PRIMARY: config.ui_color_primary, ACCENT: config.ui_color_accent diff --git a/server/config.js b/server/config.js index 7c0f43cc..c5b8e8be 100644 --- a/server/config.js +++ b/server/config.js @@ -175,9 +175,35 @@ const conf = convict({ }, custom_description: { format: String, - default: 'Encrypt and send files with a link that automatically expires to ensure your important documents don’t stay online forever.', + default: + 'Encrypt and send files with a link that automatically expires to ensure your important documents don’t stay online forever.', env: 'CUSTOM_DESCRIPTION' }, + custom_intro_title: { + format: String, + default: '', + env: 'CUSTOM_INTRO_TITLE' + }, + custom_intro_description: { + format: String, + default: '', + env: 'CUSTOM_INTRO_DESCRIPTION' + }, + custom_download_description: { + format: String, + default: '', + env: 'CUSTOM_DOWNLOAD_DESCRIPTION' + }, + custom_try_send_description: { + format: String, + default: '', + env: 'CUSTOM_TRY_SEND_DESCRIPTION' + }, + custom_send_your_files_link: { + format: String, + default: '', + env: 'CUSTOM_SEND_YOUR_FILES_LINK' + }, detect_base_url: { format: Boolean, default: false,