Added MeshMessenger title bar customization.
This commit is contained in:
parent
d849d6cd07
commit
8291c82839
|
@ -174,6 +174,8 @@
|
||||||
"newAccountsRights": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
|
"newAccountsRights": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
|
||||||
"welcomeText": { "type": "string", "description": "Text that will be shown on the login screen." },
|
"welcomeText": { "type": "string", "description": "Text that will be shown on the login screen." },
|
||||||
"welcomePicture": { "type": "string", "description": "Name of the PNG or JPEG file that will be shown on the login screen. Put this file in the meshcentral-data folder and place the file name here." },
|
"welcomePicture": { "type": "string", "description": "Name of the PNG or JPEG file that will be shown on the login screen. Put this file in the meshcentral-data folder and place the file name here." },
|
||||||
|
"meshMessengerTitle": { "type": "string", "default": "MeshMessenger", "description": "Text that will be displayed on the top of the messenger window when no username or device name is displayed." },
|
||||||
|
"meshMessengerPicture": { "type": "string", "default": null, "description": "Name of a .png image file that is placed in meshcentral-data that is displayed on the top of the messenger web page. When null, the default image is displayed." },
|
||||||
"hide": { "type": "integer", "default": 0 },
|
"hide": { "type": "integer", "default": 0 },
|
||||||
"footer": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is logged in." },
|
"footer": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is logged in." },
|
||||||
"loginfooter": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." },
|
"loginfooter": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." },
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
|
@ -136,6 +136,8 @@
|
||||||
"_newAccountsRights": [ "nonewgroups", "notools" ],
|
"_newAccountsRights": [ "nonewgroups", "notools" ],
|
||||||
"_welcomeText": "Sample Text on Login Page.",
|
"_welcomeText": "Sample Text on Login Page.",
|
||||||
"_welcomePicture": "mainwelcome.jpg",
|
"_welcomePicture": "mainwelcome.jpg",
|
||||||
|
"_meshMessengerTitle": "MeshMessenger",
|
||||||
|
"_meshMessengerPicture": "messenger.png",
|
||||||
"___hide__": "Sum of: 1 = Hide header, 2 = Hide tab, 4 = Hide footer, 8 = Hide title, 16 = Hide left bar",
|
"___hide__": "Sum of: 1 = Hide header, 2 = Hide tab, 4 = Hide footer, 8 = Hide title, 16 = Hide left bar",
|
||||||
"_hide": 4,
|
"_hide": 4,
|
||||||
"_footer": "<a href='https://twitter.com/mytwitter'>Twitter</a>",
|
"_footer": "<a href='https://twitter.com/mytwitter'>Twitter</a>",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,7 +14,8 @@
|
||||||
<script type="text/javascript" src="scripts/filesaver.min.js"></script>
|
<script type="text/javascript" src="scripts/filesaver.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body style="font-family:Arial,Helvetica,sans-serif">
|
<body style="font-family:Arial,Helvetica,sans-serif">
|
||||||
<div id="xtop" style="position:absolute;left:0;right:0;top:0;height:38px;background-color:#036;color:#c8c8c8;box-shadow:3px 3px 10px gray">
|
<div id="xtop" style="position:absolute;left:0;right:0;top:0;height:38px;background-color:#036;color:#EEE;box-shadow:3px 3px 10px gray">
|
||||||
|
<img style="float:left" height="38" src="messenger.png" />
|
||||||
<div style="position:absolute;background-color:#036;right:0;height:38px">
|
<div style="position:absolute;background-color:#036;right:0;height:38px">
|
||||||
<div id="saveButton" class="icon15 topButton" style="margin-right:4px" title="Save conversation" onclick="saveChatSession()"></div>
|
<div id="saveButton" class="icon15 topButton" style="margin-right:4px" title="Save conversation" onclick="saveChatSession()"></div>
|
||||||
<div id="notifyButton" class="icon13 topButton" style="display:none" title="Enable browser notification" onclick="enableNotificationsButtonClick()"></div>
|
<div id="notifyButton" class="icon13 topButton" style="display:none" title="Enable browser notification" onclick="enableNotificationsButtonClick()"></div>
|
||||||
|
@ -23,7 +24,7 @@
|
||||||
<div id="micButton" class="icon6 topButton" title="Activate microphone" style="display:none" onclick="micButtonClick()"></div>
|
<div id="micButton" class="icon6 topButton" title="Activate microphone" style="display:none" onclick="micButtonClick()"></div>
|
||||||
<div id="hangupButton" class="icon11 topRedButton" title="Hang up" style="display:none" onclick="hangUpButtonClick(1)"></div>
|
<div id="hangupButton" class="icon11 topRedButton" title="Hang up" style="display:none" onclick="hangUpButtonClick(1)"></div>
|
||||||
</div>
|
</div>
|
||||||
<div style="padding-top:9px;padding-left:6px;font-size:20px;display:inline-block"><b><span id="xtitle">MeshMessenger</span></b></div>
|
<div style="padding-top:9px;padding-left:6px;font-size:20px;display:inline-block"><b><span id="xtitle"></span></b></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="xmiddle" style="position:absolute;left:0;right:0;top:38px;bottom:36px;font-size:18px">
|
<div id="xmiddle" style="position:absolute;left:0;right:0;top:38px;bottom:36px;font-size:18px">
|
||||||
<div id="xmsgparent" style="position:absolute;left:0;right:0;top:0;bottom:0;overflow-y:scroll">
|
<div id="xmsgparent" style="position:absolute;left:0;right:0;top:0;bottom:0;overflow-y:scroll">
|
||||||
|
@ -73,6 +74,8 @@
|
||||||
var userMediaSupport = 0;
|
var userMediaSupport = 0;
|
||||||
var notification = null;
|
var notification = null;
|
||||||
getUserMediaSupport(function (x) { userMediaSupport = x; })
|
getUserMediaSupport(function (x) { userMediaSupport = x; })
|
||||||
|
var meshMessengerTitle = '{{{meshMessengerTitle}}}';
|
||||||
|
var meshMessengerImage = '{{{meshMessengerImage}}}';
|
||||||
var webrtcconfiguration = '{{{webrtconfig}}}';
|
var webrtcconfiguration = '{{{webrtconfig}}}';
|
||||||
if (webrtcconfiguration == '') { webrtcconfiguration = null; } else { try { webrtcconfiguration = JSON.parse(decodeURIComponent(webrtcconfiguration)); } catch (ex) { console.log('Invalid WebRTC config: "' + webrtcconfiguration + '".'); webrtcconfiguration = null; } }
|
if (webrtcconfiguration == '') { webrtcconfiguration = null; } else { try { webrtcconfiguration = JSON.parse(decodeURIComponent(webrtcconfiguration)); } catch (ex) { console.log('Invalid WebRTC config: "' + webrtcconfiguration + '".'); webrtcconfiguration = null; } }
|
||||||
var windowFocus = true;
|
var windowFocus = true;
|
||||||
|
@ -99,7 +102,8 @@
|
||||||
|
|
||||||
// Set the title
|
// Set the title
|
||||||
if (args.title) { QH('xtitle', EscapeHtml(args.title).split(' ').join(' ')); document.title = document.title + ' - ' + args.title; }
|
if (args.title) { QH('xtitle', EscapeHtml(args.title).split(' ').join(' ')); document.title = document.title + ' - ' + args.title; }
|
||||||
|
else if (meshMessengerTitle == '!') { QH('xtitle', EscapeHtml("MeshMessenger")); } else { QH('xtitle', meshMessengerTitle); }
|
||||||
|
|
||||||
// Setup web notifications
|
// Setup web notifications
|
||||||
if (Notification) { QV('notifyButton', Notification.permission != 'granted'); }
|
if (Notification) { QV('notifyButton', Notification.permission != 'granted'); }
|
||||||
|
|
||||||
|
|
52
webserver.js
52
webserver.js
|
@ -2739,11 +2739,60 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get WebRTC configuration
|
||||||
var webRtcConfig = null;
|
var webRtcConfig = null;
|
||||||
if (obj.parent.config.settings && obj.parent.config.settings.webrtconfig && (typeof obj.parent.config.settings.webrtconfig == 'object')) { webRtcConfig = encodeURIComponent(JSON.stringify(obj.parent.config.settings.webrtconfig)).replace(/'/g, '%27'); }
|
if (obj.parent.config.settings && obj.parent.config.settings.webrtconfig && (typeof obj.parent.config.settings.webrtconfig == 'object')) { webRtcConfig = encodeURIComponent(JSON.stringify(obj.parent.config.settings.webrtconfig)).replace(/'/g, '%27'); }
|
||||||
else if (args.webrtconfig && (typeof args.webrtconfig == 'object')) { webRtcConfig = encodeURIComponent(JSON.stringify(args.webrtconfig)).replace(/'/g, '%27'); }
|
else if (args.webrtconfig && (typeof args.webrtconfig == 'object')) { webRtcConfig = encodeURIComponent(JSON.stringify(args.webrtconfig)).replace(/'/g, '%27'); }
|
||||||
|
|
||||||
|
// Setup other options
|
||||||
|
var options = { webrtconfig: webRtcConfig };
|
||||||
|
if (typeof domain.meshmessengertitle == 'string') { options.meshMessengerTitle = domain.meshmessengertitle; } else { options.meshMessengerTitle = '!'; }
|
||||||
|
|
||||||
|
// Render the page
|
||||||
res.set({ 'Cache-Control': 'no-store' });
|
res.set({ 'Cache-Control': 'no-store' });
|
||||||
render(req, res, getRenderPage('messenger', req, domain), getRenderArgs({ webrtconfig: webRtcConfig }, req, domain));
|
render(req, res, getRenderPage('messenger', req, domain), getRenderArgs(options, req, domain));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle messenger image request
|
||||||
|
function handleMessengerImageRequest(req, res) {
|
||||||
|
const domain = getDomain(req);
|
||||||
|
if (domain == null) { parent.debug('web', 'handleMessengerImageRequest: no domain'); res.sendStatus(404); return; }
|
||||||
|
parent.debug('web', 'handleMessengerImageRequest()');
|
||||||
|
|
||||||
|
// Check if we are in maintenance mode
|
||||||
|
if (parent.config.settings.maintenancemode != null) { res.sendStatus(404); return; }
|
||||||
|
|
||||||
|
//res.set({ 'Cache-Control': 'max-age=86400' }); // 1 day
|
||||||
|
if (domain.meshmessengerpicture) {
|
||||||
|
// Use the configured messenger logo picture
|
||||||
|
try { res.sendFile(obj.path.join(obj.parent.datapath, domain.meshmessengerpicture)); return; } catch (ex) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
var imagefile = 'images/messenger.png';
|
||||||
|
if (domain.webpublicpath != null) {
|
||||||
|
obj.fs.exists(obj.path.join(domain.webpublicpath, imagefile), function (exists) {
|
||||||
|
if (exists) {
|
||||||
|
// Use the domain logo picture
|
||||||
|
try { res.sendFile(obj.path.join(domain.webpublicpath, imagefile)); } catch (ex) { res.sendStatus(404); }
|
||||||
|
} else {
|
||||||
|
// Use the default logo picture
|
||||||
|
try { res.sendFile(obj.path.join(obj.parent.webPublicPath, imagefile)); } catch (ex) { res.sendStatus(404); }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (parent.webPublicOverridePath) {
|
||||||
|
obj.fs.exists(obj.path.join(obj.parent.webPublicOverridePath, imagefile), function (exists) {
|
||||||
|
if (exists) {
|
||||||
|
// Use the override logo picture
|
||||||
|
try { res.sendFile(obj.path.join(obj.parent.webPublicOverridePath, imagefile)); } catch (ex) { res.sendStatus(404); }
|
||||||
|
} else {
|
||||||
|
// Use the default logo picture
|
||||||
|
try { res.sendFile(obj.path.join(obj.parent.webPublicPath, imagefile)); } catch (ex) { res.sendStatus(404); }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Use the default logo picture
|
||||||
|
try { res.sendFile(obj.path.join(obj.parent.webPublicPath, imagefile)); } catch (ex) { res.sendStatus(404); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the server root certificate encoded in base64
|
// Returns the server root certificate encoded in base64
|
||||||
|
@ -4959,6 +5008,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||||
obj.app.post(url + 'amtevents.ashx', obj.handleAmtEventRequest);
|
obj.app.post(url + 'amtevents.ashx', obj.handleAmtEventRequest);
|
||||||
obj.app.get(url + 'meshagents', obj.handleMeshAgentRequest);
|
obj.app.get(url + 'meshagents', obj.handleMeshAgentRequest);
|
||||||
obj.app.get(url + 'messenger', handleMessengerRequest);
|
obj.app.get(url + 'messenger', handleMessengerRequest);
|
||||||
|
obj.app.get(url + 'messenger.png', handleMessengerImageRequest);
|
||||||
obj.app.get(url + 'meshosxagent', obj.handleMeshOsxAgentRequest);
|
obj.app.get(url + 'meshosxagent', obj.handleMeshOsxAgentRequest);
|
||||||
obj.app.get(url + 'meshsettings', obj.handleMeshSettingsRequest);
|
obj.app.get(url + 'meshsettings', obj.handleMeshSettingsRequest);
|
||||||
obj.app.get(url + 'devicepowerevents.ashx', obj.handleDevicePowerEvents);
|
obj.app.get(url + 'devicepowerevents.ashx', obj.handleDevicePowerEvents);
|
||||||
|
|
Loading…
Reference in New Issue