Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new environment variables for custom css, custom title, and custom description #100

Merged
merged 2 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ const conf = convict({
default: 'https://send.firefox.com',
env: 'BASE_URL'
},
custom_title: {
format: String,
default: 'Send',
env: 'CUSTOM_TITLE'
},
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.',
env: 'CUSTOM_DESCRIPTION'
},
detect_base_url: {
format: Boolean,
default: false,
Expand Down Expand Up @@ -303,7 +313,12 @@ const conf = convict({
format: String,
default: '',
env: 'UI_CUSTOM_ASSETS_WORDMARK'
}
},
custom_css: {
format: String,
default: '',
env: 'UI_CUSTOM_CSS'
}
}
});

Expand Down
10 changes: 10 additions & 0 deletions server/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ module.exports = function(state, body = '') {
type="text/css"
href="${assets.get('app.css')}"
/>
<script>
var custom_css_file = '${state.ui.assets.custom_css}';
if (custom_css_file!="undefined") {
var custom_css_enabled = document.createElement('link');
custom_css_enabled.rel = 'stylesheet';
custom_css_enabled.type = 'text/css';
custom_css_enabled.href = '${state.ui.assets.custom_css}';
document.head.appendChild(custom_css_enabled);
}
</script>
<link
rel="apple-touch-icon"
sizes="180x180"
Expand Down
8 changes: 4 additions & 4 deletions server/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ module.exports = async function(req) {
safari_pinned_tab: assets.get('safari-pinned-tab.svg'),
facebook: baseUrl + '/' + assets.get('send-fb.jpg'),
twitter: baseUrl + '/' + assets.get('send-twitter.jpg'),
wordmark: assets.get('wordmark.svg') + '#logo'
wordmark: assets.get('wordmark.svg') + '#logo',
custom_css: assets.get('undefined')
};
Object.keys(uiAssets).forEach(index => {
if (config.ui_custom_assets[index] !== '')
Expand All @@ -47,9 +48,8 @@ module.exports = async function(req) {
locale,
capabilities: { account: false },
translate: getTranslator(locale),
title: 'Send',
description:
'Encrypt and send files with a link that automatically expires to ensure your important documents don’t stay online forever.',
title: config.custom_title,
description: config.custom_description,
baseUrl,
ui: {
colors: {
Expand Down