From 136d895d155f28c2e75b3af206549acaa2a354ed Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Mon, 15 Feb 2021 09:42:51 +0100 Subject: Linter: Fix all lint errors Signed-off-by: Philip Molares --- lib/csp.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'lib/csp.js') diff --git a/lib/csp.js b/lib/csp.js index 24399436..a5f0a4fc 100644 --- a/lib/csp.js +++ b/lib/csp.js @@ -1,9 +1,9 @@ -var config = require('./config') -var uuid = require('uuid') +const config = require('./config') +const uuid = require('uuid') -var CspStrategy = {} +const CspStrategy = {} -var defaultDirectives = { +const defaultDirectives = { defaultSrc: ['\'self\''], scriptSrc: ['\'self\'', 'vimeo.com', 'https://gist.github.com', 'www.slideshare.net', 'https://query.yahooapis.com', '\'unsafe-eval\''], // ^ TODO: Remove unsafe-eval - webpack script-loader issues https://github.com/hackmdio/codimd/issues/594 @@ -16,28 +16,28 @@ var defaultDirectives = { connectSrc: ['*'] } -var cdnDirectives = { +const cdnDirectives = { scriptSrc: ['https://cdnjs.cloudflare.com', 'https://cdn.mathjax.org'], styleSrc: ['https://cdnjs.cloudflare.com', 'https://fonts.googleapis.com'], fontSrc: ['https://cdnjs.cloudflare.com', 'https://fonts.gstatic.com'] } -var disqusDirectives = { +const disqusDirectives = { scriptSrc: ['https://disqus.com', 'https://*.disqus.com', 'https://*.disquscdn.com'], styleSrc: ['https://*.disquscdn.com'], fontSrc: ['https://*.disquscdn.com'] } -var googleAnalyticsDirectives = { +const googleAnalyticsDirectives = { scriptSrc: ['https://www.google-analytics.com'] } -var dropboxDirectives = { +const dropboxDirectives = { scriptSrc: ['https://www.dropbox.com', '\'unsafe-inline\''] } CspStrategy.computeDirectives = function () { - var directives = {} + const directives = {} mergeDirectives(directives, config.csp.directives) mergeDirectivesIf(config.csp.addDefaults, directives, defaultDirectives) mergeDirectivesIf(config.useCDN, directives, cdnDirectives) @@ -53,10 +53,10 @@ CspStrategy.computeDirectives = function () { } function mergeDirectives (existingDirectives, newDirectives) { - for (var propertyName in newDirectives) { - var newDirective = newDirectives[propertyName] + for (const propertyName in newDirectives) { + const newDirective = newDirectives[propertyName] if (newDirective) { - var existingDirective = existingDirectives[propertyName] || [] + const existingDirective = existingDirectives[propertyName] || [] existingDirectives[propertyName] = existingDirective.concat(newDirective) } } -- cgit v1.2.3