From cb27ef4e8b2ddfa9c2395f2e09399840ee594fa7 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sun, 15 Sep 2019 12:47:59 -0700 Subject: [PATCH] Rebranding fixes --- package.json | 2 +- public/player.htm | 9 +++++++-- webserver.js | 38 +++++++++++++++++++++++++------------- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index ae2c59f6..bb4347bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.0-u", + "version": "0.4.0-v", "keywords": [ "Remote Management", "Intel AMT", diff --git a/public/player.htm b/public/player.htm index 4b94304f..9a99cb2a 100644 --- a/public/player.htm +++ b/public/player.htm @@ -260,8 +260,13 @@ agentDesktop.ProcessData(data); } else if (recFileProtocol == 101) { // Intel AMT KVM - if ((readState == 0) && (rstr2hex(data) == '4100000000000000')) { readState = 1; } // We are not authenticated, KVM data starts here. - else if (readState == 1) { amtDesktop.ProcessData(data); } + if ((readState == 0) && (rstr2hex(data) == '4100000000000000')) { + // We are not authenticated, KVM data starts here. + readState = 1; + if (data.length > 8) { amtDesktop.ProcessData(data.substring(8)); } + } else if (readState == 1) { + amtDesktop.ProcessData(data); + } } } else if ((type == 2) && flagBinary && flagUser) { // User --> Device data diff --git a/webserver.js b/webserver.js index 15da4a34..3b436fda 100644 --- a/webserver.js +++ b/webserver.js @@ -1856,14 +1856,19 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { // Use the logo in the database res.set({ 'Content-Type': 'image/jpeg' }); res.send(parent.configurationFiles[domain.titlepicture]); + return; } else { // Use the logo on file - try { res.sendFile(obj.path.join(obj.parent.datapath, domain.titlepicture)); } catch (e) { - try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/logoback.png')); } catch (e) { res.sendStatus(404); } - } + try { res.sendFile(obj.path.join(obj.parent.datapath, domain.titlepicture)); return; } catch (ex) { } } + } + + if (parent.webPublicOverridePath && obj.fs.existsSync(obj.path.join(obj.parent.webPublicOverridePath, 'images/logoback.png'))) { + // Use the override logo picture + try { res.sendFile(obj.path.join(obj.parent.webPublicOverridePath, 'images/logoback.png')); } catch (ex) { res.sendStatus(404); } } else { - try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/logoback.png')); } catch (e) { res.sendStatus(404); } + // Use the default logo picture + try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/logoback.png')); } catch (ex) { res.sendStatus(404); } } } @@ -1877,14 +1882,16 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { // Use the welcome image in the database res.set({ 'Content-Type': 'image/jpeg' }); res.send(parent.configurationFiles[domain.welcomepicture]); - } else { - // Use the logo on file - try { res.sendFile(obj.path.join(obj.parent.datapath, domain.welcomepicture)); } catch (e) { - try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/mainwelcome.jpg')); } catch (e) { res.sendStatus(404); } - } + return; } + } + + if (parent.webPublicOverridePath && obj.fs.existsSync(obj.path.join(obj.parent.webPublicOverridePath, 'images/mainwelcome.jpg'))) { + // Use the override logo picture + try { res.sendFile(obj.path.join(obj.parent.webPublicOverridePath, 'images/mainwelcome.jpg')); } catch (ex) { res.sendStatus(404); } } else { - try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/mainwelcome.jpg')); } catch (e) { res.sendStatus(404); } + // Use the default logo picture + try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/mainwelcome.jpg')); } catch (ex) { res.sendStatus(404); } } } @@ -3252,10 +3259,15 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { var p = obj.path.join(obj.parent.datapath, 'server.png'); if (obj.fs.existsSync(p)) { // Use the data folder server picture - try { res.sendFile(p); } catch (e) { res.sendStatus(404); } + try { res.sendFile(p); } catch (ex) { res.sendStatus(404); } } else { - // Use the default server picture - try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/server-256.png')); } catch (e) { res.sendStatus(404); } + if (parent.webPublicOverridePath && obj.fs.existsSync(obj.path.join(obj.parent.webPublicOverridePath, 'images/server-256.png'))) { + // Use the override server picture + try { res.sendFile(obj.path.join(obj.parent.webPublicOverridePath, 'images/server-256.png')); } catch (ex) { res.sendStatus(404); } + } else { + // Use the default server picture + try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/server-256.png')); } catch (ex) { res.sendStatus(404); } + } } } });