1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

add encoding options to remote desktop (#6198)

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
Simon Smith 2024-06-23 21:00:30 +01:00 committed by GitHub
parent 28c522c5bb
commit 602eb3c64a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 73 additions and 19 deletions

View file

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
@ -1226,6 +1226,17 @@
</select>
</td>
</tr>
<tr>
<td>
Encoding
</td>
<td style="width:100px">
<select id="d7encoding" style="float:right;width:200px" dir="rtl">
<option value=1>JPEG</option>
<option selected=selected value=4>WEBP</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td>
@ -1344,7 +1355,13 @@
// Check if WebP is supported
var webpSupport = false;
check_webp_feature('lossy', function (f, x) { webpSupport = x; });
check_webp_feature('lossy', function (f, x) {
webpSupport = x;
if (!x) {
d7encoding.options[1].disabled = true;
d7encoding.value = 1;
}
});
function startup() {
if ((features & 32) == 0) {
@ -4424,7 +4441,7 @@
var desktop;
var desktopNode;
var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true, quality: 40, scaling: 1024, framerate: 50, autolock: false };
var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true, quality: 40, scaling: 1024, framerate: 50, autolock: false, agentencoding: 4 };
function setupDesktop() {
// Setup the remote desktop
if ((desktopNode != currentNode) && (desktop != null)) { desktop.Stop(); desktopNode = null; desktop = null; }
@ -4548,7 +4565,7 @@
p11clearConsoleMsg();
}
}
desktop.m.ImageType = webpSupport ? 4 : 1; // Send 4 if WebP is supported, otherwise send 1 for JPEG.
desktop.m.ImageType = desktopsettings.agentencoding; // Send 4 if WebP is supported, otherwise send 1 for JPEG.
desktop.m.CompressionLevel = desktopsettings.quality; // Number from 1 to 100. 50 or less is best.
desktop.m.ScalingLevel = desktopsettings.scaling;
desktop.m.FrameRateTimer = desktopsettings.framerate;
@ -4632,12 +4649,14 @@
desktopsettings.scaling = d7bitmapscaling.value;
desktopsettings.framerate = d7framelimiter.value;
desktopsettings.autolock = d7deskAutoLock.checked;
desktopsettings.agentencoding = d7encoding.value;
localStorage.setItem('desktopsettings', JSON.stringify(desktopsettings));
applyDesktopSettings();
if (desktop) {
if (desktop.contype == 1) {
if (desktop.State != 0) { desktop.m.SendCompressionLevel(webpSupport ? 4 : 1, desktopsettings.quality, desktopsettings.scaling, desktopsettings.framerate); }
if (desktop.State != 0) { desktop.m.SendCompressionLevel(desktopsettings.agentencoding, desktopsettings.quality, desktopsettings.scaling, desktopsettings.framerate); }
desktop.sendCtrlMsg('{"ctrlChannel":"102938","type":"autolock","value":' + desktopsettings.autolock + '}');
desktop.m.SendRefresh();
}
if (desktop.contype == 2) {
if (desktop.State != 0) { desktop.Stop(); setTimeout(function () { connectDesktop(null, 2); }, 50); }
@ -4651,6 +4670,7 @@
QH('d7bitmapquality', r);
d7desktopmode.value = desktopsettings.encoding;
d7bitmapquality.value = 40; // Default value
if (desktopsettings.agentencoding) { d7encoding.value = desktopsettings.agentencoding; } else { desktopsettings.agentencoding = 4; }
if (ops.indexOf(parseInt(desktopsettings.quality)) >= 0) { d7bitmapquality.value = desktopsettings.quality; }
d7bitmapscaling.value = desktopsettings.scaling;
if (desktopsettings.framerate) { d7framelimiter.value = desktopsettings.framerate; }