Added Windows Terminal Sessions support, Notification group names.

This commit is contained in:
Ylian Saint-Hilaire 2019-12-12 17:45:42 -08:00
parent 3136e33558
commit 74e3d437dc
19 changed files with 453 additions and 131 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -768,13 +768,20 @@ function createMeshCore(agent) {
//sendConsoleText('setClip: ' + JSON.stringify(data)); //sendConsoleText('setClip: ' + JSON.stringify(data));
if (typeof data.data == 'string') { if (typeof data.data == 'string') {
MeshServerLog('Setting clipboard content, ' + data.data.length + ' byte(s)', data); MeshServerLog('Setting clipboard content, ' + data.data.length + ' byte(s)', data);
if (typeof data.data == 'string') { if (require('MeshAgent').isService) { require('clipboard').dispatchWrite(data.data); } else { require("clipboard")(data.data); } // Set the clipboard
if (require('MeshAgent').isService) { require('clipboard').dispatchWrite(data.data); } else { require("clipboard")(data.data); } // Set the clipboard mesh.SendCommand({ "action": "msg", "type": "setclip", "sessionid": data.sessionid, "success": true });
mesh.SendCommand({ "action": "msg", "type": "setclip", "sessionid": data.sessionid, "success": true });
}
} }
break; break;
} }
case 'userSessions': {
// Send back current user sessions list, this is Windows only.
//sendConsoleText('userSessions: ' + JSON.stringify(data));
if (process.platform != 'win32') break;
var p = require('user-sessions').enumerateUsers();
p.sessionid = data.sessionid;
p.then(function (u) { mesh.SendCommand({ 'action': 'msg', 'type': 'userSessions', 'sessionid': u.sessionid, 'data': u }); });
break;
}
default: default:
// Unknown action, ignore it. // Unknown action, ignore it.
break; break;
@ -1088,6 +1095,7 @@ function createMeshCore(agent) {
// Handle tunnel data // Handle tunnel data
if (this.httprequest.protocol == 0) { // 1 = Terminal (admin), 2 = Desktop, 5 = Files, 6 = PowerShell (admin), 7 = Plugin Data Exchange, 8 = Terminal (user), 9 = PowerShell (user) if (this.httprequest.protocol == 0) { // 1 = Terminal (admin), 2 = Desktop, 5 = Files, 6 = PowerShell (admin), 7 = Plugin Data Exchange, 8 = Terminal (user), 9 = PowerShell (user)
// Take a look at the protocol // Take a look at the protocol
if ((data.length > 3) && (data[0] == '{')) { onTunnelControlData(data, this); return; }
this.httprequest.protocol = parseInt(data); this.httprequest.protocol = parseInt(data);
if (typeof this.httprequest.protocol != 'number') { this.httprequest.protocol = 0; } if (typeof this.httprequest.protocol != 'number') { this.httprequest.protocol = 0; }
if ((this.httprequest.protocol == 1) || (this.httprequest.protocol == 6) || (this.httprequest.protocol == 8) || (this.httprequest.protocol == 9)) { if ((this.httprequest.protocol == 1) || (this.httprequest.protocol == 6) || (this.httprequest.protocol == 8) || (this.httprequest.protocol == 9)) {
@ -1260,8 +1268,13 @@ function createMeshCore(agent) {
return; return;
} }
// Look for a TSID
var tsid = null;
if ((this.httprequest.xoptions != null) && (typeof this.httprequest.xoptions.tsid == 'number')) { tsid = this.httprequest.xoptions.tsid; }
if (require('MeshAgent')._tsid != null) { tsid = require('MeshAgent')._tsid; }
// Remote desktop using native pipes // Remote desktop using native pipes
this.httprequest.desktop = { state: 0, kvm: mesh.getRemoteDesktopStream(require('MeshAgent')._tsid == null ? undefined : require('MeshAgent')._tsid), tunnel: this }; this.httprequest.desktop = { state: 0, kvm: mesh.getRemoteDesktopStream(tsid), tunnel: this };
this.httprequest.desktop.kvm.parent = this.httprequest.desktop; this.httprequest.desktop.kvm.parent = this.httprequest.desktop;
this.desktop = this.httprequest.desktop; this.desktop = this.httprequest.desktop;
@ -1742,7 +1755,12 @@ function createMeshCore(agent) {
return; return;
} }
if (obj.type == 'close') { if (obj.type == 'options') {
// These are additional connection options passed in the control channel.
//sendConsoleText('options: ' + JSON.stringify(obj));
delete obj.type;
ws.httprequest.xoptions = obj;
} else if (obj.type == 'close') {
// We received the close on the websocket // We received the close on the websocket
//sendConsoleText('Tunnel #' + ws.tunnel.index + ' WebSocket control close'); //sendConsoleText('Tunnel #' + ws.tunnel.index + ' WebSocket control close');
try { ws.close(); } catch (e) { } try { ws.close(); } catch (e) { }
@ -1982,10 +2000,7 @@ function createMeshCore(agent) {
var v = []; var v = [];
for(var i in u) for(var i in u)
{ {
if(u[i].State == 'Active') if(u[i].State == 'Active') { v.push({ tsid: i, type: u[i].StationName, user: u[i].Username, domain: u[i].Domain }); }
{
v.push({ tsid: i, type: u[i].StationName, user: u[i].Username });
}
} }
sendConsoleText(JSON.stringify(v, null, 1), this.sessionid); sendConsoleText(JSON.stringify(v, null, 1), this.sessionid);
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.4.5-s", "version": "0.4.5-t",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",

View File

@ -14,6 +14,7 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
obj.rauthCookie = rauthCookie; obj.rauthCookie = rauthCookie;
obj.State = 0; obj.State = 0;
obj.nodeid = null; obj.nodeid = null;
obj.options = null;
obj.socket = null; obj.socket = null;
obj.connectstate = -1; obj.connectstate = -1;
obj.tunnelid = Math.random().toString(36).substring(2); // Generate a random client tunnel id obj.tunnelid = Math.random().toString(36).substring(2); // Generate a random client tunnel id
@ -101,6 +102,7 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
if (obj.State < 3) { if (obj.State < 3) {
if ((e.data == 'c') || (e.data == 'cr')) { if ((e.data == 'c') || (e.data == 'cr')) {
if (e.data == 'cr') { obj.serverIsRecording = true; } if (e.data == 'cr') { obj.serverIsRecording = true; }
if (obj.options != null) { delete obj.options.action; obj.options.type = 'options'; try { obj.socket.send(JSON.stringify(obj.options)); } catch (ex) { } }
try { obj.socket.send(obj.protocol); } catch (ex) { } try { obj.socket.send(obj.protocol); } catch (ex) { }
obj.xxStateChange(3); obj.xxStateChange(3);

File diff suppressed because one or more lines are too long

View File

@ -476,7 +476,7 @@
<div> <div>
<div id="idx_deskFullBtn2" onclick=deskToggleFull(event)>&nbsp;&#x2716;</div> <div id="idx_deskFullBtn2" onclick=deskToggleFull(event)>&nbsp;&#x2716;</div>
<input type="button" id="autoconnectbutton1" value="AutoConnect" onclick=autoConnectDesktop(event) onkeypress="return false" onkeydown="return false" style="display:none" /> <input type="button" id="autoconnectbutton1" value="AutoConnect" onclick=autoConnectDesktop(event) onkeypress="return false" onkeydown="return false" style="display:none" />
<span id=connectbutton1span><input type=button id=connectbutton1 value="Connect" onclick=connectDesktop(event,1) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span> <span id=connectbutton1span><input type=button id=connectbutton1 value="Connect" onclick=connectDesktop(event,3) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
<span id=connectbutton1hspan>&nbsp;<input type=button id=connectbutton1h value="HW Connect" title="Connect using Intel AMT hardware KVM" onclick=connectDesktop(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span> <span id=connectbutton1hspan>&nbsp;<input type=button id=connectbutton1h value="HW Connect" title="Connect using Intel AMT hardware KVM" onclick=connectDesktop(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
<span id=disconnectbutton1span>&nbsp;<input type=button id=disconnectbutton1 value="Disconnect" onclick=connectDesktop(event,0) onkeypress="return false" onkeydown="return false" /></span> <span id=disconnectbutton1span>&nbsp;<input type=button id=disconnectbutton1 value="Disconnect" onclick=connectDesktop(event,0) onkeypress="return false" onkeydown="return false" /></span>
&nbsp;<span id="deskstatus">Disconnected</span> &nbsp;<span id="deskstatus">Disconnected</span>
@ -514,6 +514,7 @@
</div> </div>
</div> </div>
<div id=p11DeskConsoleMsg style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick=p11clearConsoleMsg()></div> <div id=p11DeskConsoleMsg style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick=p11clearConsoleMsg()></div>
<div id=p11DeskSessionSelector style="display:none;position:absolute;left:30px;top:17px;right:30px"></div>
</div> </div>
<div id=deskarea4 class="areaFoot"> <div id=deskarea4 class="areaFoot">
<div class="toright2"> <div class="toright2">
@ -1236,7 +1237,6 @@
QV('p4UserBatchCreate', (features & 0x00080000) == 0); QV('p4UserBatchCreate', (features & 0x00080000) == 0);
// Set the file editor // Set the file editor
// TODO: Set user values
d4EditWrapVal = getstore('editorWrap', 0); d4EditWrapVal = getstore('editorWrap', 0);
d4EditSizeVal = getstore('editorSize', 0); d4EditSizeVal = getstore('editorSize', 0);
d4ToggleWrap(true); d4ToggleWrap(true);
@ -1707,6 +1707,22 @@
// Display success/fail on the clipboard dialog box. // Display success/fail on the clipboard dialog box.
QH('dlgClipStatus', message.success ? '<span style=color:green>' + "Success" + '</span>' : '<span style=color:red>' + "Failed" + '</span>') QH('dlgClipStatus', message.success ? '<span style=color:green>' + "Success" + '</span>' : '<span style=color:red>' + "Failed" + '</span>')
setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000); setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000);
} else if ((message.type == 'userSessions') && (currentNode != null) && (currentNode._id == message.nodeid) && (desktop == null)) {
// Got list of user sessions
var userSessions = [];
if (message.data != null) { for (var i in message.data) { if ((message.data[i].State == 'Active') || (debugmode == 3)) { userSessions.push(message.data[i]); } } }
if (userSessions.length == 0) { connectDesktop(null, 1); } // No active sessions, do a normal connection.
else if (userSessions.length == 1) { connectDesktop(null, 1, userSessions[0].SessionId); } // One active session, connect to it
else {
var x = '';
for (var i in userSessions) {
x += '<div style="text-align:left;cursor:pointer;background-color:gray;margin:5px;padding:5px;border-radius:5px" onclick=connectDesktop(event,1,' + userSessions[i].SessionId + ')>' + userSessions[i].State + ', ' + userSessions[i].StationName;
if (userSessions[i].Username) { if (userSessions[i].Domain) { x += ' - ' + userSessions[i].Domain + '/' + userSessions[i].Username; } else { x += ' - ' + userSessions[i].Username; } }
x += '</div>';
}
QH('p11DeskSessionSelector', x);
QV('p11DeskSessionSelector', true);
}
} }
} }
} else { } else {
@ -3635,7 +3651,7 @@
// If possible, connect... // If possible, connect...
var mesh = meshes[currentNode.meshid]; var mesh = meshes[currentNode.meshid];
if ((currentNode.conn & 1) && (mesh.mtype == 2)) { if ((currentNode.conn & 1) && (mesh.mtype == 2)) {
if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 1); } // Desktop if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 3); } // Desktop
if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal
if ((panel == 13) && (files == null)) { connectFiles(null); } // files if ((panel == 13) && (files == null)) { connectFiles(null); } // files
} }
@ -5146,9 +5162,10 @@
// Debug // Debug
var autoConnectDesktopTimer = null; var autoConnectDesktopTimer = null;
function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(connectDesktop, 100); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } } function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(function() { connectDesktop(null, 1) }, 1000); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } }
function connectDesktop(e, contype) { function connectDesktop(e, contype, tsid) {
QV('p11DeskSessionSelector', false);
p11clearConsoleMsg(); p11clearConsoleMsg();
if (desktop == null) { if (desktop == null) {
desktopNode = currentNode; desktopNode = currentNode;
@ -5236,12 +5253,13 @@
}; };
desktop.Start(desktopNode._id, 16994, '*', '*', 0); desktop.Start(desktopNode._id, 16994, '*', '*', 0);
desktop.contype = 2; desktop.contype = 2;
} else { } else if ((contype == null) || (contype == 1) || ((contype == 3) && (currentNode.agent.id > 4))) {
// Setup the Mesh Agent remote desktop // Setup the Mesh Agent remote desktop
desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl); desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
desktop.debugmode = debugmode; desktop.debugmode = debugmode;
desktop.m.debugmode = debugmode; desktop.m.debugmode = debugmode;
desktop.attemptWebRTC = attemptWebRTC; desktop.attemptWebRTC = attemptWebRTC;
desktop.options = { tsid: tsid };
desktop.onStateChanged = onDesktopStateChange; desktop.onStateChanged = onDesktopStateChange;
desktop.onConsoleMessageChange = function () { desktop.onConsoleMessageChange = function () {
p11clearConsoleMsg(); p11clearConsoleMsg();
@ -5258,6 +5276,9 @@
desktop.m.onScreenSizeChange = deskAdjust; desktop.m.onScreenSizeChange = deskAdjust;
desktop.Start(desktopNode._id); desktop.Start(desktopNode._id);
desktop.contype = 1; desktop.contype = 1;
} else if (contype == 3) {
// Ask for user sessions
meshserver.send({ action: 'msg', type: 'userSessions', nodeid: currentNode._id });
} }
} else { } else {
// Disconnect and clean up the remote desktop // Disconnect and clean up the remote desktop
@ -7032,6 +7053,7 @@
if (xxdialogMode) return false; if (xxdialogMode) return false;
var x = ''; var x = '';
x += '<div><label><input id=p2notifyPlayNotifySound type=checkbox />' + "Notification sound." + '</label></div>'; x += '<div><label><input id=p2notifyPlayNotifySound type=checkbox />' + "Notification sound." + '</label></div>';
x += '<div><label><input id=p2notifyGroupName type=checkbox />' + "Display Device Group Name" + '</label></div>';
x += '<div><label><input id=p2notifyIntelDeviceConnect type=checkbox />' + "Device connections." + '</label></div>'; x += '<div><label><input id=p2notifyIntelDeviceConnect type=checkbox />' + "Device connections." + '</label></div>';
x += '<div><label><input id=p2notifyIntelDeviceDisconnect type=checkbox />' + "Device disconnections." + '</label></div>'; x += '<div><label><input id=p2notifyIntelDeviceDisconnect type=checkbox />' + "Device disconnections." + '</label></div>';
x += '<div><label><input id=p2notifyIntelAmtKvmActions type=checkbox />' + "Intel&reg; AMT desktop and serial events." + '</label></div>'; x += '<div><label><input id=p2notifyIntelAmtKvmActions type=checkbox />' + "Intel&reg; AMT desktop and serial events." + '</label></div>';
@ -7041,6 +7063,7 @@
Q('p2notifyIntelDeviceConnect').checked = (n & 2); Q('p2notifyIntelDeviceConnect').checked = (n & 2);
Q('p2notifyIntelDeviceDisconnect').checked = (n & 4); Q('p2notifyIntelDeviceDisconnect').checked = (n & 4);
Q('p2notifyIntelAmtKvmActions').checked = (n & 8); Q('p2notifyIntelAmtKvmActions').checked = (n & 8);
Q('p2notifyGroupName').checked = (n & 16);
return false; return false;
} }
@ -7050,6 +7073,7 @@
n += Q('p2notifyIntelDeviceConnect').checked ? 2 : 0; n += Q('p2notifyIntelDeviceConnect').checked ? 2 : 0;
n += Q('p2notifyIntelDeviceDisconnect').checked ? 4 : 0; n += Q('p2notifyIntelDeviceDisconnect').checked ? 4 : 0;
n += Q('p2notifyIntelAmtKvmActions').checked ? 8 : 0; n += Q('p2notifyIntelAmtKvmActions').checked ? 8 : 0;
n += Q('p2notifyGroupName').checked ? 16 : 0;
putstore('notifications', n); putstore('notifications', n);
} }
@ -9015,19 +9039,20 @@
// Refresh the notification box // Refresh the notification box
function drawNotifications() { function drawNotifications() {
var notifySettings = getstore('notifications', 0);
var r = ''; var r = '';
if (notifications.length == 0) { if (notifications.length == 0) {
r = '<div style=margin:5px>' + "There are currently no notifications" + '</div>'; r = '<div style=margin:5px>' + "There are currently no notifications" + '</div>';
} else { } else {
for (var i in notifications) { for (var i in notifications) {
var n = notifications[i]; var n = notifications[i], t = '', d = new Date(n.time), icon = 0;
var t = '';
if (n.title != null) { t = '<b>' + n.title + '</b>: ' } if (n.title != null) { t = '<b>' + n.title + '</b>: ' }
var d = new Date(n.time);
var icon = 0;
if (n.nodeid != null) { if (n.nodeid != null) {
var node = getNodeFromId(n.nodeid); var node = getNodeFromId(n.nodeid);
if (node != null) { icon = node.icon; t = '<b>' + node.name + '</b>: ' } if (node != null) {
icon = node.icon;
if (notifySettings & 16) { t = '<b>' + meshes[node.meshid].name + ' / ' + node.name + '</b>: '; } else { t = '<b>' + node.name + '</b>: '; } // Display with or without group name
}
} }
r += '<div title="' + format("Occured at {0}", printDateTime(d)) + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">'; r += '<div title="' + format("Occured at {0}", printDateTime(d)) + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">';
@ -9106,7 +9131,13 @@
var text = n.text.split('&reg;').join('').split('<b>').join('').split('</b>').join('').split('<br />').join('\r\n'); // Clean up any HTML codes var text = n.text.split('&reg;').join('').split('<b>').join('').split('</b>').join('').split('<br />').join('\r\n'); // Clean up any HTML codes
if (n.nodeid) { if (n.nodeid) {
var node = getNodeFromId(n.nodeid); var node = getNodeFromId(n.nodeid);
if (node) { notification = new Notification('{{{title}}} - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' }); } if (node) {
if (notifySettings & 16) { // Notify with group name
notification = new Notification('{{{title}}} - ' + meshes[node.meshid].name + ' - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' });
} else {
notification = new Notification('{{{title}}} - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' });
}
}
} else { } else {
if (n.icon == null) { n.icon = 0; } if (n.icon == null) { n.icon = 0; }
var title = n.title; var title = n.title;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -474,7 +474,7 @@
<div> <div>
<div id="idx_deskFullBtn2" onclick="deskToggleFull(event)">&nbsp;✖</div> <div id="idx_deskFullBtn2" onclick="deskToggleFull(event)">&nbsp;✖</div>
<input type="button" id="autoconnectbutton1" value="Automatické připojení" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <input type="button" id="autoconnectbutton1" value="Automatické připojení" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none">
<span id="connectbutton1span"><input type="button" id="connectbutton1" value="Připojit" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1span"><input type="button" id="connectbutton1" value="Připojit" onclick="connectDesktop(event,3)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
<span id="connectbutton1hspan">&nbsp;<input type="button" id="connectbutton1h" value="HW připojení" title="Připojit pomocí Intel AMT hardware KVM" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1hspan">&nbsp;<input type="button" id="connectbutton1h" value="HW připojení" title="Připojit pomocí Intel AMT hardware KVM" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
<span id="disconnectbutton1span">&nbsp;<input type="button" id="disconnectbutton1" value="Odpojit" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span> <span id="disconnectbutton1span">&nbsp;<input type="button" id="disconnectbutton1" value="Odpojit" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span>
&nbsp;<span id="deskstatus">Odpojeno</span> &nbsp;<span id="deskstatus">Odpojeno</span>
@ -512,6 +512,7 @@
</div> </div>
</div> </div>
<div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p11clearConsoleMsg()"></div> <div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p11clearConsoleMsg()"></div>
<div id="p11DeskSessionSelector" style="display:none;position:absolute;left:30px;top:17px;right:30px"></div>
</div> </div>
<div id="deskarea4" class="areaFoot"> <div id="deskarea4" class="areaFoot">
<div class="toright2"> <div class="toright2">
@ -1234,7 +1235,6 @@
QV('p4UserBatchCreate', (features & 0x00080000) == 0); QV('p4UserBatchCreate', (features & 0x00080000) == 0);
// Set the file editor // Set the file editor
// TODO: Set user values
d4EditWrapVal = getstore('editorWrap', 0); d4EditWrapVal = getstore('editorWrap', 0);
d4EditSizeVal = getstore('editorSize', 0); d4EditSizeVal = getstore('editorSize', 0);
d4ToggleWrap(true); d4ToggleWrap(true);
@ -1705,6 +1705,22 @@
// Display success/fail on the clipboard dialog box. // Display success/fail on the clipboard dialog box.
QH('dlgClipStatus', message.success ? '<span style=color:green>' + "Úspěch" + '</span>' : '<span style=color:red>' + "Selhalo" + '</span>') QH('dlgClipStatus', message.success ? '<span style=color:green>' + "Úspěch" + '</span>' : '<span style=color:red>' + "Selhalo" + '</span>')
setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000); setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000);
} else if ((message.type == 'userSessions') && (currentNode != null) && (currentNode._id == message.nodeid) && (desktop == null)) {
// Got list of user sessions
var userSessions = [];
if (message.data != null) { for (var i in message.data) { if ((message.data[i].State == 'Active') || (debugmode == 3)) { userSessions.push(message.data[i]); } } }
if (userSessions.length == 0) { connectDesktop(null, 1); } // No active sessions, do a normal connection.
else if (userSessions.length == 1) { connectDesktop(null, 1, userSessions[0].SessionId); } // One active session, connect to it
else {
var x = '';
for (var i in userSessions) {
x += '<div style="text-align:left;cursor:pointer;background-color:gray;margin:5px;padding:5px;border-radius:5px" onclick=connectDesktop(event,1,' + userSessions[i].SessionId + ')>' + userSessions[i].State + ', ' + userSessions[i].StationName;
if (userSessions[i].Username) { if (userSessions[i].Domain) { x += ' - ' + userSessions[i].Domain + '/' + userSessions[i].Username; } else { x += ' - ' + userSessions[i].Username; } }
x += '</div>';
}
QH('p11DeskSessionSelector', x);
QV('p11DeskSessionSelector', true);
}
} }
} }
} else { } else {
@ -3633,7 +3649,7 @@
// If possible, connect... // If possible, connect...
var mesh = meshes[currentNode.meshid]; var mesh = meshes[currentNode.meshid];
if ((currentNode.conn & 1) && (mesh.mtype == 2)) { if ((currentNode.conn & 1) && (mesh.mtype == 2)) {
if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 1); } // Desktop if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 3); } // Desktop
if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal
if ((panel == 13) && (files == null)) { connectFiles(null); } // files if ((panel == 13) && (files == null)) { connectFiles(null); } // files
} }
@ -5144,9 +5160,10 @@
// Debug // Debug
var autoConnectDesktopTimer = null; var autoConnectDesktopTimer = null;
function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(connectDesktop, 100); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } } function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(function() { connectDesktop(null, 1) }, 1000); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } }
function connectDesktop(e, contype) { function connectDesktop(e, contype, tsid) {
QV('p11DeskSessionSelector', false);
p11clearConsoleMsg(); p11clearConsoleMsg();
if (desktop == null) { if (desktop == null) {
desktopNode = currentNode; desktopNode = currentNode;
@ -5234,12 +5251,13 @@
}; };
desktop.Start(desktopNode._id, 16994, '*', '*', 0); desktop.Start(desktopNode._id, 16994, '*', '*', 0);
desktop.contype = 2; desktop.contype = 2;
} else { } else if ((contype == null) || (contype == 1) || ((contype == 3) && (currentNode.agent.id > 4))) {
// Setup the Mesh Agent remote desktop // Setup the Mesh Agent remote desktop
desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl); desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
desktop.debugmode = debugmode; desktop.debugmode = debugmode;
desktop.m.debugmode = debugmode; desktop.m.debugmode = debugmode;
desktop.attemptWebRTC = attemptWebRTC; desktop.attemptWebRTC = attemptWebRTC;
desktop.options = { tsid: tsid };
desktop.onStateChanged = onDesktopStateChange; desktop.onStateChanged = onDesktopStateChange;
desktop.onConsoleMessageChange = function () { desktop.onConsoleMessageChange = function () {
p11clearConsoleMsg(); p11clearConsoleMsg();
@ -5256,6 +5274,9 @@
desktop.m.onScreenSizeChange = deskAdjust; desktop.m.onScreenSizeChange = deskAdjust;
desktop.Start(desktopNode._id); desktop.Start(desktopNode._id);
desktop.contype = 1; desktop.contype = 1;
} else if (contype == 3) {
// Ask for user sessions
meshserver.send({ action: 'msg', type: 'userSessions', nodeid: currentNode._id });
} }
} else { } else {
// Disconnect and clean up the remote desktop // Disconnect and clean up the remote desktop
@ -7030,6 +7051,7 @@
if (xxdialogMode) return false; if (xxdialogMode) return false;
var x = ''; var x = '';
x += '<div><label><input id=p2notifyPlayNotifySound type=checkbox />' + "Zvuk notifikací" + '</label></div>'; x += '<div><label><input id=p2notifyPlayNotifySound type=checkbox />' + "Zvuk notifikací" + '</label></div>';
x += '<div><label><input id=p2notifyGroupName type=checkbox />' + "Display Group Name" + '</label></div>';
x += '<div><label><input id=p2notifyIntelDeviceConnect type=checkbox />' + "Připojení zařízení" + '</label></div>'; x += '<div><label><input id=p2notifyIntelDeviceConnect type=checkbox />' + "Připojení zařízení" + '</label></div>';
x += '<div><label><input id=p2notifyIntelDeviceDisconnect type=checkbox />' + "Odpojení zařízení" + '</label></div>'; x += '<div><label><input id=p2notifyIntelDeviceDisconnect type=checkbox />' + "Odpojení zařízení" + '</label></div>';
x += '<div><label><input id=p2notifyIntelAmtKvmActions type=checkbox />' + "Intel&reg; AMT desktop and serial události." + '</label></div>'; x += '<div><label><input id=p2notifyIntelAmtKvmActions type=checkbox />' + "Intel&reg; AMT desktop and serial události." + '</label></div>';
@ -7039,6 +7061,7 @@
Q('p2notifyIntelDeviceConnect').checked = (n & 2); Q('p2notifyIntelDeviceConnect').checked = (n & 2);
Q('p2notifyIntelDeviceDisconnect').checked = (n & 4); Q('p2notifyIntelDeviceDisconnect').checked = (n & 4);
Q('p2notifyIntelAmtKvmActions').checked = (n & 8); Q('p2notifyIntelAmtKvmActions').checked = (n & 8);
Q('p2notifyGroupName').checked = (n & 16);
return false; return false;
} }
@ -7048,6 +7071,7 @@
n += Q('p2notifyIntelDeviceConnect').checked ? 2 : 0; n += Q('p2notifyIntelDeviceConnect').checked ? 2 : 0;
n += Q('p2notifyIntelDeviceDisconnect').checked ? 4 : 0; n += Q('p2notifyIntelDeviceDisconnect').checked ? 4 : 0;
n += Q('p2notifyIntelAmtKvmActions').checked ? 8 : 0; n += Q('p2notifyIntelAmtKvmActions').checked ? 8 : 0;
n += Q('p2notifyGroupName').checked ? 16 : 0;
putstore('notifications', n); putstore('notifications', n);
} }
@ -9013,19 +9037,20 @@
// Refresh the notification box // Refresh the notification box
function drawNotifications() { function drawNotifications() {
var notifySettings = getstore('notifications', 0);
var r = ''; var r = '';
if (notifications.length == 0) { if (notifications.length == 0) {
r = '<div style=margin:5px>' + "Žádná notifikace" + '</div>'; r = '<div style=margin:5px>' + "Žádná notifikace" + '</div>';
} else { } else {
for (var i in notifications) { for (var i in notifications) {
var n = notifications[i]; var n = notifications[i], t = '', d = new Date(n.time), icon = 0;
var t = '';
if (n.title != null) { t = '<b>' + n.title + '</b>: ' } if (n.title != null) { t = '<b>' + n.title + '</b>: ' }
var d = new Date(n.time);
var icon = 0;
if (n.nodeid != null) { if (n.nodeid != null) {
var node = getNodeFromId(n.nodeid); var node = getNodeFromId(n.nodeid);
if (node != null) { icon = node.icon; t = '<b>' + node.name + '</b>: ' } if (node != null) {
icon = node.icon;
if (notifySettings & 16) { t = '<b>' + meshes[node.meshid].name + ' / ' + node.name + '</b>: '; } else { t = '<b>' + node.name + '</b>: '; } // Display with or without group name
}
} }
r += '<div title="' + format("Došlo k {0}", printDateTime(d)) + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">'; r += '<div title="' + format("Došlo k {0}", printDateTime(d)) + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">';
@ -9104,7 +9129,13 @@
var text = n.text.split('&reg;').join('').split('<b>').join('').split('</b>').join('').split('<br />').join('\r\n'); // Clean up any HTML codes var text = n.text.split('&reg;').join('').split('<b>').join('').split('</b>').join('').split('<br />').join('\r\n'); // Clean up any HTML codes
if (n.nodeid) { if (n.nodeid) {
var node = getNodeFromId(n.nodeid); var node = getNodeFromId(n.nodeid);
if (node) { notification = new Notification('{{{title}}} - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' }); } if (node) {
if (notifySettings & 16) { // Notify with group name
notification = new Notification('{{{title}}} - ' + meshes[node.meshid].name + ' - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' });
} else {
notification = new Notification('{{{title}}} - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' });
}
}
} else { } else {
if (n.icon == null) { n.icon = 0; } if (n.icon == null) { n.icon = 0; }
var title = n.title; var title = n.title;

View File

@ -474,7 +474,7 @@
<div> <div>
<div id="idx_deskFullBtn2" onclick="deskToggleFull(event)">&nbsp;✖</div> <div id="idx_deskFullBtn2" onclick="deskToggleFull(event)">&nbsp;✖</div>
<input type="button" id="autoconnectbutton1" value="AutoConnect" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <input type="button" id="autoconnectbutton1" value="AutoConnect" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none">
<span id="connectbutton1span"><input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1span"><input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event,3)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
<span id="connectbutton1hspan">&nbsp;<input type="button" id="connectbutton1h" value="Connexion AMT" title="Connect using Intel AMT hardware KVM" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1hspan">&nbsp;<input type="button" id="connectbutton1h" value="Connexion AMT" title="Connect using Intel AMT hardware KVM" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
<span id="disconnectbutton1span">&nbsp;<input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span> <span id="disconnectbutton1span">&nbsp;<input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span>
&nbsp;<span id="deskstatus">Débranché</span> &nbsp;<span id="deskstatus">Débranché</span>
@ -512,6 +512,7 @@
</div> </div>
</div> </div>
<div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p11clearConsoleMsg()"></div> <div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p11clearConsoleMsg()"></div>
<div id="p11DeskSessionSelector" style="display:none;position:absolute;left:30px;top:17px;right:30px"></div>
</div> </div>
<div id="deskarea4" class="areaFoot"> <div id="deskarea4" class="areaFoot">
<div class="toright2"> <div class="toright2">
@ -1234,7 +1235,6 @@
QV('p4UserBatchCreate', (features & 0x00080000) == 0); QV('p4UserBatchCreate', (features & 0x00080000) == 0);
// Set the file editor // Set the file editor
// TODO: Set user values
d4EditWrapVal = getstore('editorWrap', 0); d4EditWrapVal = getstore('editorWrap', 0);
d4EditSizeVal = getstore('editorSize', 0); d4EditSizeVal = getstore('editorSize', 0);
d4ToggleWrap(true); d4ToggleWrap(true);
@ -1705,6 +1705,22 @@
// Display success/fail on the clipboard dialog box. // Display success/fail on the clipboard dialog box.
QH('dlgClipStatus', message.success ? '<span style=color:green>' + "Succès" + '</span>' : '<span style=color:red>' + "Échoué" + '</span>') QH('dlgClipStatus', message.success ? '<span style=color:green>' + "Succès" + '</span>' : '<span style=color:red>' + "Échoué" + '</span>')
setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000); setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000);
} else if ((message.type == 'userSessions') && (currentNode != null) && (currentNode._id == message.nodeid) && (desktop == null)) {
// Got list of user sessions
var userSessions = [];
if (message.data != null) { for (var i in message.data) { if ((message.data[i].State == 'Active') || (debugmode == 3)) { userSessions.push(message.data[i]); } } }
if (userSessions.length == 0) { connectDesktop(null, 1); } // No active sessions, do a normal connection.
else if (userSessions.length == 1) { connectDesktop(null, 1, userSessions[0].SessionId); } // One active session, connect to it
else {
var x = '';
for (var i in userSessions) {
x += '<div style="text-align:left;cursor:pointer;background-color:gray;margin:5px;padding:5px;border-radius:5px" onclick=connectDesktop(event,1,' + userSessions[i].SessionId + ')>' + userSessions[i].State + ', ' + userSessions[i].StationName;
if (userSessions[i].Username) { if (userSessions[i].Domain) { x += ' - ' + userSessions[i].Domain + '/' + userSessions[i].Username; } else { x += ' - ' + userSessions[i].Username; } }
x += '</div>';
}
QH('p11DeskSessionSelector', x);
QV('p11DeskSessionSelector', true);
}
} }
} }
} else { } else {
@ -3633,7 +3649,7 @@
// If possible, connect... // If possible, connect...
var mesh = meshes[currentNode.meshid]; var mesh = meshes[currentNode.meshid];
if ((currentNode.conn & 1) && (mesh.mtype == 2)) { if ((currentNode.conn & 1) && (mesh.mtype == 2)) {
if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 1); } // Desktop if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 3); } // Desktop
if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal
if ((panel == 13) && (files == null)) { connectFiles(null); } // files if ((panel == 13) && (files == null)) { connectFiles(null); } // files
} }
@ -5144,9 +5160,10 @@
// Debug // Debug
var autoConnectDesktopTimer = null; var autoConnectDesktopTimer = null;
function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(connectDesktop, 100); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } } function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(function() { connectDesktop(null, 1) }, 1000); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } }
function connectDesktop(e, contype) { function connectDesktop(e, contype, tsid) {
QV('p11DeskSessionSelector', false);
p11clearConsoleMsg(); p11clearConsoleMsg();
if (desktop == null) { if (desktop == null) {
desktopNode = currentNode; desktopNode = currentNode;
@ -5234,12 +5251,13 @@
}; };
desktop.Start(desktopNode._id, 16994, '*', '*', 0); desktop.Start(desktopNode._id, 16994, '*', '*', 0);
desktop.contype = 2; desktop.contype = 2;
} else { } else if ((contype == null) || (contype == 1) || ((contype == 3) && (currentNode.agent.id > 4))) {
// Setup the Mesh Agent remote desktop // Setup the Mesh Agent remote desktop
desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl); desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
desktop.debugmode = debugmode; desktop.debugmode = debugmode;
desktop.m.debugmode = debugmode; desktop.m.debugmode = debugmode;
desktop.attemptWebRTC = attemptWebRTC; desktop.attemptWebRTC = attemptWebRTC;
desktop.options = { tsid: tsid };
desktop.onStateChanged = onDesktopStateChange; desktop.onStateChanged = onDesktopStateChange;
desktop.onConsoleMessageChange = function () { desktop.onConsoleMessageChange = function () {
p11clearConsoleMsg(); p11clearConsoleMsg();
@ -5256,6 +5274,9 @@
desktop.m.onScreenSizeChange = deskAdjust; desktop.m.onScreenSizeChange = deskAdjust;
desktop.Start(desktopNode._id); desktop.Start(desktopNode._id);
desktop.contype = 1; desktop.contype = 1;
} else if (contype == 3) {
// Ask for user sessions
meshserver.send({ action: 'msg', type: 'userSessions', nodeid: currentNode._id });
} }
} else { } else {
// Disconnect and clean up the remote desktop // Disconnect and clean up the remote desktop
@ -7030,6 +7051,7 @@
if (xxdialogMode) return false; if (xxdialogMode) return false;
var x = ''; var x = '';
x += '<div><label><input id=p2notifyPlayNotifySound type=checkbox />' + "Notification sound." + '</label></div>'; x += '<div><label><input id=p2notifyPlayNotifySound type=checkbox />' + "Notification sound." + '</label></div>';
x += '<div><label><input id=p2notifyGroupName type=checkbox />' + "Display Group Name" + '</label></div>';
x += '<div><label><input id=p2notifyIntelDeviceConnect type=checkbox />' + "Device connections." + '</label></div>'; x += '<div><label><input id=p2notifyIntelDeviceConnect type=checkbox />' + "Device connections." + '</label></div>';
x += '<div><label><input id=p2notifyIntelDeviceDisconnect type=checkbox />' + "Device disconnections." + '</label></div>'; x += '<div><label><input id=p2notifyIntelDeviceDisconnect type=checkbox />' + "Device disconnections." + '</label></div>';
x += '<div><label><input id=p2notifyIntelAmtKvmActions type=checkbox />' + "Intel&reg; AMT desktop and serial events." + '</label></div>'; x += '<div><label><input id=p2notifyIntelAmtKvmActions type=checkbox />' + "Intel&reg; AMT desktop and serial events." + '</label></div>';
@ -7039,6 +7061,7 @@
Q('p2notifyIntelDeviceConnect').checked = (n & 2); Q('p2notifyIntelDeviceConnect').checked = (n & 2);
Q('p2notifyIntelDeviceDisconnect').checked = (n & 4); Q('p2notifyIntelDeviceDisconnect').checked = (n & 4);
Q('p2notifyIntelAmtKvmActions').checked = (n & 8); Q('p2notifyIntelAmtKvmActions').checked = (n & 8);
Q('p2notifyGroupName').checked = (n & 16);
return false; return false;
} }
@ -7048,6 +7071,7 @@
n += Q('p2notifyIntelDeviceConnect').checked ? 2 : 0; n += Q('p2notifyIntelDeviceConnect').checked ? 2 : 0;
n += Q('p2notifyIntelDeviceDisconnect').checked ? 4 : 0; n += Q('p2notifyIntelDeviceDisconnect').checked ? 4 : 0;
n += Q('p2notifyIntelAmtKvmActions').checked ? 8 : 0; n += Q('p2notifyIntelAmtKvmActions').checked ? 8 : 0;
n += Q('p2notifyGroupName').checked ? 16 : 0;
putstore('notifications', n); putstore('notifications', n);
} }
@ -9013,19 +9037,20 @@
// Refresh the notification box // Refresh the notification box
function drawNotifications() { function drawNotifications() {
var notifySettings = getstore('notifications', 0);
var r = ''; var r = '';
if (notifications.length == 0) { if (notifications.length == 0) {
r = '<div style=margin:5px>' + "Il n'y a actuellement aucune notification" + '</div>'; r = '<div style=margin:5px>' + "Il n'y a actuellement aucune notification" + '</div>';
} else { } else {
for (var i in notifications) { for (var i in notifications) {
var n = notifications[i]; var n = notifications[i], t = '', d = new Date(n.time), icon = 0;
var t = '';
if (n.title != null) { t = '<b>' + n.title + '</b>: ' } if (n.title != null) { t = '<b>' + n.title + '</b>: ' }
var d = new Date(n.time);
var icon = 0;
if (n.nodeid != null) { if (n.nodeid != null) {
var node = getNodeFromId(n.nodeid); var node = getNodeFromId(n.nodeid);
if (node != null) { icon = node.icon; t = '<b>' + node.name + '</b>: ' } if (node != null) {
icon = node.icon;
if (notifySettings & 16) { t = '<b>' + meshes[node.meshid].name + ' / ' + node.name + '</b>: '; } else { t = '<b>' + node.name + '</b>: '; } // Display with or without group name
}
} }
r += '<div title="' + format("Survenu à {0}", printDateTime(d)) + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">'; r += '<div title="' + format("Survenu à {0}", printDateTime(d)) + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">';
@ -9104,7 +9129,13 @@
var text = n.text.split('&reg;').join('').split('<b>').join('').split('</b>').join('').split('<br />').join('\r\n'); // Clean up any HTML codes var text = n.text.split('&reg;').join('').split('<b>').join('').split('</b>').join('').split('<br />').join('\r\n'); // Clean up any HTML codes
if (n.nodeid) { if (n.nodeid) {
var node = getNodeFromId(n.nodeid); var node = getNodeFromId(n.nodeid);
if (node) { notification = new Notification('{{{title}}} - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' }); } if (node) {
if (notifySettings & 16) { // Notify with group name
notification = new Notification('{{{title}}} - ' + meshes[node.meshid].name + ' - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' });
} else {
notification = new Notification('{{{title}}} - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' });
}
}
} else { } else {
if (n.icon == null) { n.icon = 0; } if (n.icon == null) { n.icon = 0; }
var title = n.title; var title = n.title;

View File

@ -474,7 +474,7 @@
<div> <div>
<div id="idx_deskFullBtn2" onclick="deskToggleFull(event)">&nbsp;✖</div> <div id="idx_deskFullBtn2" onclick="deskToggleFull(event)">&nbsp;✖</div>
<input type="button" id="autoconnectbutton1" value="自動接続" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <input type="button" id="autoconnectbutton1" value="自動接続" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none">
<span id="connectbutton1span"><input type="button" id="connectbutton1" value="つなぐ" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1span"><input type="button" id="connectbutton1" value="つなぐ" onclick="connectDesktop(event,3)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
<span id="connectbutton1hspan">&nbsp;<input type="button" id="connectbutton1h" value="HW Connect" title="Intel AMTハードウェアKVMを使用して接続する" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1hspan">&nbsp;<input type="button" id="connectbutton1h" value="HW Connect" title="Intel AMTハードウェアKVMを使用して接続する" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
<span id="disconnectbutton1span">&nbsp;<input type="button" id="disconnectbutton1" value="切断する" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span> <span id="disconnectbutton1span">&nbsp;<input type="button" id="disconnectbutton1" value="切断する" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span>
&nbsp;<span id="deskstatus">切断されました</span> &nbsp;<span id="deskstatus">切断されました</span>
@ -512,6 +512,7 @@
</div> </div>
</div> </div>
<div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p11clearConsoleMsg()"></div> <div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p11clearConsoleMsg()"></div>
<div id="p11DeskSessionSelector" style="display:none;position:absolute;left:30px;top:17px;right:30px"></div>
</div> </div>
<div id="deskarea4" class="areaFoot"> <div id="deskarea4" class="areaFoot">
<div class="toright2"> <div class="toright2">
@ -1234,7 +1235,6 @@
QV('p4UserBatchCreate', (features & 0x00080000) == 0); QV('p4UserBatchCreate', (features & 0x00080000) == 0);
// Set the file editor // Set the file editor
// TODO: Set user values
d4EditWrapVal = getstore('editorWrap', 0); d4EditWrapVal = getstore('editorWrap', 0);
d4EditSizeVal = getstore('editorSize', 0); d4EditSizeVal = getstore('editorSize', 0);
d4ToggleWrap(true); d4ToggleWrap(true);
@ -1705,6 +1705,22 @@
// Display success/fail on the clipboard dialog box. // Display success/fail on the clipboard dialog box.
QH('dlgClipStatus', message.success ? '<span style=color:green>' + "成功" + '</span>' : '<span style=color:red>' + "失敗しました" + '</span>') QH('dlgClipStatus', message.success ? '<span style=color:green>' + "成功" + '</span>' : '<span style=color:red>' + "失敗しました" + '</span>')
setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000); setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000);
} else if ((message.type == 'userSessions') && (currentNode != null) && (currentNode._id == message.nodeid) && (desktop == null)) {
// Got list of user sessions
var userSessions = [];
if (message.data != null) { for (var i in message.data) { if ((message.data[i].State == 'Active') || (debugmode == 3)) { userSessions.push(message.data[i]); } } }
if (userSessions.length == 0) { connectDesktop(null, 1); } // No active sessions, do a normal connection.
else if (userSessions.length == 1) { connectDesktop(null, 1, userSessions[0].SessionId); } // One active session, connect to it
else {
var x = '';
for (var i in userSessions) {
x += '<div style="text-align:left;cursor:pointer;background-color:gray;margin:5px;padding:5px;border-radius:5px" onclick=connectDesktop(event,1,' + userSessions[i].SessionId + ')>' + userSessions[i].State + ', ' + userSessions[i].StationName;
if (userSessions[i].Username) { if (userSessions[i].Domain) { x += ' - ' + userSessions[i].Domain + '/' + userSessions[i].Username; } else { x += ' - ' + userSessions[i].Username; } }
x += '</div>';
}
QH('p11DeskSessionSelector', x);
QV('p11DeskSessionSelector', true);
}
} }
} }
} else { } else {
@ -3633,7 +3649,7 @@
// If possible, connect... // If possible, connect...
var mesh = meshes[currentNode.meshid]; var mesh = meshes[currentNode.meshid];
if ((currentNode.conn & 1) && (mesh.mtype == 2)) { if ((currentNode.conn & 1) && (mesh.mtype == 2)) {
if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 1); } // Desktop if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 3); } // Desktop
if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal
if ((panel == 13) && (files == null)) { connectFiles(null); } // files if ((panel == 13) && (files == null)) { connectFiles(null); } // files
} }
@ -5144,9 +5160,10 @@
// Debug // Debug
var autoConnectDesktopTimer = null; var autoConnectDesktopTimer = null;
function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(connectDesktop, 100); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } } function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(function() { connectDesktop(null, 1) }, 1000); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } }
function connectDesktop(e, contype) { function connectDesktop(e, contype, tsid) {
QV('p11DeskSessionSelector', false);
p11clearConsoleMsg(); p11clearConsoleMsg();
if (desktop == null) { if (desktop == null) {
desktopNode = currentNode; desktopNode = currentNode;
@ -5234,12 +5251,13 @@
}; };
desktop.Start(desktopNode._id, 16994, '*', '*', 0); desktop.Start(desktopNode._id, 16994, '*', '*', 0);
desktop.contype = 2; desktop.contype = 2;
} else { } else if ((contype == null) || (contype == 1) || ((contype == 3) && (currentNode.agent.id > 4))) {
// Setup the Mesh Agent remote desktop // Setup the Mesh Agent remote desktop
desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl); desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
desktop.debugmode = debugmode; desktop.debugmode = debugmode;
desktop.m.debugmode = debugmode; desktop.m.debugmode = debugmode;
desktop.attemptWebRTC = attemptWebRTC; desktop.attemptWebRTC = attemptWebRTC;
desktop.options = { tsid: tsid };
desktop.onStateChanged = onDesktopStateChange; desktop.onStateChanged = onDesktopStateChange;
desktop.onConsoleMessageChange = function () { desktop.onConsoleMessageChange = function () {
p11clearConsoleMsg(); p11clearConsoleMsg();
@ -5256,6 +5274,9 @@
desktop.m.onScreenSizeChange = deskAdjust; desktop.m.onScreenSizeChange = deskAdjust;
desktop.Start(desktopNode._id); desktop.Start(desktopNode._id);
desktop.contype = 1; desktop.contype = 1;
} else if (contype == 3) {
// Ask for user sessions
meshserver.send({ action: 'msg', type: 'userSessions', nodeid: currentNode._id });
} }
} else { } else {
// Disconnect and clean up the remote desktop // Disconnect and clean up the remote desktop
@ -7030,6 +7051,7 @@
if (xxdialogMode) return false; if (xxdialogMode) return false;
var x = ''; var x = '';
x += '<div><label><input id=p2notifyPlayNotifySound type=checkbox />' + "通知音。" + '</label></div>'; x += '<div><label><input id=p2notifyPlayNotifySound type=checkbox />' + "通知音。" + '</label></div>';
x += '<div><label><input id=p2notifyGroupName type=checkbox />' + "Display Group Name" + '</label></div>';
x += '<div><label><input id=p2notifyIntelDeviceConnect type=checkbox />' + "デバイス接続。" + '</label></div>'; x += '<div><label><input id=p2notifyIntelDeviceConnect type=checkbox />' + "デバイス接続。" + '</label></div>';
x += '<div><label><input id=p2notifyIntelDeviceDisconnect type=checkbox />' + "デバイスの切断。" + '</label></div>'; x += '<div><label><input id=p2notifyIntelDeviceDisconnect type=checkbox />' + "デバイスの切断。" + '</label></div>';
x += '<div><label><input id=p2notifyIntelAmtKvmActions type=checkbox />' + "Intelreg; AMTデスクトップおよびシリアルイベント。" + '</label></div>'; x += '<div><label><input id=p2notifyIntelAmtKvmActions type=checkbox />' + "Intelreg; AMTデスクトップおよびシリアルイベント。" + '</label></div>';
@ -7039,6 +7061,7 @@
Q('p2notifyIntelDeviceConnect').checked = (n & 2); Q('p2notifyIntelDeviceConnect').checked = (n & 2);
Q('p2notifyIntelDeviceDisconnect').checked = (n & 4); Q('p2notifyIntelDeviceDisconnect').checked = (n & 4);
Q('p2notifyIntelAmtKvmActions').checked = (n & 8); Q('p2notifyIntelAmtKvmActions').checked = (n & 8);
Q('p2notifyGroupName').checked = (n & 16);
return false; return false;
} }
@ -7048,6 +7071,7 @@
n += Q('p2notifyIntelDeviceConnect').checked ? 2 : 0; n += Q('p2notifyIntelDeviceConnect').checked ? 2 : 0;
n += Q('p2notifyIntelDeviceDisconnect').checked ? 4 : 0; n += Q('p2notifyIntelDeviceDisconnect').checked ? 4 : 0;
n += Q('p2notifyIntelAmtKvmActions').checked ? 8 : 0; n += Q('p2notifyIntelAmtKvmActions').checked ? 8 : 0;
n += Q('p2notifyGroupName').checked ? 16 : 0;
putstore('notifications', n); putstore('notifications', n);
} }
@ -9013,19 +9037,20 @@
// Refresh the notification box // Refresh the notification box
function drawNotifications() { function drawNotifications() {
var notifySettings = getstore('notifications', 0);
var r = ''; var r = '';
if (notifications.length == 0) { if (notifications.length == 0) {
r = '<div style=margin:5px>' + "現在、通知はありません" + '</div>'; r = '<div style=margin:5px>' + "現在、通知はありません" + '</div>';
} else { } else {
for (var i in notifications) { for (var i in notifications) {
var n = notifications[i]; var n = notifications[i], t = '', d = new Date(n.time), icon = 0;
var t = '';
if (n.title != null) { t = '<b>' + n.title + '</b>: ' } if (n.title != null) { t = '<b>' + n.title + '</b>: ' }
var d = new Date(n.time);
var icon = 0;
if (n.nodeid != null) { if (n.nodeid != null) {
var node = getNodeFromId(n.nodeid); var node = getNodeFromId(n.nodeid);
if (node != null) { icon = node.icon; t = '<b>' + node.name + '</b>: ' } if (node != null) {
icon = node.icon;
if (notifySettings & 16) { t = '<b>' + meshes[node.meshid].name + ' / ' + node.name + '</b>: '; } else { t = '<b>' + node.name + '</b>: '; } // Display with or without group name
}
} }
r += '<div title="' + format("{0}で発生しました", printDateTime(d)) + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">'; r += '<div title="' + format("{0}で発生しました", printDateTime(d)) + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">';
@ -9104,7 +9129,13 @@
var text = n.text.split('&reg;').join('').split('<b>').join('').split('</b>').join('').split('<br />').join('\r\n'); // Clean up any HTML codes var text = n.text.split('&reg;').join('').split('<b>').join('').split('</b>').join('').split('<br />').join('\r\n'); // Clean up any HTML codes
if (n.nodeid) { if (n.nodeid) {
var node = getNodeFromId(n.nodeid); var node = getNodeFromId(n.nodeid);
if (node) { notification = new Notification('{{{title}}} - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' }); } if (node) {
if (notifySettings & 16) { // Notify with group name
notification = new Notification('{{{title}}} - ' + meshes[node.meshid].name + ' - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' });
} else {
notification = new Notification('{{{title}}} - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' });
}
}
} else { } else {
if (n.icon == null) { n.icon = 0; } if (n.icon == null) { n.icon = 0; }
var title = n.title; var title = n.title;

View File

@ -474,7 +474,7 @@
<div> <div>
<div id="idx_deskFullBtn2" onclick="deskToggleFull(event)">&nbsp;✖</div> <div id="idx_deskFullBtn2" onclick="deskToggleFull(event)">&nbsp;✖</div>
<input type="button" id="autoconnectbutton1" value="Conexão automática" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <input type="button" id="autoconnectbutton1" value="Conexão automática" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none">
<span id="connectbutton1span"><input type="button" id="connectbutton1" value="Conectar" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1span"><input type="button" id="connectbutton1" value="Conectar" onclick="connectDesktop(event,3)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
<span id="connectbutton1hspan">&nbsp;<input type="button" id="connectbutton1h" value="Conectar HW" title="Connect using Intel AMT hardware KVM" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1hspan">&nbsp;<input type="button" id="connectbutton1h" value="Conectar HW" title="Connect using Intel AMT hardware KVM" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
<span id="disconnectbutton1span">&nbsp;<input type="button" id="disconnectbutton1" value="Desconectar" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span> <span id="disconnectbutton1span">&nbsp;<input type="button" id="disconnectbutton1" value="Desconectar" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span>
&nbsp;<span id="deskstatus">Desconectado</span> &nbsp;<span id="deskstatus">Desconectado</span>
@ -512,6 +512,7 @@
</div> </div>
</div> </div>
<div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p11clearConsoleMsg()"></div> <div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p11clearConsoleMsg()"></div>
<div id="p11DeskSessionSelector" style="display:none;position:absolute;left:30px;top:17px;right:30px"></div>
</div> </div>
<div id="deskarea4" class="areaFoot"> <div id="deskarea4" class="areaFoot">
<div class="toright2"> <div class="toright2">
@ -1234,7 +1235,6 @@
QV('p4UserBatchCreate', (features & 0x00080000) == 0); QV('p4UserBatchCreate', (features & 0x00080000) == 0);
// Set the file editor // Set the file editor
// TODO: Set user values
d4EditWrapVal = getstore('editorWrap', 0); d4EditWrapVal = getstore('editorWrap', 0);
d4EditSizeVal = getstore('editorSize', 0); d4EditSizeVal = getstore('editorSize', 0);
d4ToggleWrap(true); d4ToggleWrap(true);
@ -1705,6 +1705,22 @@
// Display success/fail on the clipboard dialog box. // Display success/fail on the clipboard dialog box.
QH('dlgClipStatus', message.success ? '<span style=color:green>' + "Sucesso" + '</span>' : '<span style=color:red>' + "Falhou" + '</span>') QH('dlgClipStatus', message.success ? '<span style=color:green>' + "Sucesso" + '</span>' : '<span style=color:red>' + "Falhou" + '</span>')
setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000); setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000);
} else if ((message.type == 'userSessions') && (currentNode != null) && (currentNode._id == message.nodeid) && (desktop == null)) {
// Got list of user sessions
var userSessions = [];
if (message.data != null) { for (var i in message.data) { if ((message.data[i].State == 'Active') || (debugmode == 3)) { userSessions.push(message.data[i]); } } }
if (userSessions.length == 0) { connectDesktop(null, 1); } // No active sessions, do a normal connection.
else if (userSessions.length == 1) { connectDesktop(null, 1, userSessions[0].SessionId); } // One active session, connect to it
else {
var x = '';
for (var i in userSessions) {
x += '<div style="text-align:left;cursor:pointer;background-color:gray;margin:5px;padding:5px;border-radius:5px" onclick=connectDesktop(event,1,' + userSessions[i].SessionId + ')>' + userSessions[i].State + ', ' + userSessions[i].StationName;
if (userSessions[i].Username) { if (userSessions[i].Domain) { x += ' - ' + userSessions[i].Domain + '/' + userSessions[i].Username; } else { x += ' - ' + userSessions[i].Username; } }
x += '</div>';
}
QH('p11DeskSessionSelector', x);
QV('p11DeskSessionSelector', true);
}
} }
} }
} else { } else {
@ -3633,7 +3649,7 @@
// If possible, connect... // If possible, connect...
var mesh = meshes[currentNode.meshid]; var mesh = meshes[currentNode.meshid];
if ((currentNode.conn & 1) && (mesh.mtype == 2)) { if ((currentNode.conn & 1) && (mesh.mtype == 2)) {
if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 1); } // Desktop if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 3); } // Desktop
if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal
if ((panel == 13) && (files == null)) { connectFiles(null); } // files if ((panel == 13) && (files == null)) { connectFiles(null); } // files
} }
@ -5144,9 +5160,10 @@
// Debug // Debug
var autoConnectDesktopTimer = null; var autoConnectDesktopTimer = null;
function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(connectDesktop, 100); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } } function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(function() { connectDesktop(null, 1) }, 1000); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } }
function connectDesktop(e, contype) { function connectDesktop(e, contype, tsid) {
QV('p11DeskSessionSelector', false);
p11clearConsoleMsg(); p11clearConsoleMsg();
if (desktop == null) { if (desktop == null) {
desktopNode = currentNode; desktopNode = currentNode;
@ -5234,12 +5251,13 @@
}; };
desktop.Start(desktopNode._id, 16994, '*', '*', 0); desktop.Start(desktopNode._id, 16994, '*', '*', 0);
desktop.contype = 2; desktop.contype = 2;
} else { } else if ((contype == null) || (contype == 1) || ((contype == 3) && (currentNode.agent.id > 4))) {
// Setup the Mesh Agent remote desktop // Setup the Mesh Agent remote desktop
desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl); desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
desktop.debugmode = debugmode; desktop.debugmode = debugmode;
desktop.m.debugmode = debugmode; desktop.m.debugmode = debugmode;
desktop.attemptWebRTC = attemptWebRTC; desktop.attemptWebRTC = attemptWebRTC;
desktop.options = { tsid: tsid };
desktop.onStateChanged = onDesktopStateChange; desktop.onStateChanged = onDesktopStateChange;
desktop.onConsoleMessageChange = function () { desktop.onConsoleMessageChange = function () {
p11clearConsoleMsg(); p11clearConsoleMsg();
@ -5256,6 +5274,9 @@
desktop.m.onScreenSizeChange = deskAdjust; desktop.m.onScreenSizeChange = deskAdjust;
desktop.Start(desktopNode._id); desktop.Start(desktopNode._id);
desktop.contype = 1; desktop.contype = 1;
} else if (contype == 3) {
// Ask for user sessions
meshserver.send({ action: 'msg', type: 'userSessions', nodeid: currentNode._id });
} }
} else { } else {
// Disconnect and clean up the remote desktop // Disconnect and clean up the remote desktop
@ -7030,6 +7051,7 @@
if (xxdialogMode) return false; if (xxdialogMode) return false;
var x = ''; var x = '';
x += '<div><label><input id=p2notifyPlayNotifySound type=checkbox />' + "Som de notificação." + '</label></div>'; x += '<div><label><input id=p2notifyPlayNotifySound type=checkbox />' + "Som de notificação." + '</label></div>';
x += '<div><label><input id=p2notifyGroupName type=checkbox />' + "Display Group Name" + '</label></div>';
x += '<div><label><input id=p2notifyIntelDeviceConnect type=checkbox />' + "Conexões de dispositivos." + '</label></div>'; x += '<div><label><input id=p2notifyIntelDeviceConnect type=checkbox />' + "Conexões de dispositivos." + '</label></div>';
x += '<div><label><input id=p2notifyIntelDeviceDisconnect type=checkbox />' + "Desconexões de dispositivos." + '</label></div>'; x += '<div><label><input id=p2notifyIntelDeviceDisconnect type=checkbox />' + "Desconexões de dispositivos." + '</label></div>';
x += '<div><label><input id=p2notifyIntelAmtKvmActions type=checkbox />' + "Intel&reg; Área de trabalho AMT e eventos seriais." + '</label></div>'; x += '<div><label><input id=p2notifyIntelAmtKvmActions type=checkbox />' + "Intel&reg; Área de trabalho AMT e eventos seriais." + '</label></div>';
@ -7039,6 +7061,7 @@
Q('p2notifyIntelDeviceConnect').checked = (n & 2); Q('p2notifyIntelDeviceConnect').checked = (n & 2);
Q('p2notifyIntelDeviceDisconnect').checked = (n & 4); Q('p2notifyIntelDeviceDisconnect').checked = (n & 4);
Q('p2notifyIntelAmtKvmActions').checked = (n & 8); Q('p2notifyIntelAmtKvmActions').checked = (n & 8);
Q('p2notifyGroupName').checked = (n & 16);
return false; return false;
} }
@ -7048,6 +7071,7 @@
n += Q('p2notifyIntelDeviceConnect').checked ? 2 : 0; n += Q('p2notifyIntelDeviceConnect').checked ? 2 : 0;
n += Q('p2notifyIntelDeviceDisconnect').checked ? 4 : 0; n += Q('p2notifyIntelDeviceDisconnect').checked ? 4 : 0;
n += Q('p2notifyIntelAmtKvmActions').checked ? 8 : 0; n += Q('p2notifyIntelAmtKvmActions').checked ? 8 : 0;
n += Q('p2notifyGroupName').checked ? 16 : 0;
putstore('notifications', n); putstore('notifications', n);
} }
@ -9013,19 +9037,20 @@
// Refresh the notification box // Refresh the notification box
function drawNotifications() { function drawNotifications() {
var notifySettings = getstore('notifications', 0);
var r = ''; var r = '';
if (notifications.length == 0) { if (notifications.length == 0) {
r = '<div style=margin:5px>' + "Atualmente não há notificações" + '</div>'; r = '<div style=margin:5px>' + "Atualmente não há notificações" + '</div>';
} else { } else {
for (var i in notifications) { for (var i in notifications) {
var n = notifications[i]; var n = notifications[i], t = '', d = new Date(n.time), icon = 0;
var t = '';
if (n.title != null) { t = '<b>' + n.title + '</b>: ' } if (n.title != null) { t = '<b>' + n.title + '</b>: ' }
var d = new Date(n.time);
var icon = 0;
if (n.nodeid != null) { if (n.nodeid != null) {
var node = getNodeFromId(n.nodeid); var node = getNodeFromId(n.nodeid);
if (node != null) { icon = node.icon; t = '<b>' + node.name + '</b>: ' } if (node != null) {
icon = node.icon;
if (notifySettings & 16) { t = '<b>' + meshes[node.meshid].name + ' / ' + node.name + '</b>: '; } else { t = '<b>' + node.name + '</b>: '; } // Display with or without group name
}
} }
r += '<div title="' + format("Ocorreu em {0}", printDateTime(d)) + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">'; r += '<div title="' + format("Ocorreu em {0}", printDateTime(d)) + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">';
@ -9104,7 +9129,13 @@
var text = n.text.split('&reg;').join('').split('<b>').join('').split('</b>').join('').split('<br />').join('\r\n'); // Clean up any HTML codes var text = n.text.split('&reg;').join('').split('<b>').join('').split('</b>').join('').split('<br />').join('\r\n'); // Clean up any HTML codes
if (n.nodeid) { if (n.nodeid) {
var node = getNodeFromId(n.nodeid); var node = getNodeFromId(n.nodeid);
if (node) { notification = new Notification('{{{title}}} - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' }); } if (node) {
if (notifySettings & 16) { // Notify with group name
notification = new Notification('{{{title}}} - ' + meshes[node.meshid].name + ' - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' });
} else {
notification = new Notification('{{{title}}} - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' });
}
}
} else { } else {
if (n.icon == null) { n.icon = 0; } if (n.icon == null) { n.icon = 0; }
var title = n.title; var title = n.title;