From 2906bb52f36895158c33051e9384890426c989e2 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Fri, 20 Dec 2019 14:50:06 -0800 Subject: [PATCH] Removed 1h cache, back to etag. --- package.json | 2 +- webserver.js | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 1b7d6c81..23bac251 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.6-a", + "version": "0.4.6-c", "keywords": [ "Remote Management", "Intel AMT", diff --git a/webserver.js b/webserver.js index 71fdd9b8..44c99a2f 100644 --- a/webserver.js +++ b/webserver.js @@ -564,14 +564,14 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { if (webAuthnKey != null) { // Figure out the origin var httpport = ((args.aliasport != null) ? args.aliasport : args.port); - var origin = "https://" + (domain.dns ? domain.dns : parent.certificates.CommonName); + var origin = 'https://' + (domain.dns ? domain.dns : parent.certificates.CommonName); if (httpport != 443) { origin += ':' + httpport; } var assertionExpectations = { challenge: req.session.u2fchallenge, origin: origin, - factor: "either", - fmt: "fido-u2f", + factor: 'either', + fmt: 'fido-u2f', publicKey: webAuthnKey.publicKey, prevCounter: webAuthnKey.counter, userHandle: Buffer.from(user._id, 'binary').toString('base64') @@ -1924,7 +1924,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { function handleLogoRequest(req, res) { const domain = checkUserIpAddress(req, res); - res.set({ 'Cache-Control': 'max-age=86400' }); // 1 day + //res.set({ 'Cache-Control': 'max-age=86400' }); // 1 day if ((domain != null) && domain.titlepicture) { if ((parent.configurationFiles != null) && (parent.configurationFiles[domain.titlepicture] != null)) { // Use the logo in the database @@ -2013,7 +2013,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { function handleWelcomeImageRequest(req, res) { const domain = checkUserIpAddress(req, res); - res.set({ 'Cache-Control': 'max-age=86400' }); // 1 day + //res.set({ 'Cache-Control': 'max-age=86400' }); // 1 day if ((domain != null) && domain.welcomepicture) { if ((parent.configurationFiles != null) && (parent.configurationFiles[domain.welcomepicture] != null)) { // Use the welcome image in the database @@ -3391,7 +3391,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { // Add HTTP security headers to all responses obj.app.use(function (req, res, next) { parent.debug('webrequest', req.url); - res.removeHeader("X-Powered-By"); + res.removeHeader('X-Powered-By'); var domain = req.xdomain = getDomain(req); // If this domain has configured headers, use them. @@ -3528,8 +3528,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { serialtunnel.xdomain = domain; serialtunnel.xip = req.ip; ws.on('message', function (b) { serialtunnel.updateBuffer(Buffer.from(b, 'binary')) }); - serialtunnel.forwardwrite = function (b) { ws.send(b, "binary") } - ws.on("close", function () { serialtunnel.emit('end'); }); + serialtunnel.forwardwrite = function (b) { ws.send(b, 'binary') } + ws.on('close', function () { serialtunnel.emit('end'); }); obj.parent.mqttbroker.handle(serialtunnel); // Pass socket wrapper to MQTT broker }); } @@ -3568,10 +3568,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { //obj.app.get(url + 'stop', function (req, res) { res.send('Stopping Server, click here to login.'); setTimeout(function () { parent.Stop(); }, 500); }); // Indicates to ExpressJS that the override public folder should be used to serve static files. - if (obj.parent.webPublicOverridePath != null) { obj.app.use(url, obj.express.static(obj.parent.webPublicOverridePath, { maxAge: '1h' })); } + if (obj.parent.webPublicOverridePath != null) { obj.app.use(url, obj.express.static(obj.parent.webPublicOverridePath)); } // Indicates to ExpressJS that the default public folder should be used to serve static files. - obj.app.use(url, obj.express.static(obj.parent.webPublicPath, { maxAge: '1h' })); + obj.app.use(url, obj.express.static(obj.parent.webPublicPath)); // Start regular disconnection list flush every 2 minutes. obj.wsagentsDisconnectionsTimer = setInterval(function () { obj.wsagentsDisconnections = {}; }, 120000);