Added local remote desktop recording.
Ylian Saint-Hilaire committed
May 2, 2020 at 17:59 UTC
4606e8beb13054490c3d991345f738ac86e3cb8b
8 files changed
+66
-18
public/images/icon-film-red.png
Binary files /dev/null and b/public/images/icon-film-red.png differ
public/images/icon-film.png
Binary files a/public/images/icon-film.png and b/public/images/icon-film.png differ
public/scripts/agent-desktop-0.0.2-min.js
+1
-1
@@ -1 +1 @@
1
-var CreateAgentRemoteDesktop=function(e,n){var g={};"string"==typeof(g.CanvasId=e)&&(g.CanvasId=Q(e)),g.Canvas=g.CanvasId.getContext("2d"),g.scrolldiv=n,g.State=0,g.PendingOperations=[],g.tilesReceived=0,g.TilesDrawn=0,g.KillDraw=0,g.ipad=!1,g.tabletKeyboardVisible=!1,g.LastX=0,g.LastY=0,g.touchenabled=0,g.submenuoffset=0,g.touchtimer=null,g.TouchArray={},g.connectmode=0,g.connectioncount=0,g.rotation=0,g.protocol=2,g.debugmode=0,g.firstUpKeys=[],g.stopInput=!1,g.localKeyMap=!0,g.pressedKeys=[],g.sessionid=0,g.username,g.oldie=!1,g.CompressionLevel=50,g.ScalingLevel=1024,g.FrameRateTimer=100,g.FirstDraw=!1,g.ScreenWidth=960,g.ScreenHeight=700,g.width=960,g.height=960,g.onScreenSizeChange=null,g.onMessage=null,g.onConnectCountChanged=null,g.onDebugMessage=null,g.onTouchEnabledChanged=null,g.onDisplayinfo=null,g.accumulator=null;var v=["default","progress","crosshair","pointer","help","text","no-drop","move","nesw-resize","ns-resize","nwse-resize","w-resize","alias","wait","none","not-allowed","col-resize","row-resize","copy","zoom-in","zoom-out"];g.Start=function(){g.State=0,g.accumulator=null},g.Stop=function(){g.setRotation(0),g.UnGrabKeyInput(),g.UnGrabMouseInput(),g.touchenabled=0,null!=g.onScreenSizeChange&&g.onScreenSizeChange(g,g.ScreenWidth,g.ScreenHeight,g.CanvasId),g.Canvas.clearRect(0,0,g.CanvasId.width,g.CanvasId.height)},g.xxStateChange=function(e){if(g.State!=e)switch(g.State=e,g.CanvasId.style.cursor="default",e){case 0:g.Stop()}},g.send=function(e){1<g.debugmode&&console.log("KSend("+e.length+"): "+rstr2hex(e)),null!=g.parent&&g.parent.send(e)},g.ProcessPictureMsg=function(e,n,t){var o=new Image;o.xcount=g.tilesReceived++;var a=g.tilesReceived;o.src="data:image/jpeg;base64,"+btoa(e.substring(4,e.length)),o.onload=function(){if(null!=g.Canvas&&g.KillDraw<a&&0!=g.State)for(g.PendingOperations.push([a,2,o,n,t]);g.DoPendingOperations(););},o.error=function(){console.log("DecodeTileError")}},g.DoPendingOperations=function(){if(0==g.PendingOperations.length)return!1;for(var e=0;e<g.PendingOperations.length;e++){var n=g.PendingOperations[e];if(n[0]==g.TilesDrawn+1)return 1==n[1]?g.ProcessCopyRectMsg(n[2]):2==n[1]&&(g.Canvas.drawImage(n[2],g.rotX(n[3],n[4]),g.rotY(n[3],n[4])),delete n[2]),g.PendingOperations.splice(e,1),delete n,g.TilesDrawn++,g.TilesDrawn==g.tilesReceived&&g.KillDraw<g.TilesDrawn&&(g.KillDraw=g.TilesDrawn=g.tilesReceived=0),!0}return g.oldie&&0<g.PendingOperations.length&&g.TilesDrawn++,!1},g.ProcessCopyRectMsg=function(e){var n=((255&e.charCodeAt(0))<<8)+(255&e.charCodeAt(1)),t=((255&e.charCodeAt(2))<<8)+(255&e.charCodeAt(3)),o=((255&e.charCodeAt(4))<<8)+(255&e.charCodeAt(5)),a=((255&e.charCodeAt(6))<<8)+(255&e.charCodeAt(7)),r=((255&e.charCodeAt(8))<<8)+(255&e.charCodeAt(9)),s=((255&e.charCodeAt(10))<<8)+(255&e.charCodeAt(11));g.Canvas.drawImage(Canvas.canvas,n,t,r,s,o,a,r,s)},g.SendUnPause=function(){g.send(String.fromCharCode(0,8,0,5,0))},g.SendPause=function(){g.send(String.fromCharCode(0,8,0,5,1))},g.SendCompressionLevel=function(e,n,t,o){n&&(g.CompressionLevel=n),t&&(g.ScalingLevel=t),o&&(g.FrameRateTimer=o),g.send(String.fromCharCode(0,5,0,10,e,g.CompressionLevel)+g.shortToStr(g.ScalingLevel)+g.shortToStr(g.FrameRateTimer))},g.SendRefresh=function(){g.send(String.fromCharCode(0,6,0,4))},g.ProcessScreenMsg=function(e,n){for(0<g.debugmode&&console.log("ScreenSize: "+e+" x "+n),g.Canvas.setTransform(1,0,0,1,0,0),g.rotation=0,g.FirstDraw=!0,g.ScreenWidth=g.width=e,g.ScreenHeight=g.height=n,g.KillDraw=g.tilesReceived;0<g.PendingOperations.length;)g.PendingOperations.shift();g.SendCompressionLevel(1),g.SendUnPause(),null!=g.onScreenSizeChange&&g.onScreenSizeChange(g,g.ScreenWidth,g.ScreenHeight,g.CanvasId)},g.ProcessData=function(e){for(var n=0;n<e.length;){var t=g.ProcessDataEx(e.substring(n));if(null==t||0==t)break;n+=t}},g.ProcessDataEx=function(e){if(null!=g.accumulator&&(e=g.accumulator+e,g.accumulator=null),1<g.debugmode&&console.log("KRecv("+e.length+"): "+rstr2hex(e.substring(0,Math.min(e.length,40)))),!(e.length<4)){var n=null,t=0,o=0,a=ReadShort(e,0),r=ReadShort(e,2),s=0;if(27==a&&8==r){if(e.length<12)return;if(a=ReadShort(e,8),(r=ReadInt(e,4))+8>e.length)return void(g.accumulator=e);e=e.substring(8),s=8}if(r!=e.length&&0<g.debugmode&&console.log(r,e.length,r==e.length),18<=a&&65!=a&&88!=a)return console.error("Invalid KVM command "+a+" of size "+r),console.log("Invalid KVM data",e.length,rstr2hex(e.substring(0,40))+"..."),void(g.parent&&g.parent.setConsoleMessage&&g.parent.setConsoleMessage("Invalid KVM command "+a+" of size "+r));if(!(r>e.length)){switch(3!=a&&4!=a&&7!=a||(t=((255&(n=e.substring(4,r)).charCodeAt(0))<<8)+(255&n.charCodeAt(1)),o=((255&n.charCodeAt(2))<<8)+(255&n.charCodeAt(3)),0<g.debugmode&&console.log("CMD"+a+" at X="+t+" Y="+o)),a){case 3:g.FirstDraw&&g.onResize(),g.ProcessPictureMsg(n,t,o);break;case 4:g.FirstDraw&&g.onResize(),g.TilesDrawn==g.tilesReceived?g.ProcessCopyRectMsg(n):g.PendingOperations.push([++tilesReceived,1,n]);break;case 7:g.ProcessScreenMsg(t,o),g.SendKeyMsgKC(g.KeyAction.UP,16),g.SendKeyMsgKC(g.KeyAction.UP,17),g.SendKeyMsgKC(g.KeyAction.UP,18),g.SendKeyMsgKC(g.KeyAction.UP,91),g.SendKeyMsgKC(g.KeyAction.UP,92),g.SendKeyMsgKC(g.KeyAction.UP,16),g.send(String.fromCharCode(0,14,0,4));break;case 11:var i=0,c={},u=((255&e.charCodeAt(4))<<8)+(255&e.charCodeAt(5));if(0<u){i=((255&e.charCodeAt(6+2*u))<<8)+(255&e.charCodeAt(7+2*u));for(var l=0;l<u;l++){var d=((255&e.charCodeAt(6+2*l))<<8)+(255&e.charCodeAt(7+2*l));c[d]=65535==d?"All Displays":"Display "+d}}null!=g.onDisplayinfo&&g.onDisplayinfo(g,c,i);break;case 12:break;case 14:g.touchenabled=1,g.TouchArray={},null!=g.onTouchEnabledChanged&&g.onTouchEnabledChanged(g.touchenabled);break;case 15:g.TouchArray={};break;case 16:g.connectioncount=ReadInt(e,4),null!=g.onConnectCountChanged&&g.onConnectCountChanged(g.connectioncount,g);break;case 17:null!=g.onMessage&&g.onMessage(e.substring(4,r),g);break;case 65:"."!=(e=e.substring(4))[0]?(console.log(e),g.parent&&g.parent.setConsoleMessage&&g.parent.setConsoleMessage(e)):console.log("KVM: "+e.substring(1));break;case 88:if(5!=r)break;var h=e.charCodeAt(4);v.length<h&&(h=0),g.CanvasId.style.cursor=v[h]}return r+s}g.accumulator=e}},g.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32},g.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5,DBLCLICK:6},g.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15},g.Alternate=0;var o={Pause:19,CapsLock:20,Space:32,Quote:222,Minus:189,NumpadMultiply:106,NumpadAdd:107,PrintScreen:44,Comma:188,NumpadSubtract:109,NumpadDecimal:110,Period:190,Slash:191,NumpadDivide:111,Semicolon:186,Equal:187,OSLeft:91,BracketLeft:219,OSRight:91,Backslash:220,BracketRight:221,ContextMenu:93,Backquote:192,NumLock:144,ScrollLock:145,Backspace:8,Tab:9,Enter:13,NumpadEnter:13,Escape:27,Delete:46,Home:36,PageUp:33,PageDown:34,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,End:35,Insert:45,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,VolumeMute:181};return g.SendKeyMsg=function(e,n){var t;null!=e&&((n=n||window.event).code&&0==g.localKeyMap?null!=(t=function(e){return e.code.startsWith("Key")&&4==e.code.length?e.code.charCodeAt(3):e.code.startsWith("Digit")&&6==e.code.length?e.code.charCodeAt(5):e.code.startsWith("Numpad")&&7==e.code.length?e.code.charCodeAt(6)+48:o[e.code]}(n))&&g.SendKeyMsgKC(e,t):(59==(t=n.keyCode)?t=186:173==t?t=189:61==t&&(t=187),g.SendKeyMsgKC(e,t)))},g.SendMessage=function(e){3==g.State&&g.send(String.fromCharCode(0,17)+g.shortToStr(4+e.length)+e)},g.SendKeyMsgKC=function(e,n){if(3==g.State)if("object"==typeof e)for(var t in e)g.SendKeyMsgKC(e[t][0],e[t][1]);else{if(1==e)-1==g.pressedKeys.indexOf(n)&&g.pressedKeys.unshift(n);else if(2==e){-1!=(t=g.pressedKeys.indexOf(n))&&g.pressedKeys.splice(t,1)}g.send(String.fromCharCode(0,g.InputType.KEY,0,6,e-1,n))}},g.sendcad=function(){g.SendCtrlAltDelMsg()},g.SendCtrlAltDelMsg=function(){3==g.State&&g.send(String.fromCharCode(0,g.InputType.CTRLALTDEL,0,4))},g.SendEscKey=function(){3==g.State&&g.send(String.fromCharCode(0,g.InputType.KEY,0,6,0,27,0,g.InputType.KEY,0,6,1,27))},g.SendStartMsg=function(){g.SendKeyMsgKC(g.KeyAction.EXDOWN,91),g.SendKeyMsgKC(g.KeyAction.EXUP,91)},g.SendCharmsMsg=function(){g.SendKeyMsgKC(g.KeyAction.EXDOWN,91),g.SendKeyMsgKC(g.KeyAction.DOWN,67),g.SendKeyMsgKC(g.KeyAction.UP,67),g.SendKeyMsgKC(g.KeyAction.EXUP,91)},g.SendTouchMsg1=function(e,n,t,o){3==g.State&&g.send(String.fromCharCode(0,g.InputType.TOUCH)+g.shortToStr(14)+String.fromCharCode(1,e)+g.intToStr(n)+g.shortToStr(t)+g.shortToStr(o))},g.SendTouchMsg2=function(e,n){var t,o="";for(var a in g.TouchArray)a==e?t=n:1==g.TouchArray[a].f?(t=65542,g.TouchArray[a].f=3,"START"+a):2==g.TouchArray[a].f?(t=262144,"STOP"+a):t=131078,o+=String.fromCharCode(a)+g.intToStr(t)+g.shortToStr(g.TouchArray[a].x)+g.shortToStr(g.TouchArray[a].y),2==g.TouchArray[a].f&&delete g.TouchArray[a];3==g.State&&g.send(String.fromCharCode(0,g.InputType.TOUCH)+g.shortToStr(5+o.length)+String.fromCharCode(2)+o),0==Object.keys(g.TouchArray).length&&null!=g.touchtimer&&(clearInterval(g.touchtimer),g.touchtimer=null)},g.SendMouseMsg=function(e,n){if(3==g.State&&null!=e&&null!=g.Canvas){if(!n)n=window.event;var t=g.Canvas.canvas.height/g.CanvasId.clientHeight,o=g.Canvas.canvas.width/g.CanvasId.clientWidth,a=g.GetPositionOfControl(g.Canvas.canvas),r=(n.pageX-a[0])*o,s=(n.pageY-a[1])*t;if(n.addx&&(r+=n.addx),n.addy&&(s+=n.addy),0<=r&&r<=g.Canvas.canvas.width&&0<=s&&s<=g.Canvas.canvas.height){var i=0,c=0;e==g.KeyAction.UP||e==g.KeyAction.DOWN?n.which?i=1==n.which?g.MouseButton.LEFT:2==n.which?g.MouseButton.MIDDLE:g.MouseButton.RIGHT:n.button&&(i=0==n.button?g.MouseButton.LEFT:1==n.button?g.MouseButton.MIDDLE:g.MouseButton.RIGHT):e==g.KeyAction.SCROLL&&(n.detail?c=120*n.detail*-1:n.wheelDelta&&(c=3*n.wheelDelta));var u="";u=e==g.KeyAction.DBLCLICK?String.fromCharCode(0,g.InputType.MOUSE,0,10,0,136,r/256&255,255&r,s/256&255,255&s):e==g.KeyAction.SCROLL?String.fromCharCode(0,g.InputType.MOUSE,0,12,0,0,r/256&255,255&r,s/256&255,255&s,c/256&255,255&c):String.fromCharCode(0,g.InputType.MOUSE,0,10,0,e==g.KeyAction.DOWN?i:2*i&255,r/256&255,255&r,s/256&255,255&s),g.Action==g.KeyAction.NONE?0==g.Alternate||g.ipad?(g.send(u),g.Alternate=1):g.Alternate=0:g.send(u)}}},g.GetDisplayNumbers=function(){g.send(String.fromCharCode(0,11,0,4))},g.SetDisplay=function(e){g.send(String.fromCharCode(0,12,0,6,e>>8,255&e))},g.intToStr=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},g.shortToStr=function(e){return String.fromCharCode(e>>8&255,255&e)},g.onResize=function(){0!=g.ScreenWidth&&0!=g.ScreenHeight&&(g.Canvas.canvas.width==g.ScreenWidth&&g.Canvas.canvas.height==g.ScreenHeight||(g.FirstDraw&&(g.Canvas.canvas.width=g.ScreenWidth,g.Canvas.canvas.height=g.ScreenHeight,g.Canvas.fillRect(0,0,g.ScreenWidth,g.ScreenHeight),null!=g.onScreenSizeChange&&g.onScreenSizeChange(g,g.ScreenWidth,g.ScreenHeight,g.CanvasId)),g.FirstDraw=!1))},g.xxMouseInputGrab=!1,g.xxKeyInputGrab=!1,g.xxMouseMove=function(e){return 3==g.State&&g.SendMouseMsg(g.KeyAction.NONE,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.xxMouseUp=function(e){return 3==g.State&&g.SendMouseMsg(g.KeyAction.UP,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.xxMouseDown=function(e){return 3==g.State&&g.SendMouseMsg(g.KeyAction.DOWN,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.xxMouseDblClick=function(e){return 3==g.State&&g.SendMouseMsg(g.KeyAction.DBLCLICK,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.xxDOMMouseScroll=function(e){return 3!=g.State||(g.SendMouseMsg(g.KeyAction.SCROLL,e),!1)},g.xxMouseWheel=function(e){return 3!=g.State||(g.SendMouseMsg(g.KeyAction.SCROLL,e),!1)},g.xxKeyUp=function(e){return 3==g.State&&g.SendKeyMsg(g.KeyAction.UP,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.xxKeyDown=function(e){return 3==g.State&&g.SendKeyMsg(g.KeyAction.DOWN,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.xxKeyPress=function(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.handleKeys=function(e){return 1!=g.stopInput&&3==desktop.State&&g.xxKeyPress(e)},g.handleKeyUp=function(e){if(1==g.stopInput||3!=desktop.State)return!1;if(g.firstUpKeys.length<5&&(g.firstUpKeys.push(e.keyCode),5==g.firstUpKeys.length)){var n=g.firstUpKeys.join(",");"16,17,91,91,16"!=n&&"16,17,18,91,92"!=n||(g.stopInput=!0)}return g.xxKeyUp(e)},g.handleKeyDown=function(e){return 1!=g.stopInput&&3==desktop.State&&g.xxKeyDown(e)},g.handleReleaseKeys=function(){var e=JSON.parse(JSON.stringify(g.pressedKeys));for(var n in e)g.SendKeyMsgKC(g.KeyAction.UP,e[n])},g.mousedblclick=function(e){return 1!=g.stopInput&&g.xxMouseDblClick(e)},g.mousedown=function(e){return 1!=g.stopInput&&g.xxMouseDown(e)},g.mouseup=function(e){return 1!=g.stopInput&&g.xxMouseUp(e)},g.mousemove=function(e){return 1!=g.stopInput&&g.xxMouseMove(e)},g.mousewheel=function(e){return 1!=g.stopInput&&g.xxMouseWheel(e)},g.xxMsTouchEvent=function(e){if(4!=e.originalEvent.pointerType){if(e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),"MSPointerDown"==e.type||"MSPointerMove"==e.type||"MSPointerUp"==e.type){var n=0,t=e.originalEvent.pointerId%256,o=e.offsetX*(Canvas.canvas.width/g.CanvasId.clientWidth),a=e.offsetY*(Canvas.canvas.height/g.CanvasId.clientHeight);"MSPointerDown"==e.type?n=65542:"MSPointerMove"==e.type?n=131078:"MSPointerUp"==e.type&&(n=262144),g.TouchArray[t]||(g.TouchArray[t]={x:o,y:a}),g.SendTouchMsg2(t,n),"MSPointerUp"==e.type&&delete g.TouchArray[t]}else alert(e.type);return!0}},g.xxTouchStart=function(e){if(3==g.State)if(e.preventDefault&&e.preventDefault(),0==g.touchenabled||1==g.touchenabled){if(1<e.originalEvent.touches.length)return;var n=e.originalEvent.touches[0];e.which=1,g.LastX=e.pageX=n.pageX,g.LastY=e.pageY=n.pageY,g.SendMouseMsg(KeyAction.DOWN,e)}else{var t=g.GetPositionOfControl(Canvas.canvas);for(var o in e.originalEvent.changedTouches)if(e.originalEvent.changedTouches[o].identifier){var a=e.originalEvent.changedTouches[o].identifier%256;g.TouchArray[a]||(g.TouchArray[a]={x:(e.originalEvent.touches[o].pageX-t[0])*(Canvas.canvas.width/g.CanvasId.clientWidth),y:(e.originalEvent.touches[o].pageY-t[1])*(Canvas.canvas.height/g.CanvasId.clientHeight),f:1})}0<Object.keys(g.TouchArray).length&&null==touchtimer&&(g.touchtimer=setInterval(function(){g.SendTouchMsg2(256,0)},50))}},g.xxTouchMove=function(e){if(3==g.State)if(e.preventDefault&&e.preventDefault(),0==g.touchenabled||1==g.touchenabled){if(1<e.originalEvent.touches.length)return;var n=e.originalEvent.touches[0];e.which=1,g.LastX=e.pageX=n.pageX,g.LastY=e.pageY=n.pageY,g.SendMouseMsg(g.KeyAction.NONE,e)}else{var t=g.GetPositionOfControl(Canvas.canvas);for(var o in e.originalEvent.changedTouches)if(e.originalEvent.changedTouches[o].identifier){var a=e.originalEvent.changedTouches[o].identifier%256;g.TouchArray[a]&&(g.TouchArray[a].x=(e.originalEvent.touches[o].pageX-t[0])*(g.Canvas.canvas.width/g.CanvasId.clientWidth),g.TouchArray[a].y=(e.originalEvent.touches[o].pageY-t[1])*(g.Canvas.canvas.height/g.CanvasId.clientHeight))}}},g.xxTouchEnd=function(e){if(3==g.State)if(e.preventDefault&&e.preventDefault(),0==g.touchenabled||1==g.touchenabled){if(1<e.originalEvent.touches.length)return;e.which=1,e.pageX=LastX,e.pageY=LastY,g.SendMouseMsg(KeyAction.UP,e)}else for(var n in e.originalEvent.changedTouches)if(e.originalEvent.changedTouches[n].identifier){var t=e.originalEvent.changedTouches[n].identifier%256;g.TouchArray[t]&&(g.TouchArray[t].f=2)}},g.GrabMouseInput=function(){if(1!=g.xxMouseInputGrab){var e=g.CanvasId;e.onmousemove=g.xxMouseMove,e.onmouseup=g.xxMouseUp,e.onmousedown=g.xxMouseDown,e.touchstart=g.xxTouchStart,e.touchmove=g.xxTouchMove,e.touchend=g.xxTouchEnd,e.MSPointerDown=g.xxMsTouchEvent,e.MSPointerMove=g.xxMsTouchEvent,e.MSPointerUp=g.xxMsTouchEvent,navigator.userAgent.match(/mozilla/i)?e.DOMMouseScroll=g.xxDOMMouseScroll:e.onmousewheel=g.xxMouseWheel,g.xxMouseInputGrab=!0}},g.UnGrabMouseInput=function(){if(0!=g.xxMouseInputGrab){var e=g.CanvasId;e.onmousemove=null,e.onmouseup=null,e.onmousedown=null,e.touchstart=null,e.touchmove=null,e.touchend=null,e.MSPointerDown=null,e.MSPointerMove=null,e.MSPointerUp=null,navigator.userAgent.match(/mozilla/i)?e.DOMMouseScroll=null:e.onmousewheel=null,g.xxMouseInputGrab=!1}},g.GrabKeyInput=function(){1!=g.xxKeyInputGrab&&(document.onkeyup=g.xxKeyUp,document.onkeydown=g.xxKeyDown,document.onkeypress=g.xxKeyPress,g.xxKeyInputGrab=!0)},g.UnGrabKeyInput=function(){0!=g.xxKeyInputGrab&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,g.xxKeyInputGrab=!1)},g.GetPositionOfControl=function(e){var n=Array(2);for(n[0]=n[1]=0;e;)n[0]+=e.offsetLeft,n[1]+=e.offsetTop,e=e.offsetParent;return n},g.crotX=function(e,n){return 0==g.rotation?e:1==g.rotation?n:2==g.rotation?g.Canvas.canvas.width-e:3==g.rotation?g.Canvas.canvas.height-n:void 0},g.crotY=function(e,n){return 0==g.rotation?n:1==g.rotation?g.Canvas.canvas.width-e:2==g.rotation?g.Canvas.canvas.height-n:3==g.rotation?e:void 0},g.rotX=function(e,n){return 0==g.rotation||1==g.rotation?e:2==g.rotation?e-g.Canvas.canvas.width:3==g.rotation?e-g.Canvas.canvas.height:void 0},g.rotY=function(e,n){return 0==g.rotation||3==g.rotation?n:1==g.rotation?n-g.Canvas.canvas.width:2==g.rotation?n-g.Canvas.canvas.height:void 0},g.tcanvas=null,g.setRotation=function(e){for(;e<0;)e+=4;var n=e%4;if(n==g.rotation)return!0;var t=g.Canvas.canvas.width,o=g.Canvas.canvas.height;1!=g.rotation&&3!=g.rotation||(t=g.Canvas.canvas.height,o=g.Canvas.canvas.width),null==g.tcanvas&&(g.tcanvas=document.createElement("canvas"));var a=g.tcanvas.getContext("2d");return a.setTransform(1,0,0,1,0,0),a.canvas.width=t,a.canvas.height=o,a.rotate(-90*g.rotation*Math.PI/180),0==g.rotation&&a.drawImage(g.Canvas.canvas,0,0),1==g.rotation&&a.drawImage(g.Canvas.canvas,-g.Canvas.canvas.width,0),2==g.rotation&&a.drawImage(g.Canvas.canvas,-g.Canvas.canvas.width,-g.Canvas.canvas.height),3==g.rotation&&a.drawImage(g.Canvas.canvas,0,-g.Canvas.canvas.height),0!=g.rotation&&2!=g.rotation||(g.Canvas.canvas.height=t,g.Canvas.canvas.width=o),1!=g.rotation&&3!=g.rotation||(g.Canvas.canvas.height=o,g.Canvas.canvas.width=t),g.Canvas.setTransform(1,0,0,1,0,0),g.Canvas.rotate(90*n*Math.PI/180),g.rotation=n,g.Canvas.drawImage(g.tcanvas,g.rotX(0,0),g.rotY(0,0)),g.ScreenWidth=g.Canvas.canvas.width,g.ScreenHeight=g.Canvas.canvas.height,null!=g.onScreenSizeChange&&g.onScreenSizeChange(g,g.ScreenWidth,g.ScreenHeight,g.CanvasId),!0},g.MuchTheSame=function(e,n){return Math.abs(e-n)<4},g.Debug=function(e){console.log(e)},g.getIEVersion=function(){var e=-1;if("Microsoft Internet Explorer"==navigator.appName){var n=navigator.userAgent;null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(n)&&(e=parseFloat(RegExp.$1))}return e},g.haltEvent=function(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g}
\ No newline at end of file
1
+var CreateAgentRemoteDesktop=function(e,n){var g={};"string"==typeof(g.CanvasId=e)&&(g.CanvasId=Q(e)),g.Canvas=g.CanvasId.getContext("2d"),g.scrolldiv=n,g.State=0,g.PendingOperations=[],g.tilesReceived=0,g.TilesDrawn=0,g.KillDraw=0,g.ipad=!1,g.tabletKeyboardVisible=!1,g.LastX=0,g.LastY=0,g.touchenabled=0,g.submenuoffset=0,g.touchtimer=null,g.TouchArray={},g.connectmode=0,g.connectioncount=0,g.rotation=0,g.protocol=2,g.debugmode=0,g.firstUpKeys=[],g.stopInput=!1,g.localKeyMap=!0,g.pressedKeys=[],g.sessionid=0,g.username,g.oldie=!1,g.CompressionLevel=50,g.ScalingLevel=1024,g.FrameRateTimer=100,g.FirstDraw=!1,g.ScreenWidth=960,g.ScreenHeight=700,g.width=960,g.height=960,g.onScreenSizeChange=null,g.onMessage=null,g.onConnectCountChanged=null,g.onDebugMessage=null,g.onTouchEnabledChanged=null,g.onDisplayinfo=null,g.accumulator=null;var v=["default","progress","crosshair","pointer","help","text","no-drop","move","nesw-resize","ns-resize","nwse-resize","w-resize","alias","wait","none","not-allowed","col-resize","row-resize","copy","zoom-in","zoom-out"];g.Start=function(){g.State=0,g.accumulator=null},g.Stop=function(){g.setRotation(0),g.UnGrabKeyInput(),g.UnGrabMouseInput(),g.touchenabled=0,null!=g.onScreenSizeChange&&g.onScreenSizeChange(g,g.ScreenWidth,g.ScreenHeight,g.CanvasId),g.Canvas.clearRect(0,0,g.CanvasId.width,g.CanvasId.height)},g.xxStateChange=function(e){if(g.State!=e)switch(g.State=e,g.CanvasId.style.cursor="default",e){case 0:g.Stop()}},g.send=function(e){1<g.debugmode&&console.log("KSend("+e.length+"): "+rstr2hex(e)),null!=g.parent&&g.parent.send(e)},g.ProcessPictureMsg=function(e,n,t){var o=new Image;o.xcount=g.tilesReceived++;var a=g.tilesReceived;o.src="data:image/jpeg;base64,"+btoa(e.substring(4,e.length)),o.onload=function(){if(null!=g.Canvas&&g.KillDraw<a&&0!=g.State)for(g.PendingOperations.push([a,2,o,n,t]);g.DoPendingOperations(););},o.error=function(){console.log("DecodeTileError")}},g.DoPendingOperations=function(){if(0==g.PendingOperations.length)return!1;for(var e=0;e<g.PendingOperations.length;e++){var n=g.PendingOperations[e];if(n[0]==g.TilesDrawn+1)return 1==n[1]?g.ProcessCopyRectMsg(n[2]):2==n[1]&&(g.Canvas.drawImage(n[2],g.rotX(n[3],n[4]),g.rotY(n[3],n[4])),delete n[2]),g.PendingOperations.splice(e,1),delete n,g.TilesDrawn++,g.TilesDrawn==g.tilesReceived&&g.KillDraw<g.TilesDrawn&&(g.KillDraw=g.TilesDrawn=g.tilesReceived=0),!0}return g.oldie&&0<g.PendingOperations.length&&g.TilesDrawn++,!1},g.ProcessCopyRectMsg=function(e){var n=((255&e.charCodeAt(0))<<8)+(255&e.charCodeAt(1)),t=((255&e.charCodeAt(2))<<8)+(255&e.charCodeAt(3)),o=((255&e.charCodeAt(4))<<8)+(255&e.charCodeAt(5)),a=((255&e.charCodeAt(6))<<8)+(255&e.charCodeAt(7)),r=((255&e.charCodeAt(8))<<8)+(255&e.charCodeAt(9)),s=((255&e.charCodeAt(10))<<8)+(255&e.charCodeAt(11));g.Canvas.drawImage(Canvas.canvas,n,t,r,s,o,a,r,s)},g.SendUnPause=function(){g.send(String.fromCharCode(0,8,0,5,0))},g.SendPause=function(){g.send(String.fromCharCode(0,8,0,5,1))},g.SendCompressionLevel=function(e,n,t,o){n&&(g.CompressionLevel=n),t&&(g.ScalingLevel=t),o&&(g.FrameRateTimer=o),g.send(String.fromCharCode(0,5,0,10,e,g.CompressionLevel)+g.shortToStr(g.ScalingLevel)+g.shortToStr(g.FrameRateTimer))},g.SendRefresh=function(){g.send(String.fromCharCode(0,6,0,4))},g.ProcessScreenMsg=function(e,n){for(0<g.debugmode&&console.log("ScreenSize: "+e+" x "+n),g.Canvas.setTransform(1,0,0,1,0,0),g.rotation=0,g.FirstDraw=!0,g.ScreenWidth=g.width=e,g.ScreenHeight=g.height=n,g.KillDraw=g.tilesReceived;0<g.PendingOperations.length;)g.PendingOperations.shift();g.SendCompressionLevel(1),g.SendUnPause(),null!=g.onScreenSizeChange&&g.onScreenSizeChange(g,g.ScreenWidth,g.ScreenHeight,g.CanvasId)},g.ProcessData=function(e){for(var n=0;n<e.length;){var t=g.ProcessDataEx(e.substring(n));if(null==t||0==t)break;n+=t}},g.ProcessDataEx=function(e){if(null!=g.accumulator&&(e=g.accumulator+e,g.accumulator=null),1<g.debugmode&&console.log("KRecv("+e.length+"): "+rstr2hex(e.substring(0,Math.min(e.length,40)))),!(e.length<4)){var n=null,t=0,o=0,a=ReadShort(e,0),r=ReadShort(e,2),s=0;if(null!=g.recordedData&&(g.recordedData.push(p(2,1,e.length)),g.recordedData.push(e)),27==a&&8==r){if(e.length<12)return;if(a=ReadShort(e,8),(r=ReadInt(e,4))+8>e.length)return void(g.accumulator=e);e=e.substring(8),s=8}if(r!=e.length&&0<g.debugmode&&console.log(r,e.length,r==e.length),18<=a&&65!=a&&88!=a)return console.error("Invalid KVM command "+a+" of size "+r),console.log("Invalid KVM data",e.length,rstr2hex(e.substring(0,40))+"..."),void(g.parent&&g.parent.setConsoleMessage&&g.parent.setConsoleMessage("Invalid KVM command "+a+" of size "+r));if(!(r>e.length)){switch(3!=a&&4!=a&&7!=a||(t=((255&(n=e.substring(4,r)).charCodeAt(0))<<8)+(255&n.charCodeAt(1)),o=((255&n.charCodeAt(2))<<8)+(255&n.charCodeAt(3)),0<g.debugmode&&console.log("CMD"+a+" at X="+t+" Y="+o)),a){case 3:g.FirstDraw&&g.onResize(),g.ProcessPictureMsg(n,t,o);break;case 4:g.FirstDraw&&g.onResize(),g.TilesDrawn==g.tilesReceived?g.ProcessCopyRectMsg(n):g.PendingOperations.push([++tilesReceived,1,n]);break;case 7:g.ProcessScreenMsg(t,o),g.SendKeyMsgKC(g.KeyAction.UP,16),g.SendKeyMsgKC(g.KeyAction.UP,17),g.SendKeyMsgKC(g.KeyAction.UP,18),g.SendKeyMsgKC(g.KeyAction.UP,91),g.SendKeyMsgKC(g.KeyAction.UP,92),g.SendKeyMsgKC(g.KeyAction.UP,16),g.send(String.fromCharCode(0,14,0,4));break;case 11:var i=0,c={},u=((255&e.charCodeAt(4))<<8)+(255&e.charCodeAt(5));if(0<u){i=((255&e.charCodeAt(6+2*u))<<8)+(255&e.charCodeAt(7+2*u));for(var l=0;l<u;l++){var d=((255&e.charCodeAt(6+2*l))<<8)+(255&e.charCodeAt(7+2*l));c[d]=65535==d?"All Displays":"Display "+d}}null!=g.onDisplayinfo&&g.onDisplayinfo(g,c,i);break;case 12:break;case 14:g.touchenabled=1,g.TouchArray={},null!=g.onTouchEnabledChanged&&g.onTouchEnabledChanged(g.touchenabled);break;case 15:g.TouchArray={};break;case 16:g.connectioncount=ReadInt(e,4),null!=g.onConnectCountChanged&&g.onConnectCountChanged(g.connectioncount,g);break;case 17:null!=g.onMessage&&g.onMessage(e.substring(4,r),g);break;case 65:"."!=(e=e.substring(4))[0]?(console.log(e),g.parent&&g.parent.setConsoleMessage&&g.parent.setConsoleMessage(e)):console.log("KVM: "+e.substring(1));break;case 88:if(5!=r)break;var h=e.charCodeAt(4);v.length<h&&(h=0),g.CanvasId.style.cursor=v[h]}return r+s}g.accumulator=e}},g.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32},g.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5,DBLCLICK:6},g.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15},g.Alternate=0;var o={Pause:19,CapsLock:20,Space:32,Quote:222,Minus:189,NumpadMultiply:106,NumpadAdd:107,PrintScreen:44,Comma:188,NumpadSubtract:109,NumpadDecimal:110,Period:190,Slash:191,NumpadDivide:111,Semicolon:186,Equal:187,OSLeft:91,BracketLeft:219,OSRight:91,Backslash:220,BracketRight:221,ContextMenu:93,Backquote:192,NumLock:144,ScrollLock:145,Backspace:8,Tab:9,Enter:13,NumpadEnter:13,Escape:27,Delete:46,Home:36,PageUp:33,PageDown:34,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,End:35,Insert:45,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,VolumeMute:181};function p(e,n,t){var o=Date.now();return"number"==typeof t?(g.recordedSize+=t,g.shortToStr(e)+g.shortToStr(n)+g.intToStr(t)+g.intToStr(o>>32)+g.intToStr(32&o)):(g.recordedSize+=t.length,g.shortToStr(e)+g.shortToStr(n)+g.intToStr(t.length)+g.intToStr(o>>32)+g.intToStr(32&o)+t)}return g.SendKeyMsg=function(e,n){var t;null!=e&&((n=n||window.event).code&&0==g.localKeyMap?null!=(t=function(e){return e.code.startsWith("Key")&&4==e.code.length?e.code.charCodeAt(3):e.code.startsWith("Digit")&&6==e.code.length?e.code.charCodeAt(5):e.code.startsWith("Numpad")&&7==e.code.length?e.code.charCodeAt(6)+48:o[e.code]}(n))&&g.SendKeyMsgKC(e,t):(59==(t=n.keyCode)?t=186:173==t?t=189:61==t&&(t=187),g.SendKeyMsgKC(e,t)))},g.SendMessage=function(e){3==g.State&&g.send(String.fromCharCode(0,17)+g.shortToStr(4+e.length)+e)},g.SendKeyMsgKC=function(e,n){if(3==g.State)if("object"==typeof e)for(var t in e)g.SendKeyMsgKC(e[t][0],e[t][1]);else{if(1==e)-1==g.pressedKeys.indexOf(n)&&g.pressedKeys.unshift(n);else if(2==e){-1!=(t=g.pressedKeys.indexOf(n))&&g.pressedKeys.splice(t,1)}g.send(String.fromCharCode(0,g.InputType.KEY,0,6,e-1,n))}},g.sendcad=function(){g.SendCtrlAltDelMsg()},g.SendCtrlAltDelMsg=function(){3==g.State&&g.send(String.fromCharCode(0,g.InputType.CTRLALTDEL,0,4))},g.SendEscKey=function(){3==g.State&&g.send(String.fromCharCode(0,g.InputType.KEY,0,6,0,27,0,g.InputType.KEY,0,6,1,27))},g.SendStartMsg=function(){g.SendKeyMsgKC(g.KeyAction.EXDOWN,91),g.SendKeyMsgKC(g.KeyAction.EXUP,91)},g.SendCharmsMsg=function(){g.SendKeyMsgKC(g.KeyAction.EXDOWN,91),g.SendKeyMsgKC(g.KeyAction.DOWN,67),g.SendKeyMsgKC(g.KeyAction.UP,67),g.SendKeyMsgKC(g.KeyAction.EXUP,91)},g.SendTouchMsg1=function(e,n,t,o){3==g.State&&g.send(String.fromCharCode(0,g.InputType.TOUCH)+g.shortToStr(14)+String.fromCharCode(1,e)+g.intToStr(n)+g.shortToStr(t)+g.shortToStr(o))},g.SendTouchMsg2=function(e,n){var t,o="";for(var a in g.TouchArray)a==e?t=n:1==g.TouchArray[a].f?(t=65542,g.TouchArray[a].f=3,"START"+a):2==g.TouchArray[a].f?(t=262144,"STOP"+a):t=131078,o+=String.fromCharCode(a)+g.intToStr(t)+g.shortToStr(g.TouchArray[a].x)+g.shortToStr(g.TouchArray[a].y),2==g.TouchArray[a].f&&delete g.TouchArray[a];3==g.State&&g.send(String.fromCharCode(0,g.InputType.TOUCH)+g.shortToStr(5+o.length)+String.fromCharCode(2)+o),0==Object.keys(g.TouchArray).length&&null!=g.touchtimer&&(clearInterval(g.touchtimer),g.touchtimer=null)},g.SendMouseMsg=function(e,n){if(3==g.State&&null!=e&&null!=g.Canvas){if(!n)n=window.event;var t=g.Canvas.canvas.height/g.CanvasId.clientHeight,o=g.Canvas.canvas.width/g.CanvasId.clientWidth,a=g.GetPositionOfControl(g.Canvas.canvas),r=(n.pageX-a[0])*o,s=(n.pageY-a[1])*t;if(n.addx&&(r+=n.addx),n.addy&&(s+=n.addy),0<=r&&r<=g.Canvas.canvas.width&&0<=s&&s<=g.Canvas.canvas.height){var i=0,c=0;e==g.KeyAction.UP||e==g.KeyAction.DOWN?n.which?i=1==n.which?g.MouseButton.LEFT:2==n.which?g.MouseButton.MIDDLE:g.MouseButton.RIGHT:n.button&&(i=0==n.button?g.MouseButton.LEFT:1==n.button?g.MouseButton.MIDDLE:g.MouseButton.RIGHT):e==g.KeyAction.SCROLL&&(n.detail?c=120*n.detail*-1:n.wheelDelta&&(c=3*n.wheelDelta));var u="";u=e==g.KeyAction.DBLCLICK?String.fromCharCode(0,g.InputType.MOUSE,0,10,0,136,r/256&255,255&r,s/256&255,255&s):e==g.KeyAction.SCROLL?String.fromCharCode(0,g.InputType.MOUSE,0,12,0,0,r/256&255,255&r,s/256&255,255&s,c/256&255,255&c):String.fromCharCode(0,g.InputType.MOUSE,0,10,0,e==g.KeyAction.DOWN?i:2*i&255,r/256&255,255&r,s/256&255,255&s),g.Action==g.KeyAction.NONE?0==g.Alternate||g.ipad?(g.send(u),g.Alternate=1):g.Alternate=0:g.send(u)}}},g.GetDisplayNumbers=function(){g.send(String.fromCharCode(0,11,0,4))},g.SetDisplay=function(e){g.send(String.fromCharCode(0,12,0,6,e>>8,255&e))},g.intToStr=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},g.shortToStr=function(e){return String.fromCharCode(e>>8&255,255&e)},g.onResize=function(){0!=g.ScreenWidth&&0!=g.ScreenHeight&&(g.Canvas.canvas.width==g.ScreenWidth&&g.Canvas.canvas.height==g.ScreenHeight||(g.FirstDraw&&(g.Canvas.canvas.width=g.ScreenWidth,g.Canvas.canvas.height=g.ScreenHeight,g.Canvas.fillRect(0,0,g.ScreenWidth,g.ScreenHeight),null!=g.onScreenSizeChange&&g.onScreenSizeChange(g,g.ScreenWidth,g.ScreenHeight,g.CanvasId)),g.FirstDraw=!1))},g.xxMouseInputGrab=!1,g.xxKeyInputGrab=!1,g.xxMouseMove=function(e){return 3==g.State&&g.SendMouseMsg(g.KeyAction.NONE,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.xxMouseUp=function(e){return 3==g.State&&g.SendMouseMsg(g.KeyAction.UP,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.xxMouseDown=function(e){return 3==g.State&&g.SendMouseMsg(g.KeyAction.DOWN,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.xxMouseDblClick=function(e){return 3==g.State&&g.SendMouseMsg(g.KeyAction.DBLCLICK,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.xxDOMMouseScroll=function(e){return 3!=g.State||(g.SendMouseMsg(g.KeyAction.SCROLL,e),!1)},g.xxMouseWheel=function(e){return 3!=g.State||(g.SendMouseMsg(g.KeyAction.SCROLL,e),!1)},g.xxKeyUp=function(e){return 3==g.State&&g.SendKeyMsg(g.KeyAction.UP,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.xxKeyDown=function(e){return 3==g.State&&g.SendKeyMsg(g.KeyAction.DOWN,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.xxKeyPress=function(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g.handleKeys=function(e){return 1!=g.stopInput&&3==desktop.State&&g.xxKeyPress(e)},g.handleKeyUp=function(e){if(1==g.stopInput||3!=desktop.State)return!1;if(g.firstUpKeys.length<5&&(g.firstUpKeys.push(e.keyCode),5==g.firstUpKeys.length)){var n=g.firstUpKeys.join(",");"16,17,91,91,16"!=n&&"16,17,18,91,92"!=n||(g.stopInput=!0)}return g.xxKeyUp(e)},g.handleKeyDown=function(e){return 1!=g.stopInput&&3==desktop.State&&g.xxKeyDown(e)},g.handleReleaseKeys=function(){var e=JSON.parse(JSON.stringify(g.pressedKeys));for(var n in e)g.SendKeyMsgKC(g.KeyAction.UP,e[n])},g.mousedblclick=function(e){return 1!=g.stopInput&&g.xxMouseDblClick(e)},g.mousedown=function(e){return 1!=g.stopInput&&g.xxMouseDown(e)},g.mouseup=function(e){return 1!=g.stopInput&&g.xxMouseUp(e)},g.mousemove=function(e){return 1!=g.stopInput&&g.xxMouseMove(e)},g.mousewheel=function(e){return 1!=g.stopInput&&g.xxMouseWheel(e)},g.xxMsTouchEvent=function(e){if(4!=e.originalEvent.pointerType){if(e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),"MSPointerDown"==e.type||"MSPointerMove"==e.type||"MSPointerUp"==e.type){var n=0,t=e.originalEvent.pointerId%256,o=e.offsetX*(Canvas.canvas.width/g.CanvasId.clientWidth),a=e.offsetY*(Canvas.canvas.height/g.CanvasId.clientHeight);"MSPointerDown"==e.type?n=65542:"MSPointerMove"==e.type?n=131078:"MSPointerUp"==e.type&&(n=262144),g.TouchArray[t]||(g.TouchArray[t]={x:o,y:a}),g.SendTouchMsg2(t,n),"MSPointerUp"==e.type&&delete g.TouchArray[t]}else alert(e.type);return!0}},g.xxTouchStart=function(e){if(3==g.State)if(e.preventDefault&&e.preventDefault(),0==g.touchenabled||1==g.touchenabled){if(1<e.originalEvent.touches.length)return;var n=e.originalEvent.touches[0];e.which=1,g.LastX=e.pageX=n.pageX,g.LastY=e.pageY=n.pageY,g.SendMouseMsg(KeyAction.DOWN,e)}else{var t=g.GetPositionOfControl(Canvas.canvas);for(var o in e.originalEvent.changedTouches)if(e.originalEvent.changedTouches[o].identifier){var a=e.originalEvent.changedTouches[o].identifier%256;g.TouchArray[a]||(g.TouchArray[a]={x:(e.originalEvent.touches[o].pageX-t[0])*(Canvas.canvas.width/g.CanvasId.clientWidth),y:(e.originalEvent.touches[o].pageY-t[1])*(Canvas.canvas.height/g.CanvasId.clientHeight),f:1})}0<Object.keys(g.TouchArray).length&&null==touchtimer&&(g.touchtimer=setInterval(function(){g.SendTouchMsg2(256,0)},50))}},g.xxTouchMove=function(e){if(3==g.State)if(e.preventDefault&&e.preventDefault(),0==g.touchenabled||1==g.touchenabled){if(1<e.originalEvent.touches.length)return;var n=e.originalEvent.touches[0];e.which=1,g.LastX=e.pageX=n.pageX,g.LastY=e.pageY=n.pageY,g.SendMouseMsg(g.KeyAction.NONE,e)}else{var t=g.GetPositionOfControl(Canvas.canvas);for(var o in e.originalEvent.changedTouches)if(e.originalEvent.changedTouches[o].identifier){var a=e.originalEvent.changedTouches[o].identifier%256;g.TouchArray[a]&&(g.TouchArray[a].x=(e.originalEvent.touches[o].pageX-t[0])*(g.Canvas.canvas.width/g.CanvasId.clientWidth),g.TouchArray[a].y=(e.originalEvent.touches[o].pageY-t[1])*(g.Canvas.canvas.height/g.CanvasId.clientHeight))}}},g.xxTouchEnd=function(e){if(3==g.State)if(e.preventDefault&&e.preventDefault(),0==g.touchenabled||1==g.touchenabled){if(1<e.originalEvent.touches.length)return;e.which=1,e.pageX=LastX,e.pageY=LastY,g.SendMouseMsg(KeyAction.UP,e)}else for(var n in e.originalEvent.changedTouches)if(e.originalEvent.changedTouches[n].identifier){var t=e.originalEvent.changedTouches[n].identifier%256;g.TouchArray[t]&&(g.TouchArray[t].f=2)}},g.GrabMouseInput=function(){if(1!=g.xxMouseInputGrab){var e=g.CanvasId;e.onmousemove=g.xxMouseMove,e.onmouseup=g.xxMouseUp,e.onmousedown=g.xxMouseDown,e.touchstart=g.xxTouchStart,e.touchmove=g.xxTouchMove,e.touchend=g.xxTouchEnd,e.MSPointerDown=g.xxMsTouchEvent,e.MSPointerMove=g.xxMsTouchEvent,e.MSPointerUp=g.xxMsTouchEvent,navigator.userAgent.match(/mozilla/i)?e.DOMMouseScroll=g.xxDOMMouseScroll:e.onmousewheel=g.xxMouseWheel,g.xxMouseInputGrab=!0}},g.UnGrabMouseInput=function(){if(0!=g.xxMouseInputGrab){var e=g.CanvasId;e.onmousemove=null,e.onmouseup=null,e.onmousedown=null,e.touchstart=null,e.touchmove=null,e.touchend=null,e.MSPointerDown=null,e.MSPointerMove=null,e.MSPointerUp=null,navigator.userAgent.match(/mozilla/i)?e.DOMMouseScroll=null:e.onmousewheel=null,g.xxMouseInputGrab=!1}},g.GrabKeyInput=function(){1!=g.xxKeyInputGrab&&(document.onkeyup=g.xxKeyUp,document.onkeydown=g.xxKeyDown,document.onkeypress=g.xxKeyPress,g.xxKeyInputGrab=!0)},g.UnGrabKeyInput=function(){0!=g.xxKeyInputGrab&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,g.xxKeyInputGrab=!1)},g.GetPositionOfControl=function(e){var n=Array(2);for(n[0]=n[1]=0;e;)n[0]+=e.offsetLeft,n[1]+=e.offsetTop,e=e.offsetParent;return n},g.crotX=function(e,n){return 0==g.rotation?e:1==g.rotation?n:2==g.rotation?g.Canvas.canvas.width-e:3==g.rotation?g.Canvas.canvas.height-n:void 0},g.crotY=function(e,n){return 0==g.rotation?n:1==g.rotation?g.Canvas.canvas.width-e:2==g.rotation?g.Canvas.canvas.height-n:3==g.rotation?e:void 0},g.rotX=function(e,n){return 0==g.rotation||1==g.rotation?e:2==g.rotation?e-g.Canvas.canvas.width:3==g.rotation?e-g.Canvas.canvas.height:void 0},g.rotY=function(e,n){return 0==g.rotation||3==g.rotation?n:1==g.rotation?n-g.Canvas.canvas.width:2==g.rotation?n-g.Canvas.canvas.height:void 0},g.tcanvas=null,g.setRotation=function(e){for(;e<0;)e+=4;var n=e%4;if(n==g.rotation)return!0;var t=g.Canvas.canvas.width,o=g.Canvas.canvas.height;1!=g.rotation&&3!=g.rotation||(t=g.Canvas.canvas.height,o=g.Canvas.canvas.width),null==g.tcanvas&&(g.tcanvas=document.createElement("canvas"));var a=g.tcanvas.getContext("2d");return a.setTransform(1,0,0,1,0,0),a.canvas.width=t,a.canvas.height=o,a.rotate(-90*g.rotation*Math.PI/180),0==g.rotation&&a.drawImage(g.Canvas.canvas,0,0),1==g.rotation&&a.drawImage(g.Canvas.canvas,-g.Canvas.canvas.width,0),2==g.rotation&&a.drawImage(g.Canvas.canvas,-g.Canvas.canvas.width,-g.Canvas.canvas.height),3==g.rotation&&a.drawImage(g.Canvas.canvas,0,-g.Canvas.canvas.height),0!=g.rotation&&2!=g.rotation||(g.Canvas.canvas.height=t,g.Canvas.canvas.width=o),1!=g.rotation&&3!=g.rotation||(g.Canvas.canvas.height=o,g.Canvas.canvas.width=t),g.Canvas.setTransform(1,0,0,1,0,0),g.Canvas.rotate(90*n*Math.PI/180),g.rotation=n,g.Canvas.drawImage(g.tcanvas,g.rotX(0,0),g.rotY(0,0)),g.ScreenWidth=g.Canvas.canvas.width,g.ScreenHeight=g.Canvas.canvas.height,null!=g.onScreenSizeChange&&g.onScreenSizeChange(g,g.ScreenWidth,g.ScreenHeight,g.CanvasId),!0},g.StartRecording=function(){null==g.recordedData&&g.CanvasId.toBlob(function(e){var s=new FileReader;s.readAsArrayBuffer(e),s.onload=function(e){for(var n="",t=new Uint8Array(s.result),o=t.byteLength,a=0;a<o;a++)n+=String.fromCharCode(t[a]);g.recordedData=[],g.recordedStart=Date.now(),g.recordedSize=0,g.recordedData.push(p(1,0,JSON.stringify({magic:"MeshCentralRelaySession",ver:1,time:(new Date).toLocaleString(),protocol:2}))),g.recordedData.push(p(2,1,g.shortToStr(7)+g.shortToStr(8)+g.shortToStr(g.ScreenWidth)+g.shortToStr(g.ScreenHeight)));var r=4+n.length;65e3<r?g.recordedData.push(p(2,1,g.shortToStr(27)+g.shortToStr(8)+g.intToStr(r)+g.shortToStr(3)+g.shortToStr(0)+g.shortToStr(0)+g.shortToStr(0)+n)):g.recordedData.push(p(2,1,g.shortToStr(3)+g.shortToStr(r)+g.shortToStr(0)+g.shortToStr(0)+n))}})},g.StopRecording=function(){if(null!=g.recordedData){var e=g.recordedData;return e.push(p(3,0,"MeshCentralMCREC")),delete g.recordedData,delete g.recordedStart,delete g.recordedSize,e}},g.MuchTheSame=function(e,n){return Math.abs(e-n)<4},g.Debug=function(e){console.log(e)},g.getIEVersion=function(){var e=-1;if("Microsoft Internet Explorer"==navigator.appName){var n=navigator.userAgent;null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(n)&&(e=parseFloat(RegExp.$1))}return e},g.haltEvent=function(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},g}
\ No newline at end of file
public/scripts/agent-desktop-0.0.2.js
+42
-3
@@ -196,7 +196,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
196
if (obj.debugmode > 1) { console.log("KRecv(" + str.length + "): " + rstr2hex(str.substring(0, Math.min(str.length, 40)))); }
197
if (str.length < 4) return;
198
var cmdmsg = null, X = 0, Y = 0, command = ReadShort(str, 0), cmdsize = ReadShort(str, 2), jumboAdd = 0;
199
- if (obj.recordedData != null) { obj.recordedData.push({ t: Date.now(), d: str }); }
199
+ if (obj.recordedData != null) { obj.recordedData.push(recordingEntry(2, 1, str.length)); obj.recordedData.push(str); }
200
if ((command == 27) && (cmdsize == 8)) {
201
// Jumbo packet
202
if (str.length < 12) return;
@@ -779,17 +779,56 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
779
}
780
781
obj.StartRecording = function () {
782
- obj.recordedData = [];
783
- obj.recordedStart = Date.now();
782
+ if (obj.recordedData != null) return;
783
+ // Take a screen shot and save it to file
784
+ obj.CanvasId['toBlob'](function (blob) {
785
+ var fileReader = new FileReader();
786
+ fileReader.readAsArrayBuffer(blob);
787
+ fileReader.onload = function (event) {
788
+ // This is an ArrayBuffer, convert it to a string array
789
+ var binary = '', bytes = new Uint8Array(fileReader.result), length = bytes.byteLength;
790
+ for (var i = 0; i < length; i++) { binary += String.fromCharCode(bytes[i]); }
791
+ obj.recordedData = [];
792
+ obj.recordedStart = Date.now();
793
+ obj.recordedSize = 0;
794
+ obj.recordedData.push(recordingEntry(1, 0, JSON.stringify({ magic: 'MeshCentralRelaySession', ver: 1, time: new Date().toLocaleString(), protocol: 2 }))); // Metadata (nodeid: obj.nodeid)
795
+ obj.recordedData.push(recordingEntry(2, 1, obj.shortToStr(7) + obj.shortToStr(8) + obj.shortToStr(obj.ScreenWidth) + obj.shortToStr(obj.ScreenHeight))); // Screen width and height
796
+ // Save a screenshot
797
+ var cmdlen = (4 + binary.length);
798
+ if (cmdlen > 65000) {
799
+ // Jumbo Packet
800
+ obj.recordedData.push(recordingEntry(2, 1, obj.shortToStr(27) + obj.shortToStr(8) + obj.intToStr(cmdlen) + obj.shortToStr(3) + obj.shortToStr(0) + obj.shortToStr(0) + obj.shortToStr(0) + binary));
801
+ } else {
802
+ // Normal packet
803
+ obj.recordedData.push(recordingEntry(2, 1, obj.shortToStr(3) + obj.shortToStr(cmdlen) + obj.shortToStr(0) + obj.shortToStr(0) + binary));
804
+ }
805
+ };
806
+ });
807
}
808
809
obj.StopRecording = function () {
810
+ if (obj.recordedData == null) return;
811
var r = obj.recordedData;
812
+ r.push(recordingEntry(3, 0, 'MeshCentralMCREC'));
813
delete obj.recordedData;
814
delete obj.recordedStart;
815
+ delete obj.recordedSize;
816
return r;
817
}
818
819
+ function recordingEntry(type, flags, data) {
820
+ // Header: Type (2) + Flags (2) + Size(4) + Time(8)
821
+ // Type (1 = Header, 2 = Network Data), Flags (1 = Binary, 2 = User), Size (4 bytes), Time (8 bytes)
822
+ var now = Date.now();
823
+ if (typeof data == 'number') {
824
+ obj.recordedSize += data;
825
+ return obj.shortToStr(type) + obj.shortToStr(flags) + obj.intToStr(data) + obj.intToStr(now >> 32) + obj.intToStr(now & 32);
826
+ } else {
827
+ obj.recordedSize += data.length;
828
+ return obj.shortToStr(type) + obj.shortToStr(flags) + obj.intToStr(data.length) + obj.intToStr(now >> 32) + obj.intToStr(now & 32) + data;
829
+ }
830
+ }
831
+
832
// Private method
833
obj.MuchTheSame = function (a, b) { return (Math.abs(a - b) < 4); }
834
obj.Debug = function (msg) { console.log(msg); }
public/scripts/agent-redir-ws-0.1.1-min.js
+1
-1
@@ -1 +1 @@
1
-var CreateAgentRedirect=function(e,t,n,o,a,r){var c={};function l(){1==c.webSwitchOk&&1==c.webRtcActive&&(c.latency.current=-1,c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}'),c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}'),null!=c.onStateChanged&&c.onStateChanged(c,c.State))}((c.m=t).parent=c).meshserver=e,c.authCookie=o,c.rauthCookie=a,c.State=0,c.nodeid=null,c.options=null,c.socket=null,c.connectstate=-1,c.tunnelid=Math.random().toString(36).substring(2),c.protocol=t.protocol,c.onStateChanged=null,c.ctrlMsgAllowed=!0,c.attemptWebRTC=!1,c.webRtcActive=!1,c.webSwitchOk=!1,c.webchannel=null,c.webrtc=null,c.debugmode=0,c.serverIsRecording=!1,c.latency={lastSend:null,current:-1,callback:null},null==r&&(r="/"),c.consoleMessage=null,c.onConsoleMessageChange=null,c.Start=function(e){var t=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?browser=1&p="+c.protocol+"&nodeid="+e+"&id="+c.tunnelid;null!=o&&""!=o&&(t+="&auth="+o),null!=urlargs&&null!=urlargs.slowrelay&&(t+="&slowrelay="+urlargs.slowrelay),c.nodeid=e,c.connectstate=0,c.socket=new WebSocket(t),c.socket.onopen=c.xxOnSocketConnected,c.socket.onmessage=c.xxOnMessage,c.socket.onerror=function(e){},c.socket.onclose=c.xxOnSocketClosed,c.xxStateChange(1);var n="*"+r+"meshrelay.ashx?p="+c.protocol+"&nodeid="+e+"&id="+c.tunnelid;null!=a&&""!=a&&(n+="&rauth="+a),c.meshserver.send({action:"msg",type:"tunnel",nodeid:c.nodeid,value:n,usage:c.protocol})},c.xxOnSocketConnected=function(){1==c.debugmode&&console.log("onSocketConnected"),c.xxStateChange(2)},c.xxOnControlCommand=function(e){var t;try{t=JSON.parse(e)}catch(e){return}"102938"==t.ctrlChannel?("undefined"!=typeof args&&args.redirtrace&&console.log("RedirRecv",t),"console"==t.type?c.setConsoleMessage(t.msg):"rtt"==t.type&&"number"==typeof t.time?(c.latency.current=(new Date).getTime()-t.time,null!=c.latency.callbacks&&c.latency.callback(c.latency.current)):null!=c.webrtc&&("answer"==t.type?c.webrtc.setRemoteDescription(new RTCSessionDescription(t),function(){},c.xxCloseWebRTC):"webrtc0"==t.type?(c.webSwitchOk=!0,l()):"webrtc1"==t.type?c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}'):t.type)):c.xxOnSocketData(e)},c.setConsoleMessage=function(e){c.consoleMessage!=e&&(c.consoleMessage=e,c.onConsoleMessageChange&&c.onConsoleMessageChange(c,c.consoleMessage))},c.sendCtrlMsg=function(e){if(1==c.ctrlMsgAllowed){"undefined"!=typeof args&&args.redirtrace&&console.log("RedirSend",typeof e,e);try{c.socket.send(e)}catch(e){}}},c.xxOnMessage=function(e){if(c.State<3&&("c"==e.data||"cr"==e.data)){if("cr"==e.data&&(c.serverIsRecording=!0),null!=c.options){delete c.options.action,c.options.type="options";try{c.sendCtrlMsg(JSON.stringify(c.options))}catch(e){}}try{c.socket.send(c.protocol)}catch(e){}if(c.xxStateChange(3),1==c.attemptWebRTC){"undefined"!=typeof RTCPeerConnection?c.webrtc=new RTCPeerConnection(null):"undefined"!=typeof webkitRTCPeerConnection&&(c.webrtc=new webkitRTCPeerConnection(null)),null!=c.webrtc&&c.webrtc.createDataChannel&&(c.webchannel=c.webrtc.createDataChannel("DataChannel",{}),c.webchannel.onmessage=c.xxOnMessage,c.webchannel.onopen=function(){c.webRtcActive=!0,l()},c.webchannel.onclose=function(e){c.webRtcActive&&c.Stop()},c.webrtc.onicecandidate=function(e){if(null==e.candidate)try{c.sendCtrlMsg(JSON.stringify(c.webrtcoffer))}catch(e){}else c.webrtcoffer.sdp+="a="+e.candidate.candidate+"\r\n"},c.webrtc.oniceconnectionstatechange=function(){null!=c.webrtc&&("disconnected"==c.webrtc.iceConnectionState?1==c.webRtcActive?c.Stop():c.xxCloseWebRTC():"failed"==c.webrtc.iceConnectionState&&c.xxCloseWebRTC())},c.webrtc.createOffer(function(e){c.webrtcoffer=e,c.webrtc.setLocalDescription(e,function(){},c.xxCloseWebRTC)},c.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}}))}}else if("string"!=typeof e.data){if("object"==typeof e.data){if(1==i)return void d.push(e.data);if(s.readAsBinaryString&&null==c.m.ProcessBinaryData)i=!0,s.readAsBinaryString(new Blob([e.data]));else if(s.readAsArrayBuffer)i=!0,s.readAsArrayBuffer(e.data);else{for(var t="",n=new Uint8Array(e.data),o=n.byteLength,a=0;a<o;a++)t+=String.fromCharCode(n[a]);c.xxOnSocketData(t)}}else c.xxOnSocketData(e.data);if(1!=c.webRtcActive){var r=(new Date).getTime();(null==c.latency.lastSend||5e3<r-c.latency.lastSend)&&(c.latency.lastSend=r,c.sendCtrlMsg('{"ctrlChannel":"102938","type":"rtt","time":'+r+"}"))}}else c.xxOnControlCommand(e.data)};var s=new FileReader,i=!1,d=[];return s.readAsBinaryString?s.onload=function(e){c.xxOnSocketData(e.target.result),0==d.length?i=!1:s.readAsBinaryString(new Blob([d.shift()]))}:s.readAsArrayBuffer&&(s.onloadend=function(e){c.xxOnSocketData(e.target.result),0==d.length?i=!1:s.readAsArrayBuffer(d.shift())}),c.xxOnSocketData=function(e){if(e&&-1!=c.connectstate){if("object"==typeof e){if(c.m.ProcessBinaryData)return c.m.ProcessBinaryData(e);for(var t="",n=new Uint8Array(e),o=n.byteLength,a=0;a<o;a++)t+=String.fromCharCode(n[a]);e=t}else if("string"!=typeof e)return;return"undefined"!=typeof args&&args.redirtrace&&console.log("RedirRecv",typeof e,e.length,"{"==e[0]?e:rstr2hex(e).substring(0,64)),c.m.ProcessData(e)}},c.sendText=function(e){"string"!=typeof e&&(e=JSON.stringify(e)),c.send(encode_utf8(e))},c.send=function(e){"undefined"!=typeof args&&args.redirtrace&&console.log("RedirSend",typeof e,e.length,"{"==e[0]?e:rstr2hex(e).substring(0,64));try{if(null!=c.socket&&c.socket.readyState==WebSocket.OPEN)if("string"==typeof e)if(1==c.debugmode){for(var t=new Uint8Array(e.length),n=[],o=0;o<e.length;++o)t[o]=e.charCodeAt(o),n.push(e.charCodeAt(o));1==c.webRtcActive?c.webchannel.send(t.buffer):c.socket.send(t.buffer)}else{for(t=new Uint8Array(e.length),o=0;o<e.length;++o)t[o]=e.charCodeAt(o);1==c.webRtcActive?c.webchannel.send(t.buffer):c.socket.send(t.buffer)}else 1==c.webRtcActive?c.webchannel.send(e):c.socket.send(e)}catch(e){}},c.xxOnSocketClosed=function(){c.Stop(1)},c.xxStateChange=function(e){c.State!=e&&(c.State=e,c.m.xxStateChange(c.State),null!=c.onStateChanged&&c.onStateChanged(c,c.State))},c.xxCloseWebRTC=function(){if(null!=c.webchannel){try{c.webchannel.close()}catch(e){}c.webchannel=null}if(null!=c.webrtc){try{c.webrtc.close()}catch(e){}c.webrtc=null}c.webRtcActive=!1},c.Stop=function(e){if(1==c.debugmode&&console.log("stop",e),c.xxCloseWebRTC(),c.connectstate=-1,null!=c.socket){try{1==c.socket.readyState&&(c.sendCtrlMsg('{"ctrlChannel":"102938","type":"close"}'),c.socket.close())}catch(e){}c.socket=null}c.xxStateChange(0)},c}
\ No newline at end of file
1
+var CreateAgentRedirect=function(e,t,n,o,a,r){var c={};function l(){1==c.webSwitchOk&&1==c.webRtcActive&&(c.latency.current=-1,c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}'),c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}'),null!=c.onStateChanged&&c.onStateChanged(c,c.State))}((c.m=t).parent=c).meshserver=e,c.authCookie=o,c.rauthCookie=a,c.State=0,c.nodeid=null,c.options=null,c.socket=null,c.connectstate=-1,c.tunnelid=Math.random().toString(36).substring(2),c.protocol=t.protocol,c.onStateChanged=null,c.ctrlMsgAllowed=!0,c.attemptWebRTC=!1,c.webRtcActive=!1,c.webSwitchOk=!1,c.webchannel=null,c.webrtc=null,c.debugmode=0,c.serverIsRecording=!1,c.latency={lastSend:null,current:-1,callback:null},null==r&&(r="/"),c.consoleMessage=null,c.onConsoleMessageChange=null,c.Start=function(e){var t=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?browser=1&p="+c.protocol+"&nodeid="+e+"&id="+c.tunnelid;null!=o&&""!=o&&(t+="&auth="+o),null!=urlargs&&null!=urlargs.slowrelay&&(t+="&slowrelay="+urlargs.slowrelay),c.nodeid=e,c.connectstate=0,c.socket=new WebSocket(t),c.socket.onopen=c.xxOnSocketConnected,c.socket.onmessage=c.xxOnMessage,c.socket.onerror=function(e){},c.socket.onclose=c.xxOnSocketClosed,c.xxStateChange(1);var n="*"+r+"meshrelay.ashx?p="+c.protocol+"&nodeid="+e+"&id="+c.tunnelid;null!=a&&""!=a&&(n+="&rauth="+a),c.meshserver.send({action:"msg",type:"tunnel",nodeid:c.nodeid,value:n,usage:c.protocol})},c.xxOnSocketConnected=function(){1==c.debugmode&&console.log("onSocketConnected"),c.xxStateChange(2)},c.xxOnControlCommand=function(e){var t;try{t=JSON.parse(e)}catch(e){return}"102938"==t.ctrlChannel?("undefined"!=typeof args&&args.redirtrace&&console.log("RedirRecv",t),"console"==t.type?c.setConsoleMessage(t.msg):"rtt"==t.type&&"number"==typeof t.time?(c.latency.current=(new Date).getTime()-t.time,null!=c.latency.callbacks&&c.latency.callback(c.latency.current)):null!=c.webrtc&&("answer"==t.type?c.webrtc.setRemoteDescription(new RTCSessionDescription(t),function(){},c.xxCloseWebRTC):"webrtc0"==t.type?(c.webSwitchOk=!0,l()):"webrtc1"==t.type?c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}'):t.type)):c.xxOnSocketData(e)},c.setConsoleMessage=function(e){c.consoleMessage!=e&&(c.consoleMessage=e,c.onConsoleMessageChange&&c.onConsoleMessageChange(c,c.consoleMessage))},c.sendCtrlMsg=function(e){if(1==c.ctrlMsgAllowed){"undefined"!=typeof args&&args.redirtrace&&console.log("RedirSend",typeof e,e);try{c.socket.send(e)}catch(e){}}},c.xxOnMessage=function(e){if(c.State<3&&("c"==e.data||"cr"==e.data)){if("cr"==e.data&&(c.serverIsRecording=!0),null!=c.options){delete c.options.action,c.options.type="options";try{c.sendCtrlMsg(JSON.stringify(c.options))}catch(e){}}try{c.socket.send(c.protocol)}catch(e){}if(c.xxStateChange(3),1==c.attemptWebRTC){"undefined"!=typeof RTCPeerConnection?c.webrtc=new RTCPeerConnection(null):"undefined"!=typeof webkitRTCPeerConnection&&(c.webrtc=new webkitRTCPeerConnection(null)),null!=c.webrtc&&c.webrtc.createDataChannel&&(c.webchannel=c.webrtc.createDataChannel("DataChannel",{}),c.webchannel.onmessage=c.xxOnMessage,c.webchannel.onopen=function(){c.webRtcActive=!0,l()},c.webchannel.onclose=function(e){c.webRtcActive&&c.Stop()},c.webrtc.onicecandidate=function(e){if(null==e.candidate)try{c.sendCtrlMsg(JSON.stringify(c.webrtcoffer))}catch(e){}else c.webrtcoffer.sdp+="a="+e.candidate.candidate+"\r\n"},c.webrtc.oniceconnectionstatechange=function(){null!=c.webrtc&&("disconnected"==c.webrtc.iceConnectionState?1==c.webRtcActive?c.Stop():c.xxCloseWebRTC():"failed"==c.webrtc.iceConnectionState&&c.xxCloseWebRTC())},c.webrtc.createOffer(function(e){c.webrtcoffer=e,c.webrtc.setLocalDescription(e,function(){},c.xxCloseWebRTC)},c.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}}))}}else if("string"!=typeof e.data){if("object"==typeof e.data){if(1==i)return void d.push(e.data);if(s.readAsBinaryString&&null==c.m.ProcessBinaryData)i=!0,s.readAsBinaryString(new Blob([e.data]));else if(s.readAsArrayBuffer)i=!0,s.readAsArrayBuffer(e.data);else{for(var t="",n=new Uint8Array(e.data),o=n.byteLength,a=0;a<o;a++)t+=String.fromCharCode(n[a]);c.xxOnSocketData(t)}}else c.xxOnSocketData(e.data);if(1!=c.webRtcActive){var r=(new Date).getTime();(null==c.latency.lastSend||5e3<r-c.latency.lastSend)&&(c.latency.lastSend=r,c.sendCtrlMsg('{"ctrlChannel":"102938","type":"rtt","time":'+r+"}"))}}else c.xxOnControlCommand(e.data)};var s=new FileReader,i=!1,d=[];return s.readAsBinaryString&&null==c.m.ProcessBinaryData?s.onload=function(e){c.xxOnSocketData(e.target.result),0==d.length?i=!1:s.readAsBinaryString(new Blob([d.shift()]))}:s.readAsArrayBuffer&&(s.onloadend=function(e){c.xxOnSocketData(e.target.result),0==d.length?i=!1:s.readAsArrayBuffer(d.shift())}),c.xxOnSocketData=function(e){if(e&&-1!=c.connectstate){if("object"==typeof e){if(c.m.ProcessBinaryData)return c.m.ProcessBinaryData(e);for(var t="",n=new Uint8Array(e),o=n.byteLength,a=0;a<o;a++)t+=String.fromCharCode(n[a]);e=t}else if("string"!=typeof e)return;return"undefined"!=typeof args&&args.redirtrace&&console.log("RedirRecv",typeof e,e.length,"{"==e[0]?e:rstr2hex(e).substring(0,64)),c.m.ProcessData(e)}},c.sendText=function(e){"string"!=typeof e&&(e=JSON.stringify(e)),c.send(encode_utf8(e))},c.send=function(e){"undefined"!=typeof args&&args.redirtrace&&console.log("RedirSend",typeof e,e.length,"{"==e[0]?e:rstr2hex(e).substring(0,64));try{if(null!=c.socket&&c.socket.readyState==WebSocket.OPEN)if("string"==typeof e)if(1==c.debugmode){for(var t=new Uint8Array(e.length),n=[],o=0;o<e.length;++o)t[o]=e.charCodeAt(o),n.push(e.charCodeAt(o));1==c.webRtcActive?c.webchannel.send(t.buffer):c.socket.send(t.buffer)}else{for(t=new Uint8Array(e.length),o=0;o<e.length;++o)t[o]=e.charCodeAt(o);1==c.webRtcActive?c.webchannel.send(t.buffer):c.socket.send(t.buffer)}else 1==c.webRtcActive?c.webchannel.send(e):c.socket.send(e)}catch(e){}},c.xxOnSocketClosed=function(){c.Stop(1)},c.xxStateChange=function(e){c.State!=e&&(c.State=e,c.m.xxStateChange(c.State),null!=c.onStateChanged&&c.onStateChanged(c,c.State))},c.xxCloseWebRTC=function(){if(null!=c.webchannel){try{c.webchannel.close()}catch(e){}c.webchannel=null}if(null!=c.webrtc){try{c.webrtc.close()}catch(e){}c.webrtc=null}c.webRtcActive=!1},c.Stop=function(e){if(1==c.debugmode&&console.log("stop",e),c.xxCloseWebRTC(),c.connectstate=-1,null!=c.socket){try{1==c.socket.readyState&&(c.sendCtrlMsg('{"ctrlChannel":"102938","type":"close"}'),c.socket.close())}catch(e){}c.socket=null}c.xxStateChange(0)},c}
\ No newline at end of file
public/scripts/amt-wsman-0.2.0-min.js
+1
-1
@@ -1 +1 @@
1
-var WsmanStackCreateService=function(e,s,r,a,o,t){var p={};function l(e){if(!e)return"";var s=" ";for(var r in e)e.hasOwnProperty(r)&&0===r.indexOf("@")&&(s+=r.substring(1)+'="'+e[r]+'" ');return s}function w(e){if(!e)return"";if("string"==typeof e)return e;if(e.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+e.InstanceID+"</w:Selector></w:SelectorSet>";var s="<w:SelectorSet>";for(var r in e)if(e.hasOwnProperty(r)){if(s+='<w:Selector Name="'+r+'">',e[r].ReferenceParameters){s+="<a:EndpointReference>",s+="<a:Address>"+e[r].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+e[r].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var a=e[r].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(a))for(var o=0;o<a.length;o++)s+="<w:Selector"+l(a[o])+">"+a[o].Value+"</w:Selector>";else s+="<w:Selector"+l(a)+">"+a.Value+"</w:Selector>";s+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else s+=e[r];s+="</w:Selector>"}return s+="</w:SelectorSet>"}return p.NextMessageId=1,p.Address="/wsman",p.comm=CreateWsmanComm(e,s,r,a,o,t),p.PerformAjax=function(e,o,s,r,a){null==a&&(a=""),p.comm.PerformAjax('<?xml version=\"1.0\" encoding=\"utf-8\"?><Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns="http://www.w3.org/2003/05/soap-envelope" '+a+"><Header><a:Action>"+e,function(e,s,r){if(200==s){var a=p.ParseWsman(e);a&&null!=a?o(p,a.Header.ResourceURI,a,200,r):o(p,null,{Header:{HttpError:s}},601,r)}else o(p,null,{Header:{HttpError:s}},s,r)},s,r)},p.CancelAllQueries=function(e){p.comm.CancelAllQueries(e)},p.GetNameFromUrl=function(e){var s=e.lastIndexOf("/");return-1==s?e:e.substring(s+1)},p.ExecSubscribe=function(e,s,r,a,o,t,n,l,c,d){var m="",i="";null!=c&&null!=d&&(m="<t:IssuedTokens><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>"+c+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+d+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>",i='<Auth Profile="http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/secprofile/http/digest"/>'),l=null!=l&&null!=l?"<a:ReferenceParameters>"+l+"</a:ReferenceParameters>":"";var u="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+w(n)+m+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.dmtf.org/wbem/wsman/1/wsman/'+s+'"><e:NotifyTo><a:Address>'+r+"</a:Address></e:NotifyTo>"+i+"</e:Delivery><e:Expires>PT0.000000S</e:Expires></e:Subscribe>";p.PerformAjax(u+"</Body></Envelope>",a,o,t,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:m="http://x.com"')},p.ExecUnSubscribe=function(e,s,r,a,o){var t="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+w(o)+"</Header><Body><e:Unsubscribe/>";p.PerformAjax(t+"</Body></Envelope>",s,r,a,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')},p.ExecPut=function(e,s,r,a,o,t){var n="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+w(t)+"</Header><Body>"+function(e,s){if(!e||null==s)return"";var r=p.GetNameFromUrl(e),a="<r:"+r+' xmlns:r="'+e+'">';for(var o in s)if(s.hasOwnProperty(o)&&0!==o.indexOf("__")&&0!==o.indexOf("@")&&void 0!==s[o]&&null!==s[o]&&"function"!=typeof s[o])if("object"==typeof s[o]&&s[o].ReferenceParameters){a+="<r:"+o+"><a:Address>"+s[o].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+s[o].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var t=s[o].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(t))for(var n=0;n<t.length;n++)a+="<w:Selector"+l(t[n])+">"+t[n].Value+"</w:Selector>";else a+="<w:Selector"+l(t)+">"+t.Value+"</w:Selector>";a+="</w:SelectorSet></a:ReferenceParameters></r:"+o+">"}else if(Array.isArray(s[o]))for(n=0;n<s[o].length;n++)a+="<r:"+o+">"+s[o][n].toString()+"</r:"+o+">";else a+="<r:"+o+">"+s[o].toString()+"</r:"+o+">";return a+="</r:"+r+">"}(e,s);p.PerformAjax(n+"</Body></Envelope>",r,a,o)},p.ExecCreate=function(e,s,r,a,o,t){var n=p.GetNameFromUrl(e),l="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+w(t)+"</Header><Body><g:"+n+' xmlns:g="'+e+'">';for(var c in s)l+="<g:"+c+">"+s[c]+"</g:"+c+">";p.PerformAjax(l+"</g:"+n+"></Body></Envelope>",r,a,o)},p.ExecCreateXml=function(e,s,r,a,o){var t=p.GetNameFromUrl(e);p.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout></Header><Body><r:"+t+' xmlns:r="'+e+'">'+s+"</r:"+t+"></Body></Envelope>",r,a,o)},p.ExecDelete=function(e,s,r,a,o){var t="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+w(s)+"</Header><Body /></Envelope>";p.PerformAjax(t,r,a,o)},p.ExecGet=function(e,s,r,a){p.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>",s,r,a)},p.ExecMethod=function(e,s,r,a,o,t,n){var l="";for(var c in r)if(null!=r[c])if(Array.isArray(r[c]))for(var d in r[c])l+="<r:"+c+">"+r[c][d]+"</r:"+c+">";else l+="<r:"+c+">"+r[c]+"</r:"+c+">";p.ExecMethodXml(e,s,l,a,o,t,n)},p.ExecMethodXml=function(e,s,r,a,o,t,n){p.PerformAjax(e+"/"+s+"</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+w(n)+"</Header><Body><r:"+s+'_INPUT xmlns:r="'+e+'">'+r+"</r:"+s+"_INPUT></Body></Envelope>",a,o,t)},p.ExecEnum=function(e,s,r,a){p.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>',s,r,a)},p.ExecPull=function(e,s,r,a,o){p.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>'+s+"</EnumerationContext><MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters></Pull></Body></Envelope>",r,a,o)},p.ParseWsman=function(s){try{s.childNodes||(s=function(e){{if(window.DOMParser)return(new DOMParser).parseFromString(e,"text/xml");var s=new ActiveXObject("Microsoft.XMLDOM");return s.async=!1,s.loadXML(e),s}}(s));var e,r={Header:{}},a=s.getElementsByTagName("Header")[0];if(!(a=a||s.getElementsByTagName("a:Header")[0]))return null;for(var o=0;o<a.childNodes.length;o++){var t=a.childNodes[o];r.Header[t.localName]=t.textContent}var n=s.getElementsByTagName("Body")[0];return(n=n||s.getElementsByTagName("a:Body")[0])?(0<n.childNodes.length&&((e=n.childNodes[0].localName).indexOf("_OUTPUT")==e.length-7&&(e=e.substring(0,e.length-7)),r.Header.Method=e,r.Body=function e(s){var r,a={};for(var o=0;o<s.childNodes.length;o++){var t=s.childNodes[o];"true"==(r=0==t.childElementCount?t.textContent:e(t))&&(r=!0),"false"==r&&(r=!1);var n=r;if(0<t.attributes.length){n={Value:r};for(var l=0;l<t.attributes.length;l++)n["@"+t.attributes[l].name]=t.attributes[l].value}a[t.localName]instanceof Array?a[t.localName].push(n):null==a[t.localName]?a[t.localName]=n:a[t.localName]=[a[t.localName],n]}return a}(n.childNodes[0])),r):null}catch(e){return console.log("Unable to parse XML: "+s),null}},p}
\ No newline at end of file
1
+var WsmanStackCreateService=function(e,s,r,a,o,t){var p={};function l(e){if(!e)return"";var s=" ";for(var r in e)e.hasOwnProperty(r)&&0===r.indexOf("@")&&(s+=r.substring(1)+'="'+e[r]+'" ');return s}function w(e){if(!e)return"";if("string"==typeof e)return e;if(e.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+e.InstanceID+"</w:Selector></w:SelectorSet>";var s="<w:SelectorSet>";for(var r in e)if(e.hasOwnProperty(r)){if(s+='<w:Selector Name="'+r+'">',e[r].ReferenceParameters){s+="<a:EndpointReference>",s+="<a:Address>"+e[r].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+e[r].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var a=e[r].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(a))for(var o=0;o<a.length;o++)s+="<w:Selector"+l(a[o])+">"+a[o].Value+"</w:Selector>";else s+="<w:Selector"+l(a)+">"+a.Value+"</w:Selector>";s+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else s+=e[r];s+="</w:Selector>"}return s+="</w:SelectorSet>"}return p.NextMessageId=1,p.Address="/wsman",p.comm=CreateWsmanComm(e,s,r,a,o,t),p.PerformAjax=function(e,o,s,r,a){null==a&&(a=""),p.comm.PerformAjax('<?xml version=\"1.0\" encoding=\"utf-8\"?><Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns="http://www.w3.org/2003/05/soap-envelope" '+a+"><Header><a:Action>"+e,function(e,s,r){if(200==s){var a=p.ParseWsman(e);a&&null!=a?o(p,a.Header.ResourceURI,a,200,r):o(p,null,{Header:{HttpError:s}},601,r)}else o(p,null,{Header:{HttpError:s}},s,r)},s,r)},p.CancelAllQueries=function(e){p.comm.CancelAllQueries(e)},p.GetNameFromUrl=function(e){var s=e.lastIndexOf("/");return-1==s?e:e.substring(s+1)},p.ExecSubscribe=function(e,s,r,a,o,t,n,l,d,c){var m="",i="";null!=d&&null!=c&&(m="<t:IssuedTokens><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>"+d+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+c+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>",i='<Auth Profile="http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/secprofile/http/digest"/>'),l=null!=l&&null!=l?"<a:ReferenceParameters>"+l+"</a:ReferenceParameters>":"";var u="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+w(n)+m+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.dmtf.org/wbem/wsman/1/wsman/'+s+'"><e:NotifyTo><a:Address>'+r+"</a:Address></e:NotifyTo>"+i+"</e:Delivery><e:Expires>PT0.000000S</e:Expires></e:Subscribe>";p.PerformAjax(u+"</Body></Envelope>",a,o,t,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:m="http://x.com"')},p.ExecUnSubscribe=function(e,s,r,a,o){var t="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+w(o)+"</Header><Body><e:Unsubscribe/>";p.PerformAjax(t+"</Body></Envelope>",s,r,a,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')},p.ExecPut=function(e,s,r,a,o,t){var n="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+w(t)+"</Header><Body>"+function(e,s){if(!e||null==s)return"";var r=p.GetNameFromUrl(e),a="<r:"+r+' xmlns:r="'+e+'">';for(var o in s)if(s.hasOwnProperty(o)&&0!==o.indexOf("__")&&0!==o.indexOf("@")&&void 0!==s[o]&&null!==s[o]&&"function"!=typeof s[o])if("object"==typeof s[o]&&s[o].ReferenceParameters){a+="<r:"+o+"><a:Address>"+s[o].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+s[o].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var t=s[o].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(t))for(var n=0;n<t.length;n++)a+="<w:Selector"+l(t[n])+">"+t[n].Value+"</w:Selector>";else a+="<w:Selector"+l(t)+">"+t.Value+"</w:Selector>";a+="</w:SelectorSet></a:ReferenceParameters></r:"+o+">"}else if(Array.isArray(s[o]))for(n=0;n<s[o].length;n++)a+="<r:"+o+">"+s[o][n].toString()+"</r:"+o+">";else a+="<r:"+o+">"+s[o].toString()+"</r:"+o+">";return a+="</r:"+r+">"}(e,s);p.PerformAjax(n+"</Body></Envelope>",r,a,o)},p.ExecCreate=function(e,s,r,a,o,t){var n=p.GetNameFromUrl(e),l="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+w(t)+"</Header><Body><g:"+n+' xmlns:g="'+e+'">';for(var d in s)l+="<g:"+d+">"+s[d]+"</g:"+d+">";p.PerformAjax(l+"</g:"+n+"></Body></Envelope>",r,a,o)},p.ExecCreateXml=function(e,s,r,a,o){var t=p.GetNameFromUrl(e);p.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout></Header><Body><r:"+t+' xmlns:r="'+e+'">'+s+"</r:"+t+"></Body></Envelope>",r,a,o)},p.ExecDelete=function(e,s,r,a,o){var t="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+w(s)+"</Header><Body /></Envelope>";p.PerformAjax(t,r,a,o)},p.ExecGet=function(e,s,r,a){p.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>",s,r,a)},p.ExecMethod=function(e,s,r,a,o,t,n){var l="";for(var d in r)if(null!=r[d])if(Array.isArray(r[d]))for(var c in r[d])l+="<r:"+d+">"+r[d][c]+"</r:"+d+">";else l+="<r:"+d+">"+r[d]+"</r:"+d+">";p.ExecMethodXml(e,s,l,a,o,t,n)},p.ExecMethodXml=function(e,s,r,a,o,t,n){p.PerformAjax(e+"/"+s+"</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+w(n)+"</Header><Body><r:"+s+'_INPUT xmlns:r="'+e+'">'+r+"</r:"+s+"_INPUT></Body></Envelope>",a,o,t)},p.ExecEnum=function(e,s,r,a){p.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>',s,r,a)},p.ExecPull=function(e,s,r,a,o){p.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+p.Address+"</a:To><w:ResourceURI>"+e+"</w:ResourceURI><a:MessageID>"+p.NextMessageId+++'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>'+s+"</EnumerationContext><MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters></Pull></Body></Envelope>",r,a,o)},p.ParseWsman=function(s){try{s.childNodes||(s=function(e){{if(window.DOMParser)return(new DOMParser).parseFromString(e,"text/xml");var s=new ActiveXObject("Microsoft.XMLDOM");return s.async=!1,s.loadXML(e),s}}(s));var e,r={Header:{}},a=s.getElementsByTagName("Header")[0];if(!(a=a||s.getElementsByTagName("a:Header")[0]))return null;for(var o=0;o<a.childNodes.length;o++){var t=a.childNodes[o];r.Header[t.localName]=t.textContent}var n=s.getElementsByTagName("Body")[0];return(n=n||s.getElementsByTagName("a:Body")[0])?(0<n.childNodes.length&&((e=n.childNodes[0].localName).indexOf("_OUTPUT")==e.length-7&&(e=e.substring(0,e.length-7)),r.Header.Method=e,r.Body=function e(s){var r,a={};for(var o=0;o<s.childNodes.length;o++){var t=s.childNodes[o];"true"==(r=0==t.childElementCount?t.textContent:e(t))&&(r=!0),"false"==r&&(r=!1);var n=r;if(0<t.attributes.length){n={Value:r};for(var l=0;l<t.attributes.length;l++)n["@"+t.attributes[l].name]=t.attributes[l].value}a[t.localName]instanceof Array?a[t.localName].push(n):null==a[t.localName]?a[t.localName]=n:a[t.localName]=[a[t.localName],n]}return a}(n.childNodes[0])),r):null}catch(e){return console.log("Unable to parse XML: "+s),null}},p}
\ No newline at end of file
translate/translate.json
+9
-6
@@ -20335,6 +20335,12 @@
20335
"default.handlebars->23->1453"
20336
]
20337
},
20338
+ {
20339
+ "en": "Record remote desktop session to file",
20340
+ "xloc": [
20341
+ "default.handlebars->container->column_l->p11->deskarea0->deskarea4->1"
20342
+ ]
20343
+ },
20344
{
20345
"cs": "Rekurzivní mazání",
20346
"de": "Rekursiv Löschen",
@@ -21679,7 +21685,7 @@
21685
"ru": "Сохранить снимок экрана удаленного рабочего стола",
21686
"zh-chs": "保存遠程桌面的屏幕截圖",
21687
"xloc": [
21682
- "default.handlebars->container->column_l->p11->deskarea0->deskarea1->1"
21688
+ "default.handlebars->container->column_l->p11->deskarea0->deskarea4->1"
21689
]
21690
},
21691
{
@@ -21711,10 +21717,7 @@
21717
"nl": "Opslaan...",
21718
"pt": "Salvar...",
21719
"ru": "Сохранить...",
21714
- "zh-chs": "保存...",
21715
- "xloc": [
21716
- "default.handlebars->container->column_l->p11->deskarea0->deskarea1->1"
21717
- ]
21720
+ "zh-chs": "保存..."
21721
},
21722
{
21723
"cs": "Škálování",
@@ -30087,4 +30090,4 @@
30090
]
30091
}
30092
]
30090
-}
30093
+}
\ No newline at end of file
views/default.handlebars
+12
-6
@@ -572,7 +572,7 @@
572
<span id=DeskOpenWebButton title="Open a web address on the remote computer"><img src='images/icon-url2.png' onclick=deviceUrlFunction() height=16 width=16 style=padding-top:2px /></span>
573
<span id=DeskBackgroundButton title="Toggle remote desktop background"><img src='images/icon-background.png' onclick=deviceToggleBackground(event) height=16 width=16 style=padding-top:2px /></span>
574
<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>
575
- <span id=DeskRecordButton title="Record remote desktop session to file" style="display:none"><img src='images/icon-film.png' onclick=deskRecordSession() height=16 width=16 style=padding-top:2px /></span>
575
+ <span id=DeskRecordButton title="Record remote desktop session to file" style="display:none"><img id=DeskRecordButtonImage src='images/icon-film.png' onclick=deskRecordSession() height=16 width=16 style=padding-top:2px /></span>
576
</div>
577
<div>
578
<select id="deskkeys">
@@ -5806,7 +5806,7 @@
5806
5807
// Display this only if we have Chat & Notify permissions
5808
QV('DeskSaveImageButton', (deskState == 3) && (Q('Desk')['toBlob'] != null));
5809
- QV('DeskRecordButton', (deskState == 3));
5809
+ QV('DeskRecordButton', (deskState == 3) && (Q('Desk')['toBlob'] != null));
5810
QV('DeskChatButton', ((rights & 16384) != 0) && (browserfullscreen == false) && (inputAllowed) && (currentNode.agent) && online);
5811
QV('DeskNotifyButton', ((rights & 16384) != 0) && (browserfullscreen == false) && (currentNode.agent) && (currentNode.agent.id < 5) && (inputAllowed) && (currentNode.agent) && online);
5812
@@ -5994,6 +5994,9 @@
5994
QH('deskstatus', str);
5995
switch (state) {
5996
case 0:
5997
+ // Stop recording
5998
+ if (desktop.m.recordedData != null) { deskRecordSession(); }
5999
+
6000
// Disconnect and clean up the remote desktop
6001
desktop.Stop();
6002
desktopNode = desktop = null;
@@ -6530,13 +6533,13 @@
6533
if (desktop == null) return;
6534
if (desktop.m.recordedData == null) {
6535
// Start recording
6533
- console.log('Start record');
6536
+ Q('DeskRecordButtonImage').src = 'images/icon-film-red.png';
6537
desktop.m.StartRecording();
6538
} else {
6539
// Stop recording
6537
- console.log('Stop record');
6538
- var rec = desktop.m.StopRecording();
6539
- console.log('frames', rec.length);
6540
+ Q('DeskRecordButtonImage').src = 'images/icon-film.png';
6541
+ var d = new Date(), n = 'DesktopSesion-' + 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);
6542
+ saveAs(data2blob(desktop.m.StopRecording().join('')), n + '.mcrec');
6543
}
6544
}
6545
@@ -11659,6 +11662,9 @@
11662
if ((xxcurrentView == 50) || (Math.floor(xxcurrentView / 10) != Math.floor(x / 10))) { goBackStack.push(xxcurrentView); }
11663
}
11664
11665
+ // If we are recording the desktop, stop it now.
11666
+ if ((xxcurrentView == 11) && (desktop != null) && (desktop.m.recordedData != null)) { deskRecordSession(); }
11667
+
11668
// Edit this line when adding a new screen
11669
for (var i = 0; i < 52; i++) { QV('p' + i, i == x); }
11670
xxcurrentView = x;