Started work on device session indication
Ylian Saint-Hilaire committed
May 11, 2020 at 16:30 UTC
6baf3285ccc2ed14f56d7fe39105840052db58df
19 files changed
+67
-6
agents/agents-new/MeshCmd-signed.exe
Binary files /dev/null and b/agents/agents-new/MeshCmd-signed.exe differ
agents/agents-new/MeshCmd64-signed.exe
Binary files /dev/null and b/agents/agents-new/MeshCmd64-signed.exe differ
agents/agents-new/MeshService-signed.exe
Binary files /dev/null and b/agents/agents-new/MeshService-signed.exe differ
agents/agents-new/MeshService.exe
Binary files /dev/null and b/agents/agents-new/MeshService.exe differ
agents/agents-new/MeshService64-signed.exe
Binary files /dev/null and b/agents/agents-new/MeshService64-signed.exe differ
agents/agents-new/MeshService64.exe
Binary files /dev/null and b/agents/agents-new/MeshService64.exe differ
agents/agents-old/MeshCmd-signed.exe
Binary files /dev/null and b/agents/agents-old/MeshCmd-signed.exe differ
agents/agents-old/MeshCmd64-signed.exe
Binary files /dev/null and b/agents/agents-old/MeshCmd64-signed.exe differ
agents/agents-old/MeshService-signed.exe
Binary files /dev/null and b/agents/agents-old/MeshService-signed.exe differ
agents/agents-old/MeshService.exe
Binary files /dev/null and b/agents/agents-old/MeshService.exe differ
agents/agents-old/MeshService64-signed.exe
Binary files /dev/null and b/agents/agents-old/MeshService64-signed.exe differ
agents/agents-old/MeshService64.exe
Binary files /dev/null and b/agents/agents-old/MeshService64.exe differ
meshdesktopmultiplex.js
+4
-1
@@ -304,11 +304,13 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
304
}
305
}
306
307
- // Send the list of all users currently vieweing this session to all viewers
307
+ // Send the list of all users currently vieweing this session to all viewers and servers
308
obj.sendSessionMetadata = function () {
309
var allUsers = {};
310
for (var i in obj.viewers) { var v = obj.viewers[i]; if ((v.user != null) && (v.user._id != null)) { if (allUsers[v.user._id] == null) { allUsers[v.user._id] = 1; } else { allUsers[v.user._id]++; } } }
311
obj.sendToAllViewers(JSON.stringify({ type: 'metadata', 'ctrlChannel': '102938', users: allUsers, startTime: obj.startTime }));
312
+
313
+ // TODO: Update the servers
314
}
315
316
// Send this command to all viewers
@@ -401,6 +403,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
403
if (peer == obj.agent) {
404
obj.recordingFileWriting = true;
405
recordData(true, data, function () {
406
+ if (obj.viewers == null) return;
407
obj.recordingFileWriting = false;
408
if ((obj.viewersOverflowCount < obj.viewers.length) && obj.agent && (obj.agent.paused == true)) { obj.agent.paused = false; obj.agent.ws._socket.resume(); }
409
obj.processAgentData(data);
public/images/icon-relay-notify.png
Binary files /dev/null and b/public/images/icon-relay-notify.png differ
public/images/icon-relay-notify10.png
Binary files /dev/null and b/public/images/icon-relay-notify10.png differ
public/images/icon-relay-notify12.png
Binary files /dev/null and b/public/images/icon-relay-notify12.png differ
public/styles/style.css
+38
@@ -746,6 +746,44 @@ NoMeshesPanel img {
746
width: 47px;
747
}
748
749
+.deviceNotifyDot {
750
+ text-align:center;
751
+ position:absolute;
752
+ right:10px;
753
+ top:0px;
754
+ width:16px;
755
+ height:16px;
756
+ color:#FFF;
757
+ background-color:#00F;
758
+ padding:2px;
759
+ border-radius:10px;
760
+ box-shadow: 2px 2px 10px black;
761
+ cursor:pointer;
762
+}
763
+
764
+ .deviceNotifyDot:hover {
765
+ background-color:#44F;
766
+ }
767
+
768
+.deviceNotifySmallDot {
769
+ text-align:center;
770
+ position:absolute;
771
+ right:10px;
772
+ top:0px;
773
+ width:10px;
774
+ height:10px;
775
+ color:#FFF;
776
+ padding:2px;
777
+ background-color:#00F;
778
+ border-radius:10px;
779
+ box-shadow: 2px 2px 10px black;
780
+ cursor:pointer;
781
+}
782
+
783
+ .deviceNotifySmallDot:hover {
784
+ background-color:#44F;
785
+ }
786
+
787
#xdevices {
788
max-height: calc(100vh - 242px);
789
overflow-y: auto;
translate/translate.json
+1
-1
@@ -30971,4 +30971,4 @@
30971
]
30972
}
30973
]
30974
-}
30974
+}
\ No newline at end of file
views/default.handlebars
+24
-4
@@ -3151,11 +3151,21 @@
3151
if (showRealNames == true && node.rname != null) name = EscapeHtml(node.rname);
3152
if (name.length == 0) { name = '<i>' + "None" + '</i>'; }
3153
3154
+ // Setup device notification (TODO)
3155
+ var devNotify = '';
3156
+ if (node.sessions != null) {
3157
+ if (view == 2) {
3158
+ devNotify = '<img onclick=showDeviceSessions(\'' + node._id + '\') class=deviceNotifySmallDot src=images/icon-relay-notify10.png width=10 height=10>';
3159
+ } else {
3160
+ devNotify = '<img onclick=showDeviceSessions(\'' + node._id + '\') class=deviceNotifyDot src=images/icon-relay-notify.png width=16 height=16>';
3161
+ }
3162
+ }
3163
+
3164
// Node
3165
var icon = node.icon;
3166
if ((!node.conn) || (node.conn == 0)) { icon += ' gray'; }
3167
if (view == 1) {
3158
- r += '<div id=devs cmenu=devsContentMenu onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=display:inline-block;width:' + deviceBoxWidth + 'px;height:50px;padding-top:1px;padding-bottom:1px><div style=width:22px;height:50%;float:left;padding-top:12px><input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox></div><div style=height:100%;cursor:pointer tabindex=0 onclick=gotoDevice(\'' + node._id + '\',null,null,event) onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',null,null,event)"><div class="i' + icon + '" style=width:50px;float:left></div><div style=height:100%><div class=g1></div><div class=e2><div class=e1 style=width:' + (deviceBoxWidth - 100) + 'px title="' + title + '">' + name + '</div><div>' + NodeStateStr(node) + '</div></div><div class=g2></div></div></div></div>';
3168
+ r += '<div id=devs cmenu=devsContentMenu onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=display:inline-block;position:relative;width:' + deviceBoxWidth + 'px;height:50px;padding-top:1px;padding-bottom:1px><div style=width:22px;height:50%;float:left;padding-top:12px><input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox></div><div style=height:100%;cursor:pointer tabindex=0 onclick=gotoDevice(\'' + node._id + '\',null,null,event) onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',null,null,event)"><div class="i' + icon + '" style=width:50px;float:left></div><div style=height:100%><div class=g1></div><div class=e2><div class=e1 style=width:' + (deviceBoxWidth - 100) + 'px title="' + title + '">' + name + '</div><div>' + NodeStateStr(node) + '</div></div><div class=g2></div></div></div>' + devNotify + '</div>';
3169
} else if (view == 2) {
3170
var states = [];
3171
if (node.conn) {
@@ -3170,11 +3180,11 @@
3180
if (sort == 1) { collapseName = ('pwr:' + (node.pwr?node.pwr:0)); }
3181
else if (sort == 3) { collapseName = 'tag:**xx**xx*TaG*xx**xx**'; }
3182
var collapsed = (sort != 3) & CollapsedGroups[collapseName];
3173
- r += '<tr name=DevxCol' + collapseName + (collapsed?' style=display:none':'') + '><td><div id=devs cmenu=devsContentMenu class=bar18 tabindex=0 onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=height:18px;width:100%;font-size:medium onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',null,null,event)">';
3183
+ r += '<tr name=DevxCol' + collapseName + (collapsed?' style=display:none':'') + '><td style=position:relative><div id=devs cmenu=devsContentMenu class=bar18 tabindex=0 onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=height:18px;width:100%;font-size:medium onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',null,null,event)">';
3184
r += '<div class=deviceBarCheckbox><input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox></div>';
3185
r += '<div class=deviceBarIcon onclick=gotoDevice(\'' + node._id + '\',null,null,event)><div class="j' + icon + '" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>';
3186
r += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>';
3177
- r += '<div class=style10 style=cursor:pointer;font-size:14px title="' + title + '" onclick=gotoDevice(\'' + node._id + '\',null,null,event)><span style=width:300px>' + name + '</span></div></div></td>';
3187
+ r += '<div class=style10 style=cursor:pointer;font-size:14px title="' + title + '" onclick=gotoDevice(\'' + node._id + '\',null,null,event)><span style=width:300px>' + name + '</span></div></div>' + devNotify + '</td>';
3188
r += '<td style=text-align:center>' + getUserShortStr(node);
3189
r += '<td style=text-align:center>' + (node.ip != null ? node.ip : '');
3190
r += '<td style=text-align:center>' + states.join(' + ');
@@ -3182,7 +3192,7 @@
3192
r += '</tr>';
3193
} else if ((view == 3) && (node.conn & 1) && (((meshrights & 8) || (meshrights & 256)) != 0) && ((node.agent.caps & 1) != 0)) { // Check if we have rights and agent is capable of KVM.
3194
if ((multiDesktopFilter) && ((multiDesktopFilter.length == 0) || (multiDesktopFilter.indexOf('devid_' + node._id) >= 0))) {
3185
- r += '<div id=devs cmenu=devsContentMenu style=display:inline-block;margin:1px;background-color:lightgray;border-radius:5px;position:relative><div tabindex=0 style=padding:3px;cursor:pointer onclick=gotoDevice(\'' + node._id + '\',11,null,event) onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',11,null,event)">';
3195
+ r += '<div id=devs cmenu=devsContentMenu style=display:inline-block;position:relative;margin:1px;background-color:lightgray;border-radius:5px;position:relative><div tabindex=0 style=padding:3px;cursor:pointer onclick=gotoDevice(\'' + node._id + '\',11,null,event) onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',11,null,event)">' + devNotify;
3196
//r += '<input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox style=float:left>';
3197
r += '<div class="j' + icon + '" style=width:16px;float:left></div> ' + name + '</div>';
3198
r += '<span onclick=gotoDevice(\'' + node._id + '\',null,null,event)></span><div id=xkvmid_' + node._id.split('/')[2] + '><div id=skvmid_' + node._id.split('/')[2] + ' tabindex=0 style="position:absolute;color:white;left:5px;top:27px;text-shadow:0px 0px 5px #000;z-index:1000;cursor:default" onclick=toggleKvmDevice(\'' + node._id + '\') onkeypress="if (event.key==\'Enter\') toggleKvmDevice(\'' + node._id + '\')">' + "Disconnected" + '</div></div>';
@@ -3393,6 +3403,16 @@
3403
oldviewmode = view;
3404
}
3405
3406
+ // Show currently active sessions on this device
3407
+ function showDeviceSessions(nodeid) {
3408
+ if (xxdialogMode) return;
3409
+ var node = getNodeFromId(nodeid), x = '';
3410
+ if (node == null) return;
3411
+ console.log(node.sessions);
3412
+ x += addHtmlValue4("User", '1 session'); // TODO
3413
+ setDialogMode(2, "Sessions - " + EscapeHtml(node.name), 1, null, x, 'SESSIONS-' + nodeid);
3414
+ }
3415
+
3416
function toggleCollapseGroup(id, id2, type) {
3417
var x;
3418
if (type == 2) {