mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added remote desktop WebP support.
This commit is contained in:
parent
9d03981bfc
commit
dea1df33b6
5 changed files with 53 additions and 13 deletions
|
@ -41,6 +41,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
|
|||
obj.sessionid = 0;
|
||||
obj.username;
|
||||
obj.oldie = false;
|
||||
obj.ImageType = 1; // 1 = JPEG, 2 = PNG, 3 = TIFF, 4 = WebP
|
||||
obj.CompressionLevel = 50;
|
||||
obj.ScalingLevel = 1024;
|
||||
obj.FrameRateTimer = 100;
|
||||
|
@ -174,11 +175,11 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
|
|||
obj.send(String.fromCharCode(0x00, 0x08, 0x00, 0x05, 0x01));
|
||||
}
|
||||
|
||||
obj.SendCompressionLevel = function (type, level, scaling, frametimer) {
|
||||
obj.SendCompressionLevel = function (type, level, scaling, frametimer) { // Type: 1 = JPEG, 2 = PNG, 3 = TIFF, 4 = WebP
|
||||
obj.ImageType = type;
|
||||
if (level) { obj.CompressionLevel = level; }
|
||||
if (scaling) { obj.ScalingLevel = scaling; }
|
||||
if (frametimer) { obj.FrameRateTimer = frametimer; }
|
||||
//console.log('SendCompressionLevel', obj.CompressionLevel, obj.ScalingLevel, obj.FrameRateTimer);
|
||||
obj.send(String.fromCharCode(0x00, 0x05, 0x00, 0x0A, type, obj.CompressionLevel) + obj.shortToStr(obj.ScalingLevel) + obj.shortToStr(obj.FrameRateTimer));
|
||||
}
|
||||
|
||||
|
@ -196,7 +197,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
|
|||
obj.ScreenHeight = obj.height = height;
|
||||
obj.KillDraw = obj.tilesReceived;
|
||||
while (obj.PendingOperations.length > 0) { obj.PendingOperations.shift(); }
|
||||
obj.SendCompressionLevel(1);
|
||||
obj.SendCompressionLevel(obj.ImageType);
|
||||
obj.SendUnPause();
|
||||
obj.SendRemoteInputLock(2); // Query input lock state
|
||||
// No need to event the display size change now, it will be evented on first draw.
|
||||
|
@ -739,7 +740,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
|
|||
if (obj.xxKeyInputGrab == true) return;
|
||||
document.onkeyup = obj.xxKeyUp;
|
||||
document.onkeydown = obj.xxKeyDown;
|
||||
document.onkeypress = obj.xxKeyPress;
|
||||
document.onkeypress = obj.xxKeyPress;c
|
||||
obj.xxKeyInputGrab = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,4 +127,26 @@ function parseUriArgs() {
|
|||
if (!isSafeString(r[name])) { delete r[name]; } else { var x = parseInt(r[name]); if (x == r[name]) { r[name] = x; } }
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
// check_webp_feature:
|
||||
// 'feature' can be one of 'lossy', 'lossless', 'alpha' or 'animation'.
|
||||
// 'callback(feature, isSupported)' will be passed back the detection result (in an asynchronous way!)
|
||||
// From: https://stackoverflow.com/questions/5573096/detecting-webp-support
|
||||
function check_webp_feature(feature, callback) {
|
||||
var kTestImages = {
|
||||
lossy: "UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"//,
|
||||
//lossless: "UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",
|
||||
//alpha: "UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",
|
||||
//animation: "UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"
|
||||
};
|
||||
var img = new Image();
|
||||
img.onload = function () {
|
||||
var result = (img.width > 0) && (img.height > 0);
|
||||
callback(feature, result);
|
||||
};
|
||||
img.onerror = function () {
|
||||
callback(feature, false);
|
||||
};
|
||||
img.src = "data:image/webp;base64," + kTestImages[feature];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue