Removed 1h cache, back to etag.

This commit is contained in:
Ylian Saint-Hilaire 2019-12-20 14:50:06 -08:00
parent def2338f9c
commit 2906bb52f3
2 changed files with 11 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.4.6-a", "version": "0.4.6-c",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",

View File

@ -564,14 +564,14 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if (webAuthnKey != null) { if (webAuthnKey != null) {
// Figure out the origin // Figure out the origin
var httpport = ((args.aliasport != null) ? args.aliasport : args.port); 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; } if (httpport != 443) { origin += ':' + httpport; }
var assertionExpectations = { var assertionExpectations = {
challenge: req.session.u2fchallenge, challenge: req.session.u2fchallenge,
origin: origin, origin: origin,
factor: "either", factor: 'either',
fmt: "fido-u2f", fmt: 'fido-u2f',
publicKey: webAuthnKey.publicKey, publicKey: webAuthnKey.publicKey,
prevCounter: webAuthnKey.counter, prevCounter: webAuthnKey.counter,
userHandle: Buffer.from(user._id, 'binary').toString('base64') userHandle: Buffer.from(user._id, 'binary').toString('base64')
@ -1924,7 +1924,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
function handleLogoRequest(req, res) { function handleLogoRequest(req, res) {
const domain = checkUserIpAddress(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 ((domain != null) && domain.titlepicture) {
if ((parent.configurationFiles != null) && (parent.configurationFiles[domain.titlepicture] != null)) { if ((parent.configurationFiles != null) && (parent.configurationFiles[domain.titlepicture] != null)) {
// Use the logo in the database // Use the logo in the database
@ -2013,7 +2013,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
function handleWelcomeImageRequest(req, res) { function handleWelcomeImageRequest(req, res) {
const domain = checkUserIpAddress(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 ((domain != null) && domain.welcomepicture) {
if ((parent.configurationFiles != null) && (parent.configurationFiles[domain.welcomepicture] != null)) { if ((parent.configurationFiles != null) && (parent.configurationFiles[domain.welcomepicture] != null)) {
// Use the welcome image in the database // 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 // Add HTTP security headers to all responses
obj.app.use(function (req, res, next) { obj.app.use(function (req, res, next) {
parent.debug('webrequest', req.url); parent.debug('webrequest', req.url);
res.removeHeader("X-Powered-By"); res.removeHeader('X-Powered-By');
var domain = req.xdomain = getDomain(req); var domain = req.xdomain = getDomain(req);
// If this domain has configured headers, use them. // If this domain has configured headers, use them.
@ -3528,8 +3528,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
serialtunnel.xdomain = domain; serialtunnel.xdomain = domain;
serialtunnel.xip = req.ip; serialtunnel.xip = req.ip;
ws.on('message', function (b) { serialtunnel.updateBuffer(Buffer.from(b, 'binary')) }); ws.on('message', function (b) { serialtunnel.updateBuffer(Buffer.from(b, 'binary')) });
serialtunnel.forwardwrite = function (b) { ws.send(b, "binary") } serialtunnel.forwardwrite = function (b) { ws.send(b, 'binary') }
ws.on("close", function () { serialtunnel.emit('end'); }); ws.on('close', function () { serialtunnel.emit('end'); });
obj.parent.mqttbroker.handle(serialtunnel); // Pass socket wrapper to MQTT broker 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, <a href="' + url + '">click here to login</a>.'); setTimeout(function () { parent.Stop(); }, 500); }); //obj.app.get(url + 'stop', function (req, res) { res.send('Stopping Server, <a href="' + url + '">click here to login</a>.'); setTimeout(function () { parent.Stop(); }, 500); });
// Indicates to ExpressJS that the override public folder should be used to serve static files. // 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. // 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. // Start regular disconnection list flush every 2 minutes.
obj.wsagentsDisconnectionsTimer = setInterval(function () { obj.wsagentsDisconnections = {}; }, 120000); obj.wsagentsDisconnectionsTimer = setInterval(function () { obj.wsagentsDisconnections = {}; }, 120000);