improved RDP to desktop tab integration.

Ylian Saint-Hilaire committed May 4, 2022 at 01:55 UTC 4a9331cd1b1ddbfca12c05de5ebd529ba8052cbe
4 files changed +117 -19
MeshCentralServer.njsproj
+1
@@ -180,6 +180,7 @@
180 <Compile Include="public\novnc\vendor\pako\lib\zlib\trees.js" />
181 <Compile Include="public\novnc\vendor\pako\lib\zlib\zstream.js" />
182 <Compile Include="public\novnc\vendor\promise.js" />
183 + <Compile Include="public\scripts\agent-rdp-0.0.1.js" />
184 <Compile Include="public\scripts\agent-redir-rtc-0.1.0.js" />
185 <Compile Include="public\serviceworker.js" />
186 <Compile Include="rdp\asn1\ber.js" />
public/styles/style.css
+38 -6
@@ -608,7 +608,7 @@ body {
608 }
609
610
611 -#d7bitmapquality, #d7bitmapquality, #d7bitmapscaling, #d7framelimiter, #d7desktopmode {
611 +#d7bitmapquality, #d7bitmapquality, #d7bitmapscaling, #d7framelimiter, #d7desktopmode, #d7rdpsize {
612 float: right;
613 width: 200px;
614 height: 20px;
@@ -619,16 +619,16 @@ body {
619 border-bottom: 1px solid gray;
620 }
621
622 -#d7meshkvm div, #d7amtkvm div, #d3upload, #d3localmode {
622 +#d7meshkvm div, #d7amtkvm div, #d7rdpkvm div, #d3upload, #d3localmode {
623 margin: 3px 0 3px 0;
624 display: flex;
625 justify-content: space-between;
626 }
627
628 -#d7otherset {
628 +#d7otherset, #d7rdpflags {
629 border: 1px solid #666;
630 - width: 200px;
631 - height: 60px;
630 + width: 230px;
631 + height: 100px;
632 overflow-y: scroll;
633 background-color: white;
634 }
@@ -3234,4 +3234,36 @@ a {
3234 .night .desktopButtons {
3235 filter: invert(60%);
3236 -webkit-filter: invert(60%);
3237 - }
\ No newline at end of file
3237 + }
3238 +
3239 +
3240 +.dtab {
3241 + overflow: hidden;
3242 + border-bottom: 1px solid #ccc;
3243 + background-color: #f1f1f1;
3244 +}
3245 +
3246 +.dtab button {
3247 + background-color: inherit;
3248 + float: left;
3249 + border: none;
3250 + outline: none;
3251 + cursor: pointer;
3252 + padding: 4px 6px;
3253 + transition: 0.3s;
3254 +}
3255 +
3256 +.dtab button:hover {
3257 + background-color: #ddd;
3258 +}
3259 +
3260 +.dtab button.active {
3261 + background-color: #ccc;
3262 +}
3263 +
3264 +.dtabcontent {
3265 + display: none;
3266 + padding: 6px 12px;
3267 + border: 1px solid #ccc;
3268 + border-top: none;
3269 +}
\ No newline at end of file
views/agentinvite.handlebars
-1
@@ -43,7 +43,6 @@
43 border: 1px solid #ccc;
44 border-top: none;
45 }
46 -
46 </style>
47 </head>
48 <body id="body" onload="if (typeof(startup) !== 'undefined') startup();" style="display:none;overflow:hidden">
views/default.handlebars
+78 -12
@@ -703,7 +703,6 @@
703 <span id=DeskInputLockedButton title="Remote input is locked"><img class="desktopButtons" id=DeskInputLockedButtonImage src='images/icon-keylock-red.png' onclick=deskInputLockFunction(0) height=16 width=16 /></span>
704 <span id=DeskInputUnLockedButton title="Remote input is unlocked"><img class="desktopButtons" id=DeskInputUnLockedButtonImage src='images/icon-keylock.png' onclick=deskInputLockFunction(1) height=16 width=16 /></span>
705 <span id=DeskGuestShareButton title="Share the device with a guest"><img class="desktopButtons" id=DeskInputUnLockedButtonImage src='images/icon-share2.png' onclick=showShareDevice() height=16 width=16 /></span>
706 -
706 </div>
707 <div class="toright2"><span id=DeskMonitorSelectionSpan></span></div>
708 <div>
@@ -1278,9 +1277,14 @@
1277 <textarea id=d4editorarea autocomplete="off" style="height:calc(100vh - 286px);width:100%;overflow:scroll;resize:none;white-space:pre"></textarea>
1278 </div>
1279 <div id=dialog7 style="">
1281 - <div id="d7meshkvm">
1282 - <h4>Agent Remote Desktop</h4>
1283 - <div>
1280 + <div class="dtab">
1281 + <button id="td7meshkvm" class="tablinks" onclick="changeDesktopSettingsTab(event, 'd7meshkvm')">Agent</button>
1282 + <button id="td7rdpkvm" class="tablinks" onclick="changeDesktopSettingsTab(event, 'd7rdpkvm')">RDP</button>
1283 + <button id="td7amtkvm" class="tablinks" onclick="changeDesktopSettingsTab(event, 'd7amtkvm')">Intel&reg; AMT</button>
1284 + </div>
1285 + <div id="d7meshkvm" class="tabcontent">
1286 + <!--<h4>Agent Remote Desktop</h4>-->
1287 + <div style="margin-top:8px">
1288 <div>Quality</div>
1289 <select id="d7bitmapquality" dir="rtl"></select>
1290 </div>
@@ -1316,9 +1320,9 @@
1320 </div>
1321 </div>
1322 </div>
1319 - <div id="d7amtkvm">
1320 - <h4>Intel&reg; AMT Hardware KVM</h4>
1321 - <div>
1323 + <div id="d7amtkvm" class="tabcontent">
1324 + <!--<h4>Intel&reg; AMT Hardware KVM</h4>-->
1325 + <div style="margin-top:8px">
1326 <div>Image Encoding</div>
1327 <select id="d7desktopmode">
1328 <option value="1">RLE8, Fastest</option>
@@ -1336,6 +1340,37 @@
1340 </div>
1341 </div>
1342 </div>
1343 + <div id="d7rdpkvm" class="tabcontent">
1344 + <!--<h4>Remote Desktop Protocol</h4>-->
1345 + <div style="margin-top:8px">
1346 + <div>Display Size</div>
1347 + <select id="d7rdpsize">
1348 + <option value="1">Browser Size</option>
1349 + <option value="2">Screen Size</option>
1350 + <option value="3">Canvas Size</option>
1351 + <option value="4">640x480</option>
1352 + <option value="5">1024×768</option>
1353 + <option value="6">1280×800</option>
1354 + <option value="7">1440×900</option>
1355 + <option value="8">1600×900</option>
1356 + <option value="9">1680×1050</option>
1357 + <option value="10">1920×1080</option>
1358 + </select>
1359 + </div>
1360 + <div>
1361 + <div>Optimizations</div>
1362 + <div id="d7rdpflags" style="display:block">
1363 + <label style="display:block"><input type="checkbox" id="d7rdp1" />Disable Wallpaper</label>
1364 + <label style="display:block"><input type="checkbox" id="d7rdp2" />Disable Full Window Drag</label>
1365 + <label style="display:block"><input type="checkbox" id="d7rdp3" />Disable Menu Animations</label>
1366 + <label style="display:block"><input type="checkbox" id="d7rdp4" />Disable Theming</label>
1367 + <label style="display:block"><input type="checkbox" id="d7rdp6" />Disable Cursor Chadow</label>
1368 + <label style="display:block"><input type="checkbox" id="d7rdp7" />Disable Cursor Settings</label>
1369 + <label style="display:block"><input type="checkbox" id="d7rdp8" />Enable Font Smooting</label>
1370 + <label style="display:block"><input type="checkbox" id="d7rdp9" />Enable Desktop Composision</label>
1371 + </div>
1372 + </div>
1373 + </div>
1374 </div>
1375 </div>
1376 <div id="idx_dlgButtonBar">
@@ -4726,8 +4761,9 @@
4761 function onDeviceSearchChanged(e) { if (e != null) { if (e.target.id == 'SearchInput') { Q('KvmSearchInput').value = Q('SearchInput').value; } else { Q('SearchInput').value = Q('KvmSearchInput').value; } } mainUpdate(5); }
4762
4763 function showMultiDesktopSettings() {
4729 - QV('d7amtkvm', false);
4730 - QV('d7meshkvm', true);
4764 + QV('td7amtkvm', false);
4765 + QV('td7meshkvm', true);
4766 + QV('td7rdpkvm', false);
4767 QV('d7desktopOtherSettings', false);
4768 d7bitmapquality.value = multidesktopsettings.quality;
4769 d7bitmapscaling.value = multidesktopsettings.scaling;
@@ -5928,7 +5964,6 @@
5964 if (action == 1) { connectDesktop(null, 3, null, 0x0008 + 0x0040); } // Consent Prompt + Privacy bar
5965 if (action == 2) { connectDesktop(null, 3, null, 0x0008); } // Consent Prompt
5966 if (action == 3) { connectDesktop(null, 3, null, 0x0040); } // Privacy bar
5931 - if (action == 4) { askRdpCredentials(); } // RDP
5967 if (action == 10) { if (desktop != null) { desktop.sendCtrlMsg('{"ctrlChannel":"102938","type":"autolock","value":true}'); connectDesktop(); } } // Disconnect and lock
5968 if (action == 11) { if (desktop != null) { desktop.sendCtrlMsg('{"ctrlChannel":"102938","type":"autolock","value":false}'); connectDesktop(); } } // Disconnect without lock
5969 }
@@ -8277,8 +8312,9 @@
8312 );
8313 }
8314 // Show the right settings
8280 - QV('d7amtkvm', (currentNode.intelamt != null && ((currentNode.intelamt.ver != null) || (currentNode.agent == null))) && ((deskState == 0) || (desktop.contype == 2)));
8281 - QV('d7meshkvm', (webRtcDesktop) || ((currentNode.agent != null) && (currentNode.agent.caps & 1) && ((deskState == false) || (desktop.contype == 1))));
8315 + QV('td7amtkvm', (currentNode.intelamt != null && ((currentNode.intelamt.ver != null) || (currentNode.agent == null))) && ((deskState == 0) || (desktop.contype == 2)));
8316 + QV('td7meshkvm', (webRtcDesktop) || ((currentNode.agent != null) && (currentNode.agent.caps & 1) && ((deskState == 0) || (desktop.contype == 1))));
8317 + QV('td7rdpkvm', ((currentNode.agent != null) && ((currentNode.agent.id == 3) || (currentNode.agent.id == 4)) && ((deskState == 0) || (desktop.contype == 4))));
8318
8319 // Enable buttons
8320 var inputAllowed = ((features2 & 0x2000) == 0) && ((currentNode.agent == null) || (currentNode.agent.id != 14)) && ((rights == 0xFFFFFFFF) || (((rights & 8) != 0) && ((rights & 256) == 0) && ((rights & 4096) == 0)));
@@ -8694,9 +8730,31 @@
8730 if (xxdialogMode) return;
8731 applyDesktopSettings();
8732 updateDesktopButtons();
8733 +
8734 + if (QS('td7meshkvm').display != 'none') { changeDesktopSettingsTab(null, 'd7meshkvm'); }
8735 + else if (QS('td7rdpkvm').display != 'none') { changeDesktopSettingsTab(null, 'd7rdpkvm'); }
8736 + else if (QS('td7amtkvm').display != 'none') { changeDesktopSettingsTab(null, 'd7amtkvm'); }
8737 +
8738 setDialogMode(7, "Remote Desktop Settings", 3, showDesktopSettingsChanged);
8739 }
8740
8741 + function changeDesktopSettingsTab(evt, tabname) {
8742 + // Declare all variables
8743 + var i, tabcontent, tablinks;
8744 +
8745 + // Get all elements with class="tabcontent" and hide them
8746 + tabcontent = document.getElementsByClassName('tabcontent');
8747 + for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = 'none'; }
8748 +
8749 + // Get all elements with class="tablinks" and remove the class "active"
8750 + tablinks = document.getElementsByClassName('tablinks');
8751 + for (i = 0; i < tablinks.length; i++) { tablinks[i].className = tablinks[i].className.replace(' active', ''); }
8752 +
8753 + // Show the current tab, and add an "active" class to the button that opened the tab
8754 + document.getElementById(tabname).style.display = 'block';
8755 + if (evt != null) { evt.currentTarget.className += ' active'; } else { document.getElementById('t' + tabname).className += ' active'; }
8756 + }
8757 +
8758 function showDesktopSettingsChanged() {
8759 desktopsettings.encoding = d7desktopmode.value;
8760 desktopsettings.showfocus = d7showfocus.checked;
@@ -8709,6 +8767,11 @@
8767 desktopsettings.autoclipboard = d7deskAutoClipboard.checked;
8768 desktopsettings.autolock = d7deskAutoLock.checked;
8769 desktopsettings.localkeymap = d7localKeyMap.checked;
8770 + desktopsettings.rdpsize = parseInt(d7rdpsize.value);
8771 + desktopsettings.rdpflags = d7rdpsize.value;
8772 + var rdpflags = 0;
8773 + for (var i = 1; i < 10; i++) { if ((i != 5) && (Q('d7rdp' + i).checked)) { rdpflags |= (1 << (i - 1)); } }
8774 + desktopsettings.rdpflags = rdpflags;
8775 localStorage.setItem('desktopsettings', JSON.stringify(desktopsettings));
8776 applyDesktopSettings();
8777 updateDesktopButtons();
@@ -8745,6 +8808,9 @@
8808 if (desktopsettings.autolock != null) { d7deskAutoLock.checked = desktopsettings.autolock; }
8809 if (desktopsettings.localkeymap) { d7localKeyMap.checked = desktopsettings.localkeymap; }
8810 QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (desktop.state != 0) && (desktopsettings.showfocus));
8811 + if (desktopsettings.rdpsize != null) { d7rdpsize.value = desktopsettings.rdpsize; }
8812 + if (desktopsettings.rdpflags == null) { desktopsettings.rdpflags = 0x2F; }
8813 + for (var i = 1; i < 10; i++) { if (i != 5) { Q('d7rdp' + i).checked = ((desktopsettings.rdpflags & (1 << (i - 1))) != 0); } }
8814 }
8815
8816 // Enter browser fullscreen