Added the ability to define a custom footer via environment variables

Added the CUSTOM_FOOTER_TEXT and CUSTOM_FOOTER_URL environment variables.

If undefined, the default translated footer will display.

If only CUSTOM_FOOTER_TEXT is defined, only this defined text will display in place of the normal footer text.

If only CUSTOM_FOOTER_URL is defined then the defined URL will display.

If both variables are defined, the defined text will display as a link to the defined URL.
This commit is contained in:
HrBingR 2022-08-11 23:04:45 +02:00
parent bce861bcaf
commit e32ea7d0aa
3 changed files with 52 additions and 1 deletions

View File

@ -65,6 +65,45 @@ class Footer extends Component {
`);
}
// Defining a custom footer
var footer = [];
if (this.state != undefined && this.state.WEB_UI != undefined) {
const WEB_UI = this.state.WEB_UI;
if (WEB_UI.CUSTOM_FOOTER_URL != '' && WEB_UI.CUSTOM_FOOTER_TEXT != '') {
footer.push(html`
<li class="m-2">
<a href="${WEB_UI.CUSTOM_FOOTER_URL}" target="_blank">
${WEB_UI.CUSTOM_FOOTER_TEXT}
</a>
</li>
`);
}
else if (WEB_UI.CUSTOM_FOOTER_URL != '') {
footer.push(html`
<li class="m-2">
<a href="${WEB_UI.CUSTOM_FOOTER_URL}" target="_blank">
${WEB_UI.CUSTOM_FOOTER_URL}
</a>
</li>
`);
}
else if (WEB_UI.CUSTOM_FOOTER_TEXT != '') {
footer.push(html`
<li class="m-2">
${WEB_UI.CUSTOM_FOOTER_TEXT}
</li>
`)
}
else {
footer.push(html`
<li class="m-2">
${translate('footerText')}
</li>
`);
}
}
return html`
<footer
class="flex flex-col md:flex-row items-start w-full flex-none self-start p-6 md:p-8 font-medium text-xs text-grey-60 dark:text-grey-40 md:items-center justify-between"
@ -72,7 +111,7 @@ class Footer extends Component {
<ul
class="flex flex-col md:flex-row items-start md:items-center md:justify-start"
>
<li class="m-2">${translate('footerText')}</li>
${footer}
</ul>
<ul
class="flex flex-col md:flex-row items-start md:items-center md:justify-end"

View File

@ -13,6 +13,8 @@ module.exports = {
FOOTER_CLI_URL: config.footer_cli_url,
FOOTER_DMCA_URL: config.footer_dmca_url,
FOOTER_SOURCE_URL: config.footer_source_url,
CUSTOM_FOOTER_TEXT: config.custom_footer_text,
CUSTOM_FOOTER_URL: config.custom_footer_url,
COLORS: {
PRIMARY: config.ui_color_primary,
ACCENT: config.ui_color_accent

View File

@ -253,6 +253,16 @@ const conf = convict({
default: 'https://github.com/timvisee/send',
env: 'SEND_FOOTER_SOURCE_URL'
},
custom_footer_text: {
format: String,
default: '',
env: 'CUSTOM_FOOTER_TEXT'
},
custom_footer_url: {
format: String,
default: '',
env: 'CUSTOM_FOOTER_URL'
},
ui_color_primary: {
format: String,
default: '#0a84ff',