Skip to content

Commit

Permalink
Merge pull request #27 from OpenLMIS/OLMIS-8028-clean-code
Browse files Browse the repository at this point in the history
OLMIS-8028: code cleanup
  • Loading branch information
DominikNoga authored Oct 30, 2024
2 parents 8d2c318 + aae6e28 commit c19a215
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/openlmis-home/csp-generate.run.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,16 @@
function getCSPTag() {
var GOOGLE_ANALYTICS_URL = 'www.google-analytics.com';
var SUPERSET_URL = '${SUPERSET_URL}';
console.log('SUPERSET_URL 1 with ${} notation: ' + SUPERSET_URL);

if (SUPERSET_URL.substr(0, 2) === '${') {
SUPERSET_URL = '@@SUPERSET_URL';
console.log('SUPERSET_URL 2 with @@ notation: ' + SUPERSET_URL);
if (SUPERSET_URL.substr(0, 2) === '@@') {
SUPERSET_URL = '';
console.log('SUPERSET_URL not found');
}
SUPERSET_URL = '';
}

var cspHeader = 'default-src \'self\' \'unsafe-inline\' ' + SUPERSET_URL + ';\n' +
var cspHeader = 'default-src \'self\' ' + SUPERSET_URL + ' \'unsafe-inline\';\n' +
'img-src \'self\' ' + GOOGLE_ANALYTICS_URL + ';\n' +
'script-src \'self\' ' + GOOGLE_ANALYTICS_URL + ' \'unsafe-inline\' \'unsafe-eval\';\n' +
'connect-src \'self\' ' + GOOGLE_ANALYTICS_URL + ' ' + SUPERSET_URL + ';\n' +
'frame-src \'self\'' + SUPERSET_URL + ';';
'frame-src \'self\' ' + SUPERSET_URL + ';';

return cspHeader;
}
Expand Down

0 comments on commit c19a215

Please sign in to comment.