diff --git a/MeshCentralServer.njsproj b/MeshCentralServer.njsproj index b2988f75..92bf34ee 100644 --- a/MeshCentralServer.njsproj +++ b/MeshCentralServer.njsproj @@ -263,6 +263,7 @@ + diff --git a/meshuser.js b/meshuser.js index f33c97bd..d2d72d2d 100644 --- a/meshuser.js +++ b/meshuser.js @@ -2847,7 +2847,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use var smesh = command.meshid.split('/'); if ((smesh.length != 3) || (smesh[0] != 'mesh') || (smesh[1] != domain.id)) { err = 'Invalid group id'; } var serverName = parent.getWebServerName(domain); - if (parent.args.lanonly == true) { err = 'Server has not fixed IP or DNS name.'; } // Handle any errors if (err != null) { @@ -2865,6 +2864,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use var xdomain = (domain.dns == null) ? domain.id : ''; if (xdomain != '') xdomain += "/"; var url = "http" + (args.notls ? '' : 's') + "://" + serverName + ":" + httpsPort + "/" + xdomain + "agentinvite?c=" + inviteCookie; + if (serverName.split('.') == 1) { url = "/" + xdomain + "agentinvite?c=" + inviteCookie; } ws.send(JSON.stringify({ action: 'createInviteLink', meshid: command.meshid, url: url, expire: command.expire, cookie: inviteCookie, responseid: command.responseid, tag: command.tag })); break; diff --git a/package.json b/package.json index 0d7b38f2..4c0eaa9b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.1-i", + "version": "0.4.1-j", "keywords": [ "Remote Management", "Intel AMT", diff --git a/public/images/messenger32.png b/public/images/messenger32.png index da6b8527..f7fd80a4 100644 Binary files a/public/images/messenger32.png and b/public/images/messenger32.png differ diff --git a/public/styles/messenger.css b/public/styles/messenger.css index bf044de7..acc3cecc 100644 --- a/public/styles/messenger.css +++ b/public/styles/messenger.css @@ -104,6 +104,21 @@ background-color: orange; } +.icon12 { + background: url(../images/messenger32.png) -352px 0px; + background-color: gray; +} + +.icon13 { + background: url(../images/messenger32.png) -384px 0px; + background-color: gray; +} + +.icon14 { + background: url(../images/messenger32.png) -416px 0px; + background-color: gray; +} + .fileicon { background: url(../images/messenger32.png) -96px 0px; height: 32px; diff --git a/views/messenger-min.handlebars b/views/messenger-min.handlebars index a2fa1033..19bdf575 100644 --- a/views/messenger-min.handlebars +++ b/views/messenger-min.handlebars @@ -1 +1 @@ - MeshMessenger
MeshMessenger
\ No newline at end of file + MeshMessenger
MeshMessenger
\ No newline at end of file diff --git a/views/messenger.handlebars b/views/messenger.handlebars index 0ea4f482..5ee4aac5 100644 --- a/views/messenger.handlebars +++ b/views/messenger.handlebars @@ -12,6 +12,7 @@
+
@@ -52,6 +53,7 @@ var remoteStream = null; var multiWebRtc = true; // if set to true, multiple WebRTC sessions will be setup. If false, everything uses one session. var userMediaSupport = 0; + var notification = null; getUserMediaSupport(function (x) { userMediaSupport = x; }) var webrtcconfiguration = "{{{webrtconfig}}}"; if (webrtcconfiguration == '') { webrtcconfiguration = null; } else { try { webrtcconfiguration = JSON.parse(decodeURIComponent(webrtcconfiguration)); } catch (ex) { console.log('Invalid WebRTC config: \"' + webrtcconfiguration + '\".'); webrtcconfiguration = null; } } @@ -65,13 +67,23 @@ // Set the title if (args.title) { QH('xtitle', ' - ' + args.title); document.title = document.title + ' - ' + args.title; } + // Setup web notifications + if (Notification) { QV('notifyButton', Notification.permission != 'granted'); } + // Listen to drag & drop events document.addEventListener('dragover', haltEvent, false); document.addEventListener('dragleave', haltEvent, false); document.addEventListener('drop', fileDrop, false); + document.onclick = function (e) { + if (Notification) { QV('notifyButton', Notification.permission != 'granted'); } + if (notification != null) { notification.close(); notification = null; } + } + // Trap document key up events document.onkeyup = function ondockeypress(e) { + if (Notification) { QV('notifyButton', Notification.permission != 'granted'); } + if (notification != null) { notification.close(); notification = null; } if (state == 2) { if ((e.keyCode == 8) && (userInputFocus == 0)) { // Backspace @@ -84,6 +96,8 @@ // Trap document key presses document.onkeypress = function ondockeypress(e) { + if (Notification) { QV('notifyButton', Notification.permission != 'granted'); } + if (notification != null) { notification.close(); notification = null; } if (state == 2) { if (e.keyCode == 13) { // Return @@ -148,10 +162,23 @@ function displayRemote(msg) { QA('xmsg', '
' + msg + '
'); Q('xmsg').scrollTop = Q('xmsg').scrollHeight; + + // If web notifications are granted, use it. + if (Notification) { QV('notifyButton', Notification.permission != 'granted'); } + if (Notification && (Notification.permission == "granted")) { + if (notification != null) { notification.close(); notification = null; } + if (args.title) { + notification = new Notification("MeshMessenger - " + args.title, { body: msg }); + } else { + notification = new Notification("MeshMessenger", { body: msg }); + } + } } // Display and send a message from the local user function xsend(event) { + if (notification != null) { notification.close(); notification = null; } + if (Notification) { QV('notifyButton', Notification.permission != 'granted'); } var outtext = Q('xouttext').value; if (outtext.length > 0) { Q('xouttext').value = ''; @@ -486,6 +513,12 @@ send({ action: 'fileUploadAck', id: msg.id }); } + // Toggle notification + function enableNotificationsButtonClick() { + if (Notification) { Notification.requestPermission().then(function (permission) { QV('notifyButton', permission != "granted"); }); } + return false; + } + // Camera button function camButtonClick() { if (localStream == null) { startLocalStream({ video: true, audio: true }); } @@ -603,6 +636,7 @@ if (webchannel != null) { try { webchannel.close(); } catch (e) { } webchannel = null; } if (socket != null) { try { socket.close(); } catch (e) { } socket = null; } } +