drop.chapril.org-firefoxsend/server/initScript.js

15 lines
339 B
JavaScript
Raw Normal View History

2018-08-08 00:40:17 +02:00
const html = require('choo/html');
const raw = require('choo/html/raw');
module.exports = function(state) {
// return '';
return state.cspNonce
? html`
<script nonce="${state.cspNonce}">
const downloadMetadata = ${
state.downloadMetadata ? raw(JSON.stringify(state.downloadMetadata)) : '{}'
};
</script>`
: '';
};