From 83c3f6310aeeb6b3c7a8c23392d78ca345be9b34 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Thu, 6 Oct 2016 22:44:58 +0200 Subject: [PATCH] Don't make the codestyle any worse than it is --- server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index d3aaa5630..dc0077a35 100644 --- a/server.js +++ b/server.js @@ -17,12 +17,14 @@ var Storage = require(config.storage||'./storage/file'); var app = Express(); +var httpsOpts; + app.use(function (req, res, next) { var host = req.headers.host; if (config.websocketPort) { host = host.replace(/\:[0-9]+/, ':' + config.websocketPort); } - var proto = httpsOpts ? 'wss://' : 'ws://' + var proto = httpsOpts ? 'wss://' : 'ws://'; res.setHeader('Content-Security-Policy', [ "default-src 'none'", "style-src 'unsafe-inline' 'self'", @@ -54,7 +56,6 @@ app.use("/customize", Express.static(__dirname + '/customize.dist')); app.use(/^\/[^\/]*$/, Express.static('customize')); app.use(/^\/[^\/]*$/, Express.static('customize.dist')); -var httpsOpts; if (config.privKeyAndCertFiles) { var privKeyAndCerts = ''; config.privKeyAndCertFiles.forEach(function (file) {