More work on desktop sharing.
Ylian Saint-Hilaire committed
Aug 7, 2020 at 11:08 UTC
51f2c9b0a757083f2738dde9646a55515eff58c6
2 files changed
+16
-19
views/desktop.handlebars
+15
-18
@@ -19,6 +19,7 @@
19
<script type="text/javascript" src="scripts/zlib-inflate{{min}}.js"></script>
20
<script type="text/javascript" src="scripts/zlib-adler32{{min}}.js"></script>
21
<script type="text/javascript" src="scripts/zlib-crc32{{min}}.js"></script>
22
+ <script keeplink=1 type="text/javascript" src="scripts/filesaver.min.js"></script>
23
<title>{{{title}}}</title>
24
</head>
25
<body style="overflow:hidden;background-color:black">
@@ -52,7 +53,7 @@
53
<div id=deskarea4 class="areaFoot">
54
<div class="toright2">
55
<span id="DeskLatency" title="Desktop Session Latency"></span>
55
- <span id="DeskTimer" title="Session time"></span>
56
+ <span id="DeskTimer" style="display:none" title="Session time"></span>
57
<select id=termdisplays style="display:none" onchange=deskSetDisplay(event) onkeypress="return false" onkeydown="return false"></select>
58
<span id=DeskSaveImageButton title="Save a screenshot of the remote desktop"><img src='images/icon-camera.png' onclick=deskSaveImage() height=16 width=16 style=padding-top:2px /></span>
59
</div>
@@ -163,10 +164,11 @@
164
var domainUrl = '{{{domainurl}}}';
165
var authCookie = '{{{authCookie}}}';
166
var authRelayCookie = '{{{authRelayCookie}}}';
166
- var desktopNodeId = '{nodeid}';
167
+ var desktopNodeId = '{{{nodeid}}}';
168
var urlargs = parseUriArgs();
169
var debugmode = urlargs.debug;
170
var attemptWebRTC = false;
171
+ var updateSessionTimer = null;
172
var StatusStrs = ["Disconnected", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"];
173
174
function start() {
@@ -265,7 +267,8 @@
267
var inputAllowed = true; // TODO
268
QE('connectbutton1', agentPresent);
269
QE('connectbutton1h', intelAmtPresent);
268
- QV('DeskClip', agentPresent && ((desktop == null) || (desktop.contype != 2))); // Clipboard not supported on macOS
270
+ //QV('DeskClip', agentPresent && ((desktop == null) || (desktop.contype != 2))); // Clipboard not supported on macOS
271
+ QV('DeskClip', false); // Clipboard not supported on this page
272
QE('DeskClip', deskState == 3);
273
QE('DeskType', deskState == 3);
274
QV('DeskWD', inputAllowed);
@@ -423,7 +426,7 @@
426
desktop.Stop();
427
webRtcDesktopReset();
428
desktop = null;
426
- if (pluginHandler != null) { pluginHandler.callHook('onDesktopDisconnect'); }
429
+ //if (pluginHandler != null) { pluginHandler.callHook('onDesktopDisconnect'); }
430
}
431
}
432
@@ -533,17 +536,7 @@
536
QH('DeskTimer', '');
537
}
538
536
- // Terminal
537
- seconds = 0;
538
- if (terminal && terminal.startTime) {
539
- if (terminal.latency && (terminal.latency.current >= 0)) { latencyStr = format('{0} ms, ', terminal.latency.current); }
540
- seconds = Math.floor((new Date() - terminal.startTime) / 1000);
541
- QH('TermTimer', latencyStr + zeroPad(Math.floor(seconds / 3600), 2) + ':' + zeroPad((Math.floor(seconds / 60) % 60), 2) + ':' + zeroPad((seconds % 60), 2));
542
- } else {
543
- QH('TermTimer', '');
544
- }
545
-
546
- if ((desktop == null) && (terminal == null)) { clearInterval(updateSessionTimer); updateSessionTimer = null; }
539
+ if (desktop == null) { clearInterval(updateSessionTimer); updateSessionTimer = null; }
540
}
541
542
function showDesktopSettings() {
@@ -857,6 +850,7 @@
850
}
851
}
852
853
+ /*
854
// Show clipboard dialog
855
function showDeskClip() {
856
if (xxdialogMode || desktop == null || desktop.State != 3) return;
@@ -879,8 +873,9 @@
873
function showDeskClipSet() {
874
if (desktop == null || desktop.State != 3) return;
875
meshserver.send({ action: 'msg', type: 'setclip', nodeid: currentNode._id, data: Q('d2clipText').value });
882
- QV('linuxClipWarn', currentNode && currentNode.agent && (currentNode.agent.id > 4) && (currentNode.agent.id != 21) && (currentNode.agent.id != 22));
876
+ //QV('linuxClipWarn', currentNode && currentNode.agent && (currentNode.agent.id > 4) && (currentNode.agent.id != 21) && (currentNode.agent.id != 22));
877
}
878
+ */
879
880
// Send CTRL-ALT-DEL
881
function sendCAD() {
@@ -888,6 +883,7 @@
883
desktop.m.sendcad();
884
}
885
886
+ /*
887
// Show process dialogs
888
function toggleDeskTools() {
889
if (xxdialogMode) return;
@@ -1015,6 +1011,7 @@
1011
setTimeout(function () { refreshDeskTools(1) }, 1000);
1012
}
1013
}
1014
+ */
1015
1016
// Toggle mouse and keyboard input
1017
function toggleKvmControl() { QS('DeskControlSpan').color = Q('DeskControl').checked ? null : 'red'; }
@@ -1022,7 +1019,7 @@
1019
// Save the desktop image to file
1020
function deskSaveImage() {
1021
if (xxdialogMode || desktop == null || desktop.State != 3) return;
1025
- var d = new Date(), n = "Desktop" + '-' + currentNode.name + '-' + d.getFullYear() + '-' + ('0' + (d.getMonth() + 1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + '-' + ('0' + d.getHours()).slice(-2) + '-' + ('0' + d.getMinutes()).slice(-2);
1022
+ var d = new Date(), n = "Desktop" + '-' + d.getFullYear() + '-' + ('0' + (d.getMonth() + 1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + '-' + ('0' + d.getHours()).slice(-2) + '-' + ('0' + d.getMinutes()).slice(-2);
1023
Q('Desk')['toBlob'](function (blob) { saveAs(blob, n + '.png'); });
1024
}
1025
@@ -1088,7 +1085,7 @@
1085
QV('idx_dlgDeleteButton', b & 4);
1086
QV('idx_dlgButtonBar', b & 7);
1087
if (y) QH('id_dialogtitle', y);
1091
- for (var i = 1; i < 3; i++) { QV('dialog' + i, i == x); } // Edit this line when more dialogs are added
1088
+ for (var i = 1; i < 8; i++) { QV('dialog' + i, i == x); } // Edit this line when more dialogs are added
1089
QV('dialog', x);
1090
if (c) { if (x == 2) { QH('id_dialogOptions', c); } else { QH('id_dialogMessage', c); } }
1091
}
webserver.js
+1
-1
@@ -2892,7 +2892,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
2892
var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
2893
parent.debug('web', 'handleDesktopRequest: sending guest desktop page');
2894
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0' });
2895
- render(req, res, getRenderPage('desktop', req, domain), getRenderArgs({ authCookie: authCookie, authRelayCookie: authRelayCookie, domainurl: encodeURIComponent(domain.url).replace(/'/g, '%27'), serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort }, req, domain));
2895
+ render(req, res, getRenderPage('desktop', req, domain), getRenderArgs({ authCookie: authCookie, authRelayCookie: authRelayCookie, domainurl: encodeURIComponent(domain.url).replace(/'/g, '%27'), nodeid: c.nid, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort }, req, domain));
2896
}
2897
2898
// Handle domain redirection