24
1
Fork 0

Merge branch 'fix-csp' into 'master'

Fix CSP

Closes #29

See merge request timvisee/send!24
This commit is contained in:
Tim Visée 2022-08-22 15:27:03 +00:00
commit e030c46a9c
2 changed files with 16 additions and 21 deletions

View File

@ -169,14 +169,14 @@ const conf = convict({
env: 'BASE_URL' env: 'BASE_URL'
}, },
custom_title: { custom_title: {
format: String, format: String,
default: 'Send', default: 'Send',
env: 'CUSTOM_TITLE' env: 'CUSTOM_TITLE'
}, },
custom_description: { custom_description: {
format: String, format: String,
default: 'Encrypt and send files with a link that automatically expires to ensure your important documents dont stay online forever.', default: 'Encrypt and send files with a link that automatically expires to ensure your important documents dont stay online forever.',
env: 'CUSTOM_DESCRIPTION' env: 'CUSTOM_DESCRIPTION'
}, },
detect_base_url: { detect_base_url: {
format: Boolean, format: Boolean,
@ -329,11 +329,11 @@ const conf = convict({
default: '', default: '',
env: 'UI_CUSTOM_ASSETS_WORDMARK' env: 'UI_CUSTOM_ASSETS_WORDMARK'
}, },
custom_css: { custom_css: {
format: String, format: String,
default: '', default: '',
env: 'UI_CUSTOM_CSS' env: 'UI_CUSTOM_CSS'
} }
} }
}); });

View File

@ -3,6 +3,10 @@ const assets = require('../common/assets');
const initScript = require('./initScript'); const initScript = require('./initScript');
module.exports = function(state, body = '') { module.exports = function(state, body = '') {
const custom_css = state.ui.assets.custom_css !== ''
? html`<link rel="stylesheet" type="text/css" href="${state.ui.assets.custom_css}" />`
: ''
return html` return html`
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${state.locale}"> <html lang="${state.locale}">
@ -40,16 +44,7 @@ module.exports = function(state, body = '') {
type="text/css" type="text/css"
href="${assets.get('app.css')}" href="${assets.get('app.css')}"
/> />
<script> ${custom_css}
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 <link
rel="apple-touch-icon" rel="apple-touch-icon"
sizes="180x180" sizes="180x180"