Changed minification strategy, added minify support to multi-language.

Ylian Saint-Hilaire committed Oct 24, 2019 at 10:45 UTC 8d6c0bbb42f30926ac3df8868a3f8f276ccb9440
34 files changed +9398 -7868
MeshCentralServer.njsproj
+2
@@ -271,6 +271,8 @@
271 <Content Include="readme.md" />
272 <Content Include="sample-config.json" />
273 <Content Include="SourceFileList.txt" />
274 + <Content Include="translate\readme.txt" />
275 + <Content Include="translate\translate.json" />
276 <Content Include="views\agentinvite.handlebars" />
277 <Content Include="views\default-min.handlebars" />
278 <Content Include="views\default-mobile-min.handlebars" />
package.json
+2
@@ -37,8 +37,10 @@
37 "express": "^4.17.0",
38 "express-handlebars": "^3.1.0",
39 "express-ws": "^4.0.0",
40 + "html-minifier": "^4.0.0",
41 "ipcheck": "^0.1.0",
42 "meshcentral": "*",
43 + "minify-js": "0.0.4",
44 "minimist": "^1.2.0",
45 "multiparty": "^4.2.1",
46 "nedb": "^1.8.0",
public/compress.bat
+3 -17
@@ -1,18 +1,4 @@
1 @ECHO OFF
2 -CALL:CompressHandlebars default
3 -CALL:CompressHandlebars default-mobile
4 -CALL:CompressHandlebars login
5 -CALL:CompressHandlebars login-mobile
6 -CALL:CompressHandlebars messenger
7 -PAUSE
8 -GOTO:eof
9 -
10 -:CompressHandlebars
11 -ECHO COMPRESS ..\views\%~1.handlebars TO ..\views\%~1-min.handlebars
12 -DEL ..\views\%~1-min.handlebars
13 -COPY ..\views\%~1.handlebars index.html
14 -..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe compress.wcc -c
15 -COPY compress.htm ..\views\%~1-min.handlebars
16 -DEL compress.htm
17 -DEL index.html
18 -GOTO:eof
2 +CD ..\translate
3 +C:\Users\Default.DESKTOP-M9I88C9\AppData\Roaming\nvm\v12.13.0\node translate.js minifyall
4 +C:\Users\Default.DESKTOP-M9I88C9\AppData\Roaming\nvm\v12.13.0\node translate.js translateall
public/player-min.htm new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><script src=scripts/agent-desktop-0.0.2.js></script><script src=scripts/amt-desktop-0.0.2.js></script><script src=scripts/amt-terminal-0.0.2.js></script><script src=scripts/zlib.js></script><script src=scripts/zlib-inflate.js></script><script src=scripts/zlib-adler32.js></script><script src=scripts/zlib-crc32.js></script><body style=overflow:hidden;background-color:#000><div id=p11 class=noselect style=overflow:hidden><div id=deskarea0><div id=deskarea1 class=areaHead><div class=toright2><div class=deskareaicon title="Toggle View Mode"onclick=toggleAspectRatio(1)>&#8690;</div></div><div><input id=OpenFileButton type=button value="Open File..."onclick=openfile()><span id=deskstatus></span></div></div><div id=deskarea2><div class=areaProgress><div id=progressbar></div></div></div><div id=deskarea3x style="max-height:calc(100vh - 54px);height:calc(100vh - 54px)"onclick=togglePause()><div id=bigok style="display:none;left:calc((100vh / 2))"><b>&checkmark;</b></div><div id=bigfail style="display:none;left:calc((100vh / 2))"><b>&#10007;</b></div><div id=metadatadiv style=padding:20px;color:#d3d3d3;text-align:left;display:none></div><div id=DeskParent><canvas id=Desk width=640 height=480></canvas></div><div id=TermParent style=display:none><pre id=Term></pre></div><div id=p11DeskConsoleMsg style=display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:#ff0;background-color:rgba(0,0,0,.6);padding:10px;border-radius:5px onclick=clearConsoleMsg()></div></div><div id=deskarea4 class=areaFoot><div class=toright2><div id=timespan style=padding-top:4px;padding-right:4px>00:00:00</div></div><div>&nbsp; <input id=PlayButton type=button value=Play disabled onclick=play()> <input id=PauseButton type=button value=Pause disabled onclick=pause()> <input id=RestartButton type=button value=Restart disabled onclick=restart()><select id=PlaySpeed onchange=this.blur()><option value=4>1/4 Speed<option value=2>1/2 Speed<option value=1 selected>Normal Speed<option value=0.5>2x Speed<option value=0.25>4x Speed<option value=0.1>10x Speed</select></div></div></div><div id=dialog class=noselect style=display:none><div id=dialogHeader><div tabindex=0 id=id_dialogclose onclick=setDialogMode() onkeypress='"Enter"==event.key&&setDialogMode()'>&#x2716;</div><div id=id_dialogtitle></div></div><div id=dialogBody><div id=dialog1><div id=id_dialogMessage></div></div><div id=dialog2><div id=id_dialogOptions></div></div></div><div id=idx_dlgButtonBar><input id=idx_dlgCancelButton type=button value=Cancel onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK onclick=dialogclose(1)><div><input id=idx_dlgDeleteButton type=button value=Delete style=display:none onclick=dialogclose(2)></div></div></div></div><script>var recFile=null,recFilePtr=0,recFileStartTime=0,recFileLastTime=0,recFileEndTime=0,recFileMetadata=null,recFileProtocol=0,agentDesktop=null,amtDesktop=null,playing=!1,readState=0,waitTimer=null,waitTimerArgs=null,deskAspectRatio=0,currentDeltaTimeTotalSec=0;function start(){window.onresize=deskAdjust,document.ondrop=ondrop,document.ondragover=ondragover,document.ondragleave=ondragleave,document.onkeypress=onkeypress,Q("PlaySpeed").value=1,cleanup()}function readNextBlock(l){if(recFilePtr+16>recFile.size)QS("progressbar").width="100%",l(-1);else{var e=new FileReader;e.onload=function(){var e=ReadShort(this.result,0),t=ReadShort(this.result,2),a=ReadInt(this.result,4),r=(ReadInt(this.result,8)<<32)+ReadInt(this.result,12);if(recFilePtr+16+a>recFile.size)QS("progressbar").width="100%",l(-1);else{var i=new FileReader;i.onload=function(){recFilePtr+=16+a,QS("progressbar").width=0==recFileEndTime?Math.floor(recFilePtr/recFile.size*100)+"%":Math.floor((recFileLastTime-recFileStartTime)/(recFileEndTime-recFileStartTime)*100)+"%",l(e,t,r,this.result)},i.readAsBinaryString(recFile.slice(recFilePtr+16,recFilePtr+16+a))}},e.readAsBinaryString(recFile.slice(recFilePtr,recFilePtr+16))}}function readLastBlock(i){if(recFile.size<32)i(-1);else{var e=new FileReader;e.onload=function(){var e=ReadShort(this.result,0),t=ReadShort(this.result,2),a=ReadInt(this.result,4),r=(ReadInt(this.result,8)<<32)+ReadInt(this.result,12);3==e&&16==a&&"MeshCentralMCREC"==this.result.substring(16,32)?i(e,t,r):i(-1)},e.readAsBinaryString(recFile.slice(recFile.size-32,recFile.size))}}function addInfo(e,t){return null==t?"":addInfoNoEsc(e,EscapeHtml(t))}function addInfoNoEsc(e,t){return null==t?"":"<span style=color:gray>"+EscapeHtml(e)+"</span>:&nbsp;<span style=font-size:20px>"+t+"</span><br/>"}function processFirstBlock(e,t,a,r){if(recFileProtocol=0,1==e&&0==t){try{recFileMetadata=JSON.parse(r)}catch(e){return void cleanup()}if(null!=recFileMetadata&&"MeshCentralRelaySession"==recFileMetadata.magic&&1==recFileMetadata.ver){var i="";if(i+=addInfo("Time",recFileMetadata.time),0!=recFileEndTime){var l=Math.floor((recFileEndTime-a)/1e3);i+=addInfo("Duration",format("{0} second{1}",l,1<l?"s":""))}if(i+=addInfo("Username",recFileMetadata.username),i+=addInfo("UserID",recFileMetadata.userid),i+=addInfo("SessionID",recFileMetadata.sessionid),recFileMetadata.ipaddr1&&recFileMetadata.ipaddr2&&(i+=addInfo("Addresses",format("{0} to {1}",recFileMetadata.ipaddr1,recFileMetadata.ipaddr2))),recFileMetadata.devicename&&(i+=addInfo("DeviceName",recFileMetadata.devicename)),i+=addInfo("NodeID",recFileMetadata.nodeid),recFileMetadata.protocol){var n=recFileMetadata.protocol;1==n?n="MeshCentral Terminal":2==n?n="MeshCentral Desktop":100==n?n="Intel&reg; AMT WSMAN":101==n&&(n="Intel&reg; AMT Redirection"),i+=addInfoNoEsc("Protocol",n)}QV("DeskParent",!0),QV("TermParent",!1),1==recFileMetadata.protocol?(recFileProtocol=1,i+="<br /><br /><span style=color:gray>Press [space] to play/pause.</span>",QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),recFileStartTime=recFileLastTime=a):2==recFileMetadata.protocol?(recFileProtocol=2,i+="<br /><br /><span style=color:gray>Press [space] to play/pause.</span>",QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),recFileStartTime=recFileLastTime=a,(agentDesktop=CreateAgentRemoteDesktop("Desk")).onScreenSizeChange=deskAdjust,agentDesktop.State=3,deskAdjust()):101==recFileMetadata.protocol&&(recFileProtocol=101,i+="<br /><br /><span style=color:gray>Press [space] to play/pause.</span>",QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),recFileStartTime=recFileLastTime=a,(amtDesktop=CreateAmtRemoteDesktop("Desk")).onScreenSizeChange=deskAdjust,amtDesktop.State=3,amtDesktop.Start(),deskAdjust()),QV("metadatadiv",!0),QH("metadatadiv",i),QH("deskstatus",recFile.name)}else cleanup()}else cleanup()}function processBlock(e,t,a,r){if(e<0)pause();else{var i=Math.round((a-recFileLastTime)*parseFloat(Q("PlaySpeed").value));i<5?processBlockEx(e,t,a,r):(waitTimerArgs=[e,t,a,r],waitTimer=setTimeout(function(){waitTimer=null,processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3])},i))}}function processBlockEx(e,t,a,r){if(0!=playing){var i=0!=(1&t),l=0!=(2&t),n=Math.floor((a-recFileStartTime)/1e3);if(currentDeltaTimeTotalSec!=n){currentDeltaTimeTotalSec=n;var o=Math.floor(n/3600);n-=3600*o;var s=Math.floor(n/60);n-=60*o;var c=Math.floor(n);QH("timespan",pad2(o)+":"+pad2(s)+":"+pad2(c))}2==e&&i&&!l?1==recFileProtocol?agentTerminal.ProcessData(r):2==recFileProtocol?agentDesktop.ProcessData(r):101==recFileProtocol&&(0==readState&&"4100000000000000"==rstr2hex(r)?(readState=1,8<r.length&&amtDesktop.ProcessData(r.substring(8))):1==readState&&amtDesktop.ProcessData(r)):2==e&&i&&l&&101==recFileProtocol&&"0000000008080001000700070003050200000000"==rstr2hex(r)&&(amtDesktop.bpp=1),recFileLastTime=a,playing&&readNextBlock(processBlock)}}function cleanup(){recFilePtr=0,playing=!1,(recFileMetadata=recFile=null)!=agentDesktop&&(agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height),agentDesktop=null),null!=amtDesktop&&(amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height),amtDesktop=null),recFileEndTime=currentDeltaTimeTotalSec=readState=0,(agentTerminal=waitTimerArgs=null)!=waitTimer&&(clearTimeout(waitTimer),waitTimer=null),QH("deskstatus",""),QE("PlayButton",!1),QE("PauseButton",!1),QE("RestartButton",!1),QS("progressbar").width="0px",QH("timespan","00:00:00"),QV("metadatadiv",!0),QH("metadatadiv",'<span style="font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:28px">MeshCentral Session Player</span><br /><br /><span style=color:gray>Drag & drop a .mcrec file or click "Open File..."</span>'),QV("DeskParent",!0),QV("TermParent",!1)}function ondrop(e){if(haltEvent(e),QV("bigfail",!1),QV("bigok",!1),null!=e.dataTransfer){var t=[];for(var a in e.dataTransfer.files)null!=e.dataTransfer.files[a].type&&null!=e.dataTransfer.files[a].size&&0!=e.dataTransfer.files[a].size&&e.dataTransfer.files[a].name.endsWith(".mcrec")&&t.push(e.dataTransfer.files[a]);0!=t.length&&(cleanup(),recFile=t[0],recFilePtr=0,readNextBlock(processFirstBlock),readLastBlock(function(e,t,a){recFileEndTime=3==e?a:0}))}}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,dragtimer=null;function ondragover(e){haltEvent(e),null!=dragtimer&&(clearTimeout(dragtimer),dragtimer=null);QV("bigok",!0),QV("bigfail",!1)}function ondragleave(e){haltEvent(e),dragtimer=setTimeout(function(){QV("bigfail",!1),QV("bigok",!1),dragtimer=null},10)}function onkeypress(e){xxdialogMode||(" "==e.key&&(togglePause(),haltEvent(e)),"1"==e.key&&(Q("PlaySpeed").value=4,haltEvent(e)),"2"==e.key&&(Q("PlaySpeed").value=2,haltEvent(e)),"3"==e.key&&(Q("PlaySpeed").value=1,haltEvent(e)),"4"==e.key&&(Q("PlaySpeed").value=.5,haltEvent(e)),"5"==e.key&&(Q("PlaySpeed").value=.25,haltEvent(e)),"6"==e.key&&(Q("PlaySpeed").value=.1,haltEvent(e)),"0"==e.key&&(pause(),restart(),haltEvent(e)))}function openfile(){setDialogMode(2,"Open File...",3,openfileEx,'<input type=file name=files id=p2fileinput style=width:100% accept=".mcrec" onchange="openfileChanged()" />'),QE("idx_dlgOkButton",!1)}function openfileEx(){var e=Q("p2fileinput").files;if(null!=e){var t=[];for(var a in e)null!=e[a].type&&null!=e[a].size&&0!=e[a].size&&e[a].name.endsWith(".mcrec")&&t.push(e[a])}0!=t.length&&(cleanup(),recFile=t[0],recFilePtr=0,readNextBlock(processFirstBlock),readLastBlock(function(e,t,a){recFileEndTime=3==e?a:0}),Q("OpenFileButton").blur())}function openfileChanged(){var e=Q("p2fileinput").files;if(null!=e){var t=[];for(var a in e)null!=e[a].type&&null!=e[a].size&&0!=e[a].size&&e[a].name.endsWith(".mcrec")&&t.push(e[a])}QE("idx_dlgOkButton",1==t.length)}function togglePause(){return null!=recFile&&(1==playing?pause():recFilePtr!=recFile.size&&play()),!1}function play(){Q("PlayButton").blur(),1!=playing&&0!=recFileProtocol&&(playing=!0,QV("metadatadiv",!1),QE("PlayButton",!1),QE("PauseButton",!0),QE("RestartButton",!1),1==recFileProtocol&&null==agentTerminal&&(QV("DeskParent",!1),QV("TermParent",!0),agentTerminal=CreateAmtRemoteTerminal("Term",{}),agentTerminal.State=3),readNextBlock(processBlock))}function pause(){Q("PauseButton").blur(),0!=playing&&(playing=!1,QE("PlayButton",recFilePtr!=recFile.size),QE("PauseButton",!1),QE("RestartButton",0!=recFilePtr),null!=waitTimer&&(clearTimeout(waitTimer),waitTimer=null,processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3]),waitTimerArgs=null))}function restart(){Q("RestartButton").blur(),1!=playing&&(currentDeltaTimeTotalSec=readState=recFilePtr=0,QV("metadatadiv",!0),QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),QS("progressbar").width="0px",QH("timespan","00:00:00"),QV("DeskParent",!0),QV("TermParent",!1),agentDesktop?agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height):amtDesktop?(amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height),(amtDesktop=CreateAmtRemoteDesktop("Desk")).onScreenSizeChange=deskAdjust,amtDesktop.State=3,amtDesktop.Start()):agentTerminal=agentTerminal&&null)}function clearConsoleMsg(){QH("p11DeskConsoleMsg","")}function toggleAspectRatio(e){1===e&&(deskAspectRatio=(deskAspectRatio+1)%3),deskAdjust()}function deskAdjust(){var e=Q("DeskParent").clientHeight,t=Q("DeskParent").clientWidth,a=Q("Desk").height,r=Q("Desk").width;if(2==deskAspectRatio)QS("Desk")["margin-top"]=null,QS("Desk").height="100%",QS("Desk").width="100%",QS("DeskParent").overflow="hidden";else if(1==deskAspectRatio)QS("Desk")["margin-top"]="0px",QS("Desk").height=a+"px",QS("Desk").width=r+"px",QS("DeskParent").overflow="scroll";else{if(a/r<e/t){var i=a*t/r+"px";QS("Desk").height=i,QS("Desk").width="100%"}else{var l=r*e/a+"px";QS("Desk").height="100%",QS("Desk").width=l}QS("Desk")["margin-top"]=null,QS("DeskParent").overflow="hidden"}}var xxcurrentView=-1;function setDialogMode(e,t,a,r,i,l){xxdialogMode=e,xxdialogFunc=r,xxdialogButtons=a,xxdialogTag=l,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&a),QV("idx_dlgCancelButton",2&a),QV("id_dialogclose",2&a||8&a),QV("idx_dlgDeleteButton",4&a),QV("idx_dlgButtonBar",7&a),t&&QH("id_dialogtitle",t);for(var n=1;n<3;n++)QV("dialog"+n,n==e);QV("dialog",e),i&&(2==e?QH("id_dialogOptions",i):QH("id_dialogMessage",i))}function dialogclose(e){var t=xxdialogFunc,a=xxdialogButtons,r=xxdialogTag;setDialogMode(),(8&a||e)&&t&&t(e,r)}function messagebox(e,t){setSessionActivity(),QH("id_dialogMessage",t),setDialogMode(1,e,1)}function statusbox(e,t){setSessionActivity(),QH("id_dialogMessage",t),setDialogMode(1,e)}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function pad2(e){var t="00"+e;return t.substr(t.length-2)}function format(e){var a=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,t){return void 0!==a[t]?a[t]:e})}start()</script>
\ No newline at end of file
public/translations/player-min_fr.htm new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><script src=scripts/agent-desktop-0.0.2.js></script><script src=scripts/amt-desktop-0.0.2.js></script><script src=scripts/amt-terminal-0.0.2.js></script><script src=scripts/zlib.js></script><script src=scripts/zlib-inflate.js></script><script src=scripts/zlib-adler32.js></script><script src=scripts/zlib-crc32.js></script><body style=overflow:hidden;background-color:#000><div id=p11 class=noselect style=overflow:hidden><div id=deskarea0><div id=deskarea1 class=areaHead><div class=toright2><div class=deskareaicon title="Toggle View Mode"onclick=toggleAspectRatio(1)>⇲</div></div><div><input id=OpenFileButton type=button value="Open File..."onclick=openfile()><span id=deskstatus></span></div></div><div id=deskarea2><div class=areaProgress><div id=progressbar></div></div></div><div id=deskarea3x style="max-height:calc(100vh - 54px);height:calc(100vh - 54px)"onclick=togglePause()><div id=bigok style="display:none;left:calc((100vh / 2))"><b>✓</b></div><div id=bigfail style="display:none;left:calc((100vh / 2))"><b>✗</b></div><div id=metadatadiv style=padding:20px;color:#d3d3d3;text-align:left;display:none></div><div id=DeskParent><canvas id=Desk width=640 height=480></canvas></div><div id=TermParent style=display:none><pre id=Term></pre></div><div id=p11DeskConsoleMsg style=display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:#ff0;background-color:rgba(0,0,0,.6);padding:10px;border-radius:5px onclick=clearConsoleMsg()></div></div><div id=deskarea4 class=areaFoot><div class=toright2><div id=timespan style=padding-top:4px;padding-right:4px>00:00:00</div></div><div>&nbsp; <input id=PlayButton type=button value=Jouer disabled onclick=play()> <input id=PauseButton type=button value=Pause disabled onclick=pause()> <input id=RestartButton type=button value=Redémarrer disabled onclick=restart()><select id=PlaySpeed onchange=this.blur()><option value=4>1/4 vitesse<option value=2>1/2 vitesse<option value=1 selected>Normal Speed<option value=0.5>2x vitesse<option value=0.25>4x vitesse<option value=0.1>10x vitesse</select></div></div></div><div id=dialog class=noselect style=display:none><div id=dialogHeader><div tabindex=0 id=id_dialogclose onclick=setDialogMode() onkeypress='"Enter"==event.key&&setDialogMode()'>✖</div><div id=id_dialogtitle></div></div><div id=dialogBody><div id=dialog1><div id=id_dialogMessage></div></div><div id=dialog2><div id=id_dialogOptions></div></div></div><div id=idx_dlgButtonBar><input id=idx_dlgCancelButton type=button value=Annuler onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK onclick=dialogclose(1)><div><input id=idx_dlgDeleteButton type=button value=Delete style=display:none onclick=dialogclose(2)></div></div></div></div><script>var recFile=null,recFilePtr=0,recFileStartTime=0,recFileLastTime=0,recFileEndTime=0,recFileMetadata=null,recFileProtocol=0,agentDesktop=null,amtDesktop=null,playing=!1,readState=0,waitTimer=null,waitTimerArgs=null,deskAspectRatio=0,currentDeltaTimeTotalSec=0;function start(){window.onresize=deskAdjust,document.ondrop=ondrop,document.ondragover=ondragover,document.ondragleave=ondragleave,document.onkeypress=onkeypress,Q("PlaySpeed").value=1,cleanup()}function readNextBlock(l){if(recFilePtr+16>recFile.size)QS("progressbar").width="100%",l(-1);else{var e=new FileReader;e.onload=function(){var e=ReadShort(this.result,0),t=ReadShort(this.result,2),a=ReadInt(this.result,4),r=(ReadInt(this.result,8)<<32)+ReadInt(this.result,12);if(recFilePtr+16+a>recFile.size)QS("progressbar").width="100%",l(-1);else{var i=new FileReader;i.onload=function(){recFilePtr+=16+a,QS("progressbar").width=0==recFileEndTime?Math.floor(recFilePtr/recFile.size*100)+"%":Math.floor((recFileLastTime-recFileStartTime)/(recFileEndTime-recFileStartTime)*100)+"%",l(e,t,r,this.result)},i.readAsBinaryString(recFile.slice(recFilePtr+16,recFilePtr+16+a))}},e.readAsBinaryString(recFile.slice(recFilePtr,recFilePtr+16))}}function readLastBlock(i){if(recFile.size<32)i(-1);else{var e=new FileReader;e.onload=function(){var e=ReadShort(this.result,0),t=ReadShort(this.result,2),a=ReadInt(this.result,4),r=(ReadInt(this.result,8)<<32)+ReadInt(this.result,12);3==e&&16==a&&"MeshCentralMCREC"==this.result.substring(16,32)?i(e,t,r):i(-1)},e.readAsBinaryString(recFile.slice(recFile.size-32,recFile.size))}}function addInfo(e,t){return null==t?"":addInfoNoEsc(e,EscapeHtml(t))}function addInfoNoEsc(e,t){return null==t?"":"<span style=color:gray>"+EscapeHtml(e)+"</span>:&nbsp;<span style=font-size:20px>"+t+"</span><br/>"}function processFirstBlock(e,t,a,r){if(recFileProtocol=0,1==e&&0==t){try{recFileMetadata=JSON.parse(r)}catch(e){return void cleanup()}if(null!=recFileMetadata&&"MeshCentralRelaySession"==recFileMetadata.magic&&1==recFileMetadata.ver){var i="";if(i+=addInfo("Temps",recFileMetadata.time),0!=recFileEndTime){var l=Math.floor((recFileEndTime-a)/1e3);i+=addInfo("Duration",format("{0} second{1}",l,1<l?"s":""))}if(i+=addInfo("Nom d'utilisateur",recFileMetadata.username),i+=addInfo("Identifiant d'utilisateur",recFileMetadata.userid),i+=addInfo("SessionID",recFileMetadata.sessionid),recFileMetadata.ipaddr1&&recFileMetadata.ipaddr2&&(i+=addInfo("Addresses",format("{0} to {1}",recFileMetadata.ipaddr1,recFileMetadata.ipaddr2))),recFileMetadata.devicename&&(i+=addInfo("DeviceName",recFileMetadata.devicename)),i+=addInfo("NodeID",recFileMetadata.nodeid),recFileMetadata.protocol){var n=recFileMetadata.protocol;1==n?n="MeshCentral Terminal":2==n?n="MeshCentral Desktop":100==n?n="Intel&reg; AMT WSMAN":101==n&&(n="Intel&reg; AMT Redirection"),i+=addInfoNoEsc("Protocol",n)}QV("DeskParent",!0),QV("TermParent",!1),1==recFileMetadata.protocol?(recFileProtocol=1,i+="<br /><br /><span style=color:gray>Press [space] to play/pause.</span>",QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),recFileStartTime=recFileLastTime=a):2==recFileMetadata.protocol?(recFileProtocol=2,i+="<br /><br /><span style=color:gray>Press [space] to play/pause.</span>",QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),recFileStartTime=recFileLastTime=a,(agentDesktop=CreateAgentRemoteDesktop("Desk")).onScreenSizeChange=deskAdjust,agentDesktop.State=3,deskAdjust()):101==recFileMetadata.protocol&&(recFileProtocol=101,i+="<br /><br /><span style=color:gray>Press [space] to play/pause.</span>",QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),recFileStartTime=recFileLastTime=a,(amtDesktop=CreateAmtRemoteDesktop("Desk")).onScreenSizeChange=deskAdjust,amtDesktop.State=3,amtDesktop.Start(),deskAdjust()),QV("metadatadiv",!0),QH("metadatadiv",i),QH("deskstatus",recFile.name)}else cleanup()}else cleanup()}function processBlock(e,t,a,r){if(e<0)pause();else{var i=Math.round((a-recFileLastTime)*parseFloat(Q("PlaySpeed").value));i<5?processBlockEx(e,t,a,r):(waitTimerArgs=[e,t,a,r],waitTimer=setTimeout(function(){waitTimer=null,processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3])},i))}}function processBlockEx(e,t,a,r){if(0!=playing){var i=0!=(1&t),l=0!=(2&t),n=Math.floor((a-recFileStartTime)/1e3);if(currentDeltaTimeTotalSec!=n){currentDeltaTimeTotalSec=n;var o=Math.floor(n/3600);n-=3600*o;var s=Math.floor(n/60);n-=60*o;var c=Math.floor(n);QH("timespan",pad2(o)+":"+pad2(s)+":"+pad2(c))}2==e&&i&&!l?1==recFileProtocol?agentTerminal.ProcessData(r):2==recFileProtocol?agentDesktop.ProcessData(r):101==recFileProtocol&&(0==readState&&"4100000000000000"==rstr2hex(r)?(readState=1,8<r.length&&amtDesktop.ProcessData(r.substring(8))):1==readState&&amtDesktop.ProcessData(r)):2==e&&i&&l&&101==recFileProtocol&&"0000000008080001000700070003050200000000"==rstr2hex(r)&&(amtDesktop.bpp=1),recFileLastTime=a,playing&&readNextBlock(processBlock)}}function cleanup(){recFilePtr=0,playing=!1,(recFileMetadata=recFile=null)!=agentDesktop&&(agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height),agentDesktop=null),null!=amtDesktop&&(amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height),amtDesktop=null),recFileEndTime=currentDeltaTimeTotalSec=readState=0,(agentTerminal=waitTimerArgs=null)!=waitTimer&&(clearTimeout(waitTimer),waitTimer=null),QH("deskstatus",""),QE("PlayButton",!1),QE("PauseButton",!1),QE("RestartButton",!1),QS("progressbar").width="0px",QH("timespan","00:00:00"),QV("metadatadiv",!0),QH("metadatadiv",'<span style="font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:28px">MeshCentral Session Player</span><br /><br /><span style=color:gray>Drag & drop a .mcrec file or click "Open File..."</span>'),QV("DeskParent",!0),QV("TermParent",!1)}function ondrop(e){if(haltEvent(e),QV("bigfail",!1),QV("bigok",!1),null!=e.dataTransfer){var t=[];for(var a in e.dataTransfer.files)null!=e.dataTransfer.files[a].type&&null!=e.dataTransfer.files[a].size&&0!=e.dataTransfer.files[a].size&&e.dataTransfer.files[a].name.endsWith(".mcrec")&&t.push(e.dataTransfer.files[a]);0!=t.length&&(cleanup(),recFile=t[0],recFilePtr=0,readNextBlock(processFirstBlock),readLastBlock(function(e,t,a){recFileEndTime=3==e?a:0}))}}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,dragtimer=null;function ondragover(e){haltEvent(e),null!=dragtimer&&(clearTimeout(dragtimer),dragtimer=null);QV("bigok",!0),QV("bigfail",!1)}function ondragleave(e){haltEvent(e),dragtimer=setTimeout(function(){QV("bigfail",!1),QV("bigok",!1),dragtimer=null},10)}function onkeypress(e){xxdialogMode||(" "==e.key&&(togglePause(),haltEvent(e)),"1"==e.key&&(Q("PlaySpeed").value=4,haltEvent(e)),"2"==e.key&&(Q("PlaySpeed").value=2,haltEvent(e)),"3"==e.key&&(Q("PlaySpeed").value=1,haltEvent(e)),"4"==e.key&&(Q("PlaySpeed").value=.5,haltEvent(e)),"5"==e.key&&(Q("PlaySpeed").value=.25,haltEvent(e)),"6"==e.key&&(Q("PlaySpeed").value=.1,haltEvent(e)),"0"==e.key&&(pause(),restart(),haltEvent(e)))}function openfile(){setDialogMode(2,"Open File...",3,openfileEx,'<input type=file name=files id=p2fileinput style=width:100% accept=".mcrec" onchange="openfileChanged()" />'),QE("idx_dlgOkButton",!1)}function openfileEx(){var e=Q("p2fileinput").files;if(null!=e){var t=[];for(var a in e)null!=e[a].type&&null!=e[a].size&&0!=e[a].size&&e[a].name.endsWith(".mcrec")&&t.push(e[a])}0!=t.length&&(cleanup(),recFile=t[0],recFilePtr=0,readNextBlock(processFirstBlock),readLastBlock(function(e,t,a){recFileEndTime=3==e?a:0}),Q("OpenFileButton").blur())}function openfileChanged(){var e=Q("p2fileinput").files;if(null!=e){var t=[];for(var a in e)null!=e[a].type&&null!=e[a].size&&0!=e[a].size&&e[a].name.endsWith(".mcrec")&&t.push(e[a])}QE("idx_dlgOkButton",1==t.length)}function togglePause(){return null!=recFile&&(1==playing?pause():recFilePtr!=recFile.size&&play()),!1}function play(){Q("PlayButton").blur(),1!=playing&&0!=recFileProtocol&&(playing=!0,QV("metadatadiv",!1),QE("PlayButton",!1),QE("PauseButton",!0),QE("RestartButton",!1),1==recFileProtocol&&null==agentTerminal&&(QV("DeskParent",!1),QV("TermParent",!0),agentTerminal=CreateAmtRemoteTerminal("Term",{}),agentTerminal.State=3),readNextBlock(processBlock))}function pause(){Q("PauseButton").blur(),0!=playing&&(playing=!1,QE("PlayButton",recFilePtr!=recFile.size),QE("PauseButton",!1),QE("RestartButton",0!=recFilePtr),null!=waitTimer&&(clearTimeout(waitTimer),waitTimer=null,processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3]),waitTimerArgs=null))}function restart(){Q("RestartButton").blur(),1!=playing&&(currentDeltaTimeTotalSec=readState=recFilePtr=0,QV("metadatadiv",!0),QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),QS("progressbar").width="0px",QH("timespan","00:00:00"),QV("DeskParent",!0),QV("TermParent",!1),agentDesktop?agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height):amtDesktop?(amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height),(amtDesktop=CreateAmtRemoteDesktop("Desk")).onScreenSizeChange=deskAdjust,amtDesktop.State=3,amtDesktop.Start()):agentTerminal=agentTerminal&&null)}function clearConsoleMsg(){QH("p11DeskConsoleMsg","")}function toggleAspectRatio(e){1===e&&(deskAspectRatio=(deskAspectRatio+1)%3),deskAdjust()}function deskAdjust(){var e=Q("DeskParent").clientHeight,t=Q("DeskParent").clientWidth,a=Q("Desk").height,r=Q("Desk").width;if(2==deskAspectRatio)QS("Desk")["margin-top"]=null,QS("Desk").height="100%",QS("Desk").width="100%",QS("DeskParent").overflow="hidden";else if(1==deskAspectRatio)QS("Desk")["margin-top"]="0px",QS("Desk").height=a+"px",QS("Desk").width=r+"px",QS("DeskParent").overflow="scroll";else{if(a/r<e/t){var i=a*t/r+"px";QS("Desk").height=i,QS("Desk").width="100%"}else{var l=r*e/a+"px";QS("Desk").height="100%",QS("Desk").width=l}QS("Desk")["margin-top"]=null,QS("DeskParent").overflow="hidden"}}var xxcurrentView=-1;function setDialogMode(e,t,a,r,i,l){xxdialogMode=e,xxdialogFunc=r,xxdialogButtons=a,xxdialogTag=l,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&a),QV("idx_dlgCancelButton",2&a),QV("id_dialogclose",2&a||8&a),QV("idx_dlgDeleteButton",4&a),QV("idx_dlgButtonBar",7&a),t&&QH("id_dialogtitle",t);for(var n=1;n<3;n++)QV("dialog"+n,n==e);QV("dialog",e),i&&(2==e?QH("id_dialogOptions",i):QH("id_dialogMessage",i))}function dialogclose(e){var t=xxdialogFunc,a=xxdialogButtons,r=xxdialogTag;setDialogMode(),(8&a||e)&&t&&t(e,r)}function messagebox(e,t){setSessionActivity(),QH("id_dialogMessage",t),setDialogMode(1,e,1)}function statusbox(e,t){setSessionActivity(),QH("id_dialogMessage",t),setDialogMode(1,e)}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function pad2(e){var t="00"+e;return t.substr(t.length-2)}function format(e){var a=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,t){return void 0!==a[t]?a[t]:e})}start()</script>
\ No newline at end of file
public/translations/player.min_fr.htm new
+1
@@ -0,0 +1 @@
1 +<!DOCTYPE html><html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <link type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS"> <script type="text/javascript" src="scripts/common-0.0.1.js"></script> <script type="text/javascript" src="scripts/agent-desktop-0.0.2.js"></script> <script type="text/javascript" src="scripts/amt-desktop-0.0.2.js"></script> <script type="text/javascript" src="scripts/amt-terminal-0.0.2.js"></script> <script type="text/javascript" src="scripts/zlib.js"></script> <script type="text/javascript" src="scripts/zlib-inflate.js"></script> <script type="text/javascript" src="scripts/zlib-adler32.js"></script> <script type="text/javascript" src="scripts/zlib-crc32.js"></script></head><body style="overflow:hidden;background-color:black"> <div id="p11" class="noselect" style="overflow:hidden"> <div id="deskarea0"> <div id="deskarea1" class="areaHead"> <div class="toright2"> <div class="deskareaicon" title="Toggle View Mode" onclick="toggleAspectRatio(1)">⇲</div> </div> <div> <input id="OpenFileButton" type="button" value="Open File..." onclick="openfile()"> <span id="deskstatus"></span> </div> </div> <div id="deskarea2" style=""> <div class="areaProgress"><div id="progressbar" style=""></div></div> </div> <div id="deskarea3x" style="max-height:calc(100vh - 54px);height:calc(100vh - 54px);" onclick="togglePause()"> <div id="bigok" style="display:none;left:calc((100vh / 2))"><b>✓</b></div> <div id="bigfail" style="display:none;left:calc((100vh / 2))"><b>✗</b></div> <div id="metadatadiv" style="padding:20px;color:lightgrey;text-align:left;display:none"></div> <div id="DeskParent"> <canvas id="Desk" width="640" height="480"></canvas> </div> <div id="TermParent" style="display:none"> <pre id="Term"></pre> </div> <div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="clearConsoleMsg()"></div> </div> <div id="deskarea4" class="areaFoot"> <div class="toright2"> <div id="timespan" style="padding-top:4px;padding-right:4px">00:00:00</div> </div> <div> &nbsp; <input id="PlayButton" type="button" value="Jouer" disabled="disabled" onclick="play()"> <input id="PauseButton" type="button" value="Pause" disabled="disabled" onclick="pause()"> <input id="RestartButton" type="button" value="Redémarrer" disabled="disabled" onclick="restart()"> <select id="PlaySpeed" onchange="this.blur();"> <option value="4">1/4 vitesse</option> <option value="2">1/2 vitesse</option> <option value="1" selected="">Normal Speed</option> <option value="0.5">2x vitesse</option> <option value="0.25">4x vitesse</option> <option value="0.1">10x vitesse</option> </select> </div> </div> </div> <div id="dialog" class="noselect" style="display:none"> <div id="dialogHeader"> <div tabindex="0" id="id_dialogclose" onclick="setDialogMode()" onkeypress="if (event.key == 'Enter') setDialogMode()">✖</div> <div id="id_dialogtitle"></div> </div> <div id="dialogBody"> <div id="dialog1"> <div id="id_dialogMessage" style=""></div> </div> <div id="dialog2" style=""> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar"> <input id="idx_dlgCancelButton" type="button" value="Annuler" style="" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="" onclick="dialogclose(1)"> <div><input id="idx_dlgDeleteButton" type="button" value="Delete" style="display:none" onclick="dialogclose(2)"></div> </div> </div> </div> <script> var recFile=null; var recFilePtr=0; var recFileStartTime=0; var recFileLastTime=0; var recFileEndTime=0; var recFileMetadata=null; var recFileProtocol=0; var agentDesktop=null; var amtDesktop=null; var playing=false; var readState=0; var waitTimer=null; var waitTimerArgs=null; var deskAspectRatio=0; var currentDeltaTimeTotalSec=0; function start() { window.onresize=deskAdjust; document.ondrop=ondrop; document.ondragover=ondragover; document.ondragleave=ondragleave; document.onkeypress=onkeypress; Q('PlaySpeed').value=1; cleanup(); } function readNextBlock(func) { if((recFilePtr + 16) > recFile.size) { QS('progressbar').width = '100%'; func(-1); } else { var fr=new FileReader(); fr.onload=function () { var type=ReadShort(this.result,0); var flags=ReadShort(this.result,2); var size=ReadInt(this.result,4); var time=(ReadInt(this.result,8) << 32) + ReadInt(this.result,12); if((recFilePtr + 16 + size) > recFile.size) { QS('progressbar').width = '100%'; func(-1); } else { var fr2=new FileReader(); fr2.onload=function () { recFilePtr +=(16 + size); if(recFileEndTime==0) { QS('progressbar').width = Math.floor(100 * (recFilePtr / recFile.size)) + '%'; } else { QS('progressbar').width = Math.floor(((recFileLastTime - recFileStartTime) / (recFileEndTime - recFileStartTime)) * 100) + '%'; } func(type,flags,time,this.result); }; fr2.readAsBinaryString(recFile.slice(recFilePtr + 16,recFilePtr + 16 + size)); } }; fr.readAsBinaryString(recFile.slice(recFilePtr,recFilePtr + 16)); } } function readLastBlock(func) { if(recFile.size < 32) { func(-1); } else { var fr=new FileReader(); fr.onload=function () { var type=ReadShort(this.result,0); var flags=ReadShort(this.result,2); var size=ReadInt(this.result,4); var time=(ReadInt(this.result,8) << 32) + ReadInt(this.result,12); if((type==3) && (size==16) && (this.result.substring(16,32)=='MeshCentralMCREC')) { func(type,flags,time); } else { func(-1); } }; fr.readAsBinaryString(recFile.slice(recFile.size - 32,recFile.size)); } } function addInfo(name,value) { if(value==null) return ''; return addInfoNoEsc(name,EscapeHtml(value)); } function addInfoNoEsc(name,value) { if(value==null) return ''; return '<span style=color:gray>' + EscapeHtml(name) + '</span>:&nbsp;<span style=font-size:20px>' + value + '</span><br/>'; } function processFirstBlock(type,flags,time,data) { recFileProtocol=0; if((type !=1) || (flags !=0)) { cleanup(); return; } try { recFileMetadata=JSON.parse(data) } catch (ex) { cleanup(); return; } if((recFileMetadata==null) || (recFileMetadata.magic !='MeshCentralRelaySession') || (recFileMetadata.ver !=1)) { cleanup(); return; } var x=''; x +=addInfo("Temps",recFileMetadata.time); if(recFileEndTime !=0) { var secs=Math.floor((recFileEndTime - time) / 1000); x +=addInfo("Duration", format("{0} second{1}",secs,(secs > 1)?'s' : '')); } x +=addInfo("Nom d'utilisateur",recFileMetadata.username); x +=addInfo("Identifiant d'utilisateur",recFileMetadata.userid); x +=addInfo("SessionID",recFileMetadata.sessionid); if(recFileMetadata.ipaddr1 && recFileMetadata.ipaddr2) { x +=addInfo("Addresses", format("{0} to {1}",recFileMetadata.ipaddr1,recFileMetadata.ipaddr2)); } if(recFileMetadata.devicename) { x +=addInfo("DeviceName",recFileMetadata.devicename); } x +=addInfo("NodeID",recFileMetadata.nodeid); if(recFileMetadata.protocol) { var p=recFileMetadata.protocol; if(p==1) { p="MeshCentral Terminal"; } else if(p==2) { p="MeshCentral Desktop"; } else if(p==100) { p="Intel&reg; AMT WSMAN"; } else if(p==101) { p="Intel&reg; AMT Redirection"; } x +=addInfoNoEsc("Protocol",p); } QV('DeskParent',true); QV('TermParent',false); if(recFileMetadata.protocol==1) { recFileProtocol=1; x +='<br /><br /><span style=color:gray>' + #73# + '</span>'; QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); recFileStartTime=recFileLastTime=time; } else if(recFileMetadata.protocol==2) { recFileProtocol=2; x +='<br /><br /><span style=color:gray>' + #74# + '</span>'; QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); recFileStartTime=recFileLastTime=time; agentDesktop=CreateAgentRemoteDesktop('Desk'); agentDesktop.onScreenSizeChange=deskAdjust; agentDesktop.State=3; deskAdjust(); } else if(recFileMetadata.protocol==101) { recFileProtocol=101; x +='<br /><br /><span style=color:gray>Press [space] to play/pause.</span>'; QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); recFileStartTime=recFileLastTime=time; amtDesktop=CreateAmtRemoteDesktop('Desk'); amtDesktop.onScreenSizeChange=deskAdjust; amtDesktop.State=3; amtDesktop.Start(); deskAdjust(); } QV('metadatadiv',true); QH('metadatadiv',x); QH('deskstatus',recFile.name); } function processBlock(type,flags,time,data) { if(type < 0) { pause(); return; } var waitTime=Math.round((time - recFileLastTime) * parseFloat(Q('PlaySpeed').value)); if(waitTime < 5) { processBlockEx(type,flags,time,data); } else { waitTimerArgs=[type,flags,time,data] waitTimer=setTimeout(function () { waitTimer=null; processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3]); },waitTime); } } function processBlockEx(type,flags,time,data) { if(playing==false) return; var flagBinary=(flags & 1) !=0,flagUser=(flags & 2) !=0; var deltaTimeTotalSec=Math.floor((time - recFileStartTime) / 1000); if(currentDeltaTimeTotalSec !=deltaTimeTotalSec) { currentDeltaTimeTotalSec=deltaTimeTotalSec; var deltaTimeHours=Math.floor(deltaTimeTotalSec / 3600); deltaTimeTotalSec -=(deltaTimeHours * 3600) var deltaTimeMinutes=Math.floor(deltaTimeTotalSec / 60); deltaTimeTotalSec -=(deltaTimeHours * 60) var deltaTimeSeconds=Math.floor(deltaTimeTotalSec); QH('timespan', pad2(deltaTimeHours) + ':' + pad2(deltaTimeMinutes) + ':' + pad2(deltaTimeSeconds)) } if((type==2) && flagBinary && !flagUser) { if(recFileProtocol==1) { agentTerminal.ProcessData(data); } else if(recFileProtocol==2) { agentDesktop.ProcessData(data); } else if(recFileProtocol==101) { if((readState==0) && (rstr2hex(data)=='4100000000000000')) { readState=1; if(data.length > 8) { amtDesktop.ProcessData(data.substring(8)); } } else if(readState==1) { amtDesktop.ProcessData(data); } } } else if((type==2) && flagBinary && flagUser) { if(recFileProtocol==101) { if(rstr2hex(data)=='0000000008080001000700070003050200000000') { amtDesktop.bpp=1; } } } recFileLastTime=time; if(playing) { readNextBlock(processBlock); } } function cleanup() { recFile=null; recFilePtr=0; recFileMetadata=null; playing=false; if(agentDesktop !=null) { agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height); agentDesktop=null; } if(amtDesktop !=null) { amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height); amtDesktop=null; } readState=0; waitTimerArgs=null; currentDeltaTimeTotalSec=0; recFileEndTime=0; agentTerminal=null; if(waitTimer !=null) { clearTimeout(waitTimer); waitTimer=null; } QH('deskstatus', ''); QE('PlayButton',false); QE('PauseButton',false); QE('RestartButton',false); QS('progressbar').width = '0px'; QH('timespan', '00:00:00'); QV('metadatadiv',true); QH('metadatadiv', '<span style=\#75# + '</span>'); QV('DeskParent',true); QV('TermParent',false); } function ondrop(e) { haltEvent(e); QV('bigfail',false); QV('bigok',false); if(e.dataTransfer==null) return; var files=[]; for (var i in e.dataTransfer.files) { if((e.dataTransfer.files[i].type !=null) && (e.dataTransfer.files[i].size !=null) && (e.dataTransfer.files[i].size !=0) && (e.dataTransfer.files[i].name.endsWith('.mcrec'))) { files.push(e.dataTransfer.files[i]); } } if(files.length==0) return; cleanup(); recFile=files[0]; recFilePtr=0; readNextBlock(processFirstBlock); readLastBlock(function (type,flags,time) { if(type==3) { recFileEndTime=time; } else { recFileEndTime=0; } }); } var dragtimer=null; function ondragover(e) { haltEvent(e); if(dragtimer !=null) { clearTimeout(dragtimer); dragtimer=null; } var ac=true; QV('bigok',ac); QV('bigfail',!ac); } function ondragleave(e) { haltEvent(e); dragtimer=setTimeout(function () { QV('bigfail', false); QV('bigok',false); dragtimer=null; },10); } function onkeypress(e) { if(xxdialogMode) return; if(e.key==' ') { togglePause(); haltEvent(e); } if(e.key=='1') { Q('PlaySpeed').value=4; haltEvent(e); } if(e.key=='2') { Q('PlaySpeed').value=2; haltEvent(e); } if(e.key=='3') { Q('PlaySpeed').value=1; haltEvent(e); } if(e.key=='4') { Q('PlaySpeed').value=0.5; haltEvent(e); } if(e.key=='5') { Q('PlaySpeed').value=0.25; haltEvent(e); } if(e.key=='6') { Q('PlaySpeed').value=0.1; haltEvent(e); } if(e.key=='0') { pause(); restart(); haltEvent(e); } } function openfile() { var x='<input type=file name=files id=p2fileinput style=width:100% accept=#76# />'; setDialogMode(2,"Open File...",3,openfileEx,x); QE('idx_dlgOkButton',false); } function openfileEx() { var xfiles=Q('p2fileinput').files; if(xfiles !=null) { var files=[]; for (var i in xfiles) { if((xfiles[i].type !=null) && (xfiles[i].size !=null) && (xfiles[i].size !=0) && (xfiles[i].name.endsWith('.mcrec'))) { files.push(xfiles[i]); } } } if(files.length==0) return; cleanup(); recFile=files[0]; recFilePtr=0; readNextBlock(processFirstBlock); readLastBlock(function (type,flags,time) { if(type==3) { recFileEndTime=time; } else { recFileEndTime=0; } }); Q('OpenFileButton').blur(); } function openfileChanged() { var xfiles=Q('p2fileinput').files; if(xfiles !=null) { var files=[]; for (var i in xfiles) { if((xfiles[i].type !=null) && (xfiles[i].size !=null) && (xfiles[i].size !=0) && (xfiles[i].name.endsWith('.mcrec'))) { files.push(xfiles[i]); } } } QE('idx_dlgOkButton',files.length==1); } function togglePause() { if(recFile !=null) { if(playing==true) { pause(); } else { if(recFilePtr !=recFile.size) { play(); } } } return false; } function play() { Q('PlayButton').blur(); if((playing==true) || (recFileProtocol==0)) return; playing=true; QV('metadatadiv',false); QE('PlayButton',false); QE('PauseButton',true); QE('RestartButton',false); if((recFileProtocol==1) && (agentTerminal==null)) { QV('DeskParent',false); QV('TermParent',true); agentTerminal=CreateAmtRemoteTerminal('Term',{}); agentTerminal.State=3; } readNextBlock(processBlock); } function pause() { Q('PauseButton').blur(); if(playing==false) return; playing=false; QE('PlayButton',recFilePtr !=recFile.size); QE('PauseButton',false); QE('RestartButton',recFilePtr !=0); if(waitTimer !=null) { clearTimeout(waitTimer); waitTimer=null; processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3]); waitTimerArgs=null; } } function restart() { Q('RestartButton').blur(); if(playing==true) return; recFilePtr=0; readState=0; currentDeltaTimeTotalSec=0; QV('metadatadiv',true); QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); QS('progressbar').width = '0px'; QH('timespan', '00:00:00'); QV('DeskParent',true); QV('TermParent',false); if(agentDesktop) { agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height); } else if(amtDesktop) { amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height); amtDesktop=CreateAmtRemoteDesktop('Desk'); amtDesktop.onScreenSizeChange=deskAdjust; amtDesktop.State=3; amtDesktop.Start(); } else if(agentTerminal) { agentTerminal=null; } } function clearConsoleMsg() { QH('p11DeskConsoleMsg', ''); } function toggleAspectRatio(toggle) { if(toggle===1) { deskAspectRatio=((deskAspectRatio + 1) % 3); } deskAdjust(); } function deskAdjust() { var parentH=Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth; var deskH=Q('Desk').height, deskW = Q('Desk').width; if(deskAspectRatio==2) { QS('Desk')['margin-top']=null; QS('Desk').height = '100%'; QS('Desk').width = '100%'; QS('DeskParent').overflow = 'hidden'; } else if(deskAspectRatio==1) { QS('Desk')['margin-top'] = '0px'; QS('Desk').height = deskH + 'px'; QS('Desk').width = deskW + 'px'; QS('DeskParent').overflow = 'scroll'; } else { if((parentH / parentW) > (deskH / deskW)) { var hNew=((deskH * parentW) / deskW) + 'px'; QS('Desk').height=hNew; QS('Desk').width = '100%'; } else { var wNew=((deskW * parentH) / deskH) + 'px'; QS('Desk').height = '100%'; QS('Desk').width=wNew; } QS('Desk')['margin-top']=null; QS('DeskParent').overflow = 'hidden'; } } var xxdialogMode; var xxdialogFunc; var xxdialogButtons; var xxdialogTag; var xxcurrentView=-1; function setDialogMode(x,y,b,f,c,tag) { xxdialogMode=x; xxdialogFunc=f; xxdialogButtons=b; xxdialogTag=tag; QE('idx_dlgOkButton',true); QV('idx_dlgOkButton',b & 1); QV('idx_dlgCancelButton',b & 2); QV('id_dialogclose',(b & 2) || (b & 8)); QV('idx_dlgDeleteButton',b & 4); QV('idx_dlgButtonBar',b & 7); if(y) QH('id_dialogtitle',y); for (var i=1; i < 3; i++) { QV('dialog' + i,i==x); } QV('dialog',x); if(c) { if(x==2) { QH('id_dialogOptions', c); } else { QH('id_dialogMessage',c); } } } function dialogclose(x) { var f=xxdialogFunc,b=xxdialogButtons,t=xxdialogTag; setDialogMode(); if(((b & 8) || x) && f) f(x,t); } function messagebox(t,m) { setSessionActivity(); QH('id_dialogMessage',m); setDialogMode(1,t,1); } function statusbox(t,m) { setSessionActivity(); QH('id_dialogMessage',m); setDialogMode(1,t); } function haltEvent(e) { if(e.preventDefault) e.preventDefault(); if(e.stopPropagation) e.stopPropagation(); return false; } function pad2(num) { var s='00' + num; return s.substr(s.length - 2); } function format(format) { var args=Array.prototype.slice.call(arguments,1); return format.replace(/{(\d+)}/g,function (match,number) { return typeof args[number] !='undefined'?args[number]:match; }); }; start(); </script></body></html>
\ No newline at end of file
public/translations/player_fr.htm-min new
+1
@@ -0,0 +1 @@
1 +undefined
\ No newline at end of file
public/translations/player_fr.htm-min2 new
+1
@@ -0,0 +1 @@
1 +<!DOCTYPE html><html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <link type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS"> <script type="text/javascript" src="scripts/common-0.0.1.js"></script> <script type="text/javascript" src="scripts/agent-desktop-0.0.2.js"></script> <script type="text/javascript" src="scripts/amt-desktop-0.0.2.js"></script> <script type="text/javascript" src="scripts/amt-terminal-0.0.2.js"></script> <script type="text/javascript" src="scripts/zlib.js"></script> <script type="text/javascript" src="scripts/zlib-inflate.js"></script> <script type="text/javascript" src="scripts/zlib-adler32.js"></script> <script type="text/javascript" src="scripts/zlib-crc32.js"></script></head><body style="overflow:hidden;background-color:black"> <div id="p11" class="noselect" style="overflow:hidden"> <div id="deskarea0"> <div id="deskarea1" class="areaHead"> <div class="toright2"> <div class="deskareaicon" title="Toggle View Mode" onclick="toggleAspectRatio(1)">⇲</div> </div> <div> <input id="OpenFileButton" type="button" value="Open File..." onclick="openfile()"> <span id="deskstatus"></span> </div> </div> <div id="deskarea2" style=""> <div class="areaProgress"><div id="progressbar" style=""></div></div> </div> <div id="deskarea3x" style="max-height:calc(100vh - 54px);height:calc(100vh - 54px);" onclick="togglePause()"> <div id="bigok" style="display:none;left:calc((100vh / 2))"><b>✓</b></div> <div id="bigfail" style="display:none;left:calc((100vh / 2))"><b>✗</b></div> <div id="metadatadiv" style="padding:20px;color:lightgrey;text-align:left;display:none"></div> <div id="DeskParent"> <canvas id="Desk" width="640" height="480"></canvas> </div> <div id="TermParent" style="display:none"> <pre id="Term"></pre> </div> <div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="clearConsoleMsg()"></div> </div> <div id="deskarea4" class="areaFoot"> <div class="toright2"> <div id="timespan" style="padding-top:4px;padding-right:4px">00:00:00</div> </div> <div> &nbsp; <input id="PlayButton" type="button" value="Jouer" disabled="disabled" onclick="play()"> <input id="PauseButton" type="button" value="Pause" disabled="disabled" onclick="pause()"> <input id="RestartButton" type="button" value="Redémarrer" disabled="disabled" onclick="restart()"> <select id="PlaySpeed" onchange="this.blur();"> <option value="4">1/4 vitesse</option> <option value="2">1/2 vitesse</option> <option value="1" selected="">Normal Speed</option> <option value="0.5">2x vitesse</option> <option value="0.25">4x vitesse</option> <option value="0.1">10x vitesse</option> </select> </div> </div> </div> <div id="dialog" class="noselect" style="display:none"> <div id="dialogHeader"> <div tabindex="0" id="id_dialogclose" onclick="setDialogMode()" onkeypress="if (event.key == 'Enter') setDialogMode()">✖</div> <div id="id_dialogtitle"></div> </div> <div id="dialogBody"> <div id="dialog1"> <div id="id_dialogMessage" style=""></div> </div> <div id="dialog2" style=""> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar"> <input id="idx_dlgCancelButton" type="button" value="Annuler" style="" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="" onclick="dialogclose(1)"> <div><input id="idx_dlgDeleteButton" type="button" value="Delete" style="display:none" onclick="dialogclose(2)"></div> </div> </div> </div> <script> var recFile=null; var recFilePtr=0; var recFileStartTime=0; var recFileLastTime=0; var recFileEndTime=0; var recFileMetadata=null; var recFileProtocol=0; var agentDesktop=null; var amtDesktop=null; var playing=false; var readState=0; var waitTimer=null; var waitTimerArgs=null; var deskAspectRatio=0; var currentDeltaTimeTotalSec=0; function start() { window.onresize=deskAdjust; document.ondrop=ondrop; document.ondragover=ondragover; document.ondragleave=ondragleave; document.onkeypress=onkeypress; Q('PlaySpeed').value=1; cleanup(); } function readNextBlock(func) { if((recFilePtr + 16) > recFile.size) { QS('progressbar').width = '100%'; func(-1); } else { var fr=new FileReader(); fr.onload=function () { var type=ReadShort(this.result,0); var flags=ReadShort(this.result,2); var size=ReadInt(this.result,4); var time=(ReadInt(this.result,8) << 32) + ReadInt(this.result,12); if((recFilePtr + 16 + size) > recFile.size) { QS('progressbar').width = '100%'; func(-1); } else { var fr2=new FileReader(); fr2.onload=function () { recFilePtr +=(16 + size); if(recFileEndTime==0) { QS('progressbar').width = Math.floor(100 * (recFilePtr / recFile.size)) + '%'; } else { QS('progressbar').width = Math.floor(((recFileLastTime - recFileStartTime) / (recFileEndTime - recFileStartTime)) * 100) + '%'; } func(type,flags,time,this.result); }; fr2.readAsBinaryString(recFile.slice(recFilePtr + 16,recFilePtr + 16 + size)); } }; fr.readAsBinaryString(recFile.slice(recFilePtr,recFilePtr + 16)); } } function readLastBlock(func) { if(recFile.size < 32) { func(-1); } else { var fr=new FileReader(); fr.onload=function () { var type=ReadShort(this.result,0); var flags=ReadShort(this.result,2); var size=ReadInt(this.result,4); var time=(ReadInt(this.result,8) << 32) + ReadInt(this.result,12); if((type==3) && (size==16) && (this.result.substring(16,32)=='MeshCentralMCREC')) { func(type,flags,time); } else { func(-1); } }; fr.readAsBinaryString(recFile.slice(recFile.size - 32,recFile.size)); } } function addInfo(name,value) { if(value==null) return ''; return addInfoNoEsc(name,EscapeHtml(value)); } function addInfoNoEsc(name,value) { if(value==null) return ''; return '<span style=color:gray>' + EscapeHtml(name) + '</span>:&nbsp;<span style=font-size:20px>' + value + '</span><br/>'; } function processFirstBlock(type,flags,time,data) { recFileProtocol=0; if((type !=1) || (flags !=0)) { cleanup(); return; } try { recFileMetadata=JSON.parse(data) } catch (ex) { cleanup(); return; } if((recFileMetadata==null) || (recFileMetadata.magic !='MeshCentralRelaySession') || (recFileMetadata.ver !=1)) { cleanup(); return; } var x=''; x +=addInfo("Temps",recFileMetadata.time); if(recFileEndTime !=0) { var secs=Math.floor((recFileEndTime - time) / 1000); x +=addInfo("Duration", format("{0} second{1}",secs,(secs > 1)?'s' : '')); } x +=addInfo("Nom d'utilisateur",recFileMetadata.username); x +=addInfo("Identifiant d'utilisateur",recFileMetadata.userid); x +=addInfo("SessionID",recFileMetadata.sessionid); if(recFileMetadata.ipaddr1 && recFileMetadata.ipaddr2) { x +=addInfo("Addresses", format("{0} to {1}",recFileMetadata.ipaddr1,recFileMetadata.ipaddr2)); } if(recFileMetadata.devicename) { x +=addInfo("DeviceName",recFileMetadata.devicename); } x +=addInfo("NodeID",recFileMetadata.nodeid); if(recFileMetadata.protocol) { var p=recFileMetadata.protocol; if(p==1) { p="MeshCentral Terminal"; } else if(p==2) { p="MeshCentral Desktop"; } else if(p==100) { p="Intel&reg; AMT WSMAN"; } else if(p==101) { p="Intel&reg; AMT Redirection"; } x +=addInfoNoEsc("Protocol",p); } QV('DeskParent',true); QV('TermParent',false); if(recFileMetadata.protocol==1) { recFileProtocol=1; x +='<br /><br /><span style=color:gray>' + #73# + '</span>'; QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); recFileStartTime=recFileLastTime=time; } else if(recFileMetadata.protocol==2) { recFileProtocol=2; x +='<br /><br /><span style=color:gray>' + #74# + '</span>'; QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); recFileStartTime=recFileLastTime=time; agentDesktop=CreateAgentRemoteDesktop('Desk'); agentDesktop.onScreenSizeChange=deskAdjust; agentDesktop.State=3; deskAdjust(); } else if(recFileMetadata.protocol==101) { recFileProtocol=101; x +='<br /><br /><span style=color:gray>Press [space] to play/pause.</span>'; QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); recFileStartTime=recFileLastTime=time; amtDesktop=CreateAmtRemoteDesktop('Desk'); amtDesktop.onScreenSizeChange=deskAdjust; amtDesktop.State=3; amtDesktop.Start(); deskAdjust(); } QV('metadatadiv',true); QH('metadatadiv',x); QH('deskstatus',recFile.name); } function processBlock(type,flags,time,data) { if(type < 0) { pause(); return; } var waitTime=Math.round((time - recFileLastTime) * parseFloat(Q('PlaySpeed').value)); if(waitTime < 5) { processBlockEx(type,flags,time,data); } else { waitTimerArgs=[type,flags,time,data] waitTimer=setTimeout(function () { waitTimer=null; processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3]); },waitTime); } } function processBlockEx(type,flags,time,data) { if(playing==false) return; var flagBinary=(flags & 1) !=0,flagUser=(flags & 2) !=0; var deltaTimeTotalSec=Math.floor((time - recFileStartTime) / 1000); if(currentDeltaTimeTotalSec !=deltaTimeTotalSec) { currentDeltaTimeTotalSec=deltaTimeTotalSec; var deltaTimeHours=Math.floor(deltaTimeTotalSec / 3600); deltaTimeTotalSec -=(deltaTimeHours * 3600) var deltaTimeMinutes=Math.floor(deltaTimeTotalSec / 60); deltaTimeTotalSec -=(deltaTimeHours * 60) var deltaTimeSeconds=Math.floor(deltaTimeTotalSec); QH('timespan', pad2(deltaTimeHours) + ':' + pad2(deltaTimeMinutes) + ':' + pad2(deltaTimeSeconds)) } if((type==2) && flagBinary && !flagUser) { if(recFileProtocol==1) { agentTerminal.ProcessData(data); } else if(recFileProtocol==2) { agentDesktop.ProcessData(data); } else if(recFileProtocol==101) { if((readState==0) && (rstr2hex(data)=='4100000000000000')) { readState=1; if(data.length > 8) { amtDesktop.ProcessData(data.substring(8)); } } else if(readState==1) { amtDesktop.ProcessData(data); } } } else if((type==2) && flagBinary && flagUser) { if(recFileProtocol==101) { if(rstr2hex(data)=='0000000008080001000700070003050200000000') { amtDesktop.bpp=1; } } } recFileLastTime=time; if(playing) { readNextBlock(processBlock); } } function cleanup() { recFile=null; recFilePtr=0; recFileMetadata=null; playing=false; if(agentDesktop !=null) { agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height); agentDesktop=null; } if(amtDesktop !=null) { amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height); amtDesktop=null; } readState=0; waitTimerArgs=null; currentDeltaTimeTotalSec=0; recFileEndTime=0; agentTerminal=null; if(waitTimer !=null) { clearTimeout(waitTimer); waitTimer=null; } QH('deskstatus', ''); QE('PlayButton',false); QE('PauseButton',false); QE('RestartButton',false); QS('progressbar').width = '0px'; QH('timespan', '00:00:00'); QV('metadatadiv',true); QH('metadatadiv', '<span style=\#75# + '</span>'); QV('DeskParent',true); QV('TermParent',false); } function ondrop(e) { haltEvent(e); QV('bigfail',false); QV('bigok',false); if(e.dataTransfer==null) return; var files=[]; for (var i in e.dataTransfer.files) { if((e.dataTransfer.files[i].type !=null) && (e.dataTransfer.files[i].size !=null) && (e.dataTransfer.files[i].size !=0) && (e.dataTransfer.files[i].name.endsWith('.mcrec'))) { files.push(e.dataTransfer.files[i]); } } if(files.length==0) return; cleanup(); recFile=files[0]; recFilePtr=0; readNextBlock(processFirstBlock); readLastBlock(function (type,flags,time) { if(type==3) { recFileEndTime=time; } else { recFileEndTime=0; } }); } var dragtimer=null; function ondragover(e) { haltEvent(e); if(dragtimer !=null) { clearTimeout(dragtimer); dragtimer=null; } var ac=true; QV('bigok',ac); QV('bigfail',!ac); } function ondragleave(e) { haltEvent(e); dragtimer=setTimeout(function () { QV('bigfail', false); QV('bigok',false); dragtimer=null; },10); } function onkeypress(e) { if(xxdialogMode) return; if(e.key==' ') { togglePause(); haltEvent(e); } if(e.key=='1') { Q('PlaySpeed').value=4; haltEvent(e); } if(e.key=='2') { Q('PlaySpeed').value=2; haltEvent(e); } if(e.key=='3') { Q('PlaySpeed').value=1; haltEvent(e); } if(e.key=='4') { Q('PlaySpeed').value=0.5; haltEvent(e); } if(e.key=='5') { Q('PlaySpeed').value=0.25; haltEvent(e); } if(e.key=='6') { Q('PlaySpeed').value=0.1; haltEvent(e); } if(e.key=='0') { pause(); restart(); haltEvent(e); } } function openfile() { var x='<input type=file name=files id=p2fileinput style=width:100% accept=#76# />'; setDialogMode(2,"Open File...",3,openfileEx,x); QE('idx_dlgOkButton',false); } function openfileEx() { var xfiles=Q('p2fileinput').files; if(xfiles !=null) { var files=[]; for (var i in xfiles) { if((xfiles[i].type !=null) && (xfiles[i].size !=null) && (xfiles[i].size !=0) && (xfiles[i].name.endsWith('.mcrec'))) { files.push(xfiles[i]); } } } if(files.length==0) return; cleanup(); recFile=files[0]; recFilePtr=0; readNextBlock(processFirstBlock); readLastBlock(function (type,flags,time) { if(type==3) { recFileEndTime=time; } else { recFileEndTime=0; } }); Q('OpenFileButton').blur(); } function openfileChanged() { var xfiles=Q('p2fileinput').files; if(xfiles !=null) { var files=[]; for (var i in xfiles) { if((xfiles[i].type !=null) && (xfiles[i].size !=null) && (xfiles[i].size !=0) && (xfiles[i].name.endsWith('.mcrec'))) { files.push(xfiles[i]); } } } QE('idx_dlgOkButton',files.length==1); } function togglePause() { if(recFile !=null) { if(playing==true) { pause(); } else { if(recFilePtr !=recFile.size) { play(); } } } return false; } function play() { Q('PlayButton').blur(); if((playing==true) || (recFileProtocol==0)) return; playing=true; QV('metadatadiv',false); QE('PlayButton',false); QE('PauseButton',true); QE('RestartButton',false); if((recFileProtocol==1) && (agentTerminal==null)) { QV('DeskParent',false); QV('TermParent',true); agentTerminal=CreateAmtRemoteTerminal('Term',{}); agentTerminal.State=3; } readNextBlock(processBlock); } function pause() { Q('PauseButton').blur(); if(playing==false) return; playing=false; QE('PlayButton',recFilePtr !=recFile.size); QE('PauseButton',false); QE('RestartButton',recFilePtr !=0); if(waitTimer !=null) { clearTimeout(waitTimer); waitTimer=null; processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3]); waitTimerArgs=null; } } function restart() { Q('RestartButton').blur(); if(playing==true) return; recFilePtr=0; readState=0; currentDeltaTimeTotalSec=0; QV('metadatadiv',true); QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); QS('progressbar').width = '0px'; QH('timespan', '00:00:00'); QV('DeskParent',true); QV('TermParent',false); if(agentDesktop) { agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height); } else if(amtDesktop) { amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height); amtDesktop=CreateAmtRemoteDesktop('Desk'); amtDesktop.onScreenSizeChange=deskAdjust; amtDesktop.State=3; amtDesktop.Start(); } else if(agentTerminal) { agentTerminal=null; } } function clearConsoleMsg() { QH('p11DeskConsoleMsg', ''); } function toggleAspectRatio(toggle) { if(toggle===1) { deskAspectRatio=((deskAspectRatio + 1) % 3); } deskAdjust(); } function deskAdjust() { var parentH=Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth; var deskH=Q('Desk').height, deskW = Q('Desk').width; if(deskAspectRatio==2) { QS('Desk')['margin-top']=null; QS('Desk').height = '100%'; QS('Desk').width = '100%'; QS('DeskParent').overflow = 'hidden'; } else if(deskAspectRatio==1) { QS('Desk')['margin-top'] = '0px'; QS('Desk').height = deskH + 'px'; QS('Desk').width = deskW + 'px'; QS('DeskParent').overflow = 'scroll'; } else { if((parentH / parentW) > (deskH / deskW)) { var hNew=((deskH * parentW) / deskW) + 'px'; QS('Desk').height=hNew; QS('Desk').width = '100%'; } else { var wNew=((deskW * parentH) / deskH) + 'px'; QS('Desk').height = '100%'; QS('Desk').width=wNew; } QS('Desk')['margin-top']=null; QS('DeskParent').overflow = 'hidden'; } } var xxdialogMode; var xxdialogFunc; var xxdialogButtons; var xxdialogTag; var xxcurrentView=-1; function setDialogMode(x,y,b,f,c,tag) { xxdialogMode=x; xxdialogFunc=f; xxdialogButtons=b; xxdialogTag=tag; QE('idx_dlgOkButton',true); QV('idx_dlgOkButton',b & 1); QV('idx_dlgCancelButton',b & 2); QV('id_dialogclose',(b & 2) || (b & 8)); QV('idx_dlgDeleteButton',b & 4); QV('idx_dlgButtonBar',b & 7); if(y) QH('id_dialogtitle',y); for (var i=1; i < 3; i++) { QV('dialog' + i,i==x); } QV('dialog',x); if(c) { if(x==2) { QH('id_dialogOptions', c); } else { QH('id_dialogMessage',c); } } } function dialogclose(x) { var f=xxdialogFunc,b=xxdialogButtons,t=xxdialogTag; setDialogMode(); if(((b & 8) || x) && f) f(x,t); } function messagebox(t,m) { setSessionActivity(); QH('id_dialogMessage',m); setDialogMode(1,t,1); } function statusbox(t,m) { setSessionActivity(); QH('id_dialogMessage',m); setDialogMode(1,t); } function haltEvent(e) { if(e.preventDefault) e.preventDefault(); if(e.stopPropagation) e.stopPropagation(); return false; } function pad2(num) { var s='00' + num; return s.substr(s.length - 2); } function format(format) { var args=Array.prototype.slice.call(arguments,1); return format.replace(/{(\d+)}/g,function (match,number) { return typeof args[number] !='undefined'?args[number]:match; }); }; start(); </script></body></html>
\ No newline at end of file
public/translations/player_fr.min.htm new
+1
@@ -0,0 +1 @@
1 +<!DOCTYPE html><html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <link type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS"> <script type="text/javascript" src="scripts/common-0.0.1.js"></script> <script type="text/javascript" src="scripts/agent-desktop-0.0.2.js"></script> <script type="text/javascript" src="scripts/amt-desktop-0.0.2.js"></script> <script type="text/javascript" src="scripts/amt-terminal-0.0.2.js"></script> <script type="text/javascript" src="scripts/zlib.js"></script> <script type="text/javascript" src="scripts/zlib-inflate.js"></script> <script type="text/javascript" src="scripts/zlib-adler32.js"></script> <script type="text/javascript" src="scripts/zlib-crc32.js"></script></head><body style="overflow:hidden;background-color:black"> <div id="p11" class="noselect" style="overflow:hidden"> <div id="deskarea0"> <div id="deskarea1" class="areaHead"> <div class="toright2"> <div class="deskareaicon" title="Toggle View Mode" onclick="toggleAspectRatio(1)">⇲</div> </div> <div> <input id="OpenFileButton" type="button" value="Open File..." onclick="openfile()"> <span id="deskstatus"></span> </div> </div> <div id="deskarea2" style=""> <div class="areaProgress"><div id="progressbar" style=""></div></div> </div> <div id="deskarea3x" style="max-height:calc(100vh - 54px);height:calc(100vh - 54px);" onclick="togglePause()"> <div id="bigok" style="display:none;left:calc((100vh / 2))"><b>✓</b></div> <div id="bigfail" style="display:none;left:calc((100vh / 2))"><b>✗</b></div> <div id="metadatadiv" style="padding:20px;color:lightgrey;text-align:left;display:none"></div> <div id="DeskParent"> <canvas id="Desk" width="640" height="480"></canvas> </div> <div id="TermParent" style="display:none"> <pre id="Term"></pre> </div> <div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="clearConsoleMsg()"></div> </div> <div id="deskarea4" class="areaFoot"> <div class="toright2"> <div id="timespan" style="padding-top:4px;padding-right:4px">00:00:00</div> </div> <div> &nbsp; <input id="PlayButton" type="button" value="Jouer" disabled="disabled" onclick="play()"> <input id="PauseButton" type="button" value="Pause" disabled="disabled" onclick="pause()"> <input id="RestartButton" type="button" value="Redémarrer" disabled="disabled" onclick="restart()"> <select id="PlaySpeed" onchange="this.blur();"> <option value="4">1/4 vitesse</option> <option value="2">1/2 vitesse</option> <option value="1" selected="">Normal Speed</option> <option value="0.5">2x vitesse</option> <option value="0.25">4x vitesse</option> <option value="0.1">10x vitesse</option> </select> </div> </div> </div> <div id="dialog" class="noselect" style="display:none"> <div id="dialogHeader"> <div tabindex="0" id="id_dialogclose" onclick="setDialogMode()" onkeypress="if (event.key == 'Enter') setDialogMode()">✖</div> <div id="id_dialogtitle"></div> </div> <div id="dialogBody"> <div id="dialog1"> <div id="id_dialogMessage" style=""></div> </div> <div id="dialog2" style=""> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar"> <input id="idx_dlgCancelButton" type="button" value="Annuler" style="" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="" onclick="dialogclose(1)"> <div><input id="idx_dlgDeleteButton" type="button" value="Delete" style="display:none" onclick="dialogclose(2)"></div> </div> </div> </div> <script> var recFile=null; var recFilePtr=0; var recFileStartTime=0; var recFileLastTime=0; var recFileEndTime=0; var recFileMetadata=null; var recFileProtocol=0; var agentDesktop=null; var amtDesktop=null; var playing=false; var readState=0; var waitTimer=null; var waitTimerArgs=null; var deskAspectRatio=0; var currentDeltaTimeTotalSec=0; function start() { window.onresize=deskAdjust; document.ondrop=ondrop; document.ondragover=ondragover; document.ondragleave=ondragleave; document.onkeypress=onkeypress; Q('PlaySpeed').value=1; cleanup(); } function readNextBlock(func) { if((recFilePtr + 16) > recFile.size) { QS('progressbar').width = '100%'; func(-1); } else { var fr=new FileReader(); fr.onload=function () { var type=ReadShort(this.result,0); var flags=ReadShort(this.result,2); var size=ReadInt(this.result,4); var time=(ReadInt(this.result,8) << 32) + ReadInt(this.result,12); if((recFilePtr + 16 + size) > recFile.size) { QS('progressbar').width = '100%'; func(-1); } else { var fr2=new FileReader(); fr2.onload=function () { recFilePtr +=(16 + size); if(recFileEndTime==0) { QS('progressbar').width = Math.floor(100 * (recFilePtr / recFile.size)) + '%'; } else { QS('progressbar').width = Math.floor(((recFileLastTime - recFileStartTime) / (recFileEndTime - recFileStartTime)) * 100) + '%'; } func(type,flags,time,this.result); }; fr2.readAsBinaryString(recFile.slice(recFilePtr + 16,recFilePtr + 16 + size)); } }; fr.readAsBinaryString(recFile.slice(recFilePtr,recFilePtr + 16)); } } function readLastBlock(func) { if(recFile.size < 32) { func(-1); } else { var fr=new FileReader(); fr.onload=function () { var type=ReadShort(this.result,0); var flags=ReadShort(this.result,2); var size=ReadInt(this.result,4); var time=(ReadInt(this.result,8) << 32) + ReadInt(this.result,12); if((type==3) && (size==16) && (this.result.substring(16,32)=='MeshCentralMCREC')) { func(type,flags,time); } else { func(-1); } }; fr.readAsBinaryString(recFile.slice(recFile.size - 32,recFile.size)); } } function addInfo(name,value) { if(value==null) return ''; return addInfoNoEsc(name,EscapeHtml(value)); } function addInfoNoEsc(name,value) { if(value==null) return ''; return '<span style=color:gray>' + EscapeHtml(name) + '</span>:&nbsp;<span style=font-size:20px>' + value + '</span><br/>'; } function processFirstBlock(type,flags,time,data) { recFileProtocol=0; if((type !=1) || (flags !=0)) { cleanup(); return; } try { recFileMetadata=JSON.parse(data) } catch (ex) { cleanup(); return; } if((recFileMetadata==null) || (recFileMetadata.magic !='MeshCentralRelaySession') || (recFileMetadata.ver !=1)) { cleanup(); return; } var x=''; x +=addInfo("Temps",recFileMetadata.time); if(recFileEndTime !=0) { var secs=Math.floor((recFileEndTime - time) / 1000); x +=addInfo("Duration", format("{0} second{1}",secs,(secs > 1)?'s' : '')); } x +=addInfo("Nom d'utilisateur",recFileMetadata.username); x +=addInfo("Identifiant d'utilisateur",recFileMetadata.userid); x +=addInfo("SessionID",recFileMetadata.sessionid); if(recFileMetadata.ipaddr1 && recFileMetadata.ipaddr2) { x +=addInfo("Addresses", format("{0} to {1}",recFileMetadata.ipaddr1,recFileMetadata.ipaddr2)); } if(recFileMetadata.devicename) { x +=addInfo("DeviceName",recFileMetadata.devicename); } x +=addInfo("NodeID",recFileMetadata.nodeid); if(recFileMetadata.protocol) { var p=recFileMetadata.protocol; if(p==1) { p="MeshCentral Terminal"; } else if(p==2) { p="MeshCentral Desktop"; } else if(p==100) { p="Intel&reg; AMT WSMAN"; } else if(p==101) { p="Intel&reg; AMT Redirection"; } x +=addInfoNoEsc("Protocol",p); } QV('DeskParent',true); QV('TermParent',false); if(recFileMetadata.protocol==1) { recFileProtocol=1; x +='<br /><br /><span style=color:gray>' + #73# + '</span>'; QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); recFileStartTime=recFileLastTime=time; } else if(recFileMetadata.protocol==2) { recFileProtocol=2; x +='<br /><br /><span style=color:gray>' + #74# + '</span>'; QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); recFileStartTime=recFileLastTime=time; agentDesktop=CreateAgentRemoteDesktop('Desk'); agentDesktop.onScreenSizeChange=deskAdjust; agentDesktop.State=3; deskAdjust(); } else if(recFileMetadata.protocol==101) { recFileProtocol=101; x +='<br /><br /><span style=color:gray>Press [space] to play/pause.</span>'; QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); recFileStartTime=recFileLastTime=time; amtDesktop=CreateAmtRemoteDesktop('Desk'); amtDesktop.onScreenSizeChange=deskAdjust; amtDesktop.State=3; amtDesktop.Start(); deskAdjust(); } QV('metadatadiv',true); QH('metadatadiv',x); QH('deskstatus',recFile.name); } function processBlock(type,flags,time,data) { if(type < 0) { pause(); return; } var waitTime=Math.round((time - recFileLastTime) * parseFloat(Q('PlaySpeed').value)); if(waitTime < 5) { processBlockEx(type,flags,time,data); } else { waitTimerArgs=[type,flags,time,data] waitTimer=setTimeout(function () { waitTimer=null; processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3]); },waitTime); } } function processBlockEx(type,flags,time,data) { if(playing==false) return; var flagBinary=(flags & 1) !=0,flagUser=(flags & 2) !=0; var deltaTimeTotalSec=Math.floor((time - recFileStartTime) / 1000); if(currentDeltaTimeTotalSec !=deltaTimeTotalSec) { currentDeltaTimeTotalSec=deltaTimeTotalSec; var deltaTimeHours=Math.floor(deltaTimeTotalSec / 3600); deltaTimeTotalSec -=(deltaTimeHours * 3600) var deltaTimeMinutes=Math.floor(deltaTimeTotalSec / 60); deltaTimeTotalSec -=(deltaTimeHours * 60) var deltaTimeSeconds=Math.floor(deltaTimeTotalSec); QH('timespan', pad2(deltaTimeHours) + ':' + pad2(deltaTimeMinutes) + ':' + pad2(deltaTimeSeconds)) } if((type==2) && flagBinary && !flagUser) { if(recFileProtocol==1) { agentTerminal.ProcessData(data); } else if(recFileProtocol==2) { agentDesktop.ProcessData(data); } else if(recFileProtocol==101) { if((readState==0) && (rstr2hex(data)=='4100000000000000')) { readState=1; if(data.length > 8) { amtDesktop.ProcessData(data.substring(8)); } } else if(readState==1) { amtDesktop.ProcessData(data); } } } else if((type==2) && flagBinary && flagUser) { if(recFileProtocol==101) { if(rstr2hex(data)=='0000000008080001000700070003050200000000') { amtDesktop.bpp=1; } } } recFileLastTime=time; if(playing) { readNextBlock(processBlock); } } function cleanup() { recFile=null; recFilePtr=0; recFileMetadata=null; playing=false; if(agentDesktop !=null) { agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height); agentDesktop=null; } if(amtDesktop !=null) { amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height); amtDesktop=null; } readState=0; waitTimerArgs=null; currentDeltaTimeTotalSec=0; recFileEndTime=0; agentTerminal=null; if(waitTimer !=null) { clearTimeout(waitTimer); waitTimer=null; } QH('deskstatus', ''); QE('PlayButton',false); QE('PauseButton',false); QE('RestartButton',false); QS('progressbar').width = '0px'; QH('timespan', '00:00:00'); QV('metadatadiv',true); QH('metadatadiv', '<span style=\#75# + '</span>'); QV('DeskParent',true); QV('TermParent',false); } function ondrop(e) { haltEvent(e); QV('bigfail',false); QV('bigok',false); if(e.dataTransfer==null) return; var files=[]; for (var i in e.dataTransfer.files) { if((e.dataTransfer.files[i].type !=null) && (e.dataTransfer.files[i].size !=null) && (e.dataTransfer.files[i].size !=0) && (e.dataTransfer.files[i].name.endsWith('.mcrec'))) { files.push(e.dataTransfer.files[i]); } } if(files.length==0) return; cleanup(); recFile=files[0]; recFilePtr=0; readNextBlock(processFirstBlock); readLastBlock(function (type,flags,time) { if(type==3) { recFileEndTime=time; } else { recFileEndTime=0; } }); } var dragtimer=null; function ondragover(e) { haltEvent(e); if(dragtimer !=null) { clearTimeout(dragtimer); dragtimer=null; } var ac=true; QV('bigok',ac); QV('bigfail',!ac); } function ondragleave(e) { haltEvent(e); dragtimer=setTimeout(function () { QV('bigfail', false); QV('bigok',false); dragtimer=null; },10); } function onkeypress(e) { if(xxdialogMode) return; if(e.key==' ') { togglePause(); haltEvent(e); } if(e.key=='1') { Q('PlaySpeed').value=4; haltEvent(e); } if(e.key=='2') { Q('PlaySpeed').value=2; haltEvent(e); } if(e.key=='3') { Q('PlaySpeed').value=1; haltEvent(e); } if(e.key=='4') { Q('PlaySpeed').value=0.5; haltEvent(e); } if(e.key=='5') { Q('PlaySpeed').value=0.25; haltEvent(e); } if(e.key=='6') { Q('PlaySpeed').value=0.1; haltEvent(e); } if(e.key=='0') { pause(); restart(); haltEvent(e); } } function openfile() { var x='<input type=file name=files id=p2fileinput style=width:100% accept=#76# />'; setDialogMode(2,"Open File...",3,openfileEx,x); QE('idx_dlgOkButton',false); } function openfileEx() { var xfiles=Q('p2fileinput').files; if(xfiles !=null) { var files=[]; for (var i in xfiles) { if((xfiles[i].type !=null) && (xfiles[i].size !=null) && (xfiles[i].size !=0) && (xfiles[i].name.endsWith('.mcrec'))) { files.push(xfiles[i]); } } } if(files.length==0) return; cleanup(); recFile=files[0]; recFilePtr=0; readNextBlock(processFirstBlock); readLastBlock(function (type,flags,time) { if(type==3) { recFileEndTime=time; } else { recFileEndTime=0; } }); Q('OpenFileButton').blur(); } function openfileChanged() { var xfiles=Q('p2fileinput').files; if(xfiles !=null) { var files=[]; for (var i in xfiles) { if((xfiles[i].type !=null) && (xfiles[i].size !=null) && (xfiles[i].size !=0) && (xfiles[i].name.endsWith('.mcrec'))) { files.push(xfiles[i]); } } } QE('idx_dlgOkButton',files.length==1); } function togglePause() { if(recFile !=null) { if(playing==true) { pause(); } else { if(recFilePtr !=recFile.size) { play(); } } } return false; } function play() { Q('PlayButton').blur(); if((playing==true) || (recFileProtocol==0)) return; playing=true; QV('metadatadiv',false); QE('PlayButton',false); QE('PauseButton',true); QE('RestartButton',false); if((recFileProtocol==1) && (agentTerminal==null)) { QV('DeskParent',false); QV('TermParent',true); agentTerminal=CreateAmtRemoteTerminal('Term',{}); agentTerminal.State=3; } readNextBlock(processBlock); } function pause() { Q('PauseButton').blur(); if(playing==false) return; playing=false; QE('PlayButton',recFilePtr !=recFile.size); QE('PauseButton',false); QE('RestartButton',recFilePtr !=0); if(waitTimer !=null) { clearTimeout(waitTimer); waitTimer=null; processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3]); waitTimerArgs=null; } } function restart() { Q('RestartButton').blur(); if(playing==true) return; recFilePtr=0; readState=0; currentDeltaTimeTotalSec=0; QV('metadatadiv',true); QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); QS('progressbar').width = '0px'; QH('timespan', '00:00:00'); QV('DeskParent',true); QV('TermParent',false); if(agentDesktop) { agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height); } else if(amtDesktop) { amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height); amtDesktop=CreateAmtRemoteDesktop('Desk'); amtDesktop.onScreenSizeChange=deskAdjust; amtDesktop.State=3; amtDesktop.Start(); } else if(agentTerminal) { agentTerminal=null; } } function clearConsoleMsg() { QH('p11DeskConsoleMsg', ''); } function toggleAspectRatio(toggle) { if(toggle===1) { deskAspectRatio=((deskAspectRatio + 1) % 3); } deskAdjust(); } function deskAdjust() { var parentH=Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth; var deskH=Q('Desk').height, deskW = Q('Desk').width; if(deskAspectRatio==2) { QS('Desk')['margin-top']=null; QS('Desk').height = '100%'; QS('Desk').width = '100%'; QS('DeskParent').overflow = 'hidden'; } else if(deskAspectRatio==1) { QS('Desk')['margin-top'] = '0px'; QS('Desk').height = deskH + 'px'; QS('Desk').width = deskW + 'px'; QS('DeskParent').overflow = 'scroll'; } else { if((parentH / parentW) > (deskH / deskW)) { var hNew=((deskH * parentW) / deskW) + 'px'; QS('Desk').height=hNew; QS('Desk').width = '100%'; } else { var wNew=((deskW * parentH) / deskH) + 'px'; QS('Desk').height = '100%'; QS('Desk').width=wNew; } QS('Desk')['margin-top']=null; QS('DeskParent').overflow = 'hidden'; } } var xxdialogMode; var xxdialogFunc; var xxdialogButtons; var xxdialogTag; var xxcurrentView=-1; function setDialogMode(x,y,b,f,c,tag) { xxdialogMode=x; xxdialogFunc=f; xxdialogButtons=b; xxdialogTag=tag; QE('idx_dlgOkButton',true); QV('idx_dlgOkButton',b & 1); QV('idx_dlgCancelButton',b & 2); QV('id_dialogclose',(b & 2) || (b & 8)); QV('idx_dlgDeleteButton',b & 4); QV('idx_dlgButtonBar',b & 7); if(y) QH('id_dialogtitle',y); for (var i=1; i < 3; i++) { QV('dialog' + i,i==x); } QV('dialog',x); if(c) { if(x==2) { QH('id_dialogOptions', c); } else { QH('id_dialogMessage',c); } } } function dialogclose(x) { var f=xxdialogFunc,b=xxdialogButtons,t=xxdialogTag; setDialogMode(); if(((b & 8) || x) && f) f(x,t); } function messagebox(t,m) { setSessionActivity(); QH('id_dialogMessage',m); setDialogMode(1,t,1); } function statusbox(t,m) { setSessionActivity(); QH('id_dialogMessage',m); setDialogMode(1,t); } function haltEvent(e) { if(e.preventDefault) e.preventDefault(); if(e.stopPropagation) e.stopPropagation(); return false; } function pad2(num) { var s='00' + num; return s.substr(s.length - 2); } function format(format) { var args=Array.prototype.slice.call(arguments,1); return format.replace(/{(\d+)}/g,function (match,number) { return typeof args[number] !='undefined'?args[number]:match; }); }; start(); </script></body></html>
\ No newline at end of file
public/translations/player_fr_fr.min.htm new
+1
@@ -0,0 +1 @@
1 +<!DOCTYPE html><html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <link type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS"> <script type="text/javascript" src="scripts/common-0.0.1.js"></script> <script type="text/javascript" src="scripts/agent-desktop-0.0.2.js"></script> <script type="text/javascript" src="scripts/amt-desktop-0.0.2.js"></script> <script type="text/javascript" src="scripts/amt-terminal-0.0.2.js"></script> <script type="text/javascript" src="scripts/zlib.js"></script> <script type="text/javascript" src="scripts/zlib-inflate.js"></script> <script type="text/javascript" src="scripts/zlib-adler32.js"></script> <script type="text/javascript" src="scripts/zlib-crc32.js"></script></head><body style="overflow:hidden;background-color:black"> <div id="p11" class="noselect" style="overflow:hidden"> <div id="deskarea0"> <div id="deskarea1" class="areaHead"> <div class="toright2"> <div class="deskareaicon" title="Toggle View Mode" onclick="toggleAspectRatio(1)">⇲</div> </div> <div> <input id="OpenFileButton" type="button" value="Open File..." onclick="openfile()"> <span id="deskstatus"></span> </div> </div> <div id="deskarea2" style=""> <div class="areaProgress"><div id="progressbar" style=""></div></div> </div> <div id="deskarea3x" style="max-height:calc(100vh - 54px);height:calc(100vh - 54px);" onclick="togglePause()"> <div id="bigok" style="display:none;left:calc((100vh / 2))"><b>✓</b></div> <div id="bigfail" style="display:none;left:calc((100vh / 2))"><b>✗</b></div> <div id="metadatadiv" style="padding:20px;color:lightgrey;text-align:left;display:none"></div> <div id="DeskParent"> <canvas id="Desk" width="640" height="480"></canvas> </div> <div id="TermParent" style="display:none"> <pre id="Term"></pre> </div> <div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="clearConsoleMsg()"></div> </div> <div id="deskarea4" class="areaFoot"> <div class="toright2"> <div id="timespan" style="padding-top:4px;padding-right:4px">00:00:00</div> </div> <div> &nbsp; <input id="PlayButton" type="button" value="Jouer" disabled="disabled" onclick="play()"> <input id="PauseButton" type="button" value="Pause" disabled="disabled" onclick="pause()"> <input id="RestartButton" type="button" value="Redémarrer" disabled="disabled" onclick="restart()"> <select id="PlaySpeed" onchange="this.blur();"> <option value="4">1/4 vitesse</option> <option value="2">1/2 vitesse</option> <option value="1" selected="">Normal Speed</option> <option value="0.5">2x vitesse</option> <option value="0.25">4x vitesse</option> <option value="0.1">10x vitesse</option> </select> </div> </div> </div> <div id="dialog" class="noselect" style="display:none"> <div id="dialogHeader"> <div tabindex="0" id="id_dialogclose" onclick="setDialogMode()" onkeypress="if (event.key == 'Enter') setDialogMode()">✖</div> <div id="id_dialogtitle"></div> </div> <div id="dialogBody"> <div id="dialog1"> <div id="id_dialogMessage" style=""></div> </div> <div id="dialog2" style=""> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar"> <input id="idx_dlgCancelButton" type="button" value="Annuler" style="" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="" onclick="dialogclose(1)"> <div><input id="idx_dlgDeleteButton" type="button" value="Delete" style="display:none" onclick="dialogclose(2)"></div> </div> </div> </div> <script> var recFile=null; var recFilePtr=0; var recFileStartTime=0; var recFileLastTime=0; var recFileEndTime=0; var recFileMetadata=null; var recFileProtocol=0; var agentDesktop=null; var amtDesktop=null; var playing=false; var readState=0; var waitTimer=null; var waitTimerArgs=null; var deskAspectRatio=0; var currentDeltaTimeTotalSec=0; function start() { window.onresize=deskAdjust; document.ondrop=ondrop; document.ondragover=ondragover; document.ondragleave=ondragleave; document.onkeypress=onkeypress; Q('PlaySpeed').value=1; cleanup(); } function readNextBlock(func) { if((recFilePtr + 16) > recFile.size) { QS('progressbar').width = '100%'; func(-1); } else { var fr=new FileReader(); fr.onload=function () { var type=ReadShort(this.result,0); var flags=ReadShort(this.result,2); var size=ReadInt(this.result,4); var time=(ReadInt(this.result,8) << 32) + ReadInt(this.result,12); if((recFilePtr + 16 + size) > recFile.size) { QS('progressbar').width = '100%'; func(-1); } else { var fr2=new FileReader(); fr2.onload=function () { recFilePtr +=(16 + size); if(recFileEndTime==0) { QS('progressbar').width = Math.floor(100 * (recFilePtr / recFile.size)) + '%'; } else { QS('progressbar').width = Math.floor(((recFileLastTime - recFileStartTime) / (recFileEndTime - recFileStartTime)) * 100) + '%'; } func(type,flags,time,this.result); }; fr2.readAsBinaryString(recFile.slice(recFilePtr + 16,recFilePtr + 16 + size)); } }; fr.readAsBinaryString(recFile.slice(recFilePtr,recFilePtr + 16)); } } function readLastBlock(func) { if(recFile.size < 32) { func(-1); } else { var fr=new FileReader(); fr.onload=function () { var type=ReadShort(this.result,0); var flags=ReadShort(this.result,2); var size=ReadInt(this.result,4); var time=(ReadInt(this.result,8) << 32) + ReadInt(this.result,12); if((type==3) && (size==16) && (this.result.substring(16,32)=='MeshCentralMCREC')) { func(type,flags,time); } else { func(-1); } }; fr.readAsBinaryString(recFile.slice(recFile.size - 32,recFile.size)); } } function addInfo(name,value) { if(value==null) return ''; return addInfoNoEsc(name,EscapeHtml(value)); } function addInfoNoEsc(name,value) { if(value==null) return ''; return '<span style=color:gray>' + EscapeHtml(name) + '</span>:&nbsp;<span style=font-size:20px>' + value + '</span><br/>'; } function processFirstBlock(type,flags,time,data) { recFileProtocol=0; if((type !=1) || (flags !=0)) { cleanup(); return; } try { recFileMetadata=JSON.parse(data) } catch (ex) { cleanup(); return; } if((recFileMetadata==null) || (recFileMetadata.magic !='MeshCentralRelaySession') || (recFileMetadata.ver !=1)) { cleanup(); return; } var x=''; x +=addInfo("Temps",recFileMetadata.time); if(recFileEndTime !=0) { var secs=Math.floor((recFileEndTime - time) / 1000); x +=addInfo("Duration", format("{0} second{1}",secs,(secs > 1)?'s' : '')); } x +=addInfo("Nom d'utilisateur",recFileMetadata.username); x +=addInfo("Identifiant d'utilisateur",recFileMetadata.userid); x +=addInfo("SessionID",recFileMetadata.sessionid); if(recFileMetadata.ipaddr1 && recFileMetadata.ipaddr2) { x +=addInfo("Addresses", format("{0} to {1}",recFileMetadata.ipaddr1,recFileMetadata.ipaddr2)); } if(recFileMetadata.devicename) { x +=addInfo("DeviceName",recFileMetadata.devicename); } x +=addInfo("NodeID",recFileMetadata.nodeid); if(recFileMetadata.protocol) { var p=recFileMetadata.protocol; if(p==1) { p="MeshCentral Terminal"; } else if(p==2) { p="MeshCentral Desktop"; } else if(p==100) { p="Intel&reg; AMT WSMAN"; } else if(p==101) { p="Intel&reg; AMT Redirection"; } x +=addInfoNoEsc("Protocol",p); } QV('DeskParent',true); QV('TermParent',false); if(recFileMetadata.protocol==1) { recFileProtocol=1; x +='<br /><br /><span style=color:gray>' + #73# + '</span>'; QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); recFileStartTime=recFileLastTime=time; } else if(recFileMetadata.protocol==2) { recFileProtocol=2; x +='<br /><br /><span style=color:gray>' + #74# + '</span>'; QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); recFileStartTime=recFileLastTime=time; agentDesktop=CreateAgentRemoteDesktop('Desk'); agentDesktop.onScreenSizeChange=deskAdjust; agentDesktop.State=3; deskAdjust(); } else if(recFileMetadata.protocol==101) { recFileProtocol=101; x +='<br /><br /><span style=color:gray>Press [space] to play/pause.</span>'; QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); recFileStartTime=recFileLastTime=time; amtDesktop=CreateAmtRemoteDesktop('Desk'); amtDesktop.onScreenSizeChange=deskAdjust; amtDesktop.State=3; amtDesktop.Start(); deskAdjust(); } QV('metadatadiv',true); QH('metadatadiv',x); QH('deskstatus',recFile.name); } function processBlock(type,flags,time,data) { if(type < 0) { pause(); return; } var waitTime=Math.round((time - recFileLastTime) * parseFloat(Q('PlaySpeed').value)); if(waitTime < 5) { processBlockEx(type,flags,time,data); } else { waitTimerArgs=[type,flags,time,data] waitTimer=setTimeout(function () { waitTimer=null; processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3]); },waitTime); } } function processBlockEx(type,flags,time,data) { if(playing==false) return; var flagBinary=(flags & 1) !=0,flagUser=(flags & 2) !=0; var deltaTimeTotalSec=Math.floor((time - recFileStartTime) / 1000); if(currentDeltaTimeTotalSec !=deltaTimeTotalSec) { currentDeltaTimeTotalSec=deltaTimeTotalSec; var deltaTimeHours=Math.floor(deltaTimeTotalSec / 3600); deltaTimeTotalSec -=(deltaTimeHours * 3600) var deltaTimeMinutes=Math.floor(deltaTimeTotalSec / 60); deltaTimeTotalSec -=(deltaTimeHours * 60) var deltaTimeSeconds=Math.floor(deltaTimeTotalSec); QH('timespan', pad2(deltaTimeHours) + ':' + pad2(deltaTimeMinutes) + ':' + pad2(deltaTimeSeconds)) } if((type==2) && flagBinary && !flagUser) { if(recFileProtocol==1) { agentTerminal.ProcessData(data); } else if(recFileProtocol==2) { agentDesktop.ProcessData(data); } else if(recFileProtocol==101) { if((readState==0) && (rstr2hex(data)=='4100000000000000')) { readState=1; if(data.length > 8) { amtDesktop.ProcessData(data.substring(8)); } } else if(readState==1) { amtDesktop.ProcessData(data); } } } else if((type==2) && flagBinary && flagUser) { if(recFileProtocol==101) { if(rstr2hex(data)=='0000000008080001000700070003050200000000') { amtDesktop.bpp=1; } } } recFileLastTime=time; if(playing) { readNextBlock(processBlock); } } function cleanup() { recFile=null; recFilePtr=0; recFileMetadata=null; playing=false; if(agentDesktop !=null) { agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height); agentDesktop=null; } if(amtDesktop !=null) { amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height); amtDesktop=null; } readState=0; waitTimerArgs=null; currentDeltaTimeTotalSec=0; recFileEndTime=0; agentTerminal=null; if(waitTimer !=null) { clearTimeout(waitTimer); waitTimer=null; } QH('deskstatus', ''); QE('PlayButton',false); QE('PauseButton',false); QE('RestartButton',false); QS('progressbar').width = '0px'; QH('timespan', '00:00:00'); QV('metadatadiv',true); QH('metadatadiv', '<span style=\#75# + '</span>'); QV('DeskParent',true); QV('TermParent',false); } function ondrop(e) { haltEvent(e); QV('bigfail',false); QV('bigok',false); if(e.dataTransfer==null) return; var files=[]; for (var i in e.dataTransfer.files) { if((e.dataTransfer.files[i].type !=null) && (e.dataTransfer.files[i].size !=null) && (e.dataTransfer.files[i].size !=0) && (e.dataTransfer.files[i].name.endsWith('.mcrec'))) { files.push(e.dataTransfer.files[i]); } } if(files.length==0) return; cleanup(); recFile=files[0]; recFilePtr=0; readNextBlock(processFirstBlock); readLastBlock(function (type,flags,time) { if(type==3) { recFileEndTime=time; } else { recFileEndTime=0; } }); } var dragtimer=null; function ondragover(e) { haltEvent(e); if(dragtimer !=null) { clearTimeout(dragtimer); dragtimer=null; } var ac=true; QV('bigok',ac); QV('bigfail',!ac); } function ondragleave(e) { haltEvent(e); dragtimer=setTimeout(function () { QV('bigfail', false); QV('bigok',false); dragtimer=null; },10); } function onkeypress(e) { if(xxdialogMode) return; if(e.key==' ') { togglePause(); haltEvent(e); } if(e.key=='1') { Q('PlaySpeed').value=4; haltEvent(e); } if(e.key=='2') { Q('PlaySpeed').value=2; haltEvent(e); } if(e.key=='3') { Q('PlaySpeed').value=1; haltEvent(e); } if(e.key=='4') { Q('PlaySpeed').value=0.5; haltEvent(e); } if(e.key=='5') { Q('PlaySpeed').value=0.25; haltEvent(e); } if(e.key=='6') { Q('PlaySpeed').value=0.1; haltEvent(e); } if(e.key=='0') { pause(); restart(); haltEvent(e); } } function openfile() { var x='<input type=file name=files id=p2fileinput style=width:100% accept=#76# />'; setDialogMode(2,"Open File...",3,openfileEx,x); QE('idx_dlgOkButton',false); } function openfileEx() { var xfiles=Q('p2fileinput').files; if(xfiles !=null) { var files=[]; for (var i in xfiles) { if((xfiles[i].type !=null) && (xfiles[i].size !=null) && (xfiles[i].size !=0) && (xfiles[i].name.endsWith('.mcrec'))) { files.push(xfiles[i]); } } } if(files.length==0) return; cleanup(); recFile=files[0]; recFilePtr=0; readNextBlock(processFirstBlock); readLastBlock(function (type,flags,time) { if(type==3) { recFileEndTime=time; } else { recFileEndTime=0; } }); Q('OpenFileButton').blur(); } function openfileChanged() { var xfiles=Q('p2fileinput').files; if(xfiles !=null) { var files=[]; for (var i in xfiles) { if((xfiles[i].type !=null) && (xfiles[i].size !=null) && (xfiles[i].size !=0) && (xfiles[i].name.endsWith('.mcrec'))) { files.push(xfiles[i]); } } } QE('idx_dlgOkButton',files.length==1); } function togglePause() { if(recFile !=null) { if(playing==true) { pause(); } else { if(recFilePtr !=recFile.size) { play(); } } } return false; } function play() { Q('PlayButton').blur(); if((playing==true) || (recFileProtocol==0)) return; playing=true; QV('metadatadiv',false); QE('PlayButton',false); QE('PauseButton',true); QE('RestartButton',false); if((recFileProtocol==1) && (agentTerminal==null)) { QV('DeskParent',false); QV('TermParent',true); agentTerminal=CreateAmtRemoteTerminal('Term',{}); agentTerminal.State=3; } readNextBlock(processBlock); } function pause() { Q('PauseButton').blur(); if(playing==false) return; playing=false; QE('PlayButton',recFilePtr !=recFile.size); QE('PauseButton',false); QE('RestartButton',recFilePtr !=0); if(waitTimer !=null) { clearTimeout(waitTimer); waitTimer=null; processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3]); waitTimerArgs=null; } } function restart() { Q('RestartButton').blur(); if(playing==true) return; recFilePtr=0; readState=0; currentDeltaTimeTotalSec=0; QV('metadatadiv',true); QE('PlayButton',true); QE('PauseButton',false); QE('RestartButton',false); QS('progressbar').width = '0px'; QH('timespan', '00:00:00'); QV('DeskParent',true); QV('TermParent',false); if(agentDesktop) { agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height); } else if(amtDesktop) { amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height); amtDesktop=CreateAmtRemoteDesktop('Desk'); amtDesktop.onScreenSizeChange=deskAdjust; amtDesktop.State=3; amtDesktop.Start(); } else if(agentTerminal) { agentTerminal=null; } } function clearConsoleMsg() { QH('p11DeskConsoleMsg', ''); } function toggleAspectRatio(toggle) { if(toggle===1) { deskAspectRatio=((deskAspectRatio + 1) % 3); } deskAdjust(); } function deskAdjust() { var parentH=Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth; var deskH=Q('Desk').height, deskW = Q('Desk').width; if(deskAspectRatio==2) { QS('Desk')['margin-top']=null; QS('Desk').height = '100%'; QS('Desk').width = '100%'; QS('DeskParent').overflow = 'hidden'; } else if(deskAspectRatio==1) { QS('Desk')['margin-top'] = '0px'; QS('Desk').height = deskH + 'px'; QS('Desk').width = deskW + 'px'; QS('DeskParent').overflow = 'scroll'; } else { if((parentH / parentW) > (deskH / deskW)) { var hNew=((deskH * parentW) / deskW) + 'px'; QS('Desk').height=hNew; QS('Desk').width = '100%'; } else { var wNew=((deskW * parentH) / deskH) + 'px'; QS('Desk').height = '100%'; QS('Desk').width=wNew; } QS('Desk')['margin-top']=null; QS('DeskParent').overflow = 'hidden'; } } var xxdialogMode; var xxdialogFunc; var xxdialogButtons; var xxdialogTag; var xxcurrentView=-1; function setDialogMode(x,y,b,f,c,tag) { xxdialogMode=x; xxdialogFunc=f; xxdialogButtons=b; xxdialogTag=tag; QE('idx_dlgOkButton',true); QV('idx_dlgOkButton',b & 1); QV('idx_dlgCancelButton',b & 2); QV('id_dialogclose',(b & 2) || (b & 8)); QV('idx_dlgDeleteButton',b & 4); QV('idx_dlgButtonBar',b & 7); if(y) QH('id_dialogtitle',y); for (var i=1; i < 3; i++) { QV('dialog' + i,i==x); } QV('dialog',x); if(c) { if(x==2) { QH('id_dialogOptions', c); } else { QH('id_dialogMessage',c); } } } function dialogclose(x) { var f=xxdialogFunc,b=xxdialogButtons,t=xxdialogTag; setDialogMode(); if(((b & 8) || x) && f) f(x,t); } function messagebox(t,m) { setSessionActivity(); QH('id_dialogMessage',m); setDialogMode(1,t,1); } function statusbox(t,m) { setSessionActivity(); QH('id_dialogMessage',m); setDialogMode(1,t); } function haltEvent(e) { if(e.preventDefault) e.preventDefault(); if(e.stopPropagation) e.stopPropagation(); return false; } function pad2(num) { var s='00' + num; return s.substr(s.length - 2); } function format(format) { var args=Array.prototype.slice.call(arguments,1); return format.replace(/{(\d+)}/g,function (match,number) { return typeof args[number] !='undefined'?args[number]:match; }); }; start(); </script></body></html>
\ No newline at end of file
translate/translate.js
+101 -8
@@ -13,7 +13,8 @@ var translationTable = null;
13 var sourceStrings = null;
14 var jsdom = null; //require('jsdom');
15 var esprima = null; //require('esprima'); // https://www.npmjs.com/package/esprima
16 -//var { JSDOM } = jsdom;
16 +var minifyLib = 2; // 0 = None, 1 = minify-js, 2 = HTMLMinifier
17 +var minify = null;
18
19 var meshCentralSourceFiles = [
20 "../views/agentinvite.handlebars",
@@ -21,6 +22,7 @@ var meshCentralSourceFiles = [
22 "../views/default-mobile.handlebars",
23 "../views/download.handlebars",
24 "../views/error404.handlebars",
25 + "../views/error404-mobile.handlebars",
26 "../views/login.handlebars",
27 "../views/login-mobile.handlebars",
28 "../views/message.handlebars",
@@ -32,15 +34,20 @@ var meshCentralSourceFiles = [
34 // node translate.json EXTRACT bob.json ../meshcentral/views/default.handlebars
35 // node translate.js TRANSLATE fr test2.json ../meshcentral/views/default.handlebars
36
35 -InstallModules(['jsdom', 'esprima'], start);
37 +var libs = ['jsdom', 'esprima', 'minify-js'];
38 +if (minifyLib == 1) { libs.push('minify-js'); }
39 +if (minifyLib == 2) { libs.push('html-minifier'); }
40 +InstallModules(libs, start);
41
42 function start() {
43 jsdom = require('jsdom');
44 esprima = require('esprima'); // https://www.npmjs.com/package/esprima
45 + if (minifyLib == 1) { minify = require('minify-js'); }
46 + if (minifyLib == 2) { minify = require('html-minifier').minify; }
47
48 var command = null;
49 if (process.argv.length > 2) { command = process.argv[2].toLowerCase(); }
43 - if (['check', 'extract', 'extractall', 'translate', 'translateall'].indexOf(command) == -1) { command = null; }
50 + if (['check', 'extract', 'extractall', 'translate', 'translateall', 'minifyall'].indexOf(command) == -1) { command = null; }
51
52 console.log('MeshCentral web site translator');
53 if (command == null) {
@@ -61,6 +68,9 @@ function start() {
68 console.log('');
69 console.log(' TRANSLATEALL');
70 console.log(' Translate all MeshCentral strings using the languages.json file.');
71 + console.log('');
72 + console.log(' MINIFYALL');
73 + console.log(' Minify the main MeshCentral english web pages.');
74 process.exit();
75 return;
76 }
@@ -111,6 +121,44 @@ function start() {
121
122 translate(lang, langFile, sources, false);
123 }
124 +
125 + if (command == 'minifyall') {
126 + for (var i in meshCentralSourceFiles) {
127 + var outname = meshCentralSourceFiles[i];
128 + var outnamemin = null;
129 + if (outname.endsWith('.handlebars')) {
130 + outnamemin = (outname.substring(0, outname.length - 11) + '-min.handlebars');
131 + } else if (outname.endsWith('.html')) {
132 + outnamemin = (outname.substring(0, outname.length - 5) + '-min.html');
133 + } else if (outname.endsWith('.htm')) {
134 + outnamemin = (outname.substring(0, outname.length - 4) + '-min.htm');
135 + } else {
136 + outnamemin = (outname, outname + '.min');
137 + }
138 + console.log('Generating ' + outnamemin + '...');
139 +
140 + // Minify the file
141 + if (minifyLib = 2) {
142 + var minifiedOut = minify(fs.readFileSync(outname).toString(), {
143 + collapseBooleanAttributes: true,
144 + collapseInlineTagWhitespace: true,
145 + collapseWhitespace: true,
146 + minifyCSS: true,
147 + minifyJS: true,
148 + removeComments: true,
149 + removeOptionalTags: true,
150 + removeEmptyAttributes: true,
151 + removeAttributeQuotes: true,
152 + removeRedundantAttributes: true,
153 + removeScriptTypeAttributes: true,
154 + removeTagWhitespace: true,
155 + preserveLineBreaks: false,
156 + useShortDoctype: true
157 + });
158 + fs.writeFileSync(outnamemin, minifiedOut, { flag: 'w+' });
159 + }
160 + }
161 + }
162 }
163
164 function translate(lang, langFile, sources, createSubDir) {
@@ -129,7 +177,7 @@ function translate(lang, langFile, sources, createSubDir) {
177 for (var i in langs) { translateEx(i, langFileData, sources, createSubDir); }
178 }
179
132 - process.exit();
180 + //process.exit();
181 return;
182 }
183
@@ -252,14 +300,59 @@ function translateFromHtml(lang, file, createSubDir) {
300 var out = dom.serialize();
301
302 var outname = file;
303 + var outnamemin = null;
304 if (createSubDir != null) { outname = path.join(path.dirname(file), createSubDir, path.basename(file)); }
256 - if (outname.endsWith('.handlebars')) { outname = (outname.substring(0, outname.length - 11) + '_' + lang + '.handlebars'); }
257 - else if (outname.endsWith('.html')) { outname = (outname.substring(0, outname.length - 5) + '_' + lang + '.html'); }
258 - else if (outname.endsWith('.htm')) { outname = (outname.substring(0, outname.length - 4) + '_' + lang + '.htm'); }
259 - else { outname = (outname + '_' + lang); }
305 + if (outname.endsWith('.handlebars')) {
306 + outnamemin = (outname.substring(0, outname.length - 11) + '-min_' + lang + '.handlebars');
307 + outname = (outname.substring(0, outname.length - 11) + '_' + lang + '.handlebars');
308 + } else if (outname.endsWith('.html')) {
309 + outnamemin = (outname.substring(0, outname.length - 5) + '-min_' + lang + '.html');
310 + outname = (outname.substring(0, outname.length - 5) + '_' + lang + '.html');
311 + } else if (outname.endsWith('.htm')) {
312 + outnamemin = (outname.substring(0, outname.length - 4) + '-min_' + lang + '.htm');
313 + outname = (outname.substring(0, outname.length - 4) + '_' + lang + '.htm');
314 + } else {
315 + outnamemin = (outname + '_' + lang + '.min');
316 + outname = (outname + '_' + lang);
317 + }
318 fs.writeFileSync(outname, out, { flag: 'w+' });
319 +
320 + // Minify the file
321 + if (minifyLib == 1) {
322 + minify.file({
323 + file: outname,
324 + dist: outnamemin
325 + }, (e, compress) => {
326 + if (e) { console.log('ERROR ', e); return done(); }
327 + compress.run((e) => { e ? console.log('Minification fail', e) : console.log('Minification sucess'); minifyDone(); });
328 + }
329 + );
330 + }
331 +
332 + // Minify the file
333 + if (minifyLib = 2) {
334 + var minifiedOut = minify(out, {
335 + collapseBooleanAttributes: true,
336 + collapseInlineTagWhitespace: true,
337 + collapseWhitespace: true,
338 + minifyCSS: true,
339 + minifyJS: true,
340 + removeComments: true,
341 + removeOptionalTags: true,
342 + removeEmptyAttributes: true,
343 + removeAttributeQuotes: true,
344 + removeRedundantAttributes: true,
345 + removeScriptTypeAttributes: true,
346 + removeTagWhitespace: true,
347 + preserveLineBreaks: false,
348 + useShortDoctype: true
349 + });
350 + fs.writeFileSync(outnamemin, minifiedOut, { flag: 'w+' });
351 + }
352 }
353
354 +function minifyDone() { console.log('Completed minification.'); }
355 +
356 function translateStrings(name, node) {
357 for (var i = 0; i < node.childNodes.length; i++) {
358 var subnode = node.childNodes[i];
views/agentinvite-min.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><title>MeshCentral - Agent Installation</title><style>.tab{overflow:hidden;border:1px solid #ccc;background-color:#f1f1f1}.tab button{background-color:inherit;float:left;border:none;outline:0;cursor:pointer;padding:14px 16px;transition:.3s}.tab button:hover{background-color:#ddd}.tab button.active{background-color:#8f8}.tabcontent{display:none;padding:6px 12px;border:1px solid #ccc;border-top:none}</style><body id=body onload='"undefined"!=typeof startup&&startup()'style=display:none;overflow:hidden><div id=container><div id=masthead class=noselect style="background:url(logo.png) 0 0;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px><strong><font style=font-size:46px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px><strong><font style=font-size:14px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div><p id=logoutControl style="color:#fff;font-size:11px;margin:10px 10px 0">{{{logoutControl}}}</div><div id=page_leftbar><div style=height:16px></div></div><div id=topbar class="noselect style3"style=height:24px;position:relative><div id=uiMenuButton title="User interface selection"onclick=showUserInterfaceSelectMenu()>&diams;<div id=uiMenu style=display:none><div id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"><div class=uiSelector1></div></div><div id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"><div class=uiSelector2></div></div><div id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"><div class=uiSelector3></div></div><div id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode"><div class=uiSelector4></div></div></div></div></div><div id=column_l style="max-height:calc(100vh - 135px);overflow-y:auto"><h1>Remote Agent Installation<span id=groupname></span></h1><p>You have been invited to install a software that will allow a remote operator to fully access your computer remotely including the desktop and files. Only follow the instructions below if this invitation was expected and you know who will be accessing your computer. Selecting your operation system and follow the instructions below.<div><div class=tab><button id=twintab64 class=tablinks onclick='openTab(event,"wintab64")'>Windows 64bit</button><button id=twintab32 class=tablinks onclick='openTab(event,"wintab32")'>Windows 32bit</button><button id=tlinuxtab class=tablinks onclick='openTab(event,"linuxtab")'>Linux</button><button id=tmacostab class=tablinks onclick='openTab(event,"macostab")'>MacOS</button></div><div id=wintab64 class=tabcontent style=background-color:#fff;color:#000><h3>Microsoft&trade; Windows 64bit</h3><p><a id=win64url>Download the software here</a>, run it and press "Install" or "Connect".<div style=text-align:center><img class=winagent-img src=images/winagent.png></div></div><div id=wintab32 class=tabcontent style=background-color:#fff;color:#000><h3>Microsoft&trade; Windows 32bit</h3><p><a id=win32url>Download the software here</a>, run it and press "Install" or "Connect".<div style=text-align:center><img class=winagent-img src=images/winagent.png></div></div><div id=linuxtab class=tabcontent style=background-color:#fff;color:#000><h3>Linux</h3><p>To install, cut and paste the following command in a root terminal.<div id=linuxinstall style="font-family:courier,'courier new',monospace;margin-left:30px"></div><input type=button value="Copy to clipboard"style=margin-left:30px;margin-top:4px onclick=copyToClipLinuxInstall()><p>To uninstall, cut and paste the following command as root.<div id=unlinuxinstall style="font-family:courier,'courier new',monospace;margin-left:30px"></div><input type=button value="Copy to clipboard"style=margin-left:30px;margin-top:4px onclick=copyToClipLinuxUnInstall()><br><br></div><div id=macostab class=tabcontent style=background-color:#fff;color:#000><h3>Apple&trade; MacOS</h3><p><a id=macosurl>Download the installer here</a>, right click on it or press "control" and click on the file. Then select "Open" and follow the instructions.<div style=text-align:center><img src=images/macosagent.png></div></div></div></div><div id=footer><table cellpadding=0 cellspacing=10 style=width:100%><tr><td style=text-align:left><td style=text-align:right></table></div></div><script>"use strict";var linuxInstall,linuxUnInstall,uiMode=parseInt(getstore("uiMode",1)),webPageStackMenu=!1,webPageFullScreen=!0,nightMode="1"==getstore("_nightMode","0"),domain="{{{domain}}}",domainUrl="{{{domainurl}}}",meshid="{{{meshid}}}",serverPort="{{{serverport}}}",serverHttps="{{{serverhttps}}}",serverNoProxy="{{{servernoproxy}}}",installFlags="{{{installflags}}}",groupName=decodeURIComponent("{{{meshname}}}");function showUserInterfaceSelectMenu(){Q("uiViewButton1").classList.remove("uiSelectorSel"),Q("uiViewButton2").classList.remove("uiSelectorSel"),Q("uiViewButton3").classList.remove("uiSelectorSel"),Q("uiViewButton4").classList.remove("uiSelectorSel");try{Q("uiViewButton"+uiMode).classList.add("uiSelectorSel")}catch(e){}QV("uiMenu","none"==QS("uiMenu").display),nightMode&&Q("uiViewButton4").classList.add("uiSelectorSel")}function userInterfaceSelectMenu(e){e&&putstore("uiMode",uiMode=e),webPageFullScreen=uiMode<3,webPageStackMenu=!0,toggleFullScreen(0),toggleStackMenu(0),QC("column_l").add("room4submenu")}function toggleNightMode(){(nightMode=!nightMode)?QC("body").add("night"):QC("body").remove("night"),putstore("_nightMode",nightMode?"1":"0")}function toggleFullScreen(e){1===e&&putstore("webPageFullScreen",webPageFullScreen=!webPageFullScreen);0==webPageFullScreen?(QC("body").remove("menu_stack"),QC("body").remove("fullscreen"),QC("body").remove("arg_hide")):QC("body").add("fullscreen"),QV("body",!0)}function toggleStackMenu(e){1==webPageFullScreen&&(1===e&&putstore("webPageStackMenu",webPageStackMenu=!webPageStackMenu),0==webPageStackMenu?QC("body").remove("menu_stack"):QC("body").add("menu_stack"))}function putstore(e,t){try{if("undefined"==typeof localStorage)return;localStorage.setItem(e,t)}catch(e){}}function getstore(e,t){try{if("undefined"==typeof localStorage)return t;var n=localStorage.getItem(e);return null==n||null==n?t:n}catch(e){return t}}function openTab(e,t){var n,s,l;for(s=document.getElementsByClassName("tabcontent"),n=0;n<s.length;n++)s[n].style.display="none";for(l=document.getElementsByClassName("tablinks"),n=0;n<l.length;n++)l[n].className=l[n].className.replace(" active","");document.getElementById(t).style.display="block",null!=e?e.currentTarget.className+=" active":document.getElementById("t"+t).className+=" active"}function setup(){var e=window.location.hostname,t=domainUrl.substring(0,domainUrl.length-1),n="meshagents?id=4&meshid="+meshid;if(0!=installFlags&&(n+="&installflags="+installFlags),Q("win64url").href=n,n="meshagents?id=3&meshid="+meshid,0!=installFlags&&(n+="&installflags="+installFlags),Q("win32url").href=n,n="meshosxagent?id=16&meshid="+meshid,Q("macosurl").href=n,1==serverHttps){var s=443==serverPort?"":":"+serverPort;linuxUnInstall=0==serverNoProxy?(linuxInstall="(wget https://"+e+s+domainUrl+"meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://"+e+s+domainUrl+"meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://"+e+s+t+" '"+meshid+"'\r\n","(wget https://"+e+s+domainUrl+"meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://"+e+s+domainUrl+"meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"):(linuxInstall="wget https://"+e+s+domainUrl+"meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://"+e+s+t+" '"+meshid+"'\r\n","wget https://"+e+s+domainUrl+"meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n")}else{s=80==serverPort?"":":"+serverPort;linuxUnInstall=0==serverNoProxy?(linuxInstall="(wget http://"+e+s+domainUrl+"meshagents?script=1 -O ./meshinstall.sh || wget http://"+e+s+domainUrl+"meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://"+e+s+t+" '"+meshid+"'\r\n","(wget http://"+e+s+domainUrl+"meshagents?script=1 -O ./meshinstall.sh || wget http://"+e+s+domainUrl+"meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"):(linuxInstall="wget http://"+e+s+domainUrl+"meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://"+e+s+t+" '"+meshid+"'\r\n","wget http://"+e+s+domainUrl+"meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n")}QH("linuxinstall",linuxInstall),QH("unlinuxinstall",linuxUnInstall),0<=navigator.userAgent.indexOf("Win64")?openTab(null,"wintab64"):0<=navigator.userAgent.indexOf("Windows")?openTab(null,"wintab32"):0<=navigator.userAgent.indexOf("Linux")?openTab(null,"linuxtab"):0<=navigator.userAgent.indexOf("Macintosh")?openTab(null,"macostab"):openTab(null,"wintab64")}function copyToClipLinuxInstall(){copyTextToClip(linuxInstall)}function copyToClipLinuxUnInstall(){copyTextToClip(linuxUnInstall)}function copyTextToClip(e){var t=document.createElement("DIV");t.textContent=e,document.body.appendChild(t),function(e){if(document.selection)(t=document.body.createTextRange()).moveToElementText(e),t.select();else if(window.getSelection){var t;(t=document.createRange()).selectNode(e),window.getSelection().removeAllRanges(),window.getSelection().addRange(t)}}(t),document.execCommand("copy"),t.remove()}""!=groupName&&QH("groupname"," for "+groupName),userInterfaceSelectMenu(),setup()</script>
\ No newline at end of file
views/default-min.handlebars
+866 -7834
@@ -1,7023 +1,15 @@
1 -<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <link rel="shortcut icon" type="image/x-icon" href="{{{domainurl}}}favicon.ico"> <link keeplink="1" type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS"> <style>.ol-box{box-sizing:border-box;border-radius:2px;border:2px solid #00f;}.ol-mouse-position{top:8px;right:8px;position:absolute;}.ol-scale-line{background:rgba(0,60,136,.3);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute;}.ol-scale-line-inner{border:1px solid #eee;border-top:none;color:#eee;font-size:10px;text-align:center;margin:1px;will-change:contents,width;}.ol-overlay-container{will-change:left,right,top,bottom;}.ol-unsupported{display:none;}.ol-unselectable, .ol-viewport{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:auto;-moz-user-select:auto;-ms-user-select:auto;user-select:auto;}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing;}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab;}.ol-control{position:absolute;background-color:rgba(255,255,255,.4);border-radius:4px;padding:2px;}.ol-control:hover{background-color:rgba(255,255,255,.6);}.ol-zoom{top:.5em;right:.5em;}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear;}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s;}.ol-zoom-extent{top:4.643em;left:.5em;}.ol-full-screen{right:.5em;top:.5em;}@media print{.ol-control{display:none;}}.ol-control button{display:block;margin:1px;padding:0;color:#fff;font-size:1.14em;font-weight:700;text-decoration:none;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:rgba(0,60,136,.5);border:none;border-radius:2px;}.ol-control button::-moz-focus-inner{border:none;padding:0;}.ol-zoom-extent button{line-height:1.4em;}.ol-compass{display:block;font-weight:400;font-size:1.2em;will-change:transform;}.ol-touch .ol-control button{font-size:1.5em;}.ol-touch .ol-zoom-extent{top:5.5em;}.ol-control button:focus, .ol-control button:hover{text-decoration:none;background-color:rgba(0,60,136,.7);}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0;}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px;}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);}.ol-attribution ul{margin:0;padding:0 .5em;font-size:.7rem;line-height:1.375em;color:#000;text-shadow:0 0 2px #fff;}.ol-attribution li{display:inline;list-style:none;line-height:inherit;}.ol-attribution li:not(:last-child):after{content:" ";}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle;}.ol-attribution button, .ol-attribution ul{display:inline-block;}.ol-attribution.ol-collapsed ul{display:none;}.ol-attribution.ol-logo-only ul{display:block;}.ol-attribution:not(.ol-collapsed){background:rgba(255,255,255,.8);}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0;height:1.1em;line-height:1em;}.ol-attribution.ol-logo-only{background:0 0;bottom:.4em;height:1.1em;line-height:1em;}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em;}.ol-attribution.ol-logo-only button, .ol-attribution.ol-uncollapsible button{display:none;}.ol-zoomslider{top:4.5em;left:.5em;height:200px;}.ol-zoomslider button{position:relative;height:10px;}.ol-touch .ol-zoomslider{top:5.5em;}.ol-overviewmap{left:.5em;bottom:.5em;}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0;}.ol-overviewmap .ol-overviewmap-map, .ol-overviewmap button{display:inline-block;}.ol-overviewmap .ol-overviewmap-map{border:1px solid #7b98bc;height:150px;margin:2px;width:150px;}.ol-overviewmap:not(.ol-collapsed) button{bottom:1px;left:2px;position:absolute;}.ol-overviewmap.ol-collapsed .ol-overviewmap-map, .ol-overviewmap.ol-uncollapsible button{display:none;}.ol-overviewmap:not(.ol-collapsed){background:rgba(255,255,255,.8);}.ol-overviewmap-box{border:2px dotted rgba(0,60,136,.7);}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move;}</style> <style> .ol-ctx-menu-container{position:absolute;padding:8px;background:#fff;color:#222;font-size:13px;border-radius:5px;box-shadow:3px 3px 5px rgba(0,0,0,.2);box-sizing:border-box}.ol-ctx-menu-container a,.ol-ctx-menu-container div,.ol-ctx-menu-container img,.ol-ctx-menu-container li,.ol-ctx-menu-container span,.ol-ctx-menu-container ul{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}.ol-ctx-menu-container a img{border:none}.ol-ctx-menu-container *,.ol-ctx-menu-container :after,.ol-ctx-menu-container :before{box-sizing:inherit}.ol-ctx-menu-container.ol-ctx-menu-hidden{opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container ul{list-style:none}.ol-ctx-menu-container li{position:relative;line-height:20px;padding:2px 5px}.ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover{cursor:pointer;background-color:#333;color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-submenu .ol-ctx-menu-container{border:1px solid #eee;padding:8px;top:0;opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover .ol-ctx-menu-container{opacity:1;visibility:visible;-webkit-transition-delay:0s;transition-delay:0s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:after{position:absolute;top:7px;right:10px;content:"";display:inline-block;width:.6em;height:.6em;border-right:.3em solid #222;border-top:.3em solid #222;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover:after{border-color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-separator{padding:0}.ol-ctx-menu-container li.ol-ctx-menu-separator hr{border:0;height:1px;background-image:-webkit-linear-gradient(right,transparent,rgba(0,0,0,.75),transparent);background-image:linear-gradient(270deg,transparent,rgba(0,0,0,.75),transparent)}.ol-ctx-menu-icon{text-indent:20px;background-size:20px auto;background-repeat:no-repeat;background-position:0}.ol-ctx-menu-zoom-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABaUlEQVQ4T72U7VHCQBCGn90GtAMuNGCswFiBWIFQgWMFxg6wArECsQKhArEBiB1Qwa1zgQn5IAYcxv13k71n3919L8KJQ07M47+BzgG9TRfZ/JBuWhS6BJFHRJICYrZGZIz3z5Ct2+B7gG6I6kt+wewdkQVwjtkAkR5mC8yu26A1oItR/cTsOweQBdgutD8G7jGm2PJ2n8oqUKIpIjd4HxTM8gvaT/F+AlmWnyWaIXKF95eNguFzTYFhNsdWu9kFgFlaFMANUH3D8wDLoLgSTSD2il8NCe2ZXQBxWDGwxmyUzzOMBZ7wy7Qb2K0wQfXjMOBuhlFpZtNty5sFaTQBuTusZdymeqs1SpYKcO9HkE3KbTd9WFijMHJQ5hBNEAYNq5Qd0dhyke0GiE4QzjqfW23mHT8Hl4DG4Lce3FPE7AtbBSdsbNqpoJLgYkRnNeUV+xwJDHTnUEkxHGbhBXUs5TjJjew/KPy94g+NRaIVRYmMXwAAAABJRU5ErkJggg==")}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABc0lEQVQ4T71U21ECQRDsJgGdvQDECMQIxAjECMQILCPwzAAjECIQI0AiEDPQAPaWCBhrcKHuCUcV5f7dY3v6tUscefHIePhfwBBCF8CZqRCReRs1tQxDCH1VfQLQz4EsSY4AvIjIsgm8AhhCGKrqa9zwrqoLAKckB5HtguR1E2gBMITQU9VPAD8GICIGtl3e+xHJBwBT59xtHcsCYJZlUwA3kcGHbfDep51OZywi3/acZZm9vyJ5WR5o38uACmDunNt6ZwAkUxFZDwghDFT1jeSjiJinhVUBVNVJkiTDKO8CQA+AsbNQ7s1Ps0VVn5MkSfcCtmBoDZi1Bdx4eJ7zbBolrwPy3o9J3rWSHPs3A1BbjVKlYBaIyDgvu9LDXDU2RTZmXVW1oKyLxRD+OrkOrJLy5mVM0iaftDhuhVbsvBzMglzKUNW6IV/OOWtCM8MmVvEkmbwt83LaB19fdgOtVquUZJeknaDdobTwbOcvBzPcN/AXH1DFFWP7u9oAAAAASUVORK5CYII=")}.ol-ctx-menu-zoom-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABU0lEQVQ4T72U7VECMRRFz3sNaAdkacC1AtcKxApcKnCsQOwAK3CtQKxAqEBsANYOqCDPyTIC+8WCw5jfybn33dxEOPGSE/P4b6BzQG89RT47ZJoWhy5B5BGRZAMxWyEyxvtnyFdt8AagS1F9KQ6YvSMyB84xGyDSw2yO2XUbtAJ0MaqfmH0XAPIA2y7tj4F7jAm2uG1yWQZKNEHkBu+Dg2njWBJNEbnC+8uaIFRuWfuG2QxbbrOrUd0A1Tc8D7AIjkur7DAAsVf8MiWMZ3ZR2m02LPIMscATfjHqBnY7TFD9OAy4zTCCPG/MUKMM5O6wkXFr9dZq7FQqqHk/hDzbFa73cFONTZFDdRyiCcKg5rrSiLaXkiI6RjjrfG6VzDs+B5eAxuDXeYpmNRGzL2wZ/wof+du4GNFpBVqqz5HA4MM5VEYYDrOs+1I6Q9u/4Q8O9wN/AGgWjBVqQjjgAAAAAElFTkSuQmCC")}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABYklEQVQ4T72U4VHCQBCF36tA91KAWIFYgViBWIFYgWMFYgdYgVCBWAFSgdiBFpAsFWSdxcDkQoBkhnF/ZjbfvX377ogjF4/Mw/8CVbUD4MynEJF5k2lqFapqz8yeAPRKkCXJEYAXEVnugm8BVXVgZq/FD+9mtgBwSrJfqF2QvN4FjYCq2jWzTwA/DhARh20qTdMRyQcA0xDCbZ3KCJhl2RTATaHgo+6HLMv8+xXJy+qB3l8FGoB5CKHsXcRV1b6ZvZF8FBH3NKotoJlNkiQZFONdlLtJ3rufbouZPSdJMjwIbKDQEzBrClx7eC4i33Uepmk6JnnXaOQifzMAtdGoRApugYiMI1uqKkrRWAfZo9MxM1+UZzFewl8mN4nYdVM83L7BkwbXLUrF3sfBLQDQBbDy08x8vOohXyEE71lVq9emuEk+3gZa3XYroCvwFyjP8yHJDsnxwaU08GxvS2uFhw78BbzWrxXgMbsHAAAAAElFTkSuQmCC")}</style> <script type="text/javascript" src="scripts/u2f-api.js"></script> <script type="text/javascript" src="scripts/charts.js"></script> <script type="text/javascript" src="scripts/filesaver.js"></script> <script type="text/javascript" src="scripts/ol.js"></script> <script type="text/javascript" src="scripts/ol3-contextmenu.js"></script> <title>{{{title}}}</title> </head> <body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none;min-width:495px"> <div id="contextMenu" class="contextMenu noselect" style="display:none"> <div id="cxinfo" class="cmtext" onclick="cmaction(1,event)"><b>Information</b></div> <div id="cxdesktop" class="cmtext" onclick="cmaction(3,event)">Desktop</div> <div id="cxterminal" class="cmtext" onclick="cmaction(2,event)">Terminal</div> <div id="cxfiles" class="cmtext" onclick="cmaction(4,event)">Files</div> <div id="cxevents" class="cmtext" onclick="cmaction(5,event)">Events</div> <div id="cxconsole" class="cmtext" onclick="cmaction(6,event)">Console</div> <hr id="cxmgroupsplit"> <div id="cxmdesktop" class="cmtext" onclick="cmaction(7,event)" style="display:none">Multi-Desktop</div> </div> <div id="meshContextMenu" class="contextMenu noselect" style="display:none;min-width:0px"> <div id="cxselectall" class="cmtext" onclick="cmmeshaction(1,event)">Select All</div> <div id="cxselectnone" class="cmtext" onclick="cmmeshaction(2,event)">Select None</div> </div> <div id="termShellContextMenu" class="contextMenu noselect" style="display:none;min-width:0px"> <div id="cxtermnorm" class="cmtext" onclick="cmtermaction(1,event)">Normal Connect</div> <div id="cxtermps" class="cmtext" onclick="cmtermaction(2,event)">PowerShell Connect</div> </div> <div id="container"> <div id="notifiyBox" class="notifiyBox" style="display:none"></div> <div id="masthead" class="noselect"> <div class="title">{{{title}}}</div> <div class="title2">{{{title2}}}</div> <div style="float:right"> <div id="notificationCount" onclick="clickNotificationIcon()" class="unselectable" style="display:none;" title="Click to view current notifications">0</div> </div> <p id="logoutControl">{{{logoutControl}}}<span id="idleTimeoutNotify" style="color:yellow"></span></p> </div> <div id="page_leftbar"> <div style="height:16px"></div> <div id="LeftMenuMyDevices" tabindex="0" class="lbbutton lbbuttonsel" title="My Devices" onclick="go(1,event)" onkeypress="if (event.key=='Enter') { go(1); }"> <div class="lb2"></div> </div> <div id="LeftMenuMyAccount" tabindex="0" class="lbbutton" title="My Account" onclick="go(2,event)" onkeypress="if (event.key=='Enter') { go(2); }"> <div class="lb1"></div> </div> <div id="LeftMenuMyEvents" tabindex="0" class="lbbutton" title="My Events" onclick="go(3,event)" onkeypress="if (event.key=='Enter') { go(3); }"> <div class="lb3"></div> </div> <div id="LeftMenuMyFiles" tabindex="0" class="lbbutton" style="display:none" title="My Files" onclick="go(5,event)" onkeypress="if (event.key=='Enter') { go(5); }"> <div class="lb4"></div> </div> <div id="LeftMenuMyUsers" tabindex="0" class="lbbutton" style="display:none" title="My Users" onclick="go(4,event)" onkeypress="if (event.key=='Enter') { go(4); }"> <div class="lb5"></div> </div> <div id="LeftMenuMyServer" tabindex="0" class="lbbutton" style="display:none" title="My Server" onclick="go(6,event)" onkeypress="if (event.key=='Enter') { go(6); }"> <div class="lb6"></div> </div> </div> <div id="topbar" class="noselect"> <div> <div style="position:relative"> <div tabindex="0" id="uiMenuButton" title="User interface selection" onclick="showUserInterfaceSelectMenu()" onkeypress="if (event.key == 'Enter') showUserInterfaceSelectMenu()"> &diams; <div id="uiMenu" style="display:none"> <div tabindex="0" id="uiViewButton1" class="uiSelector" onclick="userInterfaceSelectMenu(1)" title="Left bar interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(1)"><div class="uiSelector1"></div></div> <div tabindex="0" id="uiViewButton2" class="uiSelector" onclick="userInterfaceSelectMenu(2)" title="Top bar interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(2)"><div class="uiSelector2"></div></div> <div tabindex="0" id="uiViewButton3" class="uiSelector" onclick="userInterfaceSelectMenu(3)" title="Fixed width interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(3)"><div class="uiSelector3"></div></div> <div tabindex="0" id="uiViewButton4" class="uiSelector" onclick="toggleNightMode()" title="Toggle night mode" onkeypress="if (event.key == 'Enter') toggleNightMode()"><div class="uiSelector4"></div></div> </div> </div> <table id="MainMenuSpan" cellpadding="0" cellspacing="0" class="style1"> <tr> <td tabindex="0" id="MainMenuMyDevices" class="topbar_td style3x" onclick="go(1,event)" onkeypress="if (event.key == 'Enter') go(1)">My Devices</td> <td tabindex="0" id="MainMenuMyAccount" class="topbar_td style3x" onclick="go(2,event)" onkeypress="if (event.key == 'Enter') go(2)">My Account</td> <td tabindex="0" id="MainMenuMyEvents" class="topbar_td style3x" onclick="go(3,event)" onkeypress="if (event.key == 'Enter') go(3)">My Events</td> <td tabindex="0" id="MainMenuMyFiles" class="topbar_td style3x" onclick="go(5,event)" onkeypress="if (event.key == 'Enter') go(5)">My Files</td> <td tabindex="0" id="MainMenuMyUsers" class="topbar_td style3x" onclick="go(4,event)" onkeypress="if (event.key == 'Enter') go(4)">My Users</td> <td tabindex="0" id="MainMenuMyServer" class="topbar_td style3x" onclick="go(6,event)" onkeypress="if (event.key == 'Enter') go(6)">My Server</td> <td class="topbar_td_end style3">&nbsp;</td> </tr> </table> <div id="MainSubMenuSpan" style="display:none"> <table id="MainSubMenu" cellpadding="0" cellspacing="0" class="style1"> <tr> <td tabindex="0" id="MainDev" class="topbar_td style3x" onclick="go(10,event)" onkeypress="if (event.key == 'Enter') go(10)">General</td> <td tabindex="0" id="MainDevDesktop" class="topbar_td style3x" onclick="go(11,event)" onkeypress="if (event.key == 'Enter') go(11)">Desktop</td> <td tabindex="0" id="MainDevTerminal" class="topbar_td style3x" onclick="go(12,event)" onkeypress="if (event.key == 'Enter') go(12)">Terminal</td> <td tabindex="0" id="MainDevFiles" class="topbar_td style3x" onclick="go(13,event)" onkeypress="if (event.key == 'Enter') go(13)">Files</td> <td tabindex="0" id="MainDevEvents" class="topbar_td style3x" onclick="go(16,event)" onkeypress="if (event.key == 'Enter') go(16)">Events</td> <td tabindex="0" id="MainDevInfo" class="topbar_td style3x" onclick="go(17,event)" onkeypress="if (event.key == 'Enter') go(17)">Details</td> <td tabindex="0" id="MainDevAmt" class="topbar_td style3x" onclick="go(14,event)" onkeypress="if (event.key == 'Enter') go(14)">Intel&reg; AMT</td> <td tabindex="0" id="MainDevConsole" class="topbar_td style3x" onclick="go(15,event)" onkeypress="if (event.key == 'Enter') go(15)">Console</td> <td tabindex="0" id="MainDevPlugins" class="topbar_td style3x" onclick="go(19,event)" onkeypress="if (event.key == 'Enter') go(19)">Plugins</td> <td class="topbar_td_end style3">&nbsp;</td> </tr> </table> </div> <div id="MeshSubMenuSpan" style="display:none"> <table id="MeshSubMenu" cellpadding="0" cellspacing="0" class="style1"> <tr> <td tabindex="0" id="MeshGeneral" class="topbar_td style3x" onclick="go(20,event)" onkeypress="if (event.key == 'Enter') go(20)">General</td> <td class="topbar_td_end style3">&nbsp;</td> </tr> </table> </div> <div id="UserSubMenuSpan" style="display:none"> <table id="UserSubMenu" cellpadding="0" cellspacing="0" class="style1"> <tr> <td tabindex="0" id="UserGeneral" class="topbar_td style3x" onclick="go(30,event)" onkeypress="if (event.key == 'Enter') go(30)">General</td> <td tabindex="0" id="UserEvents" class="topbar_td style3x" onclick="go(31,event)" onkeypress="if (event.key == 'Enter') go(31)">Events</td> <td class="topbar_td_end style3">&nbsp;</td> </tr> </table> </div> <div id="ServerSubMenuSpan" style="display:none"> <table id="ServerSubMenu" cellpadding="0" cellspacing="0" class="style1"> <tr> <td tabindex="0" id="ServerGeneral" class="topbar_td style3x" onclick="go(6,event)" onkeypress="if (event.key == 'Enter') go(6)">General</td> <td tabindex="0" id="ServerStats" class="topbar_td style3x" onclick="go(40,event)" onkeypress="if (event.key == 'Enter') go(40)">Stats</td> <td tabindex="0" id="ServerConsole" class="topbar_td style3x" onclick="go(115,event)" onkeypress="if (event.key == 'Enter') go(115)">Console</td> <td tabindex="0" id="ServerTrace" class="topbar_td style3x" onclick="go(41,event)" onkeypress="if (event.key == 'Enter') go(41)">Trace</td> <td class="topbar_td_end style3">&nbsp;</td> </tr> </table> </div> <div id="UserDummyMenuSpan"> <table id="UserDummyMenu" cellpadding="0" cellspacing="0" class="style1"> <tr><td class="style3" style="">&nbsp;</td></tr> </table> </div> </div> </div> </div> <div id="column_l"> <div id="p0" style="display:none"> <div id="p0message"><span id="p0span">Server disconnected</span>, <href onclick="reload()" style="cursor:pointer"><u>click to reconnect</u></href>.</div> </div> <div id="p1" style="display:none"> <div style="display:none" id="devListToolbarViewIcons"> <div tabindex="0" id="devViewButton1" class="viewSelector" onclick="onDeviceViewChange(1)" onkeypress="if (event.key == 'Enter') { onDeviceViewChange(1); }" title="Columns"><div class="viewSelector2"></div></div> <div tabindex="0" id="devViewButton2" class="viewSelector" onclick="onDeviceViewChange(2)" onkeypress="if (event.key == 'Enter') { onDeviceViewChange(2); }" title="List"><div class="viewSelector1"></div></div> <div tabindex="0" id="devViewButton3" class="viewSelector" onclick="onDeviceViewChange(3)" onkeypress="if (event.key == 'Enter') { onDeviceViewChange(3); }" title="Desktops"><div class="viewSelector3"></div></div> <div tabindex="0" id="devViewButton4" class="viewSelector" onclick="onDeviceViewChange(4)" onkeypress="if (event.key == 'Enter') { onDeviceViewChange(4); }" title="Map"><div class="viewSelector4"></div></div> </div><div><h1>My Devices</h1></div> <table id="devListToolbarSpan" class="noselect"> <tr> <td class="h1"></td> <td id="devListToolbar" class="style14" style="display:none"> &nbsp;&nbsp;<input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Select All">&nbsp; <input type="button" id="GroupActionButton" disabled="disabled" value="Group Action" onclick="groupActionFunction()">&nbsp; <input id="SearchInput" type="text" placeholder="Filter" onchange="masterUpdate(5)" onkeyup="masterUpdate(5)" autocomplete="off" onfocus="onSearchFocus(1)" onblur="onSearchFocus(0)">&nbsp; <label><input type="checkbox" id="RealNameCheckBox" onclick="onRealNameCheckBox()"><span title="Show devices operating system name">OS Name</span></label> </td> <td id="kvmListToolbar" class="style14" style="display:none"> &nbsp;&nbsp;<span id="kvmMultiConnectButtonSpan"><input type="button" onclick="connectAllKvmFunction()" value="Connect All">&nbsp;</span> <input type="button" onclick="disconnectAllKvmFunction()" value="Disconnect All">&nbsp; <span id="kvmAutoConnectButtonSpan"><label><input type="checkbox" id="autoConnectDesktopCheckbox" onclick="autoConnectDesktops(event)" title="Automatic connect">Auto&nbsp;</label></span> <input type="button" onclick="showMultiDesktopSettings()" value="Settings">&nbsp; </td> <td id="devMapToolbar" class="style14" style="display:none"> &nbsp;&nbsp;<input type="text" id="mapSearchLocation" placeholder="Search Location" onfocus="onMapSearchFocus(1)" onblur="onMapSearchFocus(0)"> <input type="button" value="Search" title="Search for location" onclick="getSearchLocation()"> <input type="button" id="refreshmap" title="Reset map view" value="Reset" onclick="refreshMap(false,true)"> </td> <td class="auto-style1" style="height:100%"> <div style="display:none" id="devListToolbarView"> View <select id="viewselect" onchange="onDeviceViewChange()"> <option value="1">Columns <option value="2">List <option value="3">Desktops <option id="viewselectmapoption" value="4">Map </select> </div> <div style="display:none" id="devListToolbarSort"> Sort <select id="sortselect" onchange="masterUpdate(6)"> <option>Group <option>Power <option>Device <option>Tags </select> &nbsp; </div> <div style="display:none" id="devListToolbarSize"> Size <select id="sizeselect" onchange="onDeviceViewChange()"> <option value="0">Small <option value="1">Medium <option value="2">Large </select> &nbsp; </div> </td> <td class="h2"></td> </tr> </table> <div id="NoMeshesPanel" style="display:none"> <table> <tr> <td valign="top" style="width:50px"> <img src="images/info.png"> </td> <td> <div id="getStarted1">To get started, <a href="#" onclick="return account_createMesh()"><strong>click here to create a device group</strong></a>.</div> <div id="getStarted2">No device groups.</div> </td> </tr> </table> </div> <div id="xdevices" class="noselect" style="display:none"></div> <div id="xdevicesmap" style="display:none"> <div id="xmapSearchResultsDlg" style="display:none"> <div id="xmapSearchResultsBck"> <div id="xmapSearchClose" onclick="mapCloseSearchWindow()"><b>X</b></div> <div style="padding:5px">Location Results</div> <div style="width:100%;margin:6px"></div> </div> <div id="xmapSearchResults" style="margin:6px"></div> </div> </div> <div id="xmap-info-window"></div> </div> <div id="p2" style="display:none"> <h1>My Account</h1> <img id="p2AccountImage" alt="" src="images/clipboard-128.png"> <div id="p2AccountSecurity" style="display:none"> <p><strong>Account security</strong></p> <div style="margin-left:25px"> <div id="manageAuthApp"><div class="p2AccountActions"><span id="authAppSetupCheck"><strong>&#x2713;</strong></span></div><span><a href="#" onclick="return account_manageAuthApp()">Manage authenticator app</a><br></span></div> <div id="manageHardwareOtp"><div class="p2AccountActions"><span id="authKeySetupCheck"><strong>&#x2713;</strong></span></div><span><a href="#" onclick="return account_manageHardwareOtp(0)">Manage security keys</a><br></span></div> <div id="manageOtp"><div class="p2AccountActions"><span id="authCodesSetupCheck"><strong>&#x2713;</strong></span></div><span><a href="#" onclick="return account_manageOtp(0)">Manage backup codes</a><br></span></div> </div> </div> <div id="p2AccountActions"> <p><strong>Account actions</strong></p> <p class="mL"> <span id="verifyEmailId" style="display:none"><a href="#" onclick="return account_showVerifyEmail()">Verify email</a><br></span> <span id="accountEnableNotificationsSpan" style="display:none"><a href="#" onclick="return account_enableNotifications()">Enable web notifications</a><br></span> <a href="#" onclick="return account_showLocalizationSettings()">Localization Settings</a><br> <a href="#" onclick="return account_showAccountNotifySettings()">Notification Settings</a><br> <span id="accountChangeEmailAddressSpan" style="display:none"><a href="#" onclick="return account_showChangeEmail()">Change email address</a><br></span> <a href="#" onclick="return account_showChangePassword()">Change password</a><span id="p2nextPasswordUpdateTime"></span><br> <a href="#" onclick="return account_showDeleteAccount()">Delete account</a><br> </p> <br style="clear:both"> </div> <strong>Device Groups</strong> <span id="p2createMeshLink1">( <a href="#" onclick="return account_createMesh()" class="newMeshBtn"> New</a> )</span> <br><br> <div id="p2meshes"></div> <div id="p2noMeshFound" style="display:none">No device groups.<span id="p2createMeshLink2"> <a href="#" onclick="return account_createMesh()"><strong>Get started here!</strong></a></span></div> <br style="clear:both"> </div> <div id="p3" style="display:none"> <h1>My Events</h1> <table class="pTable"> <tr> <td class="h1"></td> <td class="auto-style1"> Show <select id="p3limitdropdown" onchange="refreshEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select>&nbsp; <a href="#" onclick="p3showDownloadEventsDialog(2)"><img src="images/link4.png" height="10" width="10" title="Download Events" style="cursor:pointer"></a>&nbsp; </td> <td class="h2"></td> </tr> </table> <div id="p3events" style=""></div> </div> <div id="p4" style="display:none"> <h1>My Users</h1> <table class="pTable"> <tr> <td class="h1"></td> <td class="style14"> <div style="float:right"> <input type="button" onclick="showUserBroadcastDialog()" style="margin-right:6px" value="Broadcast"> <a href="#" onclick="p4downloadUserInfo()"><img style="cursor:pointer" title="Download user information" src="images/link4.png"></a> <a href="#" onclick="p4batchAccountCreate()"><img id="p4UserBatchCreate" style="cursor:pointer;display:none" title="Batch create many user accounts" src="images/link6.png"></a> </div> <div> <input id="UserNewAccountButton" type="button" style="margin-left:6px" onclick="showCreateNewAccountDialog()" value="New Account..."> <input id="UserSearchInput" type="text" style="width:120px;margin-left:6px" placeholder="Filter" onchange="onUserSearchInputChanged()" onkeyup="onUserSearchInputChanged()" autocomplete="off" onfocus="onUserSearchFocus(1)" onblur="onUserSearchFocus(0)"> </div> </td> <td class="h2"></td> </tr> </table> <div id="p3users"></div> </div> <div id="p5" style="display:none"> <h1>My Files</h1> <table id="p5toolbar" cellpadding="0" cellspacing="0"> <tr> <td id="p5filehead" valign="bottom"> <div id="p5rightOfButtons"></div> <div> <input type="button" id="p5FolderUp" disabled="disabled" onclick="return p5folderup();" value="Up">&nbsp; <input type="button" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile();" value="Select All">&nbsp; <input type="button" id="p5RenameFileButton" disabled="disabled" value="Rename" onclick="p5renamefile();">&nbsp; <input type="button" id="p5DeleteFileButton" disabled="disabled" value="Delete" onclick="p5deletefile();">&nbsp; <input type="button" id="p5NewFolderButton" disabled="disabled" value="New Folder" onclick="p5createfolder();">&nbsp; <input type="button" id="p5UploadButton" disabled="disabled" value="Upload" onclick="p5uploadFile()">&nbsp; <input type="button" id="p5CutButton" disabled="disabled" value="Cut" onclick="p5copyFile(1)">&nbsp; <input type="button" id="p5CopyButton" disabled="disabled" value="Copy" onclick="p5copyFile(0)">&nbsp; <input type="button" id="p5PasteButton" disabled="disabled" value="Paste" onclick="p5pasteFile()">&nbsp; </div> </td> </tr> <tr> <td id="p5filesubhead"> <div style="float:right"> <select id="p5sortdropdown" onchange="updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </div> <div>&nbsp;&nbsp;<span id="p5currentpath"></span></div> </td> </tr> </table> <div id="p5filetable"> <div id="p5PublicShare" style=""><div>These files are shared publicly, click "link" to get public url.</div></div> <div id="bigok" style="display:none"><b>&checkmark;</b></div> <div id="bigfail" style="display:none"><b>&#10007;</b></div> <span id="p5files"></span> </div> <table id="p5toolbarBottom" style="width:100%" cellpadding="0" cellspacing="0"> <tr><td class="style6">&nbsp;<span id="p5bottomstatus"></span></td></tr> </table> </div> <div id="p6" style="display:none"> <img id="MainMeshImage" src="serverpic.ashx"> <h1>My Server</h1> <div id="p2ServerActions"> <p><strong>Server actions</strong></p> <div class="mL"> <div id="p2ServerActionsBackup"><a href="{{{domainurl}}}backup.zip" rel="noreferrer noopener" target="_blank">Download server backup</a></div> <div id="p2ServerActionsRestore"><a href="#" onclick="return server_showRestoreDlg()">Restore server with backup</a></div> <div id="p2ServerActionsVersion"><a href="#" onclick="return server_showVersionDlg()">Check server version</a></div> <div id="p2ServerActionsErrors"><a href="#" onclick="return server_showErrorsDlg()">Show server error log</a></div> </div> </div> <br><strong>Server Statistics</strong><br><br> <div id="serverStats"> <div id="serverCpuChartView" style="display:none"> <div class="chartViewCanvas"><canvas id="serverCpuChart"></canvas></div> <div class="chartViewText" id="serverCpuChartText"></div> </div> <div id="serverMemoryChartView" style="display:none"> <div class="chartViewCanvas"><canvas id="serverMemoryChart"></canvas></div> <div class="chartViewText" id="serverMemoryChartText"></div> </div><br><br> <div id="serverStatsTable"></div> </div> </div> <div id="p10" style="display:none"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:auto" valign="top"> <div id="p10title"> <div id="p10BackButton"><div class="backButton" tabindex="0" onclick="goBack()" title="Back" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div> <h1>General - <span id="p10deviceName"></span></h1> </div> <div id="p10html"></div> </td> <td style="width:20px"></td> <td style="width:200px"> <a href="#" onclick="p10showiconselector()"><img id="MainComputerImage"></a> <div id="MainComputerState"></div> </td> </tr> </table><br> <div id="p10html2"></div> <div id="p10html3"></div> </div> <div id="p11" class="noselect" style="display:none"> <div id="p11title"> <div id="p11deviceNameHeader"> <div id="p11BackButton"><div class="backButton" tabindex="0" onclick="goBack()" title="Back" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div> <div id="devListToolbarViewIcons"><div class="viewSelector" onclick="deskToggleFull(event)" title="Full Screen. Hold shift to browser full screen."><div class="viewSelector5"></div></div></div> <h1>Desktop - <span id="p11deviceName"></span></h1> </div> </div> <div id="p11warning" onclick="showFeaturesDlg()"> <div class="icon2"></div> <div class="warningbox">Intel&reg; AMT Redirection port or KVM feature is disabled<span id="p11warninga">, click here to enable it.</span></div> </div> <div id="p11warning2" onclick="showPowerActionDlg()"> <div class="icon2"></div> <div class="warningbox">Remote computer is not powered on, click here to issue a power command.</div> </div> <div id="deskarea0" cellpadding="0" cellspacing="0"> <div id="deskarea1" class="areaHead"> <div class="toright2"> <span id="p11power"></span>&nbsp; <div class='deskareaicon' title="Toggle View Mode" onclick="toggleAspectRatio(1)">&#8690;</div> <div class='deskareaicon' title="Rotate Left" onclick="drotate(-1)">&olarr;</div> <div class='deskareaicon' title="Rotate Right" onclick="drotate(1)">&orarr;</div> <div id="deskRecordIcon" class='deskareaicon' title="Server is recording this session" style="display:none;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px"></div> <input id="deskFocusBtn" type="button" title="Toggle focus mode, when active only the region around the mouse is updated" onkeypress="return false" onkeydown="return false" value="Focus All" onclick="deskToggleFocus()" style="margin-right:3px;display:none"> <input id="deskSaveBtn" type="button" title="Save a screenshot of the remote desktop" onkeypress="return false" onkeydown="return false" value="Save..." onclick="deskSaveImage()" class="mR"> <input id="deskActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" class="mR"> <input id="deskActionsSettings" type="button" value="Settings..." title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()" class="mR"> <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="display:none"> </div> <div> <div id="idx_deskFullBtn2" onclick="deskToggleFull(event)">&nbsp;&#x2716;</div> <input type="button" id="autoconnectbutton1" value="AutoConnect" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <span id="connectbutton1span"><input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1hspan">&nbsp;<input type="button" id="connectbutton1h" value="HW Connect" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="disconnectbutton1span">&nbsp;<input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span> &nbsp;<span id="deskstatus">Disconnected</span> </div> </div> <div id="deskarea2" style=""> <div class="areaProgress"><div id="progressbar" style=""></div></div> </div> <div id="deskarea3x"> <div id="DeskFocus" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)"></div> <div id="DeskParent"> <canvas id="Desk" width="640" height="480" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)" onmousewheel="dmousewheel(event)"></canvas> </div> <div id="DeskTools"> <div id="deskToolsAreaTop"> <a id="DeskToolsRefreshButton" style="right:2px" onclick="refreshDeskTools()">Refresh</a> <div id="deskToolsTopTabProcess" class="deskToolsTopTab" onclick="changeDeskToolTab(0)" style="left:0px;bottom:0px">Processes</div> <div id="deskToolsTopTabService" class="deskToolsTopTab" onclick="changeDeskToolTab(1)" style="display:none;left:90px;color:gray">Services</div> </div> <div id="deskToolsArea"> <div id="DeskToolsProcessTab"> <div id="deskToolsHeader"> <a class="colmn1" title="Sort by process id" onclick="sortProcess(0)">PID</a> <a class="colmn2" title="Sort by name" onclick="sortProcess(1)">Name</a> </div> <div id="DeskToolsProcesses" style=""></div> </div> <div id="DeskToolsServiceTab" style="display:none"> <div id="deskToolsServiceHeader"> <a class="colmn1" style="width:70px" title="Sort by state" onclick="sortService(0)">State</a> <a class="colmn2" title="Sort by name" onclick="sortService(1)">Name</a> </div> <div id="DeskToolsServices" style=""></div> </div> </div> </div> <div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p11clearConsoleMsg()"></div> </div> <div id="deskarea4" class="areaFoot"> <div class="toright2"> <span id="DeskTimer" title="Session time"></span>&nbsp; <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onkeypress="return false" onkeydown="return false"></select>&nbsp; <input id="DeskToolsButton" type="button" value="Tools" title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()">&nbsp; <span id="DeskChatButton" class="deskarea" title="Open chat window to this computer"><img src='images/icon-chat.png' onclick="deviceChat()" height="16" width="16" style="padding-top:2px"></span> <span id="DeskNotifyButton" title="Display a notification on the remote computer"><img src='images/icon-notify.png' onclick="deviceToastFunction()" height="16" width="16" style="padding-top:2px"></span> <span id="DeskOpenWebButton" title="Open a web address on remote computer"><img src='images/icon-url2.png' onclick="deviceUrlFunction()" height="16" width="16" style="padding-top:2px"></span> </div> <div> <select id="deskkeys"> <option value="10">Ctrl+Alt+Del <option value="5">Win <option value="0">Win+Down <option value="1">Win+Up <option value="2">Win+L <option value="3">Win+M <option value="4">Shift+Win+M <option value="6">Win+R <option value="7">Alt-F4 <option value="8">Ctrl-W <option value="9">Alt-Tab <option value="11">Win+Left <option value="12">Win+Right </select> <input id="DeskWD" type="button" value="Send" onkeypress="return false" onkeydown="return false" onclick="deskSendKeys()"> <input id="DeskClip" style="" type="button" value="Clipboard" onkeypress="return false" onkeydown="return false" onclick="showDeskClip()"> <input id="DeskType" style="" type="button" value="Type" onkeypress="return false" onkeydown="return false" onclick="showDeskType()"> <label><span id="DeskControlSpan" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false" onclick="toggleKvmControl()">Input</span></label>&nbsp; </div> </div> </div> </div> <div id="p12" style="display:none"> <div id="p12title"> <div id="p12BackButton"><div class="backButton" tabindex="0" onclick="goBack()" title="Back" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div> <h1>Terminal - <span id="p12deviceName"></span></h1> </div> <div id="p12warning" onclick="showFeaturesDlg()"> <div class="icon2"></div> <div class="warningbox">Intel&reg; AMT Redirection port or KVM feature is disabled<span id="p12warninga">, click here to enable it.</span></div> </div> <div id="p12warning2" onclick="showPowerActionDlg()"> <div class="icon2"></div> <div class="warningbox">Remote computer is not powered on, click here to issue a power command.</div> </div> <div id="termTable" style="position:relative"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td class="areaHead"> <div class="toright2"> <div id="termRecordIcon" class='deskareaicon' title="Server is recording this session" style="display:none;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-left:5px"></div> <input id="termActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()"> </div> <div> <input type="button" id="autoconnectbutton2" value="AutoConnect" onclick="autoConnectTerminal(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <span id="connectbutton2span"><input type="button" id="connectbutton2" value="Connect" onclick="connectTerminal(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton2hspan">&nbsp;<input type="button" id="connectbutton2h" value="HW Connect" onclick="connectTerminal(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="disconnectbutton2span">&nbsp;<input type="button" id="disconnectbutton2" value="Disconnect" onclick="connectTerminal(event,0)" onkeypress="return false" onkeydown="return false"></span> &nbsp;<span id="termstatus">Disconnected</span><span id="termtitle"></span> </div> </td> </tr> <tr> <td> <div class="areaProgress"><div id="termprogressbar" style=""></div></div> </td> </tr> <tr> <td id="termarea3x"> <pre id="Term"></pre> </td> </tr> <tr> <td class="areaFoot"> <div class="toright2"> <span id="TermTimer" title="Session time"></span>&nbsp; <span id="terminalSettingsButtons" style="display:none"> <input id="id_tcrbutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="CR+LF" title="Toggle what the return key will send" onclick="termToggleCr()"> <input id="id_tfxkeysbutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick="termToggleFx()"> <input id="id_ttypebutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Extended Ascii" title="Toggle terminal emulation type" onclick="termToggleType()"> </span> <span id="terminalSizeDropDown"> <select id="termSizeList" onkeypress="return false"><option value="1">80x25<option value="2">100x30<option value="3" selected="">Auto</select> </span> <select id="specialkeylist" onkeypress="return false"></select> <input id="specialkeylistinput" type="button" onkeypress="return false" class="bottombutton" value="Send" title="Send the selected special key" onclick="sendSpecialKey()"> </div> <div> &nbsp; <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlcbutton" value="Ctl-C" onclick="termSendKey(3,'ctrlcbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlxbutton" value="Ctl-X" onclick="termSendKey(24,'ctrlxbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="escbutton" value="ESC" onclick="termSendKey(27,'escbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="bsbutton" value="Backspace" onclick="termSendKey(8,'bsbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="pastebutton" value="Paste" title="Paste text into the terminal" onclick="showTermPasteDialog()"> </div> </td> </tr> </table> <div id="p12TermConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:45px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p12clearConsoleMsg()"></div> </div> </div> <div id="p13" style="display:none"> <div id="p13title"> <div id="p13BackButton" style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Back" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div> <h1>Files - <span id="p13deviceName"></span></h1> </div> <table id="p13toolbar" cellpadding="0" cellspacing="0"> <tr> <td class="areaHead"> <div class="toright2"> <input id="filesActionsBtn" type="button" title="Perform power actions on the device" value="Actions" onclick="deviceActionFunction()"> <div id="filesRecordIcon" class='deskareaicon' title="Server is recording this session" style="display:none;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-left:5px"></div> </div> <div> <input id="p13AutoConnect" value="AutoConnect" onclick="autoConnectFiles(event)" type="button" style="display:none"> <input id="p13Connect" value="Connect" onclick="connectFiles(event)" type="button"> <span id="p13Status">Disconnected</span> </div> </td> </tr> <tr> <td class="areaHead2" valign="bottom"> <div id="p13rightOfButtons" class="toright2"></div> <div> <input type="button" id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Up">&nbsp; <input type="button" id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="Select All">&nbsp; <input type="button" id="p13RenameFileButton" disabled="disabled" value="Rename" onclick="p13renamefile()">&nbsp; <input type="button" id="p13DeleteFileButton" disabled="disabled" value="Delete" onclick="p13deletefile()">&nbsp; <input type="button" id="p13ViewFileButton" disabled="disabled" value="Edit" onclick="p13viewfile()">&nbsp; <input type="button" id="p13NewFolderButton" disabled="disabled" value="New Folder" onclick="p13createfolder()">&nbsp; <input type="button" id="p13UploadButton" disabled="disabled" value="Upload" onclick="p13uploadFile()">&nbsp; <input type="button" id="p13CutButton" disabled="disabled" value="Cut" onclick="p13copyFile(1)">&nbsp; <input type="button" id="p13CopyButton" disabled="disabled" value="Copy" onclick="p13copyFile(0)">&nbsp; <input type="button" id="p13PasteButton" disabled="disabled" value="Paste" onclick="p13pasteFile()">&nbsp; <input type="button" id="p13RefreshButton" disabled="disabled" value="Refresh" onclick="p13folderup(9999)">&nbsp; </div> </td> </tr> <tr> <td class="areaHead3"> <div class="toright2"> <select id="p13sortdropdown" onchange="p13updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </div> <div>&nbsp;&nbsp;<span id="p13currentpath"></span></div> </td> </tr> </table> <div id="p13FilesConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:165px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p13clearConsoleMsg()"></div> <div id="p13filetable" style=""> <div id="p13bigok" style="display:none"><b>&checkmark;</b></div> <div id="p13bigfail" style="display:none"><b>&#10007;</b></div> <span id="p13files"></span> </div> <table id="p13toolbarBottom" cellpadding="0" cellspacing="0"> <tr><td class="style6">&nbsp;<span id="p13bottomstatus"></span></td></tr> </table> </div> <div id="p14" style="display:none"> <div id="p14title"> <div id="p14BackButton" style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Back" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div> <div id="devListToolbarViewIcons"><div class="viewSelector" onclick="deskToggleFull(event)" title="Full Screen. Hold shift to browser full screen."><div class="viewSelector5"></div></div></div> <h1>Intel&reg; AMT - <span id="p14deviceName"></span></h1> </div> <iframe id="p14iframe" src="{{{domainurl}}}commander.htm"></iframe> </div> <div id="p15" style="display:none"> <div id="p15title"> <div id="p15BackButton" style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Back" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div> <h1><span id="p15deviceName"></span></h1> </div> <table id="consoleTable" cellpadding="0" cellspacing="0"> <tr> <td class="areaHead"> <div class="toright2"> <div id="p15coreName" title="Information about current core running on this agent"></div> <input type="button" id="p15uploadCore" value="Agent Action" onclick="p15uploadCore(event)" title="Change the agent Java Script code module"> <img onclick="p15downloadConsoleText()" style="cursor:pointer;margin-top:6px" title="Download console text" src="images/link4.png"> </div> <div id="p15statetext"></div> </td> </tr> <tr> <td> <div class="areaProgress"><div id="consoleprogressbar" style=""></div></div> </td> </tr> <tr> <td id="p15agentConsole"> <pre id="p15agentConsoleText"></pre> </td> </tr> <tr> <td class="areaFoot"> <table style="width:100%"> <tr> <td style="width:99%"> <input id="p15consoleText" style="width:100%" onkeyup="p15consoleSend(event)" onfocus="onConsoleFocus(1)" onblur="onConsoleFocus(0)"> </td> <td>&nbsp;</td> <td id="p15outputselecttd"> <select id="p15outputselect"> <option value="1">Agent <option value="2">MQTT </select> </td> <td style="width:1%"><input id="id_p15consoleClear" type="button" class="bottombutton" value="Clear" onclick="p15consoleClear()"></td> </tr> </table> </td> </tr> </table> </div> <div id="p16" style="display:none"> <div id="p16title"> <div id="p16BackButton" style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Back" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div> <h1>Events - <span id="p16deviceName"></span></h1> </div> <table class="pTable"> <tr> <td class="h1"></td> <td class="auto-style1"> Show <select id="p16limitdropdown" onchange="refreshDeviceEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <a href="#" onclick="p3showDownloadEventsDialog(1)"><img src="images/link4.png" height="10" width="10" title="Download Events" style="cursor:pointer"></a>&nbsp; </td> <td class="h2"></td> </tr> </table> <div id="p16events"></div> </div> <div id="p17" style="display:none"> <div id="p17title"> <div id="p17BackButton" style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Back" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div> <h1>Details - <span id="p17deviceName"></span></h1> </div> <div id="p17info"></div> </div> <div id="p20" style="display:none"> <picture id="MainMeshImage" style="border-width:0px;height:200px;width:200px;float:right"> <source type="image/webp" width="200" height="200" srcset="images/webp/mesh-256.webp"></source> <img alt="" width="200" height="200" src="images/mesh-256.png"> </picture> <div style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Back" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div> <h1>General - <span id="p20meshName"></span></h1> <p id="p20info"> </div> <div id="p30" style="display:none"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:auto" valign="top"> <div id="p30title"> <div style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Back" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div> <h1>General - <span id="p30userName"></span></h1> </div> <div id="p30html"></div> </td> <td style="width:20px"></td> <td style="width:200px"> <picture id="MainUserImage" style="border-width:0px;height:200px;width:200px;float:right"> <source type="image/webp" width="200" height="200" srcset="images/webp/user-256.webp"></source> <img alt="" width="200" height="200" src="images/user-256.png"> </picture> <div style="width:100%;text-align:center"><strong><span id="MainUserState"></span></strong></div> </td> </tr> </table><br> <div id="p30html2"></div> <div id="p30html3"></div> </div> <div id="p31" style="display:none"> <div style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Back" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div> <h1>Events - <span id="p31userName"></span></h1> <table class="pTable"> <tr> <td class="h1"></td> <td class="auto-style1"> Show <select id="p31limitdropdown" onchange="refreshUsersEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <a href="#" onclick="p3showDownloadEventsDialog(3)"><img src="images/link4.png" height="10" width="10" title="Download Events" style="cursor:pointer"></a>&nbsp; </td> <td class="h2"></td> </tr> </table> <div id="p31events" style=""></div> </div> <div id="p40" style="display:none"> <h1>My Server Stats</h1> <div class="areaHead"> <div class="toright2"> <select id="p40type" onchange="updateServerTimelineStats()"> <option value="0">Connections <option value="1">Memory </select>&nbsp; <select id="p40time" onchange="updateServerTimelineHours()"> <option value="3">Last 3 hours <option value="8">Last 8 hours <option value="24">Last day <option value="168">Last week <option value="720">Last 30 days </select>&nbsp; <img src="images/link4.png" height="10" width="10" title="Download data points (.csv)" style="cursor:pointer" onclick="p40downloadEvents()">&nbsp; </div> <div> <input value="Refresh" type="button" onclick="refreshServerTimelineStats()"> &nbsp;<label><input id="p40log" type="checkbox" onclick="updateServerTimelineHours()">Log-X</label> </div> </div> <canvas id="serverMainStats" style=""></canvas> </div> <div id="p41" style="display:none"> <h1>My Server Tracing</h1> <div class="areaHead"> <div class="toright2"> Show <select id="p41limitdropdown" onchange="displayServerTrace()"> <option value="100">Last 100 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <input value="Clear" type="button" onclick="clearServerTracing()"> <img src="images/link4.png" height="10" width="10" title="Download trace (.csv)" style="cursor:pointer" onclick="p41downloadServerTrace()">&nbsp; </div> <div> <input value="Tracing" type="button" onclick="setServerTracing()"> <span id="p41traceStatus">None</span> </div> </div> <div id="p41events" style=""></div> </div> <div id="p19" style="display:none"> <h1>Plugins - <span id="p19deviceName"></span></h1> <style> #p19headers{padding-right:7px;padding-bottom:10px;font-weight:bold;border-bottom:1px dotted blue;}#p19headers > span:nth-child(n+2){border-left:1px solid black;}#p19headers > span{padding-left:4px;padding-right:4px;}</style> <div id="p19headers"></div> <div id="p19pages"></div> </div> <br id="column_l_bottomgap"> </div> <div id="footer"> <div class="footer1">{{{footer}}}</div> <div class="footer2"> <a id="verifyEmailId2" style="display:none" href="#" onclick="account_showVerifyEmail()">Verify Email</a> &nbsp;<a href="terms">Terms &amp; Privacy</a> </div> </div> <div id="dialog" class="noselect" style="display:none"> <div id="dialogHeader"> <div tabindex="0" id="id_dialogclose" onclick="setDialogMode()" onkeypress="if (event.key == 'Enter') setDialogMode()">&#x2716;</div> <div id="id_dialogtitle"></div> </div> <div id="dialogBody"> <div id="dialog1"> <div id="id_dialogMessage" style=""></div> </div> <div id="dialog2" style=""> <div id="id_dialogOptions"></div> </div> <div id="dialog3" style=""> <div id="d3upload"> <div>File Selection</div> <select id="d3uploadMode" onchange="d3modechange()"> <option value="1">Local file upload <option value="2">Server file selection </select> </div> <div id="d3localmode" style="display:none"> <div>Upload File</div> <form id="d3localmodeform" method="post" enctype="multipart/form-data" action="uploadfile.ashx" target="fileUploadFrame"> <input type="text" id="d3auth" name="auth" style="display:none"> <input type="text" id="d3attrib" name="attrib" style="display:none"> <input type="file" id="d3localFile" name="files" onchange="d3setActions()"> <input type="submit" id="d3submit" style="display:none"> </form> </div> <div id="d3servermode"> <div id="d3serveraction" valign="bottom"> <input type="button" id="p3FolderUp" disabled="disabled" onclick="d3folderup()" value="Up">&nbsp; </div> <div id="d3serverfiles"></div> </div> </div> <div id="dialog7" style=""> <div id="d7meshkvm"> <h4>Agent Remote Desktop</h4> <div> <div>Quality</div> <select id="d7bitmapquality" dir="rtl"></select> </div> <div> <div>Scaling</div> <select id="d7bitmapscaling" style="" dir="rtl"> <option selected="selected" value="1024">100% <option value="896">87.5% <option value="768">75% <option value="640">62.5% <option value="512">50% <option value="384">37.5% <option value="256">25% <option value="128">12.5% </select> </div> <div> <div>Frame rate</div> <select id="d7framelimiter" dir="rtl"> <option selected="selected" value="50">Fast <option value="100">Medium <option value="400">Slow <option value="1000">Very slow </select> </div> </div> <div id="d7amtkvm"> <h4>Intel&reg; AMT Hardware KVM</h4> <div> <div>Image Encoding</div> <select id="d7desktopmode"> <option value="1">RLE8, Fastest <option value="2">RLE16, Recommended <option value="3">RAW8, Slow <option value="4">RAW16, Very Slow </select> </div> <div> <div>Other Settings</div> <div id="d7otherset" style="display:block"> <label style="display:block"><input type="checkbox" id="d7showfocus">Show Focus Tool</label> <label style="display:block"><input type="checkbox" id="d7showcursor">Show Local Mouse Cursor</label> <label style="display:block"><input type="checkbox" id="d7localKeyMap">Local Keyboard Map</label> </div> </div> </div> </div> </div> <div id="idx_dlgButtonBar"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="" onclick="dialogclose(1)"> <div><input id="idx_dlgDeleteButton" type="button" value="Delete" style="display:none" onclick="dialogclose(2)"></div> </div> </div> <iframe name="fileUploadFrame" style="display:none"></iframe> <form style="display:none" method="post" action="uploadfile.ashx" enctype="multipart/form-data" target="fileUploadFrame"><input id="p5fileDragName" name="name"><input id="p5fileDragAuthCookie" name="auth"><input id="p5fileDragSize" name="size"><input id="p5fileDragType" name="type"><input id="p5fileDragData" name="data"><input id="p5fileDragLink" name="link"><input type="submit" id="p5loginSubmit2" style="display:none"></form> <form style="display:none" method="post" action="uploadnodefile.ashx" enctype="multipart/form-data" target="fileUploadFrame"><input id="p13fileDragName" name="name"><input id="p13fileDragSize" name="size"><input id="p13fileDragType" name="type"><input id="p13fileDragData" name="data"><input id="p13fileDragLink" name="link"><input type="submit" id="p13loginSubmit2" style="display:none"></form> <audio id="chimes"><source src="sounds/chimes.mp3" type="audio/mp3"></source></audio> </div> <script>/**
2 -* @description Set of short commonly used methods for handling HTML elements
3 -* @author Ylian Saint-Hilaire
4 -* @version v0.0.1b
5 -*/
6 -
7 -// Add startsWith for IE browser
8 -if (!String.prototype.startsWith) { String.prototype.startsWith = function (str) { return this.lastIndexOf(str, 0) === 0; }; }
9 -if (!String.prototype.endsWith) { String.prototype.endsWith = function (str) { return this.indexOf(str, this.length - str.length) !== -1; }; }
10 -
11 -// Quick UI functions, a bit of a replacement for jQuery
12 -//function Q(x) { if (document.getElementById(x) == null) { console.log('Invalid element: ' + x); } return document.getElementById(x); } // "Q"
13 -function Q(x) { return document.getElementById(x); } // "Q"
14 -function QS(x) { try { return Q(x).style; } catch (x) { } } // "Q" style
15 -function QE(x, y) { try { Q(x).disabled = !y; } catch (x) { } } // "Q" enable
16 -function QV(x, y) { try { QS(x).display = (y ? '' : 'none'); } catch (x) { } } // "Q" visible
17 -function QA(x, y) { Q(x).innerHTML += y; } // "Q" append
18 -function QH(x, y) { Q(x).innerHTML = y; } // "Q" html
19 -function QC(x) { try { return Q(x).classList; } catch (x) { } } // "Q" class
20 -
21 -// Move cursor to end of input box
22 -function inputBoxFocus(x) { Q(x).focus(); var v = Q(x).value; Q(x).value = ''; Q(x).value = v; }
23 -
24 -// Binary encoding and decoding functions
25 -function ReadShort(v, p) { return (v.charCodeAt(p) << 8) + v.charCodeAt(p + 1); }
26 -function ReadShortX(v, p) { return (v.charCodeAt(p + 1) << 8) + v.charCodeAt(p); }
27 -function ReadInt(v, p) { return (v.charCodeAt(p) * 0x1000000) + (v.charCodeAt(p + 1) << 16) + (v.charCodeAt(p + 2) << 8) + v.charCodeAt(p + 3); } // We use "*0x1000000" instead of "<<24" because the shift converts the number to signed int32.
28 -function ReadSInt(v, p) { return (v.charCodeAt(p) << 24) + (v.charCodeAt(p + 1) << 16) + (v.charCodeAt(p + 2) << 8) + v.charCodeAt(p + 3); }
29 -function ReadIntX(v, p) { return (v.charCodeAt(p + 3) * 0x1000000) + (v.charCodeAt(p + 2) << 16) + (v.charCodeAt(p + 1) << 8) + v.charCodeAt(p); }
30 -function ShortToStr(v) { return String.fromCharCode((v >> 8) & 0xFF, v & 0xFF); }
31 -function ShortToStrX(v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF); }
32 -function IntToStr(v) { return String.fromCharCode((v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF); }
33 -function IntToStrX(v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF, (v >> 24) & 0xFF); }
34 -function MakeToArray(v) { if (!v || v == null || typeof v == 'object') return v; return [v]; }
35 -function SplitArray(v) { return v.split(','); }
36 -function Clone(v) { return JSON.parse(JSON.stringify(v)); }
37 -function EscapeHtml(x) { if (typeof x == "string") return x.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;'); if (typeof x == "boolean") return x; if (typeof x == "number") return x; }
38 -function EscapeHtmlBreaks(x) { if (typeof x == "string") return x.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;').replace(/\r/g, '<br />').replace(/\n/g, '').replace(/\t/g, '&nbsp;&nbsp;'); if (typeof x == "boolean") return x; if (typeof x == "number") return x; }
39 -
40 -// Move an element from one position in an array to a new position
41 -function ArrayElementMove(arr, from, to) { arr.splice(to, 0, arr.splice(from, 1)[0]); };
42 -
43 -// Print object for HTML
44 -function ObjectToStringEx(x, c) {
45 - var r = "";
46 - if (x != 0 && (!x || x == null)) return "(Null)";
47 - if (x instanceof Array) { for (var i in x) { r += '<br />' + gap(c) + "Item #" + i + ": " + ObjectToStringEx(x[i], c + 1); } }
48 - else if (x instanceof Object) { for (var i in x) { r += '<br />' + gap(c) + i + " = " + ObjectToStringEx(x[i], c + 1); } }
49 - else { r += EscapeHtml(x); }
50 - return r;
51 -}
52 -
53 -// Print object for console
54 -function ObjectToStringEx2(x, c) {
55 - var r = "";
56 - if (x != 0 && (!x || x == null)) return "(Null)";
57 - if (x instanceof Array) { for (var i in x) { r += '\r\n' + gap2(c) + "Item #" + i + ": " + ObjectToStringEx2(x[i], c + 1); } }
58 - else if (x instanceof Object) { for (var i in x) { r += '\r\n' + gap2(c) + i + " = " + ObjectToStringEx2(x[i], c + 1); } }
59 - else { r += EscapeHtml(x); }
60 - return r;
61 -}
62 -
63 -// Create an ident gap
64 -function gap(c) { var x = ''; for (var i = 0; i < (c * 4) ; i++) { x += '&nbsp;'; } return x; }
65 -function gap2(c) { var x = ''; for (var i = 0; i < (c * 4) ; i++) { x += ' '; } return x; }
66 -
67 -// Print an object in html
68 -function ObjectToString(x) { return ObjectToStringEx(x, 0); }
69 -function ObjectToString2(x) { return ObjectToStringEx2(x, 0); }
70 -
71 -// Convert a hex string to a raw string
72 -function hex2rstr(d) {
73 - if (typeof d != "string" || d.length == 0) return '';
74 - var r = '', m = ('' + d).match(/../g), t;
75 - while (t = m.shift()) r += String.fromCharCode('0x' + t);
76 - return r
77 -}
78 -
79 -// Convert decimal to hex
80 -function char2hex(i) { return (i + 0x100).toString(16).substr(-2).toUpperCase(); }
81 -
82 -// Convert a raw string to a hex string
83 -function rstr2hex(input) { var r = '', i; for (i = 0; i < input.length; i++) { r += char2hex(input.charCodeAt(i)); } return r; }
84 -
85 -// UTF-8 encoding & decoding functions
86 -function encode_utf8(s) { return unescape(encodeURIComponent(s)); }
87 -function decode_utf8(s) { return decodeURIComponent(escape(s)); }
88 -
89 -// Convert a string into a blob
90 -function data2blob(data) {
91 - var bytes = new Array(data.length);
92 - for (var i = 0; i < data.length; i++) bytes[i] = data.charCodeAt(i);
93 - var blob = new Blob([new Uint8Array(bytes)]);
94 - return blob;
95 -}
96 -
97 -// Generate random numbers
98 -function random(max) { return Math.floor(Math.random() * max); }
99 -
100 -// Trademarks
101 -function trademarks(x) { return x.replace(/\(R\)/g, '&reg;').replace(/\(TM\)/g, '&trade;'); }
102 -
103 -// Pad a number with zeros on the left
104 -function zeroPad(num, c) { if (c == null) { c = 2; } var s = "00000000" + num; return s.substr(s.length - c); }/**
105 -* @fileoverview Meshcentral.js
106 -* @author Ylian Saint-Hilaire
107 -* @version v0.0.1
108 -*/
109 -
110 -var MeshServerCreateControl = function (domain, authCookie) {
111 - var obj = {};
112 - obj.State = 0;
113 - obj.connectstate = 0;
114 - obj.pingTimer = null;
115 - obj.authCookie = authCookie;
116 - obj.trace = false;
117 -
118 - obj.xxStateChange = function (newstate, errCode) {
119 - if (obj.State == newstate) return;
120 - var previousState = obj.State;
121 - obj.State = newstate;
122 - if (obj.onStateChanged) obj.onStateChanged(obj, obj.State, previousState, errCode);
123 - }
124 -
125 - obj.Start = function () {
126 - if (obj.connectstate != 0) return;
127 - obj.connectstate = 0;
128 - var url = window.location.protocol.replace("http", "ws") + "//" + window.location.host + domain + "control.ashx";
129 - if (obj.authCookie && (obj.authCookie != '')) { url += '?auth=' + obj.authCookie; }
130 - obj.socket = new WebSocket(url);
131 - obj.socket.onopen = function (e) { obj.connectstate = 1; }
132 - obj.socket.onmessage = obj.xxOnMessage;
133 - obj.socket.onclose = function(e) { obj.Stop(e.code); }
134 - obj.xxStateChange(1, 0);
135 - if (obj.pingTimer != null) { clearInterval(obj.pingTimer); }
136 - obj.pingTimer = setInterval(function () { obj.send({ action: 'ping' }); }, 29000); // Ping the server every 29 seconds, stops corporate proxies from disconnecting.
137 - }
138 -
139 - obj.Stop = function (errCode) {
140 - obj.connectstate = 0;
141 - if (obj.socket) { obj.socket.close(); delete obj.socket; }
142 - if (obj.pingTimer != null) { clearInterval(obj.pingTimer); obj.pingTimer = null; }
143 - obj.xxStateChange(0, errCode);
144 - }
145 -
146 - obj.xxOnMessage = function (e) {
147 - if (obj.State == 1) { obj.xxStateChange(2); }
148 - //console.log('xxOnMessage', e.data);
149 - var message;
150 - try { message = JSON.parse(e.data); } catch (e) { return; }
151 - if ((typeof message != 'object') || (message.action == 'pong')) { return; }
152 - if (message.action == 'close') { if (message.msg) { console.log(message.msg); } obj.Stop(message.cause); return; }
153 - if (obj.trace) { console.log('RECV', message); }
154 - if (obj.onMessage) obj.onMessage(obj, message);
155 - };
156 -
157 - obj.send = function (x) {
158 - if (obj.socket != null && obj.connectstate == 1) {
159 - if (obj.trace) { console.log('SEND', x); }
160 - obj.socket.send(JSON.stringify(x));
161 - }
162 - }
163 -
164 - return obj;
165 -}
166 -/**
167 -* @fileoverview Intel(r) AMT Communication Stack
168 -* @author Ylian Saint-Hilaire
169 -* @version v0.2.0b
170 -*/
171 -
172 -/**
173 - * Construct a AmtStackCreateService object, this ia the main Intel AMT communication stack.
174 - * @constructor
175 - */
176 -function AmtStackCreateService(wsmanStack) {
177 - var obj = new Object();
178 - obj.wsman = wsmanStack;
179 - obj.pfx = ["http://intel.com/wbem/wscim/1/amt-schema/1/", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/", "http://intel.com/wbem/wscim/1/ips-schema/1/"];
180 - obj.PendingEnums = [];
181 - obj.PendingBatchOperations = 0;
182 - obj.ActiveEnumsCount = 0;
183 - obj.MaxActiveEnumsCount = 1; // Maximum number of enumerations that can be done at the same time.
184 - obj.onProcessChanged = null;
185 - var _MaxProcess = 0;
186 - var _LastProcess = 0;
187 -
188 - // Return the number of pending actions
189 - obj.GetPendingActions = function () { return (obj.PendingEnums.length * 2) + (obj.ActiveEnumsCount) + obj.wsman.comm.PendingAjax.length + obj.wsman.comm.ActiveAjaxCount + obj.PendingBatchOperations; }
190 -
191 - // Private Method, Update the current processing status, this gives the application an idea of what progress is being done by the WSMAN stack
192 - function _up() {
193 - var x = obj.GetPendingActions();
194 - if (_MaxProcess < x) _MaxProcess = x;
195 - if (obj.onProcessChanged != null && _LastProcess != x) {
196 - //console.log("Process Old=" + _LastProcess + ", New=" + x + ", PEnums=" + obj.PendingEnums.length + ", AEnums=" + obj.ActiveEnumsCount + ", PAjax=" + obj.wsman.comm.PendingAjax.length + ", AAjax=" + obj.wsman.comm.ActiveAjaxCount + ", PBatch=" + obj.PendingBatchOperations);
197 - _LastProcess = x;
198 - obj.onProcessChanged(x, _MaxProcess);
199 - }
200 - if (x == 0) _MaxProcess = 0;
201 - }
202 -
203 - // Perform a WSMAN "SUBSCRIBE" operation.
204 - obj.Subscribe = function (name, delivery, url, callback, tag, pri, selectors, opaque, user, pass) { obj.wsman.ExecSubscribe(obj.CompleteName(name), delivery, url, function (ws, resuri, response, xstatus) { _up(); callback(obj, name, response, xstatus, tag); }, 0, pri, selectors, opaque, user, pass); _up(); }
205 -
206 - // Perform a WSMAN "UNSUBSCRIBE" operation.
207 - obj.UnSubscribe = function (name, callback, tag, pri, selectors) { obj.wsman.ExecUnSubscribe(obj.CompleteName(name), function (ws, resuri, response, xstatus) { _up(); callback(obj, name, response, xstatus, tag); }, 0, pri, selectors); _up(); }
208 -
209 - // Perform a WSMAN "GET" operation.
210 - obj.Get = function (name, callback, tag, pri) { obj.wsman.ExecGet(obj.CompleteName(name), function (ws, resuri, response, xstatus) { _up(); callback(obj, name, response, xstatus, tag); }, 0, pri); _up(); }
211 -
212 - // Perform a WSMAN "PUT" operation.
213 - obj.Put = function (name, putobj, callback, tag, pri, selectors) { obj.wsman.ExecPut(obj.CompleteName(name), putobj, function (ws, resuri, response, xstatus) { _up(); callback(obj, name, response, xstatus, tag); }, 0, pri, selectors); _up(); }
214 -
215 - // Perform a WSMAN "CREATE" operation.
216 - obj.Create = function (name, putobj, callback, tag, pri) { obj.wsman.ExecCreate(obj.CompleteName(name), putobj, function (ws, resuri, response, xstatus) { _up(); callback(obj, name, response, xstatus, tag); }, 0, pri); _up(); }
217 -
218 - // Perform a WSMAN "DELETE" operation.
219 - obj.Delete = function (name, putobj, callback, tag, pri) { obj.wsman.ExecDelete(obj.CompleteName(name), putobj, function (ws, resuri, response, xstatus) { _up(); callback(obj, name, response, xstatus, tag); }, 0, pri); _up(); }
220 -
221 - // Perform a WSMAN method call operation.
222 - obj.Exec = function (name, method, args, callback, tag, pri, selectors) { obj.wsman.ExecMethod(obj.CompleteName(name), method, args, function (ws, resuri, response, xstatus) { _up(); callback(obj, name, obj.CompleteExecResponse(response), xstatus, tag); }, 0, pri, selectors); _up(); }
223 -
224 - // Perform a WSMAN method call operation.
225 - obj.ExecWithXml = function (name, method, args, callback, tag, pri, selectors) { obj.wsman.ExecMethodXml(obj.CompleteName(name), method, execArgumentsToXml(args), function (ws, resuri, response, xstatus) { _up(); callback(obj, name, obj.CompleteExecResponse(response), xstatus, tag); }, 0, pri, selectors); _up(); }
226 -
227 - // Perform a WSMAN "ENUMERATE" operation.
228 - obj.Enum = function (name, callback, tag, pri) {
229 - if (obj.ActiveEnumsCount < obj.MaxActiveEnumsCount) {
230 - obj.ActiveEnumsCount++; obj.wsman.ExecEnum(obj.CompleteName(name), function (ws, resuri, response, xstatus, tag0) { _up(); _EnumStartSink(name, response, callback, resuri, xstatus, tag0); }, tag, pri);
231 - } else {
232 - obj.PendingEnums.push([name, callback, tag, pri]);
233 - }
234 - _up();
235 - }
236 -
237 - // Private method
238 - function _EnumStartSink(name, response, callback, resuri, status, tag, pri) {
239 - if (status != 200) { callback(obj, name, null, status, tag); _EnumDoNext(1); return; }
240 - if (response == null || response.Header["Method"] != "EnumerateResponse" || !response.Body["EnumerationContext"]) { callback(obj, name, null, 603, tag); _EnumDoNext(1); return; }
241 - var enumctx = response.Body["EnumerationContext"];
242 - obj.wsman.ExecPull(resuri, enumctx, function (ws, resuri, response, xstatus) { _EnumContinueSink(name, response, callback, resuri, [], xstatus, tag, pri); });
243 - }
244 -
245 - // Private method
246 - function _EnumContinueSink(name, response, callback, resuri, items, status, tag, pri) {
247 - if (status != 200) { callback(obj, name, null, status, tag); _EnumDoNext(1); return; }
248 - if (response == null || response.Header["Method"] != "PullResponse") { callback(obj, name, null, 604, tag); _EnumDoNext(1); return; }
249 - for (var i in response.Body["Items"]) {
250 - if (response.Body["Items"][i] instanceof Array) {
251 - for (var j in response.Body["Items"][i]) { items.push(response.Body["Items"][i][j]); }
252 - } else {
253 - items.push(response.Body["Items"][i]);
254 - }
255 - }
256 - if (response.Body["EnumerationContext"]) {
257 - var enumctx = response.Body["EnumerationContext"];
258 - obj.wsman.ExecPull(resuri, enumctx, function (ws, resuri, response, xstatus) { _EnumContinueSink(name, response, callback, resuri, items, xstatus, tag, 1); });
259 - } else {
260 - _EnumDoNext(1);
261 - callback(obj, name, items, status, tag);
262 - _up();
263 - }
264 - }
265 -
266 - // Private method
267 - function _EnumDoNext(dec) {
268 - obj.ActiveEnumsCount -= dec;
269 - if (obj.ActiveEnumsCount >= obj.MaxActiveEnumsCount || obj.PendingEnums.length == 0) return;
270 - var x = obj.PendingEnums.shift();
271 - obj.Enum(x[0], x[1], x[2]);
272 - _EnumDoNext(0);
273 - }
274 -
275 - // Perform a batch of WSMAN "ENUM" operations.
276 - obj.BatchEnum = function (batchname, names, callback, tag, continueOnError, pri) {
277 - obj.PendingBatchOperations += (names.length * 2);
278 - _BatchNextEnum(batchname, Clone(names), callback, tag, {}, continueOnError, pri); _up();
279 - }
280 -
281 - // Request each enum in the batch, stopping if something does not return status 200
282 - function _BatchNextEnum(batchname, names, callback, tag, results, continueOnError, pri) {
283 - obj.PendingBatchOperations -= 2;
284 - var n = names.shift(), f = obj.Enum;
285 - if (n[0] == '*') { f = obj.Get; n = n.substring(1); } // If the name starts with a star, do a GET instead of an ENUM. This will reduce round trips.
286 - //console.log((f == obj.Get?'Get ':'Enum ') + n);
287 - // Perform a GET/ENUM action
288 - f(n, function (stack, name, responses, status, tag0) {
289 - tag0[2][name] = { response: (responses==null?null:responses.Body), responses: responses, status: status };
290 - if (tag0[1].length == 0 || status == 401 || (continueOnError != true && status != 200 && status != 400)) { obj.PendingBatchOperations -= (names.length * 2); _up(); callback(obj, batchname, tag0[2], status, tag); }
291 - else { _up(); _BatchNextEnum(batchname, names, callback, tag, tag0[2], pri); }
292 - }, [batchname, names, results], pri);
293 - _up();
294 - }
295 -
296 - // Perform a batch of WSMAN "GET" operations.
297 - obj.BatchGet = function (batchname, names, callback, tag, pri) {
298 - _FetchNext({ name: batchname, names: names, callback: callback, current: 0, responses: {}, tag: tag, pri: pri }); _up();
299 - }
300 -
301 - // Private method
302 - function _FetchNext(batch) {
303 - if (batch.names.length <= batch.current) {
304 - batch.callback(obj, batch.name, batch.responses, 200, batch.tag);
305 - } else {
306 - obj.wsman.ExecGet(obj.CompleteName(batch.names[batch.current]), function (ws, resuri, response, xstatus) { _Fetched(batch, response, xstatus); }, batch.pri);
307 - batch.current++;
308 - }
309 - _up();
310 - }
311 -
312 - // Private method
313 - function _Fetched(batch, response, status) {
314 - if (response == null || status != 200) {
315 - batch.callback(obj, batch.name, null, status, batch.tag);
316 - } else {
317 - batch.responses[response.Header["Method"]] = response;
318 - _FetchNext(batch);
319 - }
320 - }
321 -
322 - // Private method
323 - obj.CompleteName = function(name) {
324 - if (name.indexOf("AMT_") == 0) return obj.pfx[0] + name;
325 - if (name.indexOf("CIM_") == 0) return obj.pfx[1] + name;
326 - if (name.indexOf("IPS_") == 0) return obj.pfx[2] + name;
327 - }
328 -
329 - obj.CompleteExecResponse = function (resp) {
330 - if (resp && resp != null && resp.Body && resp.Body["ReturnValue"]) resp.Body.ReturnValueStr = obj.AmtStatusToStr(resp.Body["ReturnValue"]);
331 - return resp;
332 - }
333 -
334 - obj.RequestPowerStateChange = function (PowerState, callback_func) {
335 - obj.CIM_PowerManagementService_RequestPowerStateChange(PowerState, "<Address xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\"><ResourceURI xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\"><Selector Name=\"CreationClassName\">CIM_ComputerSystem</Selector><Selector Name=\"Name\">ManagedSystem</Selector></SelectorSet></ReferenceParameters>", null, null, callback_func);
336 - }
337 -
338 - obj.SetBootConfigRole = function (Role, callback_func) {
339 - obj.CIM_BootService_SetBootConfigRole("<Address xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\"><ResourceURI xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\"><Selector Name=\"InstanceID\">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>", Role, callback_func);
340 - }
341 -
342 - // Cancel all pending queries with given status
343 - obj.CancelAllQueries = function (s) {
344 - obj.wsman.CancelAllQueries(s);
345 - }
346 -
347 - // Auto generated methods
348 - obj.AMT_AgentPresenceWatchdog_RegisterAgent = function (callback_func) { obj.Exec("AMT_AgentPresenceWatchdog", "RegisterAgent", {}, callback_func); }
349 - obj.AMT_AgentPresenceWatchdog_AssertPresence = function (SequenceNumber, callback_func) { obj.Exec("AMT_AgentPresenceWatchdog", "AssertPresence", { "SequenceNumber": SequenceNumber }, callback_func); }
350 - obj.AMT_AgentPresenceWatchdog_AssertShutdown = function (SequenceNumber, callback_func) { obj.Exec("AMT_AgentPresenceWatchdog", "AssertShutdown", { "SequenceNumber": SequenceNumber }, callback_func); }
351 - obj.AMT_AgentPresenceWatchdog_AddAction = function (OldState, NewState, EventOnTransition, ActionSd, ActionEac, callback_func, tag, pri, selectors) { obj.Exec("AMT_AgentPresenceWatchdog", "AddAction", { "OldState": OldState, "NewState": NewState, "EventOnTransition": EventOnTransition, "ActionSd": ActionSd, "ActionEac": ActionEac }, callback_func, tag, pri, selectors); }
352 - obj.AMT_AgentPresenceWatchdog_DeleteAllActions = function (callback_func, tag, pri, selectors) { obj.Exec("AMT_AgentPresenceWatchdog", "DeleteAllActions", {}, callback_func, tag, pri, selectors); }
353 - obj.AMT_AgentPresenceWatchdogAction_GetActionEac = function (callback_func) { obj.Exec("AMT_AgentPresenceWatchdogAction", "GetActionEac", {}, callback_func); }
354 - obj.AMT_AgentPresenceWatchdogVA_RegisterAgent = function (callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "RegisterAgent", {}, callback_func); }
355 - obj.AMT_AgentPresenceWatchdogVA_AssertPresence = function (SequenceNumber, callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "AssertPresence", { "SequenceNumber": SequenceNumber }, callback_func); }
356 - obj.AMT_AgentPresenceWatchdogVA_AssertShutdown = function (SequenceNumber, callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "AssertShutdown", { "SequenceNumber": SequenceNumber }, callback_func); }
357 - obj.AMT_AgentPresenceWatchdogVA_AddAction = function (OldState, NewState, EventOnTransition, ActionSd, ActionEac, callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "AddAction", { "OldState": OldState, "NewState": NewState, "EventOnTransition": EventOnTransition, "ActionSd": ActionSd, "ActionEac": ActionEac }, callback_func); }
358 - obj.AMT_AgentPresenceWatchdogVA_DeleteAllActions = function (_method_dummy, callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "DeleteAllActions", { "_method_dummy": _method_dummy }, callback_func); }
359 - obj.AMT_AuditLog_ClearLog = function (callback_func) { obj.Exec("AMT_AuditLog", "ClearLog", {}, callback_func); }
360 - obj.AMT_AuditLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_AuditLog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
361 - obj.AMT_AuditLog_ReadRecords = function (StartIndex, callback_func, tag) { obj.Exec("AMT_AuditLog", "ReadRecords", { "StartIndex": StartIndex }, callback_func, tag); }
362 - obj.AMT_AuditLog_SetAuditLock = function (LockTimeoutInSeconds, Flag, Handle, callback_func) { obj.Exec("AMT_AuditLog", "SetAuditLock", { "LockTimeoutInSeconds": LockTimeoutInSeconds, "Flag": Flag, "Handle": Handle }, callback_func); }
363 - obj.AMT_AuditLog_ExportAuditLogSignature = function (SigningMechanism, callback_func) { obj.Exec("AMT_AuditLog", "ExportAuditLogSignature", { "SigningMechanism": SigningMechanism }, callback_func); }
364 - obj.AMT_AuditLog_SetSigningKeyMaterial = function (SigningMechanismType, SigningKey, LengthOfCertificates, Certificates, callback_func) { obj.Exec("AMT_AuditLog", "SetSigningKeyMaterial", { "SigningMechanismType": SigningMechanismType, "SigningKey": SigningKey, "LengthOfCertificates": LengthOfCertificates, "Certificates": Certificates }, callback_func); }
365 - obj.AMT_AuditPolicyRule_SetAuditPolicy = function (Enable, AuditedAppID, EventID, PolicyType, callback_func) { obj.Exec("AMT_AuditPolicyRule", "SetAuditPolicy", { "Enable": Enable, "AuditedAppID": AuditedAppID, "EventID": EventID, "PolicyType": PolicyType }, callback_func); }
366 - obj.AMT_AuditPolicyRule_SetAuditPolicyBulk = function (Enable, AuditedAppID, EventID, PolicyType, callback_func) { obj.Exec("AMT_AuditPolicyRule", "SetAuditPolicyBulk", { "Enable": Enable, "AuditedAppID": AuditedAppID, "EventID": EventID, "PolicyType": PolicyType }, callback_func); }
367 - obj.AMT_AuthorizationService_AddUserAclEntryEx = function (DigestUsername, DigestPassword, KerberosUserSid, AccessPermission, Realms, callback_func) { obj.Exec("AMT_AuthorizationService", "AddUserAclEntryEx", { "DigestUsername": DigestUsername, "DigestPassword": DigestPassword, "KerberosUserSid": KerberosUserSid, "AccessPermission": AccessPermission, "Realms": Realms }, callback_func); }
368 - obj.AMT_AuthorizationService_EnumerateUserAclEntries = function (StartIndex, callback_func) { obj.Exec("AMT_AuthorizationService", "EnumerateUserAclEntries", { "StartIndex": StartIndex }, callback_func); }
369 - obj.AMT_AuthorizationService_GetUserAclEntryEx = function (Handle, callback_func, tag) { obj.Exec("AMT_AuthorizationService", "GetUserAclEntryEx", { "Handle": Handle }, callback_func, tag); }
370 - obj.AMT_AuthorizationService_UpdateUserAclEntryEx = function (Handle, DigestUsername, DigestPassword, KerberosUserSid, AccessPermission, Realms, callback_func) { obj.Exec("AMT_AuthorizationService", "UpdateUserAclEntryEx", { "Handle": Handle, "DigestUsername": DigestUsername, "DigestPassword": DigestPassword, "KerberosUserSid": KerberosUserSid, "AccessPermission": AccessPermission, "Realms": Realms }, callback_func); }
371 - obj.AMT_AuthorizationService_RemoveUserAclEntry = function (Handle, callback_func) { obj.Exec("AMT_AuthorizationService", "RemoveUserAclEntry", { "Handle": Handle }, callback_func); }
372 - obj.AMT_AuthorizationService_SetAdminAclEntryEx = function (Username, DigestPassword, callback_func) { obj.Exec("AMT_AuthorizationService", "SetAdminAclEntryEx", { "Username": Username, "DigestPassword": DigestPassword }, callback_func); }
373 - obj.AMT_AuthorizationService_GetAdminAclEntry = function (callback_func) { obj.Exec("AMT_AuthorizationService", "GetAdminAclEntry", {}, callback_func); }
374 - obj.AMT_AuthorizationService_GetAdminAclEntryStatus = function (callback_func) { obj.Exec("AMT_AuthorizationService", "GetAdminAclEntryStatus", {}, callback_func); }
375 - obj.AMT_AuthorizationService_GetAdminNetAclEntryStatus = function (callback_func) { obj.Exec("AMT_AuthorizationService", "GetAdminNetAclEntryStatus", {}, callback_func); }
376 - obj.AMT_AuthorizationService_SetAclEnabledState = function (Handle, Enabled, callback_func, tag) { obj.Exec("AMT_AuthorizationService", "SetAclEnabledState", { "Handle": Handle, "Enabled": Enabled }, callback_func, tag); }
377 - obj.AMT_AuthorizationService_GetAclEnabledState = function (Handle, callback_func, tag) { obj.Exec("AMT_AuthorizationService", "GetAclEnabledState", { "Handle": Handle }, callback_func, tag); }
378 - obj.AMT_EndpointAccessControlService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
379 - obj.AMT_EndpointAccessControlService_GetPosture = function (PostureType, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "GetPosture", { "PostureType": PostureType }, callback_func); }
380 - obj.AMT_EndpointAccessControlService_GetPostureHash = function (PostureType, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "GetPostureHash", { "PostureType": PostureType }, callback_func); }
381 - obj.AMT_EndpointAccessControlService_UpdatePostureState = function (UpdateType, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "UpdatePostureState", { "UpdateType": UpdateType }, callback_func); }
382 - obj.AMT_EndpointAccessControlService_GetEacOptions = function (callback_func) { obj.Exec("AMT_EndpointAccessControlService", "GetEacOptions", {}, callback_func); }
383 - obj.AMT_EndpointAccessControlService_SetEacOptions = function (EacVendors, PostureHashAlgorithm, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "SetEacOptions", { "EacVendors": EacVendors, "PostureHashAlgorithm": PostureHashAlgorithm }, callback_func); }
384 - obj.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy = function (Policy, callback_func) { obj.Exec("AMT_EnvironmentDetectionSettingData", "SetSystemDefensePolicy", { "Policy": Policy }, callback_func); }
385 - obj.AMT_EnvironmentDetectionSettingData_EnableVpnRouting = function (Enable, callback_func) { obj.Exec("AMT_EnvironmentDetectionSettingData", "EnableVpnRouting", { "Enable": Enable }, callback_func); }
386 - obj.AMT_EthernetPortSettings_SetLinkPreference = function (LinkPreference, Timeout, callback_func) { obj.Exec("AMT_EthernetPortSettings", "SetLinkPreference", { "LinkPreference": LinkPreference, "Timeout": Timeout }, callback_func); }
387 - obj.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats = function (SelectedStatistics, callback_func) { obj.Exec("AMT_HeuristicPacketFilterStatistics", "ResetSelectedStats", { "SelectedStatistics": SelectedStatistics }, callback_func); }
388 - obj.AMT_KerberosSettingData_GetCredentialCacheState = function (callback_func) { obj.Exec("AMT_KerberosSettingData", "GetCredentialCacheState", {}, callback_func); }
389 - obj.AMT_KerberosSettingData_SetCredentialCacheState = function (Enable, callback_func) { obj.Exec("AMT_KerberosSettingData", "SetCredentialCacheState", { "Enable": Enable }, callback_func); }
390 - obj.AMT_MessageLog_CancelIteration = function (IterationIdentifier, callback_func) { obj.Exec("AMT_MessageLog", "CancelIteration", { "IterationIdentifier": IterationIdentifier }, callback_func); }
391 - obj.AMT_MessageLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_MessageLog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
392 - obj.AMT_MessageLog_ClearLog = function (callback_func) { obj.Exec("AMT_MessageLog", "ClearLog", { }, callback_func); }
393 - obj.AMT_MessageLog_GetRecords = function (IterationIdentifier, MaxReadRecords, callback_func, tag) { obj.Exec("AMT_MessageLog", "GetRecords", { "IterationIdentifier": IterationIdentifier, "MaxReadRecords": MaxReadRecords }, callback_func, tag); }
394 - obj.AMT_MessageLog_GetRecord = function (IterationIdentifier, PositionToNext, callback_func) { obj.Exec("AMT_MessageLog", "GetRecord", { "IterationIdentifier": IterationIdentifier, "PositionToNext": PositionToNext }, callback_func); }
395 - obj.AMT_MessageLog_PositionAtRecord = function (IterationIdentifier, MoveAbsolute, RecordNumber, callback_func) { obj.Exec("AMT_MessageLog", "PositionAtRecord", { "IterationIdentifier": IterationIdentifier, "MoveAbsolute": MoveAbsolute, "RecordNumber": RecordNumber }, callback_func); }
396 - obj.AMT_MessageLog_PositionToFirstRecord = function (callback_func, tag) { obj.Exec("AMT_MessageLog", "PositionToFirstRecord", {}, callback_func, tag); }
397 - obj.AMT_MessageLog_FreezeLog = function (Freeze, callback_func) { obj.Exec("AMT_MessageLog", "FreezeLog", { "Freeze": Freeze }, callback_func); }
398 - obj.AMT_PublicKeyManagementService_AddCRL = function (Url, SerialNumbers, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "AddCRL", { "Url": Url, "SerialNumbers": SerialNumbers }, callback_func); }
399 - obj.AMT_PublicKeyManagementService_ResetCRLList = function (_method_dummy, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "ResetCRLList", { "_method_dummy": _method_dummy }, callback_func); }
400 - obj.AMT_PublicKeyManagementService_AddCertificate = function (CertificateBlob, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "AddCertificate", { "CertificateBlob": CertificateBlob }, callback_func); }
401 - obj.AMT_PublicKeyManagementService_AddTrustedRootCertificate = function (CertificateBlob, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "AddTrustedRootCertificate", { "CertificateBlob": CertificateBlob }, callback_func); }
402 - obj.AMT_PublicKeyManagementService_AddKey = function (KeyBlob, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "AddKey", { "KeyBlob": KeyBlob }, callback_func); }
403 - obj.AMT_PublicKeyManagementService_GeneratePKCS10Request = function (KeyPair, DNName, Usage, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "GeneratePKCS10Request", { "KeyPair": KeyPair, "DNName": DNName, "Usage": Usage }, callback_func); }
404 - obj.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx = function (KeyPair, SigningAlgorithm, NullSignedCertificateRequest, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "GeneratePKCS10RequestEx", { "KeyPair": KeyPair, "SigningAlgorithm": SigningAlgorithm, "NullSignedCertificateRequest": NullSignedCertificateRequest }, callback_func); }
405 - obj.AMT_PublicKeyManagementService_GenerateKeyPair = function (KeyAlgorithm, KeyLength, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "GenerateKeyPair", { "KeyAlgorithm": KeyAlgorithm, "KeyLength": KeyLength }, callback_func); }
406 - obj.AMT_RedirectionService_RequestStateChange = function (RequestedState, callback_func) { obj.Exec("AMT_RedirectionService", "RequestStateChange", { "RequestedState": RequestedState }, callback_func); }
407 - obj.AMT_RedirectionService_TerminateSession = function (SessionType, callback_func) { obj.Exec("AMT_RedirectionService", "TerminateSession", { "SessionType": SessionType }, callback_func); }
408 - obj.AMT_RemoteAccessService_AddMpServer = function (AccessInfo, InfoFormat, Port, AuthMethod, Certificate, Username, Password, CN, callback_func) { obj.Exec("AMT_RemoteAccessService", "AddMpServer", { "AccessInfo": AccessInfo, "InfoFormat": InfoFormat, "Port": Port, "AuthMethod": AuthMethod, "Certificate": Certificate, "Username": Username, "Password": Password, "CN": CN }, callback_func); }
409 - obj.AMT_RemoteAccessService_AddRemoteAccessPolicyRule = function (Trigger, TunnelLifeTime, ExtendedData, MpServer, callback_func) { obj.Exec("AMT_RemoteAccessService", "AddRemoteAccessPolicyRule", { "Trigger": Trigger, "TunnelLifeTime": TunnelLifeTime, "ExtendedData": ExtendedData, "MpServer": MpServer }, callback_func); }
410 - obj.AMT_RemoteAccessService_CloseRemoteAccessConnection = function (_method_dummy, callback_func) { obj.Exec("AMT_RemoteAccessService", "CloseRemoteAccessConnection", { "_method_dummy": _method_dummy }, callback_func); }
411 - obj.AMT_SetupAndConfigurationService_CommitChanges = function (_method_dummy, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "CommitChanges", { "_method_dummy": _method_dummy }, callback_func); }
412 - obj.AMT_SetupAndConfigurationService_Unprovision = function (ProvisioningMode, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "Unprovision", { "ProvisioningMode": ProvisioningMode }, callback_func); }
413 - obj.AMT_SetupAndConfigurationService_PartialUnprovision = function (_method_dummy, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "PartialUnprovision", { "_method_dummy": _method_dummy }, callback_func); }
414 - obj.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection = function (_method_dummy, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "ResetFlashWearOutProtection", { "_method_dummy": _method_dummy }, callback_func); }
415 - obj.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod = function (Duration, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "ExtendProvisioningPeriod", { "Duration": Duration }, callback_func); }
416 - obj.AMT_SetupAndConfigurationService_SetMEBxPassword = function (Password, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "SetMEBxPassword", { "Password": Password }, callback_func); }
417 - obj.AMT_SetupAndConfigurationService_SetTLSPSK = function (PID, PPS, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "SetTLSPSK", { "PID": PID, "PPS": PPS }, callback_func); }
418 - obj.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord = function (callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecord", {}, callback_func); }
419 - obj.AMT_SetupAndConfigurationService_GetUuid = function (callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "GetUuid", {}, callback_func); }
420 - obj.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents = function (callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "GetUnprovisionBlockingComponents", {}, callback_func); }
421 - obj.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2 = function (callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecordV2", {}, callback_func); }
422 - obj.AMT_SystemDefensePolicy_GetTimeout = function (callback_func) { obj.Exec("AMT_SystemDefensePolicy", "GetTimeout", {}, callback_func); }
423 - obj.AMT_SystemDefensePolicy_SetTimeout = function (Timeout, callback_func) { obj.Exec("AMT_SystemDefensePolicy", "SetTimeout", { "Timeout": Timeout }, callback_func); }
424 - obj.AMT_SystemDefensePolicy_UpdateStatistics = function (NetworkInterface, ResetOnRead, callback_func, tag, pri, selectors) { obj.Exec("AMT_SystemDefensePolicy", "UpdateStatistics", { "NetworkInterface": NetworkInterface, "ResetOnRead": ResetOnRead }, callback_func, tag, pri, selectors); }
425 - obj.AMT_SystemPowerScheme_SetPowerScheme = function (callback_func, schemeInstanceId, tag) { obj.Exec("AMT_SystemPowerScheme", "SetPowerScheme", {}, callback_func, tag, 0, { "InstanceID": schemeInstanceId }); }
426 - obj.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch = function (callback_func, tag) { obj.Exec("AMT_TimeSynchronizationService", "GetLowAccuracyTimeSynch", {}, callback_func, tag); }
427 - obj.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch = function (Ta0, Tm1, Tm2, callback_func, tag) { obj.Exec("AMT_TimeSynchronizationService", "SetHighAccuracyTimeSynch", { "Ta0": Ta0, "Tm1": Tm1, "Tm2": Tm2 }, callback_func, tag); }
428 - obj.AMT_UserInitiatedConnectionService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_UserInitiatedConnectionService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
429 - obj.AMT_WebUIService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_WebUIService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
430 - obj.AMT_WiFiPortConfigurationService_AddWiFiSettings = function (WiFiEndpoint, WiFiEndpointSettingsInput, IEEE8021xSettingsInput, ClientCredential, CACredential, callback_func) { obj.ExecWithXml("AMT_WiFiPortConfigurationService", "AddWiFiSettings", { "WiFiEndpoint": WiFiEndpoint, "WiFiEndpointSettingsInput": WiFiEndpointSettingsInput, "IEEE8021xSettingsInput": IEEE8021xSettingsInput, "ClientCredential": ClientCredential, "CACredential": CACredential }, callback_func); }
431 - obj.AMT_WiFiPortConfigurationService_UpdateWiFiSettings = function (WiFiEndpointSettings, WiFiEndpointSettingsInput, IEEE8021xSettingsInput, ClientCredential, CACredential, callback_func) { obj.ExecWithXml("AMT_WiFiPortConfigurationService", "UpdateWiFiSettings", { "WiFiEndpointSettings": WiFiEndpointSettings, "WiFiEndpointSettingsInput": WiFiEndpointSettingsInput, "IEEE8021xSettingsInput": IEEE8021xSettingsInput, "ClientCredential": ClientCredential, "CACredential": CACredential }, callback_func); }
432 - obj.AMT_WiFiPortConfigurationService_DeleteAllITProfiles = function (_method_dummy, callback_func) { obj.Exec("AMT_WiFiPortConfigurationService", "DeleteAllITProfiles", { "_method_dummy": _method_dummy }, callback_func); }
433 - obj.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles = function (_method_dummy, callback_func) { obj.Exec("AMT_WiFiPortConfigurationService", "DeleteAllUserProfiles", { "_method_dummy": _method_dummy }, callback_func); }
434 - obj.CIM_Account_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_Account", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
435 - obj.CIM_AccountManagementService_CreateAccount = function (System, AccountTemplate, callback_func) { obj.Exec("CIM_AccountManagementService", "CreateAccount", { "System": System, "AccountTemplate": AccountTemplate }, callback_func); }
436 - obj.CIM_BootConfigSetting_ChangeBootOrder = function (Source, callback_func) { obj.Exec("CIM_BootConfigSetting", "ChangeBootOrder", { "Source": Source }, callback_func); }
437 - obj.CIM_BootService_SetBootConfigRole = function (BootConfigSetting, Role, callback_func) { obj.Exec("CIM_BootService", "SetBootConfigRole", { "BootConfigSetting": BootConfigSetting, "Role": Role }, callback_func, 0, 1); }
438 - obj.CIM_Card_ConnectorPower = function (Connector, PoweredOn, callback_func) { obj.Exec("CIM_Card", "ConnectorPower", { "Connector": Connector, "PoweredOn": PoweredOn }, callback_func); }
439 - obj.CIM_Card_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec("CIM_Card", "IsCompatible", { "ElementToCheck": ElementToCheck }, callback_func); }
440 - obj.CIM_Chassis_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec("CIM_Chassis", "IsCompatible", { "ElementToCheck": ElementToCheck }, callback_func); }
441 - obj.CIM_Fan_SetSpeed = function (DesiredSpeed, callback_func) { obj.Exec("CIM_Fan", "SetSpeed", { "DesiredSpeed": DesiredSpeed }, callback_func); }
442 - obj.CIM_KVMRedirectionSAP_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_KVMRedirectionSAP", "RequestStateChange", { "RequestedState": RequestedState/*, "TimeoutPeriod": TimeoutPeriod */}, callback_func); }
443 - obj.CIM_MediaAccessDevice_LockMedia = function (Lock, callback_func) { obj.Exec("CIM_MediaAccessDevice", "LockMedia", { "Lock": Lock }, callback_func); }
444 - obj.CIM_MediaAccessDevice_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_MediaAccessDevice", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); }
445 - obj.CIM_MediaAccessDevice_Reset = function (callback_func) { obj.Exec("CIM_MediaAccessDevice", "Reset", {}, callback_func); }
446 - obj.CIM_MediaAccessDevice_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_MediaAccessDevice", "EnableDevice", { "Enabled": Enabled }, callback_func); }
447 - obj.CIM_MediaAccessDevice_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_MediaAccessDevice", "OnlineDevice", { "Online": Online }, callback_func); }
448 - obj.CIM_MediaAccessDevice_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_MediaAccessDevice", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); }
449 - obj.CIM_MediaAccessDevice_SaveProperties = function (callback_func) { obj.Exec("CIM_MediaAccessDevice", "SaveProperties", {}, callback_func); }
450 - obj.CIM_MediaAccessDevice_RestoreProperties = function (callback_func) { obj.Exec("CIM_MediaAccessDevice", "RestoreProperties", {}, callback_func); }
451 - obj.CIM_MediaAccessDevice_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_MediaAccessDevice", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
452 - obj.CIM_PhysicalFrame_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec("CIM_PhysicalFrame", "IsCompatible", { "ElementToCheck": ElementToCheck }, callback_func); }
453 - obj.CIM_PhysicalPackage_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec("CIM_PhysicalPackage", "IsCompatible", { "ElementToCheck": ElementToCheck }, callback_func); }
454 - obj.CIM_PowerManagementService_RequestPowerStateChange = function (PowerState, ManagedElement, Time, TimeoutPeriod, callback_func) { obj.Exec("CIM_PowerManagementService", "RequestPowerStateChange", { "PowerState": PowerState, "ManagedElement": ManagedElement, "Time": Time, "TimeoutPeriod": TimeoutPeriod }, callback_func, 0, 1); }
455 - obj.CIM_PowerSupply_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_PowerSupply", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); }
456 - obj.CIM_PowerSupply_Reset = function (callback_func) { obj.Exec("CIM_PowerSupply", "Reset", {}, callback_func); }
457 - obj.CIM_PowerSupply_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_PowerSupply", "EnableDevice", { "Enabled": Enabled }, callback_func); }
458 - obj.CIM_PowerSupply_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_PowerSupply", "OnlineDevice", { "Online": Online }, callback_func); }
459 - obj.CIM_PowerSupply_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_PowerSupply", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); }
460 - obj.CIM_PowerSupply_SaveProperties = function (callback_func) { obj.Exec("CIM_PowerSupply", "SaveProperties", {}, callback_func); }
461 - obj.CIM_PowerSupply_RestoreProperties = function (callback_func) { obj.Exec("CIM_PowerSupply", "RestoreProperties", {}, callback_func); }
462 - obj.CIM_PowerSupply_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_PowerSupply", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
463 - obj.CIM_Processor_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_Processor", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); }
464 - obj.CIM_Processor_Reset = function (callback_func) { obj.Exec("CIM_Processor", "Reset", {}, callback_func); }
465 - obj.CIM_Processor_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_Processor", "EnableDevice", { "Enabled": Enabled }, callback_func); }
466 - obj.CIM_Processor_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_Processor", "OnlineDevice", { "Online": Online }, callback_func); }
467 - obj.CIM_Processor_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_Processor", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); }
468 - obj.CIM_Processor_SaveProperties = function (callback_func) { obj.Exec("CIM_Processor", "SaveProperties", {}, callback_func); }
469 - obj.CIM_Processor_RestoreProperties = function (callback_func) { obj.Exec("CIM_Processor", "RestoreProperties", {}, callback_func); }
470 - obj.CIM_Processor_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_Processor", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
471 - obj.CIM_RecordLog_ClearLog = function (callback_func) { obj.Exec("CIM_RecordLog", "ClearLog", {}, callback_func); }
472 - obj.CIM_RecordLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_RecordLog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
473 - obj.CIM_RedirectionService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_RedirectionService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
474 - obj.CIM_Sensor_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_Sensor", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); }
475 - obj.CIM_Sensor_Reset = function (callback_func) { obj.Exec("CIM_Sensor", "Reset", {}, callback_func); }
476 - obj.CIM_Sensor_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_Sensor", "EnableDevice", { "Enabled": Enabled }, callback_func); }
477 - obj.CIM_Sensor_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_Sensor", "OnlineDevice", { "Online": Online }, callback_func); }
478 - obj.CIM_Sensor_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_Sensor", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); }
479 - obj.CIM_Sensor_SaveProperties = function (callback_func) { obj.Exec("CIM_Sensor", "SaveProperties", {}, callback_func); }
480 - obj.CIM_Sensor_RestoreProperties = function (callback_func) { obj.Exec("CIM_Sensor", "RestoreProperties", {}, callback_func); }
481 - obj.CIM_Sensor_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_Sensor", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
482 - obj.CIM_StatisticalData_ResetSelectedStats = function (SelectedStatistics, callback_func) { obj.Exec("CIM_StatisticalData", "ResetSelectedStats", { "SelectedStatistics": SelectedStatistics }, callback_func); }
483 - obj.CIM_Watchdog_KeepAlive = function (callback_func) { obj.Exec("CIM_Watchdog", "KeepAlive", {}, callback_func); }
484 - obj.CIM_Watchdog_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_Watchdog", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); }
485 - obj.CIM_Watchdog_Reset = function (callback_func) { obj.Exec("CIM_Watchdog", "Reset", {}, callback_func); }
486 - obj.CIM_Watchdog_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_Watchdog", "EnableDevice", { "Enabled": Enabled }, callback_func); }
487 - obj.CIM_Watchdog_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_Watchdog", "OnlineDevice", { "Online": Online }, callback_func); }
488 - obj.CIM_Watchdog_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_Watchdog", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); }
489 - obj.CIM_Watchdog_SaveProperties = function (callback_func) { obj.Exec("CIM_Watchdog", "SaveProperties", {}, callback_func); }
490 - obj.CIM_Watchdog_RestoreProperties = function (callback_func) { obj.Exec("CIM_Watchdog", "RestoreProperties", {}, callback_func); }
491 - obj.CIM_Watchdog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_Watchdog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
492 - obj.CIM_WiFiPort_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_WiFiPort", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); }
493 - obj.CIM_WiFiPort_Reset = function (callback_func) { obj.Exec("CIM_WiFiPort", "Reset", {}, callback_func); }
494 - obj.CIM_WiFiPort_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_WiFiPort", "EnableDevice", { "Enabled": Enabled }, callback_func); }
495 - obj.CIM_WiFiPort_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_WiFiPort", "OnlineDevice", { "Online": Online }, callback_func); }
496 - obj.CIM_WiFiPort_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_WiFiPort", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); }
497 - obj.CIM_WiFiPort_SaveProperties = function (callback_func) { obj.Exec("CIM_WiFiPort", "SaveProperties", {}, callback_func); }
498 - obj.CIM_WiFiPort_RestoreProperties = function (callback_func) { obj.Exec("CIM_WiFiPort", "RestoreProperties", {}, callback_func); }
499 - obj.CIM_WiFiPort_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_WiFiPort", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
500 - obj.IPS_HostBasedSetupService_Setup = function (NetAdminPassEncryptionType, NetworkAdminPassword, McNonce, Certificate, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec("IPS_HostBasedSetupService", "Setup", { "NetAdminPassEncryptionType": NetAdminPassEncryptionType, "NetworkAdminPassword": NetworkAdminPassword, "McNonce": McNonce, "Certificate": Certificate, "SigningAlgorithm": SigningAlgorithm, "DigitalSignature": DigitalSignature }, callback_func); }
501 - obj.IPS_HostBasedSetupService_AddNextCertInChain = function (NextCertificate, IsLeafCertificate, IsRootCertificate, callback_func) { obj.Exec("IPS_HostBasedSetupService", "AddNextCertInChain", { "NextCertificate": NextCertificate, "IsLeafCertificate": IsLeafCertificate, "IsRootCertificate": IsRootCertificate }, callback_func); }
502 - obj.IPS_HostBasedSetupService_AdminSetup = function (NetAdminPassEncryptionType, NetworkAdminPassword, McNonce, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec("IPS_HostBasedSetupService", "AdminSetup", { "NetAdminPassEncryptionType": NetAdminPassEncryptionType, "NetworkAdminPassword": NetworkAdminPassword, "McNonce": McNonce, "SigningAlgorithm": SigningAlgorithm, "DigitalSignature": DigitalSignature }, callback_func); }
503 - obj.IPS_HostBasedSetupService_UpgradeClientToAdmin = function (McNonce, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec("IPS_HostBasedSetupService", "UpgradeClientToAdmin", { "McNonce": McNonce, "SigningAlgorithm": SigningAlgorithm, "DigitalSignature": DigitalSignature }, callback_func); }
504 - obj.IPS_HostBasedSetupService_DisableClientControlMode = function (_method_dummy, callback_func) { obj.Exec("IPS_HostBasedSetupService", "DisableClientControlMode", { "_method_dummy": _method_dummy }, callback_func); }
505 - obj.IPS_KVMRedirectionSettingData_TerminateSession = function (callback_func) { obj.Exec("IPS_KVMRedirectionSettingData", "TerminateSession", {}, callback_func); }
506 - obj.IPS_OptInService_StartOptIn = function (callback_func) { obj.Exec("IPS_OptInService", "StartOptIn", {}, callback_func); }
507 - obj.IPS_OptInService_CancelOptIn = function (callback_func) { obj.Exec("IPS_OptInService", "CancelOptIn", {}, callback_func); }
508 - obj.IPS_OptInService_SendOptInCode = function (OptInCode, callback_func) { obj.Exec("IPS_OptInService", "SendOptInCode", { "OptInCode": OptInCode }, callback_func); }
509 - obj.IPS_OptInService_StartService = function (callback_func) { obj.Exec("IPS_OptInService", "StartService", {}, callback_func); }
510 - obj.IPS_OptInService_StopService = function (callback_func) { obj.Exec("IPS_OptInService", "StopService", {}, callback_func); }
511 - obj.IPS_OptInService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("IPS_OptInService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
512 - obj.IPS_ProvisioningRecordLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("IPS_ProvisioningRecordLog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
513 - obj.IPS_ProvisioningRecordLog_ClearLog = function (_method_dummy, callback_func) { obj.Exec("IPS_ProvisioningRecordLog", "ClearLog", { "_method_dummy": _method_dummy }, callback_func); }
514 - obj.IPS_SecIOService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("IPS_SecIOService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
515 -
516 - obj.AmtStatusToStr = function (code) { if (obj.AmtStatusCodes[code]) return obj.AmtStatusCodes[code]; else return "UNKNOWN_ERROR" }
517 - obj.AmtStatusCodes = {
518 - 0x0000: "SUCCESS",
519 - 0x0001: "INTERNAL_ERROR",
520 - 0x0002: "NOT_READY",
521 - 0x0003: "INVALID_PT_MODE",
522 - 0x0004: "INVALID_MESSAGE_LENGTH",
523 - 0x0005: "TABLE_FINGERPRINT_NOT_AVAILABLE",
524 - 0x0006: "INTEGRITY_CHECK_FAILED",
525 - 0x0007: "UNSUPPORTED_ISVS_VERSION",
526 - 0x0008: "APPLICATION_NOT_REGISTERED",
527 - 0x0009: "INVALID_REGISTRATION_DATA",
528 - 0x000A: "APPLICATION_DOES_NOT_EXIST",
529 - 0x000B: "NOT_ENOUGH_STORAGE",
530 - 0x000C: "INVALID_NAME",
531 - 0x000D: "BLOCK_DOES_NOT_EXIST",
532 - 0x000E: "INVALID_BYTE_OFFSET",
533 - 0x000F: "INVALID_BYTE_COUNT",
534 - 0x0010: "NOT_PERMITTED",
535 - 0x0011: "NOT_OWNER",
536 - 0x0012: "BLOCK_LOCKED_BY_OTHER",
537 - 0x0013: "BLOCK_NOT_LOCKED",
538 - 0x0014: "INVALID_GROUP_PERMISSIONS",
539 - 0x0015: "GROUP_DOES_NOT_EXIST",
540 - 0x0016: "INVALID_MEMBER_COUNT",
541 - 0x0017: "MAX_LIMIT_REACHED",
542 - 0x0018: "INVALID_AUTH_TYPE",
543 - 0x0019: "AUTHENTICATION_FAILED",
544 - 0x001A: "INVALID_DHCP_MODE",
545 - 0x001B: "INVALID_IP_ADDRESS",
546 - 0x001C: "INVALID_DOMAIN_NAME",
547 - 0x001D: "UNSUPPORTED_VERSION",
548 - 0x001E: "REQUEST_UNEXPECTED",
549 - 0x001F: "INVALID_TABLE_TYPE",
550 - 0x0020: "INVALID_PROVISIONING_STATE",
551 - 0x0021: "UNSUPPORTED_OBJECT",
552 - 0x0022: "INVALID_TIME",
553 - 0x0023: "INVALID_INDEX",
554 - 0x0024: "INVALID_PARAMETER",
555 - 0x0025: "INVALID_NETMASK",
556 - 0x0026: "FLASH_WRITE_LIMIT_EXCEEDED",
557 - 0x0027: "INVALID_IMAGE_LENGTH",
558 - 0x0028: "INVALID_IMAGE_SIGNATURE",
559 - 0x0029: "PROPOSE_ANOTHER_VERSION",
560 - 0x002A: "INVALID_PID_FORMAT",
561 - 0x002B: "INVALID_PPS_FORMAT",
562 - 0x002C: "BIST_COMMAND_BLOCKED",
563 - 0x002D: "CONNECTION_FAILED",
564 - 0x002E: "CONNECTION_TOO_MANY",
565 - 0x002F: "RNG_GENERATION_IN_PROGRESS",
566 - 0x0030: "RNG_NOT_READY",
567 - 0x0031: "CERTIFICATE_NOT_READY",
568 - 0x0400: "DISABLED_BY_POLICY",
569 - 0x0800: "NETWORK_IF_ERROR_BASE",
570 - 0x0801: "UNSUPPORTED_OEM_NUMBER",
571 - 0x0802: "UNSUPPORTED_BOOT_OPTION",
572 - 0x0803: "INVALID_COMMAND",
573 - 0x0804: "INVALID_SPECIAL_COMMAND",
574 - 0x0805: "INVALID_HANDLE",
575 - 0x0806: "INVALID_PASSWORD",
576 - 0x0807: "INVALID_REALM",
577 - 0x0808: "STORAGE_ACL_ENTRY_IN_USE",
578 - 0x0809: "DATA_MISSING",
579 - 0x080A: "DUPLICATE",
580 - 0x080B: "EVENTLOG_FROZEN",
581 - 0x080C: "PKI_MISSING_KEYS",
582 - 0x080D: "PKI_GENERATING_KEYS",
583 - 0x080E: "INVALID_KEY",
584 - 0x080F: "INVALID_CERT",
585 - 0x0810: "CERT_KEY_NOT_MATCH",
586 - 0x0811: "MAX_KERB_DOMAIN_REACHED",
587 - 0x0812: "UNSUPPORTED",
588 - 0x0813: "INVALID_PRIORITY",
589 - 0x0814: "NOT_FOUND",
590 - 0x0815: "INVALID_CREDENTIALS",
591 - 0x0816: "INVALID_PASSPHRASE",
592 - 0x0818: "NO_ASSOCIATION",
593 - 0x081B: "AUDIT_FAIL",
594 - 0x081C: "BLOCKING_COMPONENT",
595 - 0x0821: "USER_CONSENT_REQUIRED",
596 - 0x1000: "APP_INTERNAL_ERROR",
597 - 0x1001: "NOT_INITIALIZED",
598 - 0x1002: "LIB_VERSION_UNSUPPORTED",
599 - 0x1003: "INVALID_PARAM",
600 - 0x1004: "RESOURCES",
601 - 0x1005: "HARDWARE_ACCESS_ERROR",
602 - 0x1006: "REQUESTOR_NOT_REGISTERED",
603 - 0x1007: "NETWORK_ERROR",
604 - 0x1008: "PARAM_BUFFER_TOO_SHORT",
605 - 0x1009: "COM_NOT_INITIALIZED_IN_THREAD",
606 - 0x100A: "URL_REQUIRED"
607 - }
608 -
609 - //
610 - // Methods used for getting the event log
611 - //
612 -
613 - obj.GetMessageLog = function (func, tag) {
614 - obj.AMT_MessageLog_PositionToFirstRecord(_GetMessageLog0, [func, tag, []]);
615 - }
616 - function _GetMessageLog0(stack, name, responses, status, tag) {
617 - if (status != 200 || responses.Body["ReturnValue"] != '0') { tag[0](obj, null, tag[2]); return; }
618 - obj.AMT_MessageLog_GetRecords(responses.Body["IterationIdentifier"], 390, _GetMessageLog1, tag);
619 - }
620 - function _GetMessageLog1(stack, name, responses, status, tag) {
621 - if (status != 200 || responses.Body["ReturnValue"] != '0') { tag[0](obj, null, tag[2]); return; }
622 - var i, j, x, e, AmtMessages = tag[2], t = new Date(), TimeStamp, ra = responses.Body["RecordArray"];
623 - if (typeof ra === 'string') { responses.Body["RecordArray"] = [responses.Body["RecordArray"]]; }
624 -
625 - for (i in ra) {
626 - e = null;
627 - try { e = window.atob(ra[i]); } catch (ex) { }
628 - if (e != null) {
629 - TimeStamp = ReadIntX(e, 0);
630 - if ((TimeStamp > 0) && (TimeStamp < 0xFFFFFFFF)) {
631 - x = { 'DeviceAddress': e.charCodeAt(4), 'EventSensorType': e.charCodeAt(5), 'EventType': e.charCodeAt(6), 'EventOffset': e.charCodeAt(7), 'EventSourceType': e.charCodeAt(8), 'EventSeverity': e.charCodeAt(9), 'SensorNumber': e.charCodeAt(10), 'Entity': e.charCodeAt(11), 'EntityInstance': e.charCodeAt(12), 'EventData': [], 'Time': new Date((TimeStamp + (t.getTimezoneOffset() * 60)) * 1000) };
632 - for (j = 13; j < 21; j++) { x['EventData'].push(e.charCodeAt(j)); }
633 - x['EntityStr'] = _SystemEntityTypes[x['Entity']];
634 - x['Desc'] = _GetEventDetailStr(x['EventSensorType'], x['EventOffset'], x['EventData'], x['Entity']);
635 - if (!x['EntityStr']) x['EntityStr'] = "Unknown";
636 - AmtMessages.push(x);
637 - }
638 - }
639 - }
640 -
641 - if (responses.Body["NoMoreRecords"] != true) { obj.AMT_MessageLog_GetRecords(responses.Body["IterationIdentifier"], 390, _GetMessageLog1, [tag[0], AmtMessages, tag[2]]); } else { tag[0](obj, AmtMessages, tag[2]); }
642 - }
643 -
644 - var _EventTrapSourceTypes = "Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split('|');
645 - var _SystemFirmwareError = "Unspecified.|No system memory is physically installed in the system.|No usable system memory, all installed memory has experienced an unrecoverable failure.|Unrecoverable hard-disk/ATAPI/IDE device failure.|Unrecoverable system-board failure.|Unrecoverable diskette subsystem failure.|Unrecoverable hard-disk controller failure.|Unrecoverable PS/2 or USB keyboard failure.|Removable boot media not found.|Unrecoverable video controller failure.|No video device detected.|Firmware (BIOS) ROM corruption detected.|CPU voltage mismatch (processors that share same supply have mismatched voltage requirements)|CPU speed matching failure".split('|');
646 - var _SystemFirmwareProgress = "Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split('|');
647 - var _SystemEntityTypes = "Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split('|');
648 - obj.RealmNames = "||Redirection|PT Administration|Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split('|');
649 - obj.WatchdogCurrentStates = { 1: 'Not Started', 2: 'Stopped', 4: 'Running', 8: 'Expired', 16: 'Suspended' };
650 -
651 - function _GetEventDetailStr(eventSensorType, eventOffset, eventDataField, entity) {
652 -
653 - if (eventSensorType == 15)
654 - {
655 - if (eventDataField[0] == 235) return "Invalid Data";
656 - if (eventOffset == 0) return _SystemFirmwareError[eventDataField[1]];
657 - return _SystemFirmwareProgress[eventDataField[1]];
658 - }
659 -
660 - if (eventSensorType == 18 && eventDataField[0] == 170) // System watchdog event
661 - {
662 - return "Agent watchdog " + char2hex(eventDataField[4]) + char2hex(eventDataField[3]) + char2hex(eventDataField[2]) + char2hex(eventDataField[1]) + "-" + char2hex(eventDataField[6]) + char2hex(eventDataField[5]) + "-... changed to " + obj.WatchdogCurrentStates[eventDataField[7]];
663 - }
664 -
665 - /*
666 - if (eventSensorType == 5 && eventOffset == 0) // System chassis
667 - {
668 - return "Case intrusion";
669 - }
670 -
671 - if (eventSensorType == 192 && eventOffset == 0 && eventDataField[0] == 170 && eventDataField[1] == 48)
672 - {
673 - if (eventDataField[2] == 0) return "A remote Serial Over LAN session was established.";
674 - if (eventDataField[2] == 1) return "Remote Serial Over LAN session finished. User control was restored.";
675 - if (eventDataField[2] == 2) return "A remote IDE-Redirection session was established.";
676 - if (eventDataField[2] == 3) return "Remote IDE-Redirection session finished. User control was restored.";
677 - }
678 -
679 - if (eventSensorType == 36)
680 - {
681 - long handle = ((long)(eventDataField[1]) << 24) + ((long)(eventDataField[2]) << 16) + ((long)(eventDataField[3]) << 8) + (long)(eventDataField[4]);
682 - string nic = string.Format("#{0}", eventDataField[0]);
683 - if (eventDataField[0] == 0xAA) nic = "wired"; // TODO: Add wireless *****
684 - //if (eventDataField[0] == 0xAA) nic = "wireless";
685 -
686 - if (handle == 4294967293) { return string.Format("All received packet filter was matched on {0} interface.", nic); }
687 - if (handle == 4294967292) { return string.Format("All outbound packet filter was matched on {0} interface.", nic); }
688 - if (handle == 4294967290) { return string.Format("Spoofed packet filter was matched on {0} interface.", nic); }
689 - return string.Format("Filter {0} was matched on {1} interface.", handle, nic);
690 - }
691 -
692 - if (eventSensorType == 192)
693 - {
694 - if (eventDataField[2] == 0) return "Security policy invoked. Some or all network traffic (TX) was stopped.";
695 - if (eventDataField[2] == 2) return "Security policy invoked. Some or all network traffic (RX) was stopped.";
696 - return "Security policy invoked.";
697 - }
698 -
699 - if (eventSensorType == 193)
700 - {
701 - if (eventDataField[0] == 0xAA && eventDataField[1] == 0x30 && eventDataField[2] == 0x00 && eventDataField[3] == 0x00) { return "User request for remote connection."; }
702 - if (eventDataField[0] == 0xAA && eventDataField[1] == 0x20 && eventDataField[2] == 0x03 && eventDataField[3] == 0x01) { return "EAC error: attempt to get posture while NAC in Intel� AMT is disabled."; // eventDataField = 0xAA20030100000000 }
703 - if (eventDataField[0] == 0xAA && eventDataField[1] == 0x20 && eventDataField[2] == 0x04 && eventDataField[3] == 0x00) { return "Certificate revoked. "; }
704 - }
705 - */
706 -
707 - if (eventSensorType == 6) return "Authentication failed " + (eventDataField[1] + (eventDataField[2] << 8)) + " times. The system may be under attack.";
708 - if (eventSensorType == 30) return "No bootable media";
709 - if (eventSensorType == 32) return "Operating system lockup or power interrupt";
710 - if (eventSensorType == 35) return "System boot failure";
711 - if (eventSensorType == 37) return "System firmware started (at least one CPU is properly executing).";
712 - return "Unknown Sensor Type #" + eventSensorType;
713 - }
714 -
715 -
716 - return obj;
717 -}
718 -
719 -
720 -
721 -
722 -
723 -// TinyMD5 from https://github.com/jbt/js-crypto
724 -
725 -// Perform MD5 setup
726 -var md5_k = [];
727 -for (var i = 0; i < 64;) { md5_k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296); }
728 -
729 -// Perform MD5 on raw string and return hex
730 -function hex_md5(str) {
731 - var b, c, d, j,
732 - x = [],
733 - str2 = unescape(encodeURI(str)),
734 - a = str2.length,
735 - h = [b = 1732584193, c = -271733879, ~b, ~c],
736 - i = 0;
737 -
738 - for (; i <= a;) x[i >> 2] |= (str2.charCodeAt(i) || 128) << 8 * (i++ % 4);
739 -
740 - x[str = (a + 8 >> 6) * 16 + 14] = a * 8;
741 - i = 0;
742 -
743 - for (; i < str; i += 16) {
744 - a = h; j = 0;
745 - for (; j < 64;) {
746 - a = [
747 - d = a[3],
748 - ((b = a[1] | 0) +
749 - ((d = (
750 - (a[0] +
751 - [
752 - b & (c = a[2]) | ~b & d,
753 - d & b | ~d & c,
754 - b ^ c ^ d,
755 - c ^ (b | ~d)
756 - ][a = j >> 4]
757 - ) +
758 - (md5_k[j] +
759 - (x[[
760 - j,
761 - 5 * j + 1,
762 - 3 * j + 5,
763 - 7 * j
764 - ][a] % 16 + i] | 0)
765 - )
766 - )) << (a = [
767 - 7, 12, 17, 22,
768 - 5, 9, 14, 20,
769 - 4, 11, 16, 23,
770 - 6, 10, 15, 21
771 - ][4 * a + j++ % 4]) | d >>> 32 - a)
772 - ),
773 - b,
774 - c
775 - ];
776 - }
777 - for (j = 4; j;) h[--j] = h[j] + a[j];
778 - }
779 -
780 - str = '';
781 - for (; j < 32;) str += ((h[j >> 3] >> ((1 ^ j++ & 7) * 4)) & 15).toString(16);
782 - return str;
783 -}
784 -
785 -
786 -// Perform MD5 on raw string and return raw string result
787 -function rstr_md5(str) { return hex2rstr(hex_md5(str)); }
788 -
789 -/*
790 -Convert arguments into selector set and body XML. Used by AMT_WiFiPortConfigurationService_UpdateWiFiSettings.
791 -args = {
792 - "WiFiEndpoint": {
793 - __parameterType: 'reference',
794 - __resourceUri: 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_WiFiEndpoint',
795 - Name: 'WiFi Endpoint 0'
796 - },
797 - "WiFiEndpointSettingsInput":
798 - {
799 - __parameterType: 'instance',
800 - __namespace: 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_WiFiEndpointSettings',
801 - ElementName: document.querySelector('#editProfile-profileName').value,
802 - InstanceID: 'Intel(r) AMT:WiFi Endpoint Settings ' + document.querySelector('#editProfile-profileName').value,
803 - AuthenticationMethod: document.querySelector('#editProfile-networkAuthentication').value,
804 - //BSSType: 3, // Intel(r) AMT supports only infrastructure networks
805 - EncryptionMethod: document.querySelector('#editProfile-encryption').value,
806 - SSID: document.querySelector('#editProfile-networkName').value,
807 - Priority: 100,
808 - PSKPassPhrase: document.querySelector('#editProfile-passPhrase').value
809 - },
810 - "IEEE8021xSettingsInput": null,
811 - "ClientCredential": null,
812 - "CACredential": null
813 -},
814 -*/
815 -function execArgumentsToXml(args) {
816 - if(args === undefined || args === null) return null;
817 -
818 - var result = '';
819 - for(var argName in args) {
820 - var arg = args[argName];
821 - if(!arg) continue;
822 - if(arg['__parameterType'] === 'reference') result += referenceToXml(argName, arg);
823 - else result += instanceToXml(argName, arg);
824 - //if(arg['__isInstance']) result += instanceToXml(argName, arg);
825 - }
826 - return result;
827 -}
828 -
829 -/**
830 - * Convert JavaScript object into XML
831 -
832 - <r:WiFiEndpointSettingsInput xmlns:q="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_WiFiEndpointSettings">
833 - <q:ElementName>Wireless-Profile-Admin</q:ElementName>
834 - <q:InstanceID>Intel(r) AMT:WiFi Endpoint Settings Wireless-Profile-Admin</q:InstanceID>
835 - <q:AuthenticationMethod>6</q:AuthenticationMethod>
836 - <q:EncryptionMethod>4</q:EncryptionMethod>
837 - <q:Priority>100</q:Priority>
838 - <q:PSKPassPhrase>P@ssw0rd</q:PSKPassPhrase>
839 - </r:WiFiEndpointSettingsInput>
840 - */
841 -function instanceToXml(instanceName, inInstance) {
842 - if(inInstance === undefined || inInstance === null) return null;
843 -
844 - var hasNamespace = !!inInstance['__namespace'];
845 - var startTag = hasNamespace ? '<q:' : '<';
846 - var endTag = hasNamespace ? '</q:' : '</';
847 - var namespaceDef = hasNamespace ? (' xmlns:q="' + inInstance['__namespace'] + '"' ): '';
848 - var result = '<r:' + instanceName + namespaceDef + '>';
849 - for(var prop in inInstance) {
850 - if (!inInstance.hasOwnProperty(prop) || prop.indexOf('__') === 0) continue;
851 -
852 - if (typeof inInstance[prop] === 'function' || Array.isArray(inInstance[prop]) ) continue;
853 -
854 - if (typeof inInstance[prop] === 'object') {
855 - //result += startTag + prop +'>' + instanceToXml('prop', inInstance[prop]) + endTag + prop +'>';
856 - console.error('only convert one level down...');
857 - }
858 - else {
859 - result += startTag + prop +'>' + inInstance[prop].toString() + endTag + prop +'>';
860 - }
861 - }
862 - result += '</r:' + instanceName + '>';
863 - return result;
864 -}
865 -
866 -
867 -/**
868 - * Convert a selector set into XML. Expect no nesting.
869 - * {
870 - * selectorName : selectorValue,
871 - * selectorName : selectorValue,
872 - * ... ...
873 - * }
874 -
875 - <r:WiFiEndpoint>
876 - <a:Address>http://192.168.1.103:16992/wsman</a:Address>
877 - <a:ReferenceParameters>
878 - <w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_WiFiEndpoint</w:ResourceURI>
879 - <w:SelectorSet>
880 - <w:Selector Name="Name">WiFi Endpoint 0</w:Selector>
881 - </w:SelectorSet>
882 - </a:ReferenceParameters>
883 - </r:WiFiEndpoint>
884 -
885 - */
886 -function referenceToXml(referenceName, inReference) {
887 - if(inReference === undefined || inReference === null ) return null;
888 -
889 - var result = '<r:' + referenceName + '><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>'+ inReference['__resourceUri']+'</w:ResourceURI><w:SelectorSet>';
890 - for(var selectorName in inReference) {
891 - if (!inReference.hasOwnProperty(selectorName) || selectorName.indexOf('__') === 0) continue;
892 -
893 - if (typeof inReference[selectorName] === 'function' ||
894 - typeof inReference[selectorName] === 'object' ||
895 - Array.isArray(inReference[selectorName]) )
896 - continue;
897 -
898 - result += '<w:Selector Name="' + selectorName +'">' + inReference[selectorName].toString() + '</w:Selector>';
899 - }
900 -
901 - result += '</w:SelectorSet></a:ReferenceParameters></r:' + referenceName + '>';
902 - return result;
903 -}
904 -
905 -// Convert a byte array of SID into string
906 -function GetSidString(sid) {
907 - var r = "S-" + sid.charCodeAt(0) + "-" + sid.charCodeAt(7);
908 - for (var i = 2; i < (sid.length / 4) ; i++) r += "-" + ReadIntX(sid, i * 4);
909 - return r;
910 -}
911 -
912 -// Convert a SID readable string into bytes
913 -function GetSidByteArray(sidString) {
914 - if (!sidString || sidString == null) return null;
915 - var sidParts = sidString.split('-');
916 -
917 - // Make sure the SID has at least 4 parts and starts with 'S'
918 - if (sidParts.length < 4 || (sidParts[0] != 's' && sidParts[0] != 'S')) return null;
919 -
920 - // Check that each part of the SID is really an integer
921 - for (var i = 1; i < sidParts.length; i++) { var y = parseInt(sidParts[i]); if (y != sidParts[i]) return null; sidParts[i] = y; }
922 -
923 - // Version (8 bit) + Id count (8 bit) + 48 bit in big endian -- DO NOT use bitwise right shift operator. JavaScript converts the number into a 32 bit integer before shifting. In real world, it's highly likely this part is always 0.
924 - var r = String.fromCharCode(sidParts[1]) + String.fromCharCode(sidParts.length - 3) + ShortToStr(Math.floor(sidParts[2] / Math.pow(2, 32))) + IntToStr((sidParts[2]) & 0xFFFF);
925 -
926 - // the rest are in 32 bit in little endian
927 - for (var i = 3; i < sidParts.length; i++) r += IntToStrX(sidParts[i]);
928 - return r;
929 -}
930 -/**
931 -* @description Intel(r) AMT WSMAN Stack
932 -* @author Ylian Saint-Hilaire
933 -* @version v0.2.0
934 -*/
935 -
936 -// Construct a MeshServer object
937 -var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
938 - var obj = {};
939 - //obj.onDebugMessage = null; // Set to a function if you want to get debug messages.
940 - obj.NextMessageId = 1; // Next message number, used to label WSMAN calls.
941 - obj.Address = '/wsman';
942 - obj.comm = CreateWsmanComm(host, port, user, pass, tls, extra);
943 -
944 - obj.PerformAjax = function (postdata, callback, tag, pri, namespaces) {
945 - if (namespaces == undefined) namespaces = '';
946 - obj.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\" ' + namespaces + '><Header><a:Action>' + postdata, function (data, status, tag) {
947 - if (status != 200) { callback(obj, null, { Header: { HttpError: status } }, status, tag); return; }
948 - var wsresponse = obj.ParseWsman(data);
949 - if (!wsresponse || wsresponse == null) { callback(obj, null, { Header: { HttpError: status } }, 601, tag); } else { callback(obj, wsresponse.Header["ResourceURI"], wsresponse, 200, tag); }
950 - }, tag, pri);
951 - }
952 -
953 - // Private method
954 - //obj.Debug = function (msg) { /*console.log(msg);*/ }
955 -
956 - // Cancel all pending queries with given status
957 - obj.CancelAllQueries = function (s) { obj.comm.CancelAllQueries(s); }
958 -
959 - // Get the last element of a URI string
960 - obj.GetNameFromUrl = function (resuri) {
961 - var x = resuri.lastIndexOf("/");
962 - return (x == -1)?resuri:resuri.substring(x + 1);
963 - }
964 -
965 - // Perform a WSMAN Subscribe operation
966 - obj.ExecSubscribe = function (resuri, delivery, url, callback, tag, pri, selectors, opaque, user, pass) {
967 - var digest = "", digest2 = "";
968 - if (user != undefined && pass != undefined) { digest = '<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>' + user + '</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">' + pass + '</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>'; digest2 = '<Auth Profile="http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/secprofile/http/digest"/>'; }
969 - if (opaque != undefined && opaque != null) { opaque = '<a:ReferenceParameters>' + opaque + '</a:ReferenceParameters>'; } else { opaque = ""; }
970 - var data = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>" + _PutObjToSelectorsXml(selectors) + digest + '</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.dmtf.org/wbem/wsman/1/wsman/' + delivery + '"><e:NotifyTo><a:Address>' + url + '</a:Address></e:NotifyTo>' + digest2 + '</e:Delivery><e:Expires>PT0.000000S</e:Expires></e:Subscribe>';
971 - obj.PerformAjax(data + "</Body></Envelope>", callback, tag, pri, '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"');
972 - }
973 -
974 - // Perform a WSMAN UnSubscribe operation
975 - obj.ExecUnSubscribe = function (resuri, callback, tag, pri, selectors) {
976 - var data = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>" + _PutObjToSelectorsXml(selectors) + '</Header><Body><e:Unsubscribe/>';
977 - obj.PerformAjax(data + "</Body></Envelope>", callback, tag, pri, 'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"');
978 - }
979 -
980 - // Perform a WSMAN PUT operation
981 - obj.ExecPut = function (resuri, putobj, callback, tag, pri, selectors) {
982 - var data = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.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>" + _PutObjToSelectorsXml(selectors) + '</Header><Body>' + _PutObjToBodyXml(resuri, putobj);
983 - obj.PerformAjax(data + "</Body></Envelope>", callback, tag, pri);
984 - }
985 -
986 - // Perform a WSMAN CREATE operation
987 - obj.ExecCreate = function (resuri, putobj, callback, tag, pri, selectors) {
988 - var objname = obj.GetNameFromUrl(resuri);
989 - var data = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.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>" + _PutObjToSelectorsXml(selectors) + "</Header><Body><g:" + objname + " xmlns:g=\"" + resuri + "\">";
990 - for (var n in putobj) { data += "<g:" + n + ">" + putobj[n] + "</g:" + n + ">" }
991 - obj.PerformAjax(data + "</g:" + objname + "></Body></Envelope>", callback, tag, pri);
992 - }
993 -
994 - // Perform a WSMAN CREATE operation
995 - obj.ExecCreateXml = function (resuri, argsxml, callback, tag, pri) {
996 - var objname = obj.GetNameFromUrl(resuri), selector = "";
997 - obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.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:" + objname + " xmlns:r=\"" + resuri + "\">" + argsxml + "</r:" + objname + "></Body></Envelope>", callback, tag, pri);
998 - }
999 -
1000 - // Perform a WSMAN DELETE operation
1001 - obj.ExecDelete = function (resuri, putobj, callback, tag, pri) {
1002 - var data = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.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>" + _PutObjToSelectorsXml(putobj) + "</Header><Body /></Envelope>";
1003 - obj.PerformAjax(data, callback, tag, pri);
1004 - }
1005 -
1006 - // Perform a WSMAN GET operation
1007 - obj.ExecGet = function (resuri, callback, tag, pri) {
1008 - obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.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>", callback, tag, pri);
1009 - }
1010 -
1011 - // Perform a WSMAN method call operation
1012 - obj.ExecMethod = function (resuri, method, args, callback, tag, pri, selectors) {
1013 - var argsxml = "";
1014 - for (var i in args) { if (args[i] != null) { if (Array.isArray(args[i])) { for (var x in args[i]) { argsxml += "<r:" + i + ">" + args[i][x] + "</r:" + i + ">"; } } else { argsxml += "<r:" + i + ">" + args[i] + "</r:" + i + ">"; } } }
1015 - obj.ExecMethodXml(resuri, method, argsxml, callback, tag, pri, selectors);
1016 - }
1017 -
1018 - // Perform a WSMAN method call operation. The arguments are already formatted in XML.
1019 - obj.ExecMethodXml = function (resuri, method, argsxml, callback, tag, pri, selectors) {
1020 - obj.PerformAjax(resuri + "/" + method + "</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.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>" + _PutObjToSelectorsXml(selectors) + "</Header><Body><r:" + method + '_INPUT' + " xmlns:r=\"" + resuri + "\">" + argsxml + "</r:" + method + "_INPUT></Body></Envelope>", callback, tag, pri);
1021 - }
1022 -
1023 - // Perform a WSMAN ENUM operation
1024 - obj.ExecEnum = function (resuri, callback, tag, pri) {
1025 - obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.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>", callback, tag, pri);
1026 - }
1027 -
1028 - // Perform a WSMAN PULL operation
1029 - obj.ExecPull = function (resuri, enumctx, callback, tag, pri) {
1030 - obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.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>" + enumctx + "</EnumerationContext><MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters></Pull></Body></Envelope>", callback, tag, pri);
1031 - }
1032 -
1033 - // Private method
1034 - obj.ParseWsman = function (xml) {
1035 - try {
1036 - if (!xml.childNodes) xml = _turnToXml(xml);
1037 - var r = { Header:{} }, header = xml.getElementsByTagName("Header")[0], t;
1038 - if (!header) header = xml.getElementsByTagName("a:Header")[0];
1039 - if (!header) return null;
1040 - for (var i = 0; i < header.childNodes.length; i++) {
1041 - var child = header.childNodes[i];
1042 - r.Header[child.localName] = child.textContent;
1043 - }
1044 - var body = xml.getElementsByTagName("Body")[0];
1045 - if (!body) body = xml.getElementsByTagName("a:Body")[0];
1046 - if (!body) return null;
1047 - if (body.childNodes.length > 0) {
1048 - t = body.childNodes[0].localName;
1049 - if (t.indexOf("_OUTPUT") == t.length - 7) { t = t.substring(0, t.length - 7); }
1050 - r.Header['Method'] = t;
1051 - r.Body = _ParseWsmanRec(body.childNodes[0]);
1052 - }
1053 - return r;
1054 - } catch (e) {
1055 - console.log("Unable to parse XML: " + xml);
1056 - return null;
1057 - }
1058 - }
1059 -
1060 - // Private method
1061 - function _ParseWsmanRec(node) {
1062 - var data, r = {};
1063 - for (var i = 0; i < node.childNodes.length; i++) {
1064 - var child = node.childNodes[i];
1065 - if (child.childElementCount == 0) { data = child.textContent; } else { data = _ParseWsmanRec(child); }
1066 - if (data == 'true') data = true; // Convert 'true' into true
1067 - if (data == 'false') data = false; // Convert 'false' into false
1068 -
1069 - var childObj = data;
1070 - if (child.attributes.length > 0) {
1071 - childObj = {'Value': data };
1072 - for(var j = 0; j < child.attributes.length; j++) {
1073 - childObj['@' + child.attributes[j].name] = child.attributes[j].value;
1074 - }
1075 - }
1076 -
1077 - if (r[child.localName] instanceof Array) { r[child.localName].push(childObj); }
1078 - else if (r[child.localName] == undefined) { r[child.localName] = childObj; }
1079 - else { r[child.localName] = [r[child.localName], childObj]; }
1080 - }
1081 - return r;
1082 - }
1083 -
1084 - function _PutObjToBodyXml(resuri, putObj) {
1085 - if(!resuri || putObj === undefined || putObj === null) return '';
1086 - var objname = obj.GetNameFromUrl(resuri);
1087 - var result = '<r:' + objname + ' xmlns:r="' + resuri + '">';
1088 -
1089 - for (var prop in putObj) {
1090 - if (!putObj.hasOwnProperty(prop) || prop.indexOf('__') === 0 || prop.indexOf('@') === 0) continue;
1091 - if (putObj[prop] === undefined || putObj[prop] === null || typeof putObj[prop] === 'function') continue;
1092 - if (typeof putObj[prop] === 'object' && putObj[prop]['ReferenceParameters']) {
1093 - result += '<r:' + prop + '><a:Address>' + putObj[prop].Address + '</a:Address><a:ReferenceParameters><w:ResourceURI>' + putObj[prop]['ReferenceParameters']["ResourceURI"] + '</w:ResourceURI><w:SelectorSet>';
1094 - var selectorArray = putObj[prop]['ReferenceParameters']['SelectorSet']['Selector'];
1095 - if (Array.isArray(selectorArray)) {
1096 - for (var i=0; i< selectorArray.length; i++) {
1097 - result += '<w:Selector' + _ObjectToXmlAttributes(selectorArray[i]) + '>' + selectorArray[i]['Value'] + '</w:Selector>';
1098 - }
1099 - }
1100 - else {
1101 - result += '<w:Selector' + _ObjectToXmlAttributes(selectorArray) + '>' + selectorArray['Value'] + '</w:Selector>';
1102 - }
1103 - result += '</w:SelectorSet></a:ReferenceParameters></r:' + prop + '>';
1104 - }
1105 - else {
1106 - if (Array.isArray(putObj[prop])) {
1107 - for (var i = 0; i < putObj[prop].length; i++) {
1108 - result += '<r:' + prop + '>' + putObj[prop][i].toString() + '</r:' + prop + '>';
1109 - }
1110 - } else {
1111 - result += '<r:' + prop + '>' + putObj[prop].toString() + '</r:' + prop + '>';
1112 - }
1113 - }
1114 - }
1115 -
1116 - result += '</r:' + objname + '>';
1117 - return result;
1118 - }
1119 -
1120 - /*
1121 - convert
1122 - { @Name: 'InstanceID', @AttrName: 'Attribute Value'}
1123 - into
1124 - ' Name="InstanceID" AttrName="Attribute Value" '
1125 - */
1126 - function _ObjectToXmlAttributes(objWithAttributes) {
1127 - if(!objWithAttributes) return '';
1128 - var result = ' ';
1129 - for (var propName in objWithAttributes) {
1130 - if (!objWithAttributes.hasOwnProperty(propName) || propName.indexOf('@') !== 0) continue;
1131 - result += propName.substring(1) + '="' + objWithAttributes[propName] + '" ';
1132 - }
1133 - return result;
1134 - }
1135 -
1136 - function _PutObjToSelectorsXml(selectorSet) {
1137 - if (!selectorSet) return '';
1138 - if (typeof selectorSet == 'string') return selectorSet;
1139 - if (selectorSet['InstanceID']) return "<w:SelectorSet><w:Selector Name=\"InstanceID\">" + selectorSet['InstanceID'] + "</w:Selector></w:SelectorSet>";
1140 - var result = '<w:SelectorSet>';
1141 - for(var propName in selectorSet) {
1142 - if (!selectorSet.hasOwnProperty(propName)) continue;
1143 - result += '<w:Selector Name="' + propName + '">';
1144 - if (selectorSet[propName]['ReferenceParameters']) {
1145 - result += '<a:EndpointReference>';
1146 - result += '<a:Address>' + selectorSet[propName]['Address'] + '</a:Address><a:ReferenceParameters><w:ResourceURI>' + selectorSet[propName]['ReferenceParameters']['ResourceURI'] + '</w:ResourceURI><w:SelectorSet>';
1147 - var selectorArray = selectorSet[propName]['ReferenceParameters']['SelectorSet']['Selector'];
1148 - if (Array.isArray(selectorArray)) {
1149 - for (var i = 0; i < selectorArray.length; i++) {
1150 - result += '<w:Selector' + _ObjectToXmlAttributes(selectorArray[i]) + '>' + selectorArray[i]['Value'] + '</w:Selector>';
1151 - }
1152 - }
1153 - else {
1154 - result += '<w:Selector' + _ObjectToXmlAttributes(selectorArray) + '>' + selectorArray['Value'] + '</w:Selector>';
1155 - }
1156 - result += '</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>';
1157 - } else {
1158 - result += selectorSet[propName];
1159 - }
1160 - result += '</w:Selector>';
1161 - }
1162 - result += '</w:SelectorSet>';
1163 - return result;
1164 - }
1165 -
1166 - function _turnToXml(text) {
1167 - if (window.DOMParser) {
1168 - return new DOMParser().parseFromString(text, "text/xml");
1169 - }
1170 - else // Internet Explorer
1171 - {
1172 - var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
1173 - xmlDoc.async = false;
1174 - xmlDoc.loadXML(text);
1175 - return xmlDoc;
1176 - }
1177 - }
1178 -
1179 - return obj;
1180 -}
1181 -/**
1182 -* @description Remote Desktop
1183 -* @author Ylian Saint-Hilaire
1184 -* @version v0.0.2g
1185 -*/
1186 -
1187 -// Construct a MeshServer object
1188 -var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
1189 - var obj = {};
1190 - obj.canvasid = divid;
1191 - obj.CanvasId = Q(divid);
1192 - obj.scrolldiv = scrolldiv;
1193 - obj.canvas = Q(divid).getContext("2d");
1194 - obj.protocol = 2; // KVM
1195 - obj.state = 0;
1196 - obj.acc = "";
1197 - obj.ScreenWidth = 960;
1198 - obj.ScreenHeight = 700;
1199 - obj.width = 0;
1200 - obj.height = 0;
1201 - obj.rwidth = 0;
1202 - obj.rheight = 0;
1203 - obj.bpp = 2; // Bytes per pixel (1 or 2 supported)
1204 - obj.useZRLE = true;
1205 - obj.showmouse = true;
1206 - obj.buttonmask = 0;
1207 - obj.localKeyMap = true;
1208 - //obj.inbytes = 0;
1209 - //obj.outbytes = 0;
1210 - obj.spare = null;
1211 - obj.sparew = 0;
1212 - obj.spareh = 0;
1213 - obj.sparew2 = 0;
1214 - obj.spareh2 = 0;
1215 - obj.sparecache = {};
1216 - obj.ZRLEfirst = 1;
1217 - obj.onScreenSizeChange = null;
1218 - obj.frameRateDelay = 0;
1219 - // ###BEGIN###{DesktopInband}
1220 - obj.kvmDataSupported = false;
1221 - obj.onKvmData = null;
1222 - obj.onKvmDataPending = [];
1223 - obj.onKvmDataAck = -1;
1224 - obj.holding = false;
1225 - obj.lastKeepAlive = Date.now();
1226 - // ###END###{DesktopInband}
1227 -
1228 - obj.mNagleTimer = null; // Mouse motion slowdown timer
1229 - obj.mx = 0; // Last mouse x position
1230 - obj.my = 0; // Last mouse y position
1231 -
1232 - // Private method
1233 - obj.Debug = function (msg) { console.log(msg); }
1234 -
1235 - obj.xxStateChange = function (newstate) {
1236 - if (newstate == 0) {
1237 - obj.canvas.fillStyle = '#000000';
1238 - obj.canvas.fillRect(0, 0, obj.width, obj.height);
1239 - obj.canvas.canvas.width = obj.rwidth = obj.width = 640;
1240 - obj.canvas.canvas.height = obj.rheight = obj.height = 400;
1241 - QS(obj.canvasid).cursor = 'default';
1242 - } else {
1243 - QS(obj.canvasid).cursor = obj.showmouse ?'default':'none';
1244 - }
1245 - }
1246 -
1247 - obj.ProcessData = function (data) {
1248 - if (!data) return;
1249 - //obj.Debug("KRecv(" + data.length + "): " + rstr2hex(data));
1250 - //obj.inbytes += data.length;
1251 - //obj.Debug("KRecv(" + obj.inbytes + ")");
1252 - obj.acc += data;
1253 - while (obj.acc.length > 0) {
1254 - //obj.Debug("KAcc(" + obj.acc.length + "): " + rstr2hex(obj.acc));
1255 - var cmdsize = 0;
1256 - if (obj.state == 0 && obj.acc.length >= 12) {
1257 - // Getting handshake & version
1258 - cmdsize = 12;
1259 - //if (obj.acc.substring(0, 4) != "RFB ") { return obj.Stop(); }
1260 - //var version = parseFloat(obj.acc.substring(4, 11));
1261 - //obj.Debug("KVersion: " + version);
1262 - obj.state = 1;
1263 - obj.send("RFB 003.008\n");
1264 - }
1265 - else if (obj.state == 1 && obj.acc.length >= 1) {
1266 - // Getting security options
1267 - cmdsize = obj.acc.charCodeAt(0) + 1;
1268 - obj.send(String.fromCharCode(1)); // Send the "None" security type. Since we already authenticated using redirection digest auth, we don't need to do this again.
1269 - obj.state = 2;
1270 - }
1271 - else if (obj.state == 2 && obj.acc.length >= 4) {
1272 - // Getting security response
1273 - cmdsize = 4;
1274 - if (ReadInt(obj.acc, 0) != 0) { return obj.Stop(); }
1275 - obj.send(String.fromCharCode(1)); // Send share desktop flag
1276 - obj.state = 3;
1277 - }
1278 - else if (obj.state == 3 && obj.acc.length >= 24) {
1279 - // Getting server init
1280 - var namelen = ReadInt(obj.acc, 20);
1281 - if (obj.acc.length < 24 + namelen) return;
1282 - cmdsize = 24 + namelen;
1283 - obj.canvas.canvas.width = obj.rwidth = obj.width = obj.ScreenWidth = ReadShort(obj.acc, 0);
1284 - obj.canvas.canvas.height = obj.rheight = obj.height = obj.ScreenHeight = ReadShort(obj.acc, 2);
1285 -
1286 - // These are all values we don't really need, we are going to only run in RGB565 or RGB332 and not use the flexibility provided by these settings.
1287 - // Makes the javascript code smaller and maybe a bit faster.
1288 - /*
1289 - obj.xbpp = obj.acc.charCodeAt(4);
1290 - obj.depth = obj.acc.charCodeAt(5);
1291 - obj.bigend = obj.acc.charCodeAt(6);
1292 - obj.truecolor = obj.acc.charCodeAt(7);
1293 - obj.rmax = ReadShort(obj.acc, 8);
1294 - obj.gmax = ReadShort(obj.acc, 10);
1295 - obj.bmax = ReadShort(obj.acc, 12);
1296 - obj.rsh = obj.acc.charCodeAt(14);
1297 - obj.gsh = obj.acc.charCodeAt(15);
1298 - obj.bsh = obj.acc.charCodeAt(16);
1299 - var name = obj.acc.substring(24, 24 + namelen);
1300 - obj.Debug("name: " + name);
1301 - obj.Debug("width: " + obj.width + ", height: " + obj.height);
1302 - obj.Debug("bits-per-pixel: " + obj.xbpp);
1303 - obj.Debug("depth: " + obj.depth);
1304 - obj.Debug("big-endian-flag: " + obj.bigend);
1305 - obj.Debug("true-colour-flag: " + obj.truecolor);
1306 - obj.Debug("rgb max: " + obj.rmax + "," + obj.gmax + "," + obj.bmax);
1307 - obj.Debug("rgb shift: " + obj.rsh + "," + obj.gsh + "," + obj.bsh);
1308 - */
1309 -
1310 - // SetEncodings, with AMT we can't omit RAW, must be specified.
1311 - // Intel AMT supports encodings: RAW (0), ZRLE (16), Desktop Size (0xFFFFFF21, -223)
1312 -
1313 - var supportedEncodings = '';
1314 - if (obj.useZRLE) supportedEncodings += IntToStr(16);
1315 - supportedEncodings += IntToStr(0);
1316 - // ###BEGIN###{DesktopInband}
1317 - supportedEncodings += IntToStr(1092);
1318 - // ###END###{DesktopInband}
1319 -
1320 - obj.send(String.fromCharCode(2, 0) + ShortToStr((supportedEncodings.length / 4) + 1) + supportedEncodings + IntToStr(-223)); // Supported Encodings + Desktop Size
1321 -
1322 - // Set the pixel encoding to something much smaller
1323 - // obj.send(String.fromCharCode(0, 0, 0, 0, 16, 16, 0, 1) + ShortToStr(31) + ShortToStr(63) + ShortToStr(31) + String.fromCharCode(11, 5, 0, 0, 0, 0)); // Setup 16 bit color RGB565 (This is the default, so we don't need to set it)
1324 - if (obj.bpp == 1) obj.send(String.fromCharCode(0, 0, 0, 0, 8, 8, 0, 1) + ShortToStr(7) + ShortToStr(7) + ShortToStr(3) + String.fromCharCode(5, 2, 0, 0, 0, 0)); // Setup 8 bit color RGB332
1325 -
1326 - obj.state = 4;
1327 - if (obj.parent) { obj.parent.xxStateChange(3); }
1328 - _SendRefresh();
1329 - //obj.timer = setInterval(obj.xxOnTimer, 50);
1330 -
1331 -
1332 - if (obj.onScreenSizeChange != null) { obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight); }
1333 - }
1334 - else if (obj.state == 4) {
1335 - switch (obj.acc.charCodeAt(0)) {
1336 - case 0: // FramebufferUpdate
1337 - if (obj.acc.length < 4) return;
1338 - obj.state = 100 + ReadShort(obj.acc, 2); // Read the number of tiles that are going to be sent, add 100 and use that as our protocol state.
1339 - cmdsize = 4;
1340 - break;
1341 - case 2: // This is the bell, do nothing.
1342 - cmdsize = 1;
1343 - break;
1344 - case 3: // This is ServerCutText
1345 - if (obj.acc.length < 8) return;
1346 - var len = ReadInt(obj.acc, 4) + 8;
1347 - if (obj.acc.length < len) return;
1348 - cmdsize = handleServerCutText(obj.acc);
1349 - break;
1350 - }
1351 - }
1352 - else if (obj.state > 100 && obj.acc.length >= 12) {
1353 - var x = ReadShort(obj.acc, 0),
1354 - y = ReadShort(obj.acc, 2),
1355 - width = ReadShort(obj.acc, 4),
1356 - height = ReadShort(obj.acc, 6),
1357 - s = width * height,
1358 - encoding = ReadInt(obj.acc, 8);
1359 -
1360 - if (encoding < 17) {
1361 - if (width < 1 || width > 64 || height < 1 || height > 64) { console.log("Invalid tile size (" + width + "," + height + "), disconnecting."); return obj.Stop(); }
1362 -
1363 - // Set the spare bitmap to the rigth size if it's not already. This allows us to recycle the spare most if not all the time.
1364 - if (obj.sparew != width || obj.spareh != height) {
1365 - obj.sparew = obj.sparew2 = width;
1366 - obj.spareh = obj.spareh2 = height;
1367 - var xspacecachename = obj.sparew2 + 'x' + obj.spareh2;
1368 - obj.spare = obj.sparecache[xspacecachename];
1369 - if (!obj.spare) {
1370 - obj.sparecache[xspacecachename] = obj.spare = obj.canvas.createImageData(obj.sparew2, obj.spareh2);
1371 - var j = (obj.sparew2 * obj.spareh2) << 2;
1372 - for (var i = 3; i < j; i += 4) { obj.spare.data[i] = 0xFF; } // Set alpha channel to opaque.
1373 - }
1374 - }
1375 - }
1376 -
1377 - if (encoding == 0xFFFFFF21) {
1378 - // Desktop Size (0xFFFFFF21, -223)
1379 - obj.canvas.canvas.width = obj.rwidth = obj.width = width;
1380 - obj.canvas.canvas.height = obj.rheight = obj.height = height;
1381 - obj.send(String.fromCharCode(3, 0, 0, 0, 0, 0) + ShortToStr(obj.width) + ShortToStr(obj.height)); // FramebufferUpdateRequest
1382 - cmdsize = 12;
1383 - if (obj.onScreenSizeChange != null) { obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight); }
1384 - // obj.Debug("New desktop width: " + obj.width + ", height: " + obj.height);
1385 - }
1386 - else if (encoding == 0) {
1387 - // RAW encoding
1388 - var ptr = 12, cs = 12 + (s * obj.bpp);
1389 - if (obj.acc.length < cs) return; // Check we have all the data needed and we can only draw 64x64 tiles.
1390 - cmdsize = cs;
1391 -
1392 - // CRITICAL LOOP, optimize this as much as possible
1393 - if (obj.bpp == 2) {
1394 - for (var i = 0; i < s; i++) { _setPixel16(obj.acc.charCodeAt(ptr++) + (obj.acc.charCodeAt(ptr++) << 8), i); }
1395 - } else {
1396 - for (var i = 0; i < s; i++) { _setPixel8(obj.acc.charCodeAt(ptr++), i); }
1397 - }
1398 - _putImage(obj.spare, x, y);
1399 - }
1400 - else if (encoding == 16) {
1401 - // ZRLE encoding
1402 - if (obj.acc.length < 16) return;
1403 - var datalen = ReadInt(obj.acc, 12);
1404 - if (obj.acc.length < (16 + datalen)) return;
1405 - //obj.Debug("RECT ZRLE (" + x + "," + y + "," + width + "," + height + ") LEN = " + datalen);
1406 - //obj.Debug("RECT ZRLE LEN: " + ReadShortX(obj.acc, 17) + ", DATA: " + rstr2hex(obj.acc.substring(16)));
1407 -
1408 - // Process the ZLib header if this is the first block
1409 - var ptr = 16, delta = 5, dx = 0;
1410 -
1411 - if (datalen > 5 && obj.acc.charCodeAt(ptr) == 0 && ReadShortX(obj.acc, ptr + 1) == (datalen - delta)) {
1412 - // This is an uncompressed ZLib data block
1413 - _decodeLRE(obj.acc, ptr + 5, x, y, width, height, s, datalen);
1414 - }
1415 -
1416 - cmdsize = 16 + datalen;
1417 - }
1418 - else {
1419 - obj.Debug("Unknown Encoding: " + encoding);
1420 - return obj.Stop();
1421 - }
1422 - if (--obj.state == 100) {
1423 - obj.state = 4;
1424 - if (obj.frameRateDelay == 0) {
1425 - _SendRefresh(); // Ask for new frame
1426 - } else {
1427 - setTimeout(_SendRefresh, obj.frameRateDelay); // Hold x miliseconds before asking for a new frame
1428 - }
1429 - }
1430 - }
1431 -
1432 - if (cmdsize == 0) return;
1433 - obj.acc = obj.acc.substring(cmdsize);
1434 - }
1435 - }
1436 -
1437 - function _decodeLRE(data, ptr, x, y, width, height, s, datalen) {
1438 - var subencoding = data.charCodeAt(ptr++), index, v, runlengthdecode, palette = {}, rlecount = 0, runlength = 0, i;
1439 - // obj.Debug("RECT RLE (" + (datalen - 5) + ", " + subencoding + "):" + rstr2hex(data.substring(21, 21 + (datalen - 5))));
1440 - if (subencoding == 0) {
1441 - // RAW encoding
1442 - if (obj.bpp == 2) {
1443 - for (i = 0; i < s; i++) { _setPixel16(data.charCodeAt(ptr++) + (data.charCodeAt(ptr++) << 8), i); }
1444 - } else {
1445 - for (i = 0; i < s; i++) { _setPixel8(data.charCodeAt(ptr++), i); }
1446 - }
1447 - _putImage(obj.spare, x, y);
1448 - }
1449 - else if (subencoding == 1) {
1450 - // Solid color tile
1451 - v = data.charCodeAt(ptr++) + ((obj.bpp == 2) ? (data.charCodeAt(ptr++) << 8) : 0);
1452 - obj.canvas.fillStyle = 'rgb(' + ((obj.bpp == 1) ? ((v & 224) + ',' + ((v & 28) << 3) + ',' + _fixColor((v & 3) << 6)) : (((v >> 8) & 248) + ',' + ((v >> 3) & 252) + ',' + ((v & 31) << 3))) + ')';
1453 -
1454 -
1455 - obj.canvas.fillRect(x, y, width, height);
1456 - }
1457 - else if (subencoding > 1 && subencoding < 17) { // Packed palette encoded tile
1458 - // Read the palette
1459 - var br = 4, bm = 15; // br is BitRead and bm is BitMask. By adjusting these two we can support all the variations in this encoding.
1460 - if (obj.bpp == 2) {
1461 - for (i = 0; i < subencoding; i++) { palette[i] = data.charCodeAt(ptr++) + (data.charCodeAt(ptr++) << 8); }
1462 - if (subencoding == 2) { br = 1; bm = 1; } else if (subencoding <= 4) { br = 2; bm = 3; } // Compute bits to read & bit mark
1463 - while (rlecount < s && ptr < data.length) { v = data.charCodeAt(ptr++); for (i = (8 - br) ; i >= 0; i -= br) { _setPixel16(palette[(v >> i) & bm], rlecount++); } } // Display all the bits
1464 - } else {
1465 - for (i = 0; i < subencoding; i++) { palette[i] = data.charCodeAt(ptr++); }
1466 - if (subencoding == 2) { br = 1; bm = 1; } else if (subencoding <= 4) { br = 2; bm = 3; } // Compute bits to read & bit mark
1467 - while (rlecount < s && ptr < data.length) { v = data.charCodeAt(ptr++); for (i = (8 - br) ; i >= 0; i -= br) { _setPixel8(palette[(v >> i) & bm], rlecount++); } } // Display all the bits
1468 - }
1469 - _putImage(obj.spare, x, y);
1470 - }
1471 - else if (subencoding == 128) { // RLE encoded tile
1472 - if (obj.bpp == 2) {
1473 - while (rlecount < s && ptr < data.length) {
1474 - // Get the run color
1475 - v = data.charCodeAt(ptr++) + (data.charCodeAt(ptr++) << 8);
1476 -
1477 - // Decode the run length. This is the fastest and most compact way I found to do this.
1478 - runlength = 1; do { runlength += (runlengthdecode = data.charCodeAt(ptr++)); } while (runlengthdecode == 255);
1479 -
1480 - // Draw a run
1481 - if (obj.rotation == 0) {
1482 - _setPixel16run(v, rlecount, runlength); rlecount += runlength;
1483 - } else {
1484 - while (--runlength >= 0) { _setPixel16(v, rlecount++); }
1485 - }
1486 - }
1487 - } else {
1488 - while (rlecount < s && ptr < data.length) {
1489 - // Get the run color
1490 - v = data.charCodeAt(ptr++);
1491 -
1492 - // Decode the run length. This is the fastest and most compact way I found to do this.
1493 - runlength = 1; do { runlength += (runlengthdecode = data.charCodeAt(ptr++)); } while (runlengthdecode == 255);
1494 -
1495 - // Draw a run
1496 - if (obj.rotation == 0) {
1497 - _setPixel8run(v, rlecount, runlength); rlecount += runlength;
1498 - } else {
1499 - while (--runlength >= 0) { _setPixel8(v, rlecount++); }
1500 - }
1501 - }
1502 - }
1503 - _putImage(obj.spare, x, y);
1504 - }
1505 - else if (subencoding > 129) { // Palette RLE encoded tile
1506 - // Read the palette
1507 - if (obj.bpp == 2) {
1508 - for (i = 0; i < (subencoding - 128) ; i++) { palette[i] = data.charCodeAt(ptr++) + (data.charCodeAt(ptr++) << 8); }
1509 - } else {
1510 - for (i = 0; i < (subencoding - 128) ; i++) { palette[i] = data.charCodeAt(ptr++); }
1511 - }
1512 -
1513 - // Decode RLE on palette
1514 - while (rlecount < s && ptr < data.length) {
1515 - // Setup the run, get the color index and get the color from the palette.
1516 - runlength = 1; index = data.charCodeAt(ptr++); v = palette[index % 128];
1517 -
1518 - // If the index starts with high order bit 1, this is a run and decode the run length.
1519 - if (index > 127) { do { runlength += (runlengthdecode = data.charCodeAt(ptr++)); } while (runlengthdecode == 255); }
1520 -
1521 - // Draw a run
1522 - if (obj.rotation == 0) {
1523 - if (obj.bpp == 2) {
1524 - _setPixel16run(v, rlecount, runlength); rlecount += runlength;
1525 - } else {
1526 - _setPixel8run(v, rlecount, runlength); rlecount += runlength;
1527 - }
1528 - } else {
1529 - if (obj.bpp == 2) {
1530 - while (--runlength >= 0) { _setPixel16(v, rlecount++); }
1531 - } else {
1532 - while (--runlength >= 0) { _setPixel8(v, rlecount++); }
1533 - }
1534 - }
1535 - }
1536 - _putImage(obj.spare, x, y);
1537 - }
1538 - }
1539 -
1540 - // ###BEGIN###{DesktopInband}
1541 - obj.hold = function (holding) {
1542 - if (obj.holding == holding) return;
1543 - obj.holding = holding;
1544 - obj.canvas.fillStyle = '#000000';
1545 - obj.canvas.fillRect(0, 0, obj.width, obj.height); // Paint black
1546 - if (obj.holding == false) {
1547 - // Go back to normal operations
1548 - // Set canvas size and ask for full screen refresh
1549 - if ((obj.canvas.canvas.width != obj.width) || (obj.canvas.canvas.height != obj.height)) {
1550 - obj.canvas.canvas.width = obj.width; obj.canvas.canvas.height = obj.height;
1551 - if (obj.onScreenSizeChange != null) { obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight); } // ???
1552 - }
1553 - obj.Send(String.fromCharCode(3, 0, 0, 0, 0, 0) + ShortToStr(obj.width) + ShortToStr(obj.height)); // FramebufferUpdateRequest
1554 - } else {
1555 - obj.UnGrabMouseInput();
1556 - obj.UnGrabKeyInput();
1557 - }
1558 - }
1559 - // ###END###{DesktopInband}
1560 -
1561 - function _putImage(i, x, y) {
1562 - // ###BEGIN###{DesktopInband}
1563 - if (obj.holding == true) return;
1564 - // ###END###{DesktopInband}
1565 - obj.canvas.putImageData(i, x, y);
1566 - }
1567 -
1568 - // Set 8bit color RGB332
1569 - function _setPixel8(v, p) {
1570 - var pp = p << 2;
1571 -
1572 -
1573 - obj.spare.data[pp] = v & 224;
1574 - obj.spare.data[pp + 1] = (v & 28) << 3;
1575 - obj.spare.data[pp + 2] = _fixColor((v & 3) << 6);
1576 - }
1577 -
1578 - // Set 16bit color RGB565
1579 - function _setPixel16(v, p) {
1580 - var pp = p << 2;
1581 -
1582 -
1583 - obj.spare.data[pp] = (v >> 8) & 248;
1584 - obj.spare.data[pp + 1] = (v >> 3) & 252;
1585 - obj.spare.data[pp + 2] = (v & 31) << 3;
1586 - }
1587 -
1588 - // Set a run of 8bit color RGB332
1589 - function _setPixel8run(v, p, run) {
1590 - var pp = (p << 2), r = (v & 224), g = ((v & 28) << 3), b = (_fixColor((v & 3) << 6));
1591 - while (--run >= 0) { obj.spare.data[pp] = r; obj.spare.data[pp + 1] = g; obj.spare.data[pp + 2] = b; pp += 4; }
1592 - }
1593 -
1594 - // Set a run of 16bit color RGB565
1595 - function _setPixel16run(v, p, run) {
1596 - var pp = (p << 2), r = ((v >> 8) & 248), g = ((v >> 3) & 252), b = ((v & 31) << 3);
1597 - while (--run >= 0) { obj.spare.data[pp] = r; obj.spare.data[pp + 1] = g; obj.spare.data[pp + 2] = b; pp += 4; }
1598 - }
1599 -
1600 -
1601 - function _fixColor(c) { return (c > 127) ? (c + 32) : c; }
1602 -
1603 - function _SendRefresh() {
1604 - // ###BEGIN###{DesktopInband}
1605 - if (obj.holding == true) return;
1606 - // ###END###{DesktopInband}
1607 - // Request the entire screen
1608 - obj.send(String.fromCharCode(3, 1, 0, 0, 0, 0) + ShortToStr(obj.rwidth) + ShortToStr(obj.rheight)); // FramebufferUpdateRequest
1609 - }
1610 -
1611 - obj.Start = function () {
1612 - //obj.Debug("KVM-Start");
1613 - obj.state = 0;
1614 - obj.acc = "";
1615 - obj.ZRLEfirst = 1;
1616 - //obj.inbytes = 0;
1617 - //obj.outbytes = 0;
1618 - // ###BEGIN###{DesktopInband}
1619 - obj.onKvmDataPending = [];
1620 - obj.onKvmDataAck = -1;
1621 - obj.kvmDataSupported = false;
1622 - // ###END###{DesktopInband}
1623 - for (var i in obj.sparecache) { delete obj.sparecache[i]; }
1624 - }
1625 -
1626 - obj.Stop = function () {
1627 - obj.UnGrabMouseInput();
1628 - obj.UnGrabKeyInput();
1629 - if (obj.parent) { obj.parent.Stop(); }
1630 - }
1631 -
1632 - obj.send = function (x) {
1633 - //obj.Debug("KSend(" + x.length + "): " + rstr2hex(x));
1634 - //obj.outbytes += x.length;
1635 - if (obj.parent) { obj.parent.send(x); }
1636 - }
1637 -
1638 - var convertAmtKeyCodeTable = {
1639 - "Pause": 19,
1640 - "CapsLock": 20,
1641 - "Space": 32,
1642 - "Quote": 39,
1643 - "Minus": 45,
1644 - "NumpadMultiply": 42,
1645 - "NumpadAdd": 43,
1646 - "PrintScreen": 44,
1647 - "Comma": 44,
1648 - "NumpadSubtract": 45,
1649 - "NumpadDecimal": 46,
1650 - "Period": 46,
1651 - "Slash": 47,
1652 - "NumpadDivide": 47,
1653 - "Semicolon": 59,
1654 - "Equal": 61,
1655 - "OSLeft": 91,
1656 - "BracketLeft": 91,
1657 - "OSRight": 91,
1658 - "Backslash": 92,
1659 - "BracketRight": 93,
1660 - "ContextMenu": 93,
1661 - "Backquote": 96,
1662 - "NumLock": 144,
1663 - "ScrollLock": 145,
1664 - "Backspace": 0xff08,
1665 - "Tab": 0xff09,
1666 - "Enter": 0xff0d,
1667 - "NumpadEnter": 0xff0d,
1668 - "Escape": 0xff1b,
1669 - "Delete": 0xffff,
1670 - "Home": 0xff50,
1671 - "PageUp": 0xff55,
1672 - "PageDown": 0xff56,
1673 - "ArrowLeft": 0xff51,
1674 - "ArrowUp": 0xff52,
1675 - "ArrowRight": 0xff53,
1676 - "ArrowDown": 0xff54,
1677 - "End": 0xff57,
1678 - "Insert": 0xff63,
1679 - "F1": 0xffbe,
1680 - "F2": 0xffbf,
1681 - "F3": 0xffc0,
1682 - "F4": 0xffc1,
1683 - "F5": 0xffc2,
1684 - "F6": 0xffc3,
1685 - "F7": 0xffc4,
1686 - "F8": 0xffc5,
1687 - "F9": 0xffc6,
1688 - "F10": 0xffc7,
1689 - "F11": 0xffc8,
1690 - "F12": 0xffc9,
1691 - "ShiftLeft": 0xffe1,
1692 - "ShiftRight": 0xffe2,
1693 - "ControlLeft": 0xffe3,
1694 - "ControlRight": 0xffe4,
1695 - "AltLeft": 0xffe9,
1696 - "AltRight": 0xffea,
1697 - "MetaLeft": 0xffe7,
1698 - "MetaRight": 0xffe8
1699 - }
1700 - function convertAmtKeyCode(e) {
1701 - if (e.code.startsWith('Key') && e.code.length == 4) { return e.code.charCodeAt(3) + ((e.shiftKey == false) ? 32 : 0); }
1702 - if (e.code.startsWith('Digit') && e.code.length == 6) { return e.code.charCodeAt(5); }
1703 - if (e.code.startsWith('Numpad') && e.code.length == 7) { return e.code.charCodeAt(6); }
1704 - return convertAmtKeyCodeTable[e.code];
1705 - }
1706 -
1707 - /*
1708 - Intel AMT only recognizes a small subset of keysym characters defined in the keysymdef.h so you don�t need to
1709 - implement all the languages (this is taken care by the USB Scancode Extension in RFB4.0 protocol).
1710 - The only subset recognized by the FW is the defined by the following sets : XK_LATIN1 , XK_MISCELLANY, XK_3270, XK_XKB_KEYS, XK_KATAKANA.
1711 - In addition to keysymdef.h symbols there are 6 japanese extra keys that we do support:
1712 -
1713 - #define XK_Intel_EU_102kbd_backslash_pipe_45 0x17170056 // European 102-key: 45 (backslash/pipe), usb Usage: 0x64
1714 - #define XK_Intel_JP_106kbd_yen_pipe 0x1717007d // Japanese 106-key: 14 (Yen/pipe), usb Usage: 0x89
1715 - #define XK_Intel_JP_106kbd_backslash_underbar 0x17170073 // Japanese 106-key: 56 (backslash/underbar), usb Usage: 0x87
1716 - #define XK_Intel_JP_106kbd_NoConvert 0x1717007b // Japanese 106-key: 131 (NoConvert), usb Usage: 0x8b
1717 - #define XK_Intel_JP_106kbd_Convert 0x17170079 // Japanese 106-key: 132 (Convert), usb Usage: 0x8a
1718 - #define XK_Intel_JP_106kbd_Hirigana_Katakana 0x17170070 // Japanese 106-key: 133 (Hirigana/Katakana), usb Usage: 0x88
1719 - */
1720 -
1721 - function _keyevent(d, e) {
1722 - if (!e) { e = window.event; }
1723 -
1724 - if (e.code && (obj.localKeyMap == false)) {
1725 - // For new browsers, this mapping is keyboard language independent
1726 - var k = convertAmtKeyCode(e);
1727 - if (k != null) { obj.sendkey(k, d); }
1728 - } else {
1729 - // For older browsers, this mapping works best for EN-US keyboard
1730 - var k = e.keyCode, kk = k;
1731 - if (e.shiftKey == false && k >= 65 && k <= 90) kk = k + 32;
1732 - if (k >= 112 && k <= 124) kk = k + 0xFF4E;
1733 - if (k == 8) kk = 0xff08; // Backspace
1734 - if (k == 9) kk = 0xff09; // Tab
1735 - if (k == 13) kk = 0xff0d; // Return
1736 - if (k == 16) kk = 0xffe1; // Shift (Left)
1737 - if (k == 17) kk = 0xffe3; // Ctrl (Left)
1738 - if (k == 18) kk = 0xffe9; // Alt (Left)
1739 - if (k == 27) kk = 0xff1b; // ESC
1740 - if (k == 33) kk = 0xff55; // PageUp
1741 - if (k == 34) kk = 0xff56; // PageDown
1742 - if (k == 35) kk = 0xff57; // End
1743 - if (k == 36) kk = 0xff50; // Home
1744 - if (k == 37) kk = 0xff51; // Left
1745 - if (k == 38) kk = 0xff52; // Up
1746 - if (k == 39) kk = 0xff53; // Right
1747 - if (k == 40) kk = 0xff54; // Down
1748 - if (k == 45) kk = 0xff63; // Insert
1749 - if (k == 46) kk = 0xffff; // Delete
1750 - if (k >= 96 && k <= 105) kk = k - 48; // Key pad numbers
1751 - if (k == 106) kk = 42; // Pad *
1752 - if (k == 107) kk = 43; // Pad +
1753 - if (k == 109) kk = 45; // Pad -
1754 - if (k == 110) kk = 46; // Pad .
1755 - if (k == 111) kk = 47; // Pad /
1756 - if (k == 186) kk = 59; // ;
1757 - if (k == 187) kk = 61; // =
1758 - if (k == 188) kk = 44; // ,
1759 - if (k == 189) kk = 45; // -
1760 - if (k == 190) kk = 46; // .
1761 - if (k == 191) kk = 47; // /
1762 - if (k == 192) kk = 96; // `
1763 - if (k == 219) kk = 91; // [
1764 - if (k == 220) kk = 92; // \
1765 - if (k == 221) kk = 93; // ]
1766 - if (k == 222) kk = 39; // '
1767 - //console.log('Key' + d + ": " + k + " = " + kk);
1768 - obj.sendkey(kk, d);
1769 - }
1770 - return obj.haltEvent(e);
1771 - }
1772 -
1773 - obj.sendkey = function (k, d) {
1774 - if (typeof k == 'object') {
1775 - //for (var i in k) { obj.sendkey(k[i][0], k[i][1]); }
1776 - var buf = ''; for (var i in k) { buf += (String.fromCharCode(4, k[i][1], 0, 0) + IntToStr(k[i][0])); } obj.send(buf);
1777 - } else {
1778 - obj.send(String.fromCharCode(4, d, 0, 0) + IntToStr(k));
1779 - }
1780 - }
1781 -
1782 - function handleServerCutText(acc) {
1783 - if (acc.length < 8) return 0;
1784 - var len = ReadInt(obj.acc, 4) + 8;
1785 - if (acc.length < len) return 0;
1786 - // ###BEGIN###{DesktopInband}
1787 - if (obj.onKvmData != null) {
1788 - var d = acc.substring(8, len);
1789 - if ((d.length >= 16) && (d.substring(0, 15) == '\0KvmDataChannel')) {
1790 - if (obj.kvmDataSupported == false) { obj.kvmDataSupported = true; console.log('KVM Data Channel Supported.'); }
1791 - if (((obj.onKvmDataAck == -1) && (d.length == 16)) || (d.charCodeAt(15) != 0)) { obj.onKvmDataAck = true; }
1792 - //if (urlvars && urlvars['kvmdatatrace']) { console.log('KVM-Recv(' + (d.length - 16) + '): ' + d.substring(16)); }
1793 - if (d.length >= 16) { obj.onKvmData(d.substring(16)); } // Event the data and ack
1794 - if ((obj.onKvmDataAck == true) && (obj.onKvmDataPending.length > 0)) { obj.sendKvmData(obj.onKvmDataPending.shift()); } // Send pending data
1795 - }
1796 - }
1797 - // ###END###{DesktopInband}
1798 - return len;
1799 - }
1800 -
1801 - // ###BEGIN###{DesktopInband}
1802 - obj.sendKvmData = function (x) {
1803 - if (obj.onKvmDataAck !== true) {
1804 - obj.onKvmDataPending.push(x);
1805 - } else {
1806 - //if (urlvars && urlvars['kvmdatatrace']) { console.log('KVM-Send(' + x.length + '): ' + x); }
1807 - x = '\0KvmDataChannel\0' + x;
1808 - obj.send(String.fromCharCode(6, 0, 0, 0) + IntToStr(x.length) + x);
1809 - obj.onKvmDataAck = false;
1810 - }
1811 - }
1812 -
1813 - // Send a HWKVM keep alive if it's not been sent in the last 5 seconds.
1814 - obj.sendKeepAlive = function () {
1815 - if (obj.lastKeepAlive < Date.now() - 5000) { obj.lastKeepAlive = Date.now(); obj.send(String.fromCharCode(6, 0, 0, 0) + IntToStr(16) + '\0KvmDataChannel\0'); }
1816 - }
1817 - // ###END###{DesktopInband}
1818 -
1819 - obj.SendCtrlAltDelMsg = function () { obj.sendcad(); }
1820 - obj.sendcad = function () { obj.sendkey([[0xFFE3, 1], [0xFFE9, 1], [0xFFFF, 1], [0xFFFF, 0], [0xFFE9, 0], [0xFFE3, 0]]); } // Control down, Alt down, Delete down, Delete up , Alt up , Control up
1821 -
1822 - var _MouseInputGrab = false;
1823 - var _KeyInputGrab = false;
1824 -
1825 - obj.GrabMouseInput = function () {
1826 - if (_MouseInputGrab == true) return;
1827 - var c = obj.canvas.canvas;
1828 - c.onmouseup = obj.mouseup;
1829 - c.onmousedown = obj.mousedown;
1830 - c.onmousemove = obj.mousemove;
1831 - //if (navigator.userAgent.match(/mozilla/i)) c.DOMMouseScroll = obj.xxDOMMouseScroll; else c.onmousewheel = obj.xxMouseWheel;
1832 - _MouseInputGrab = true;
1833 - }
1834 -
1835 - obj.UnGrabMouseInput = function () {
1836 - if (_MouseInputGrab == false) return;
1837 - var c = obj.canvas.canvas;
1838 - c.onmousemove = null;
1839 - c.onmouseup = null;
1840 - c.onmousedown = null;
1841 - //if (navigator.userAgent.match(/mozilla/i)) c.DOMMouseScroll = null; else c.onmousewheel = null;
1842 - _MouseInputGrab = false;
1843 - }
1844 -
1845 - obj.GrabKeyInput = function () {
1846 - if (_KeyInputGrab == true) return;
1847 - document.onkeyup = obj.handleKeyUp;
1848 - document.onkeydown = obj.handleKeyDown;
1849 - document.onkeypress = obj.handleKeys;
1850 - _KeyInputGrab = true;
1851 - }
1852 -
1853 - obj.UnGrabKeyInput = function () {
1854 - if (_KeyInputGrab == false) return;
1855 - document.onkeyup = null;
1856 - document.onkeydown = null;
1857 - document.onkeypress = null;
1858 - _KeyInputGrab = false;
1859 - }
1860 -
1861 - obj.handleKeys = function (e) { return obj.haltEvent(e); }
1862 - obj.handleKeyUp = function (e) { return _keyevent(0, e); }
1863 - obj.handleKeyDown = function (e) { return _keyevent(1, e); }
1864 - obj.haltEvent = function (e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
1865 -
1866 - // RFB "PointerEvent" and mouse handlers
1867 - obj.mousedblclick = function (e) { }
1868 - obj.mousedown = function (e) { obj.buttonmask |= (1 << e.button); return obj.mousemove(e, 1); }
1869 - obj.mouseup = function (e) { obj.buttonmask &= (0xFFFF - (1 << e.button)); return obj.mousemove(e, 1); }
1870 - obj.mousemove = function (e, force) {
1871 - if (obj.state < 4) return true;
1872 - var ScaleFactorHeight = (obj.canvas.canvas.height / Q(obj.canvasid).offsetHeight);
1873 - var ScaleFactorWidth = (obj.canvas.canvas.width / Q(obj.canvasid).offsetWidth);
1874 - var Offsets = obj.getPositionOfControl(Q(obj.canvasid));
1875 - obj.mx = ((event.pageX - Offsets[0]) * ScaleFactorWidth);
1876 - obj.my = ((event.pageY - Offsets[1]) * ScaleFactorHeight);
1877 - if (event.addx) { obj.mx += event.addx; }
1878 - if (event.addy) { obj.my += event.addy; }
1879 -
1880 -
1881 - // This is the mouse motion nagle timer. Slow down the mouse motion event rate.
1882 - if (force == 1) {
1883 - obj.send(String.fromCharCode(5, obj.buttonmask) + ShortToStr(obj.mx) + ShortToStr(obj.my));
1884 - if (obj.mNagleTimer != null) { clearTimeout(obj.mNagleTimer); obj.mNagleTimer = null; }
1885 - } else {
1886 - if (obj.mNagleTimer == null) {
1887 - obj.mNagleTimer = setTimeout(function () {
1888 - obj.send(String.fromCharCode(5, obj.buttonmask) + ShortToStr(obj.mx) + ShortToStr(obj.my));
1889 - obj.mNagleTimer = null;
1890 - }, 50);
1891 - }
1892 - }
1893 -
1894 -
1895 - return obj.haltEvent(e);
1896 - }
1897 -
1898 - obj.getPositionOfControl = function (Control) {
1899 - var Position = Array(2);
1900 - Position[0] = Position[1] = 0;
1901 - while (Control) {
1902 - Position[0] += Control.offsetLeft;
1903 - Position[1] += Control.offsetTop;
1904 - Control = Control.offsetParent;
1905 - }
1906 - return Position;
1907 - }
1908 -
1909 - return obj;
1910 -}
1911 -/**
1912 -* @description Remote Terminal
1913 -* @author Ylian Saint-Hilaire
1914 -* @version v0.0.2c
1915 -*/
1916 -
1917 -// https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
1918 -// https://www.x.org/docs/xterm/ctlseqs.pdf
1919 -
1920 -// Construct a MeshServer object
1921 -var CreateAmtRemoteTerminal = function (divid, options) {
1922 - var obj = {};
1923 - obj.DivId = divid;
1924 - obj.DivElement = document.getElementById(divid);
1925 - obj.protocol = 1; // SOL
1926 - if (options.protocol) { obj.protocol = options.protocol; } // 1 = Normal, 6 = PowerShell
1927 - obj.fxEmulation = 0;
1928 - obj.lineFeed = '\r\n';
1929 - obj.debugmode = 0;
1930 -
1931 - obj.width = 80; // 80 or 100
1932 - obj.height = 25; // 25 or 30
1933 - obj.heightLock = 0;
1934 -
1935 - var _Terminal_CellHeight = 21;
1936 - var _Terminal_CellWidth = 13;
1937 - var _TermColors = ['000000', 'BB0000', '00BB00', 'BBBB00', '0000BB', 'BB00BB', '00BBBB', 'BBBBBB', '555555', 'FF5555', '55FF55', 'FFFF55', '5555FF', 'FF55FF', '55FFFF', 'FFFFFF'];
1938 - var _TermCurrentReverse = 0;
1939 - var _TermCurrentFColor = 7;
1940 - var _TermCurrentBColor = 0;
1941 - var _TermLineWrap = true;
1942 - var _termx = 0;
1943 - var _termy = 0;
1944 - var _termsavex = 0;
1945 - var _termsavey = 0;
1946 - var _termstate = 0;
1947 - var _escNumber = [];
1948 - var _escNumberPtr = 0;
1949 - var _escNumberMode = 0;
1950 - var _scratt = [];
1951 - var _tscreen = [];
1952 - var _VTUNDERLINE = 1;
1953 - var _VTREVERSE = 2;
1954 - var _backSpaceErase = false;
1955 - var _cursorVisible = true;
1956 - var _scrollRegion;
1957 - var _altKeypadMode = false;
1958 - var scrollBackBuffer = [];
1959 - obj.title = null;
1960 - obj.onTitleChange = null;
1961 -
1962 - obj.Start = function () { }
1963 -
1964 - obj.Init = function (width, height) {
1965 - obj.width = width ? width : 80;
1966 - obj.height = height ? height : 25;
1967 - for (var y = 0; y < obj.height; y++) {
1968 - _tscreen[y] = [];
1969 - _scratt[y] = [];
1970 - for (var x = 0; x < obj.width; x++) { _tscreen[y][x] = ' '; _scratt[y][x] = (7 << 6); }
1971 - }
1972 - obj.TermInit();
1973 - obj.TermDraw();
1974 - }
1975 -
1976 - obj.xxStateChange = function (newstate) {
1977 - if ((newstate == 3) && (options != null) && (options.xterm == true)) { obj.TermSendKeys('stty rows ' + obj.height + ' cols ' + obj.width + '\nclear\n'); }
1978 - }
1979 -
1980 - obj.ProcessData = function (str) {
1981 - if (obj.debugmode == 2) { console.log("TRecv(" + str.length + "): " + rstr2hex(str)); }
1982 - if (obj.capture != null) obj.capture += str; _ProcessVt100EscString(str); obj.TermDraw();
1983 - }
1984 -
1985 - function _ProcessVt100EscString(str) { for (var i = 0; i < str.length; i++) _ProcessVt100EscChar(String.fromCharCode(str.charCodeAt(i)), str.charCodeAt(i)); }
1986 -
1987 - function _ProcessVt100EscChar(b, c) {
1988 - switch (_termstate) {
1989 - case 0: // Normal Term State
1990 - switch (c) {
1991 - case 27: // ESC
1992 - _termstate = 1;
1993 - _escNumber = [];
1994 - _escNumberPtr = 0;
1995 - _escNumberMode = 0;
1996 - break;
1997 - default:
1998 - // Process a single char
1999 - _ProcessVt100Char(b);
2000 - break;
2001 - }
2002 - break;
2003 - case 1:
2004 - switch (b) {
2005 - case '[':
2006 - _termstate = 2;
2007 - break;
2008 - case '(':
2009 - _termstate = 4;
2010 - break;
2011 - case ')':
2012 - _termstate = 5;
2013 - break;
2014 - case ']':
2015 - _termstate = 6; // xterm strings
2016 - break;
2017 - case '=':
2018 - // Set alternate keypad mode
2019 - _altKeypadMode = true;
2020 - _termstate = 0;
2021 - break;
2022 - case '>':
2023 - // Set numeric keypad mode
2024 - _altKeypadMode = false;
2025 - _termstate = 0;
2026 - break;
2027 - case '7':
2028 - // Save Cursor
2029 - _termsavex = _termx;
2030 - _termsavey = _termy;
2031 - _termstate = 0;
2032 - break;
2033 - case '8':
2034 - // Restore Cursor
2035 - _termx = _termsavex;
2036 - _termy = _termsavey;
2037 - _termstate = 0;
2038 - break;
2039 - case 'M':
2040 - // Scroll down one
2041 - var x = 1;
2042 - for (var y = _scrollRegion[1]; y >= _scrollRegion[0] + x; y--) {
2043 - for (var z = 0; z < obj.width; z++) { _tscreen[y][z] = _tscreen[y - x][z]; _scratt[y][z] = _scratt[y - x][z]; }
2044 - }
2045 - for (var y = _scrollRegion[0] + x - 1; y > _scrollRegion[0] - 1; y--) {
2046 - for (var z = 0; z < obj.width; z++) { _tscreen[y][z] = ' '; _scratt[y][z] = (7 << 6); }
2047 - }
2048 - _termstate = 0;
2049 - break;
2050 - default:
2051 - console.log('unknown terminal short code', b);
2052 - _termstate = 0;
2053 - break;
2054 - }
2055 - break;
2056 - case 2:
2057 - if (b >= '0' && b <= '9') {
2058 - // This is a number
2059 - if (!_escNumber[_escNumberPtr]) { _escNumber[_escNumberPtr] = (b - '0'); }
2060 - else { _escNumber[_escNumberPtr] = ((_escNumber[_escNumberPtr] * 10) + (b - '0')); }
2061 - break;
2062 - } else if (b == ';') {
2063 - // New number
2064 - _escNumberPtr++;
2065 - break;
2066 - } else if (b == '?') {
2067 - _escNumberMode = 1;
2068 - break;
2069 - } else {
2070 - // Process Escape Sequence
2071 - if (!_escNumber[0]) _escNumber[0] = 0;
2072 - _ProcessEscapeHandler(b, _escNumber, _escNumberPtr + 1, _escNumberMode);
2073 - _termstate = 0;
2074 - }
2075 - break;
2076 - case 4: // '(' Code
2077 - _termstate = 0;
2078 - break;
2079 - case 5: // ')' Code
2080 - _termstate = 0;
2081 - break;
2082 - case 6: // ']' Code, xterm
2083 - var bx = b.charCodeAt(0);
2084 - if (b == ';') {
2085 - _escNumberPtr++;
2086 - } else if (bx == 7) {
2087 - _ProcessXTermHandler(_escNumber);
2088 - _termstate = 0;
2089 - } else {
2090 - if (!_escNumber[_escNumberPtr]) { _escNumber[_escNumberPtr] = b; }
2091 - else { _escNumber[_escNumberPtr] += b; }
2092 - }
2093 - break;
2094 - }
2095 - }
2096 -
2097 - function _ProcessXTermHandler(_escNumber) {
2098 - if (_escNumber.length == 0) return;
2099 - var cmd = parseInt(_escNumber[0]);
2100 - if ((cmd == 0 || cmd == 2) && (_escNumber.length > 1) && (_escNumber[1] != '?')) {
2101 - if (obj.onTitleChange) { obj.onTitleChange(obj, obj.title = _escNumber[1]); }
2102 - }
2103 - }
2104 -
2105 - function _ProcessEscapeHandler(code, args, argslen, mode) {
2106 - //console.log('process', code, args, mode);
2107 - if (mode == 1) {
2108 - switch (code) {
2109 - case 'l': // Hide the cursor
2110 - if (args[0] == 25) { _cursorVisible = false; }
2111 - break;
2112 - case 'h': // Show the cursor
2113 - if (args[0] == 25) { _cursorVisible = true; }
2114 - break;
2115 - }
2116 - } else if (mode == 0) {
2117 - var i;
2118 - switch (code) {
2119 - case 'c': // ResetDevice
2120 - // Reset
2121 - obj.TermResetScreen();
2122 - break;
2123 - case 'A': // Move cursor up n lines
2124 - if (argslen == 1) {
2125 - if (args[0] == 0) { _termy--; } else { _termy -= args[0]; }
2126 - if (_termy < 0) _termy = 0;
2127 - }
2128 - break;
2129 - case 'B': // Move cursor down n lines
2130 - if (argslen == 1) {
2131 - if (args[0] == 0) { _termy++; } else { _termy += args[0]; }
2132 - if (_termy > obj.height) _termy = obj.height;
2133 - }
2134 - break;
2135 - case 'C': // Move cursor right n lines
2136 - if (argslen == 1) {
2137 - if (args[0] == 0) { _termx++; } else { _termx += args[0]; }
2138 - if (_termx > obj.width) _termx = obj.width;
2139 - }
2140 - break;
2141 - case 'D': // Move cursor left n lines
2142 - if (argslen == 1) {
2143 - if (args[0] == 0) { _termx--; } else { _termx -= args[0]; }
2144 - if (_termx < 0) _termx = 0;
2145 - }
2146 - break;
2147 - case 'd': // Set cursor to line n
2148 - if (argslen == 1) {
2149 - _termy = args[0] - 1;
2150 - if (_termy > obj.height) _termy = obj.height;
2151 - if (_termy < 0) _termy = 0;
2152 - }
2153 - break;
2154 - case 'G': // Set cursor to col n
2155 - if (argslen == 1) {
2156 - _termx = args[0] - 1;
2157 - if (_termx < 0) _termx = 0;
2158 - if (_termx > (obj.width - 1)) _termx = (obj.width - 1);
2159 - }
2160 - break;
2161 - case 'P': // Delete X Character(s), default 1 char
2162 - var x = 1;
2163 - if (argslen == 1) { x = args[0]; }
2164 - for (i = _termx; i < obj.width - x; i++) { _tscreen[_termy][i] = _tscreen[_termy][i + x]; _scratt[_termy][i] = _scratt[_termy][i + x]; }
2165 - for (i = (obj.width - x); i < obj.width; i++) { _tscreen[_termy][i] = ' '; _scratt[_termy][i] = (7 << 6); }
2166 - break;
2167 - case 'L': // Insert X Line(s), default 1 char
2168 - var linecount = 1;
2169 - if (argslen == 1) { linecount = args[0]; }
2170 - if (linecount == 0) { linecount = 1; }
2171 - for (y = _scrollRegion[1]; y >= _termy + linecount; y--) {
2172 - _tscreen[y] = _tscreen[y - linecount];
2173 - _scratt[y] = _scratt[y - linecount];
2174 - }
2175 - for (y = _termy; y < _termy + linecount; y++) {
2176 - _tscreen[y] = [];
2177 - _scratt[y] = [];
2178 - for (x = 0; x < obj.width; x++) { _tscreen[y][x] = ' '; _scratt[y][x] = (7 << 6); }
2179 - }
2180 - break;
2181 - case 'J': // ClearScreen:
2182 - if (argslen == 1 && args[0] == 2) {
2183 - obj.TermClear((_TermCurrentBColor << 12) + (_TermCurrentFColor << 6)); // Erase entire screen
2184 - _termx = 0;
2185 - _termy = 0;
2186 - scrollBackBuffer = [];
2187 - }
2188 - else if (argslen == 0 || argslen == 1 && args[0] == 0) // Erase cursor down
2189 - {
2190 - _EraseCursorToEol();
2191 - for (i = _termy + 1; i < obj.height; i++) _EraseLine(i);
2192 - }
2193 - else if (argslen == 1 && args[0] == 1) // Erase cursor up
2194 - {
2195 - _EraseCursorToEol();
2196 - for (i = 0; i < _termy - 1; i++) _EraseLine(i);
2197 - }
2198 - break;
2199 - case 'H': // MoveCursor:
2200 - if (argslen == 2) {
2201 - if (args[0] < 1) args[0] = 1;
2202 - if (args[1] < 1) args[1] = 1;
2203 - if (args[0] > obj.height) args[0] = obj.height;
2204 - if (args[1] > obj.width) args[1] = obj.width;
2205 - _termy = args[0] - 1;
2206 - _termx = args[1] - 1;
2207 - } else {
2208 - _termy = 0;
2209 - _termx = 0;
2210 - }
2211 - break;
2212 - case 'm': // ScreenAttribs:
2213 - // Change attributes
2214 - for (i = 0; i < argslen; i++) {
2215 - if (!args[i] || args[i] == 0) {
2216 - // Reset Attributes
2217 - _TermCurrentBColor = 0;
2218 - _TermCurrentFColor = 7;
2219 - _TermCurrentReverse = 0;
2220 - }
2221 - else if (args[i] == 1) {
2222 - // Bright
2223 - if (_TermCurrentFColor < 8) _TermCurrentFColor += 8;
2224 - }
2225 - else if (args[i] == 2 || args[i] == 22) {
2226 - // Dim
2227 - if (_TermCurrentFColor >= 8) _TermCurrentFColor -= 8;
2228 - }
2229 - else if (args[i] == 7) {
2230 - // Set Reverse attribute true
2231 - _TermCurrentReverse = 2;
2232 - }
2233 - else if (args[i] == 27) {
2234 - // Set Reverse attribute false
2235 - _TermCurrentReverse = 0;
2236 - }
2237 - else if (args[i] >= 30 && args[i] <= 37) {
2238 - // Set Foreground Color
2239 - var bright = (_TermCurrentFColor >= 8);
2240 - _TermCurrentFColor = (args[i] - 30);
2241 - if (bright && _TermCurrentFColor <= 8) _TermCurrentFColor += 8;
2242 - }
2243 - else if (args[i] >= 40 && args[i] <= 47) {
2244 - // Set Background Color
2245 - _TermCurrentBColor = (args[i] - 40);
2246 - }
2247 - else if (args[i] >= 90 && args[i] <= 99) {
2248 - // Set Bright Foreground Color
2249 - _TermCurrentFColor = (args[i] - 82);
2250 - }
2251 - else if (args[i] >= 100 && args[i] <= 109) {
2252 - // Set Bright Background Color
2253 - _TermCurrentBColor = (args[i] - 92);
2254 - }
2255 - }
2256 - break;
2257 - case 'K': // EraseLine:
2258 - if (argslen == 0 || (argslen == 1 && (!args[0] || args[0] == 0))) {
2259 - _EraseCursorToEol(); // Erase from the cursor to the end of the line
2260 - } else if (argslen == 1) {
2261 - if (args[0] == 1) { // Erase from the beginning of the line to the cursor
2262 - _EraseBolToCursor();
2263 - } else if (args[0] == 2) { // Erase the line with the cursor
2264 - _EraseLine(_termy);
2265 - }
2266 - }
2267 - break;
2268 - case 'h': // EnableLineWrap:
2269 - _TermLineWrap = true;
2270 - break;
2271 - case 'l': // DisableLineWrap:
2272 - _TermLineWrap = false;
2273 - break;
2274 - case 'r': // Set the scroll region
2275 - if (argslen == 2) { _scrollRegion = [args[0] - 1, args[1] - 1]; }
2276 - if (_scrollRegion[0] < 0) { _scrollRegion[0] = 0; }
2277 - if (_scrollRegion[0] > (obj.height - 1)) { _scrollRegion[0] = (obj.height - 1); }
2278 - if (_scrollRegion[1] < 0) { _scrollRegion[1] = 0; }
2279 - if (_scrollRegion[1] > (obj.height - 1)) { _scrollRegion[1] = (obj.height - 1); }
2280 - if (_scrollRegion[0] > _scrollRegion[1]) { _scrollRegion[0] = _scrollRegion[1]; }
2281 - break;
2282 - case 'S': // Scroll up the scroll region X lines, default 1
2283 - var x = 1;
2284 - if (argslen == 1) { x = args[0] }
2285 - for (var y = _scrollRegion[0]; y <= _scrollRegion[1] - x; y++) {
2286 - for (var z = 0; z < obj.width; z++) { _tscreen[y][z] = _tscreen[y + x][z]; _scratt[y][z] = _scratt[y + x][z]; }
2287 - }
2288 - for (var y = _scrollRegion[1] - x + 1; y < _scrollRegion[1]; y++) {
2289 - for (var z = 0; z < obj.width; z++) { _tscreen[y][z] = ' '; _scratt[y][z] = (7 << 6); }
2290 - }
2291 - break;
2292 - case 'M': // Delete X lines, default 1
2293 - var x = 1;
2294 - if (argslen == 1) { x = args[0] }
2295 - for (var y = _termy; y <= _scrollRegion[1] - x; y++) {
2296 - for (var z = 0; z < obj.width; z++) { _tscreen[y][z] = _tscreen[y + x][z]; _scratt[y][z] = _scratt[y + x][z]; }
2297 - }
2298 - for (var y = _scrollRegion[1] - x + 1; y < _scrollRegion[1]; y++) {
2299 - for (var z = 0; z < obj.width; z++) { _tscreen[y][z] = ' '; _scratt[y][z] = (7 << 6); }
2300 - }
2301 - break;
2302 - case 'T': // Scroll down the scroll region X lines, default 1
2303 - var x = 1;
2304 - if (argslen == 1) { x = args[0] }
2305 - for (var y = _scrollRegion[1]; y > _scrollRegion[0] + x; y--) {
2306 - for (var z = 0; z < obj.width; z++) { _tscreen[y][z] = _tscreen[y - x][z]; _scratt[y][z] = _scratt[y - x][z]; }
2307 - }
2308 - for (var y = _scrollRegion[0] + x; y > _scrollRegion[0]; y--) {
2309 - for (var z = 0; z < obj.width; z++) { _tscreen[y][z] = ' '; _scratt[y][z] = (7 << 6); }
2310 - }
2311 - break;
2312 - case 'X': // Erase X characters, default 1 (untested)
2313 - var x = 1;
2314 - if (argslen == 1) { x = args[0] }
2315 - while ((x > 0) && (_termx > 0)) { _tscreen[_termy][_termx] = ' '; _termx--; x--; }
2316 - break;
2317 - default:
2318 - //if (code != '@') alert(code);
2319 - console.log('unknown terminal code', code, args, mode);
2320 - break;
2321 - }
2322 - }
2323 - }
2324 -
2325 - obj.ProcessVt100String = function (str) {
2326 - for (var i = 0; i < str.length; i++) _ProcessVt100Char(String.fromCharCode(str.charCodeAt(i)));
2327 - }
2328 -
2329 -
2330 -
2331 -
2332 - function _ProcessVt100Char(c) {
2333 - if (c == '\0' || c.charCodeAt() == 7) return; // Ignore null & bell
2334 - var ch = c.charCodeAt();
2335 - //console.log('_ProcessVt100Char', ch, c);
2336 -
2337 -
2338 -
2339 -
2340 - //if (ch < 32 && ch != 10 && ch != 13) alert(ch);
2341 - switch (ch) {
2342 - case 16: { c = ' '; break; } // This is an odd char that show up on Intel BIOS's.
2343 - case 24: { c = '↑'; break; }
2344 - case 25: { c = '↓'; break; }
2345 - }
2346 -
2347 - if (_termx > obj.width) _termx = obj.width;
2348 - if (_termy > (obj.height - 1)) _termy = (obj.height - 1);
2349 -
2350 - switch (c) {
2351 - case '\b': // Backspace
2352 - if (_termx > 0) {
2353 - _termx--;
2354 - if (_backSpaceErase) { _TermDrawChar(' '); }
2355 - }
2356 - break;
2357 - case '\t': // tab
2358 - var tab = 8 - (_termx % 8)
2359 - for (var x = 0; x < tab; x++) _ProcessVt100Char(" ");
2360 - break;
2361 - case '\n': // Linefeed
2362 - _termy++;
2363 - if (_termy > _scrollRegion[1]) {
2364 - // Move everything up one line
2365 - obj.recordLineTobackBuffer(0);
2366 - _TermMoveUp(1);
2367 - _termy = _scrollRegion[1];
2368 - }
2369 - if (obj.lineFeed = '\r') { _termx = 0; } // *** If we are in Linux mode, \n will also return the cursor to the first col
2370 - break;
2371 - case '\r': // Carriage Return
2372 - _termx = 0;
2373 - break;
2374 - default:
2375 - if (_termx >= obj.width) {
2376 - _termx = 0;
2377 - if (_TermLineWrap) { _termy++; }
2378 - if (_termy >= (obj.height - 1)) { _TermMoveUp(1); _termy = (obj.height - 1); }
2379 - }
2380 - _TermDrawChar(c);
2381 - _termx++;
2382 - break;
2383 - }
2384 - }
2385 -
2386 - function _TermDrawChar(c) {
2387 - _tscreen[_termy][_termx] = c;
2388 - _scratt[_termy][_termx] = (_TermCurrentFColor << 6) + (_TermCurrentBColor << 12) + _TermCurrentReverse;
2389 - }
2390 -
2391 - obj.TermClear = function(TermColor) {
2392 - for (var y = 0; y < obj.height; y++) {
2393 - for (var x = 0; x < obj.width; x++) {
2394 - _tscreen[y][x] = ' ';
2395 - _scratt[y][x] = TermColor;
2396 - }
2397 - }
2398 - scrollBackBuffer = [];
2399 - }
2400 -
2401 - obj.TermResetScreen = function () {
2402 - _TermCurrentReverse = 0;
2403 - _TermCurrentFColor = 7;
2404 - _TermCurrentBColor = 0;
2405 - _TermLineWrap = _cursorVisible = true;
2406 - _termx = _termy = 0;
2407 - _backSpaceErase = false;
2408 - _scrollRegion = [0, (obj.height - 1)];
2409 - _altKeypadMode = false;
2410 - obj.TermClear(7 << 6);
2411 - }
2412 -
2413 - function _EraseCursorToEol() {
2414 - var t = (_TermCurrentFColor << 6) + (_TermCurrentBColor << 12) + _TermCurrentReverse;
2415 - for (var x = _termx; x < obj.width; x++) {
2416 - _tscreen[_termy][x] = ' ';
2417 - _scratt[_termy][x] = t;
2418 - }
2419 - }
2420 -
2421 - function _EraseBolToCursor() {
2422 - var t = (_TermCurrentFColor << 6) + (_TermCurrentBColor << 12) + _TermCurrentReverse;
2423 - for (var x = 0; x < _termx; x++) {
2424 - _tscreen[_termy][x] = ' ';
2425 - _scratt[_termy][x] = t;
2426 - }
2427 - }
2428 -
2429 - function _EraseLine(line) {
2430 - var t = (_TermCurrentFColor << 6) + (_TermCurrentBColor << 12) + _TermCurrentReverse;
2431 - for (var x = 0; x < obj.width; x++) {
2432 - _tscreen[line][x] = ' ';
2433 - _scratt[line][x] = t;
2434 - }
2435 - }
2436 -
2437 - obj.TermSendKeys = function (keys) { if (obj.debugmode == 2) { console.log("TSend(" + keys.length + "): " + rstr2hex(keys), keys); } obj.parent.send(keys); }
2438 - obj.TermSendKey = function (key) { if (obj.debugmode == 2) { console.log("TSend(1): " + rstr2hex(String.fromCharCode(key)), key); } obj.parent.send(String.fromCharCode(key)); }
2439 -
2440 - function _TermMoveUp(linecount) {
2441 - var x, y;
2442 - for (y = _scrollRegion[0]; y <= _scrollRegion[1] - linecount; y++) {
2443 - _tscreen[y] = _tscreen[y + linecount];
2444 - _scratt[y] = _scratt[y + linecount];
2445 - }
2446 - for (y = _scrollRegion[1] - linecount + 1; y <= _scrollRegion[1]; y++) {
2447 - _tscreen[y] = [];
2448 - _scratt[y] = [];
2449 - for (x = 0; x < obj.width; x++) {
2450 - _tscreen[y][x] = ' ';
2451 - _scratt[y][x] = (7 << 6);
2452 - }
2453 - }
2454 - }
2455 -
2456 - obj.TermHandleKeys = function (e) {
2457 - if (!e.ctrlKey) {
2458 - if (e.which == 127) obj.TermSendKey(8);
2459 - else if (e.which == 13) { obj.TermSendKeys(obj.lineFeed); }
2460 - else if (e.which != 0) obj.TermSendKey(e.which);
2461 - return false;
2462 - }
2463 - if (e.preventDefault) e.preventDefault();
2464 - if (e.stopPropagation) e.stopPropagation();
2465 - }
2466 -
2467 - obj.TermHandleKeyUp = function (e) {
2468 - if ((e.which != 8) && (e.which != 32) && (e.which != 9)) return true;
2469 - if (e.preventDefault) e.preventDefault();
2470 - if (e.stopPropagation) e.stopPropagation();
2471 - return false;
2472 - }
2473 -
2474 - obj.TermHandleKeyDown = function (e) {
2475 - if ((e.which >= 65) && (e.which <= 90) && (e.ctrlKey == true)) {
2476 - obj.TermSendKey(e.which - 64);
2477 - if (e.preventDefault) e.preventDefault();
2478 - if (e.stopPropagation) e.stopPropagation();
2479 - return;
2480 - }
2481 - if (e.which == 27) { obj.TermSendKeys(String.fromCharCode(27)); return true; }; // ESC
2482 -
2483 - if (_altKeypadMode == true) {
2484 - if (e.which == 37) { obj.TermSendKeys(String.fromCharCode(27, 79, 68)); return true; }; // Left
2485 - if (e.which == 38) { obj.TermSendKeys(String.fromCharCode(27, 79, 65)); return true; }; // Up
2486 - if (e.which == 39) { obj.TermSendKeys(String.fromCharCode(27, 79, 67)); return true; }; // Right
2487 - if (e.which == 40) { obj.TermSendKeys(String.fromCharCode(27, 79, 66)); return true; }; // Down
2488 - } else {
2489 - if (e.which == 37) { obj.TermSendKeys(String.fromCharCode(27, 91, 68)); return true; }; // Left
2490 - if (e.which == 38) { obj.TermSendKeys(String.fromCharCode(27, 91, 65)); return true; }; // Up
2491 - if (e.which == 39) { obj.TermSendKeys(String.fromCharCode(27, 91, 67)); return true; }; // Right
2492 - if (e.which == 40) { obj.TermSendKeys(String.fromCharCode(27, 91, 66)); return true; }; // Down
2493 - }
2494 -
2495 - if (e.which == 33) { obj.TermSendKeys(String.fromCharCode(27, 91, 53, 126)); return true; }; // PageUp
2496 - if (e.which == 34) { obj.TermSendKeys(String.fromCharCode(27, 91, 54, 126)); return true; }; // PageDown
2497 - if (e.which == 35) { obj.TermSendKeys(String.fromCharCode(27, 91, 70)); return true; }; // End
2498 - if (e.which == 36) { obj.TermSendKeys(String.fromCharCode(27, 91, 72)); return true; }; // Home
2499 - if (e.which == 45) { obj.TermSendKeys(String.fromCharCode(27, 91, 50, 126)); return true; }; // Insert
2500 - if (e.which == 46) { obj.TermSendKeys(String.fromCharCode(27, 91, 51, 126)); return true; }; // Delete
2501 -
2502 - if (e.which == 9) { obj.TermSendKeys("\t"); if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return true; }; // TAB
2503 -
2504 - // F1 to F12 keys
2505 -
2506 - if (e.which != 8 && e.which != 32 && e.which != 9) return true;
2507 - obj.TermSendKey(e.which);
2508 - if (e.preventDefault) e.preventDefault();
2509 - if (e.stopPropagation) e.stopPropagation();
2510 - return false;
2511 - }
2512 -
2513 - obj.recordLineTobackBuffer = function(y) {
2514 - var closetag = '', buf = '';
2515 - var r = obj.TermDrawLine(buf, y, closetag);
2516 - buf = r[0];
2517 - closetag = r[1];
2518 - scrollBackBuffer.push(buf + closetag + '<br>');
2519 - }
2520 -
2521 - obj.TermDrawLine = function (buf, y, closetag) {
2522 - var newat, c, oldat = 1, x1, x2;
2523 - for (var x = 0; x < obj.width; ++x) {
2524 - newat = _scratt[y][x];
2525 - if (_termx == x && _termy == y && _cursorVisible) { newat |= _VTREVERSE; } // If this is the cursor location, reverse the color.
2526 - if (newat != oldat) {
2527 - buf += closetag;
2528 - closetag = '';
2529 - x1 = 6; x2 = 12;
2530 - if (newat & _VTREVERSE) { x1 = 12; x2 = 6; }
2531 - buf += '<span style="color:#' + _TermColors[(newat >> x1) & 0x3F] + ';background-color:#' + _TermColors[(newat >> x2) & 0x3F];
2532 - if (newat & _VTUNDERLINE) buf += ';text-decoration:underline';
2533 - buf += ';">';
2534 - closetag = "</span>" + closetag;
2535 - oldat = newat;
2536 - }
2537 -
2538 - c = _tscreen[y][x];
2539 - switch (c) {
2540 - case '&': buf += '&amp;'; break;
2541 - case '<': buf += '&lt;'; break;
2542 - case '>': buf += '&gt;'; break;
2543 - case ' ': buf += '&nbsp;'; break;
2544 - default: buf += c; break;
2545 - }
2546 - }
2547 - return [buf, closetag];
2548 - }
2549 -
2550 - obj.TermDraw = function() {
2551 - var closetag = '', buf = '';
2552 - for (var y = 0; y < obj.height; ++y) {
2553 - var r = obj.TermDrawLine(buf, y, closetag);
2554 - buf = r[0];
2555 - closetag = r[1];
2556 - if (y != (obj.height - 1)) buf += '<br>';
2557 - }
2558 -
2559 - if (scrollBackBuffer.length > 800) { scrollBackBuffer = scrollBackBuffer.slice(scrollBackBuffer.length - 800); }
2560 - var backbuffer = scrollBackBuffer.join('');
2561 - obj.DivElement.innerHTML = "<font size='4'><b>" + backbuffer + buf + closetag + "</b></font>";
2562 - obj.DivElement.scrollTop = obj.DivElement.scrollHeight;
2563 - if (obj.heightLock == 0) { setTimeout(obj.TermLockHeight, 10); }
2564 - }
2565 -
2566 - obj.TermLockHeight = function () {
2567 - obj.heightLock = obj.DivElement.clientHeight;
2568 - obj.DivElement.style['height'] = obj.DivElement.parentNode.style['height'] = obj.heightLock + 'px';
2569 - obj.DivElement.style['overflow-y'] = 'scroll';
2570 - }
2571 -
2572 - obj.TermInit = function () { obj.TermResetScreen(); }
2573 -
2574 - obj.heightLock = 0;
2575 - obj.DivElement.style['height'] = '';
2576 - if ((options != null) && (options.width != null) && (options.height != null)) { obj.Init(options.width, options.height); } else { obj.Init(); }
2577 - return obj;
2578 -}/* zlib.js -- JavaScript implementation for the zlib.
2579 - Version: 0.2.0
2580 - LastModified: Apr 12 2012
2581 - Copyright (C) 2012 Masanao Izumo <iz@onicos.co.jp>
2582 -
2583 - The original copyright notice (zlib 1.2.6):
2584 -
2585 - Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler
2586 -
2587 - This software is provided 'as-is', without any express or implied
2588 - warranty. In no event will the authors be held liable for any damages
2589 - arising from the use of this software.
2590 -
2591 - Permission is granted to anyone to use this software for any purpose,
2592 - including commercial applications, and to alter it and redistribute it
2593 - freely, subject to the following restrictions:
2594 -
2595 - 1. The origin of this software must not be misrepresented; you must not
2596 - claim that you wrote the original software. If you use this software
2597 - in a product, an acknowledgment in the product documentation would be
2598 - appreciated but is not required.
2599 - 2. Altered source versions must be plainly marked as such, and must not be
2600 - misrepresented as being the original software.
2601 - 3. This notice may not be removed or altered from any source distribution.
2602 -
2603 - Jean-loup Gailly Mark Adler
2604 - jloup@gzip.org madler@alumni.caltech.edu
2605 -
2606 -
2607 - The data format used by the zlib library is described by RFCs (Request for
2608 - Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
2609 - (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
2610 -*/
2611 -
2612 -var ZLIB = ( ZLIB || {} ); // ZLIB namespace initialization
2613 -
2614 -// common definitions
2615 -if(typeof ZLIB.common_initialized === 'undefined') {
2616 - ZLIB.Z_NO_FLUSH = 0;
2617 - ZLIB.Z_PARTIAL_FLUSH = 1;
2618 - ZLIB.Z_SYNC_FLUSH = 2;
2619 - ZLIB.Z_FULL_FLUSH = 3;
2620 - ZLIB.Z_FINISH = 4;
2621 - ZLIB.Z_BLOCK = 5;
2622 - ZLIB.Z_TREES = 6;
2623 - /* Allowed flush values; see deflate() and inflate() below for details */
2624 -
2625 - ZLIB.Z_OK = 0;
2626 - ZLIB.Z_STREAM_END = 1;
2627 - ZLIB.Z_NEED_DICT = 2;
2628 - ZLIB.Z_ERRNO = (-1);
2629 - ZLIB.Z_STREAM_ERROR = (-2);
2630 - ZLIB.Z_DATA_ERROR = (-3);
2631 - ZLIB.Z_MEM_ERROR = (-4);
2632 - ZLIB.Z_BUF_ERROR = (-5);
2633 - ZLIB.Z_VERSION_ERROR = (-6);
2634 - /* Return codes for the compression/decompression functions. Negative values
2635 - * are errors, positive values are used for special but normal events.
2636 - */
2637 -
2638 - ZLIB.Z_DEFLATED = 8; /* The deflate compression method (the only one supported in this version) */
2639 -
2640 - /**
2641 - * z_stream constructor
2642 - * @constructor
2643 - */
2644 - ZLIB.z_stream = function() {
2645 - this.next_in = 0; /* next input byte */
2646 - this.avail_in = 0; /* number of bytes available in input_data */
2647 - this.total_in = 0; /* total number of input bytes read so far */
2648 -
2649 - this.next_out = 0; /* next output byte */
2650 - this.avail_out = 0; /* remaining free space at next_out */
2651 - this.total_out = 0; /* total number of bytes output so far */
2652 -
2653 - this.msg = null; /* last error message, null if no error */
2654 - this.state = null; /* not visible by applications */
2655 -
2656 - this.data_type = 0; /* best guess about the data type: binary or text */
2657 - this.adler = 0; /* TODO: adler32 value of the uncompressed data */
2658 -
2659 - // zlib.js
2660 - this.input_data = ''; /* input data */
2661 - this.output_data = ''; /* output data */
2662 - this.error = 0; /* error code */
2663 - this.checksum_function = null; /* crc32(for gzip) or adler32(for zlib) */
2664 - };
2665 -
2666 - /**
2667 - * TODO
2668 - * @constructor
2669 - */
2670 - ZLIB.gz_header = function() {
2671 - this.text = 0; /* true if compressed data believed to be text */
2672 - this.time = 0; /* modification time */
2673 - this.xflags = 0; /* extra flags (not used when writing a gzip file) */
2674 - this.os = 0xff; /* operating system */
2675 - this.extra = null; /* extra field string or null if none */
2676 - this.extra_len = 0; /* this.extra.length (only when reading header) */
2677 - this.extra_max = 0; /* space at extra (only when reading header) */
2678 - this.name = null; /* file name string or null if none */
2679 - this.name_max = 0; /* space at name (only when reading header) */
2680 - this.comment = null; /* comment string or null if none */
2681 - this.comm_max = 0; /* space at comment (only when reading header) */
2682 - this.hcrc = 0; /* true if there was or will be a header crc */
2683 - this.done = 0; /* true when done reading gzip header (not used
2684 - when writing a gzip file) */
2685 - };
2686 -
2687 - ZLIB.common_initialized = true;
2688 -} // common definitions
2689 -/* zlib-inflate.js -- JavaScript implementation for the zlib inflate.
2690 - Version: 0.2.0
2691 - LastModified: Apr 12 2012
2692 - Copyright (C) 2012 Masanao Izumo <iz@onicos.co.jp>
2693 -
2694 - This library is one of the JavaScript zlib implementation.
2695 - Some API's are modified from the original.
2696 - Only inflate API is implemented.
2697 -
2698 - The original copyright notice (zlib 1.2.6):
2699 -
2700 - Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler
2701 -
2702 - This software is provided 'as-is', without any express or implied
2703 - warranty. In no event will the authors be held liable for any damages
2704 - arising from the use of this software.
2705 -
2706 - Permission is granted to anyone to use this software for any purpose,
2707 - including commercial applications, and to alter it and redistribute it
2708 - freely, subject to the following restrictions:
2709 -
2710 - 1. The origin of this software must not be misrepresented; you must not
2711 - claim that you wrote the original software. If you use this software
2712 - in a product, an acknowledgment in the product documentation would be
2713 - appreciated but is not required.
2714 - 2. Altered source versions must be plainly marked as such, and must not be
2715 - misrepresented as being the original software.
2716 - 3. This notice may not be removed or altered from any source distribution.
2717 -
2718 - Jean-loup Gailly Mark Adler
2719 - jloup@gzip.org madler@alumni.caltech.edu
2720 -
2721 -
2722 - The data format used by the zlib library is described by RFCs (Request for
2723 - Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
2724 - (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
2725 -*/
2726 -
2727 -/*
2728 - API documentation
2729 -==============================================================================
2730 -Usage: z_stream = ZLIB.inflateInit([windowBits]);
2731 -
2732 - Create the stream object for decompression.
2733 - See zlib.h for windowBits information.
2734 -
2735 -==============================================================================
2736 -Usage: decoded_string = z_stream.inflate(encoded_string [, {OPTIONS...}]);
2737 -
2738 -OPTIONS:
2739 - next_in: decode start offset for encoded_string.
2740 -
2741 - avail_in: // TODO document. See zlib.h for the information.
2742 -
2743 - avail_out: // TODO document. See zlib.h for the information.
2744 -
2745 - flush: // TODO document. See zlib.h for the information.
2746 -
2747 -Ex: decoded_string = z_stream.inflate(encoded_string);
2748 - decoded_string = z_stream.inflate(encoded_string,
2749 - {next_in: 0,
2750 - avail_in: encoded_string.length,
2751 - avail_out: 1024,
2752 - flush: ZLIB.Z_NO_FLUSH});
2753 -
2754 - See zlib.h for more information.
2755 -
2756 -==============================================================================
2757 -Usage: z_stream.inflateReset();
2758 - TODO document
2759 -
2760 -*/
2761 -
2762 -if( typeof ZLIB === 'undefined' ) {
2763 - alert('ZLIB is not defined. SRC zlib.js before zlib-inflate.js')
2764 -}
2765 -
2766 -(function() {
2767 -
2768 -/* inflate.c -- zlib decompression
2769 - * Copyright (C) 1995-2011 Mark Adler
2770 - * For conditions of distribution and use, see copyright notice in zlib.h
2771 - */
2772 -
2773 -var DEF_WBITS = 15;
2774 -
2775 -// inflate_mode
2776 -var HEAD = 0; /* i: waiting for magic header */
2777 -var FLAGS = 1; /* i: waiting for method and flags (gzip) */
2778 -var TIME = 2; /* i: waiting for modification time (gzip) */
2779 -var OS = 3; /* i: waiting for extra flags and operating system (gzip) */
2780 -var EXLEN = 4; /* i: waiting for extra length (gzip) */
2781 -var EXTRA = 5; /* i: waiting for extra bytes (gzip) */
2782 -var NAME = 6; /* i: waiting for end of file name (gzip) */
2783 -var COMMENT = 7; /* i: waiting for end of comment (gzip) */
2784 -var HCRC = 8; /* i: waiting for header crc (gzip) */
2785 -var DICTID = 9; /* i: waiting for dictionary check value */
2786 -var DICT = 10; /* waiting for inflateSetDictionary() call */
2787 -var TYPE = 11; /* i: waiting for type bits, including last-flag bit */
2788 -var TYPEDO = 12; /* i: same, but skip check to exit inflate on new block */
2789 -var STORED = 13; /* i: waiting for stored size (length and complement) */
2790 -var COPY_ = 14; /* i/o: same as COPY below, but only first time in */
2791 -var COPY = 15; /* i/o: waiting for input or output to copy stored block */
2792 -var TABLE = 16; /* i: waiting for dynamic block table lengths */
2793 -var LENLENS = 17; /* i: waiting for code length code lengths */
2794 -var CODELENS = 18; /* i: waiting for length/lit and distance code lengths */
2795 -var LEN_ = 19; /* i: same as LEN below, but only first time in */
2796 -var LEN = 20; /* i: waiting for length/lit/eob code */
2797 -var LENEXT = 21; /* i: waiting for length extra bits */
2798 -var DIST = 22; /* i: waiting for distance code */
2799 -var DISTEXT = 23; /* i: waiting for distance extra bits */
2800 -var MATCH = 24; /* o: waiting for output space to copy string */
2801 -var LIT = 25; /* o: waiting for output space to write literal */
2802 -var CHECK = 26; /* i: waiting for 32-bit check value */
2803 -var LENGTH = 27; /* i: waiting for 32-bit length (gzip) */
2804 -var DONE = 28; /* finished check, done -- remain here until reset */
2805 -var BAD = 29; /* got a data error -- remain here until reset */
2806 -var MEM = 30; /* got an inflate() memory error -- remain here until reset */
2807 -var SYNC = 31; /* looking for synchronization bytes to restart inflate() */
2808 -
2809 -/* Maximum size of the dynamic table. The maximum number of code structures is
2810 - 1444, which is the sum of 852 for literal/length codes and 592 for distance
2811 - codes. These values were found by exhaustive searches using the program
2812 - examples/enough.c found in the zlib distribtution. The arguments to that
2813 - program are the number of symbols, the initial root table size, and the
2814 - maximum bit length of a code. "enough 286 9 15" for literal/length codes
2815 - returns returns 852, and "enough 30 6 15" for distance codes returns 592.
2816 - The initial root table size (9 or 6) is found in the fifth argument of the
2817 - inflate_table() calls in inflate.c and infback.c. If the root table size is
2818 - changed, then these maximum sizes would be need to be recalculated and
2819 - updated. */
2820 -var ENOUGH_LENS = 852;
2821 -var ENOUGH_DISTS = 592;
2822 -var ENOUGH = (ENOUGH_LENS + ENOUGH_DISTS);
2823 -
2824 -/* Type of code to build for inflate_table() */
2825 -var CODES = 0;
2826 -var LENS = 1;
2827 -var DISTS = 2;
2828 -
2829 -
2830 -
2831 -var inflate_table_lbase = [ /* Length codes 257..285 base */
2832 - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
2833 - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0];
2834 -var inflate_table_lext = [ /* Length codes 257..285 extra */
2835 - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
2836 - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 69];
2837 -var inflate_table_dbase = [ /* Distance codes 0..29 base */
2838 - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
2839 - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
2840 - 8193, 12289, 16385, 24577, 0, 0];
2841 -var inflate_table_dext = [ /* Distance codes 0..29 extra */
2842 - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
2843 - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
2844 - 28, 28, 29, 29, 64, 64];
2845 -
2846 -/* inftrees.c -- generate Huffman trees for efficient decoding
2847 - * Copyright (C) 1995-2012 Mark Adler
2848 - * For conditions of distribution and use, see copyright notice in zlib.h
2849 - */
2850 -
2851 -ZLIB.inflate_copyright =
2852 - ' inflate 1.2.6 Copyright 1995-2012 Mark Adler ';
2853 -/*
2854 - If you use the zlib library in a product, an acknowledgment is welcome
2855 - in the documentation of your product. If for some reason you cannot
2856 - include such an acknowledgment, I would appreciate that you keep this
2857 - copyright string in the executable of your product.
2858 - */
2859 -
2860 -/*
2861 - Build a set of tables to decode the provided canonical Huffman code.
2862 - The code lengths are lens[0..codes-1]. The result starts at *table,
2863 - whose indices are 0..2^bits-1. work is a writable array of at least
2864 - lens shorts, which is used as a work area. type is the type of code
2865 - to be generated, CODES, LENS, or DISTS. On return, zero is success,
2866 - -1 is an invalid code, and +1 means that ENOUGH isn't enough. table
2867 - on return points to the next available entry's address. bits is the
2868 - requested root table index bits, and on return it is the actual root
2869 - table index bits. It will differ if the request is greater than the
2870 - longest code or if it is less than the shortest code.
2871 -*/
2872 -function inflate_table(state, type)
2873 -{
2874 - var MAXBITS = 15;
2875 - var table = state.next;
2876 - var bits = (type == DISTS ? state.distbits : state.lenbits);
2877 - var work = state.work;
2878 - var lens = state.lens;
2879 - var lens_offset = (type == DISTS ? state.nlen : 0);
2880 - var state_codes = state.codes;
2881 - var codes;
2882 - if(type == LENS)
2883 - codes = state.nlen;
2884 - else if(type == DISTS)
2885 - codes = state.ndist;
2886 - else // CODES
2887 - codes = 19;
2888 -
2889 - var len; /* a code's length in bits */
2890 - var sym; /* index of code symbols */
2891 - var min, max; /* minimum and maximum code lengths */
2892 - var root; /* number of index bits for root table */
2893 - var curr; /* number of index bits for current table */
2894 - var drop; /* code bits to drop for sub-table */
2895 - var left; /* number of prefix codes available */
2896 - var used; /* code entries in table used */
2897 - var huff; /* Huffman code */
2898 - var incr; /* for incrementing code, index */
2899 - var fill; /* index for replicating entries */
2900 - var low; /* low bits for current root entry */
2901 - var mask; /* mask for low root bits */
2902 - var here; /* table entry for duplication */
2903 - var next; /* next available space in table */
2904 - var base; /* base value table to use */
2905 - var base_offset;
2906 - var extra; /* extra bits table to use */
2907 - var extra_offset;
2908 - var end; /* use base and extra for symbol > end */
2909 - var count = new Array(MAXBITS+1); /* number of codes of each length */
2910 - var offs = new Array(MAXBITS+1); /* offsets in table for each length */
2911 -
2912 - /*
2913 - Process a set of code lengths to create a canonical Huffman code. The
2914 - code lengths are lens[0..codes-1]. Each length corresponds to the
2915 - symbols 0..codes-1. The Huffman code is generated by first sorting the
2916 - symbols by length from short to long, and retaining the symbol order
2917 - for codes with equal lengths. Then the code starts with all zero bits
2918 - for the first code of the shortest length, and the codes are integer
2919 - increments for the same length, and zeros are appended as the length
2920 - increases. For the deflate format, these bits are stored backwards
2921 - from their more natural integer increment ordering, and so when the
2922 - decoding tables are built in the large loop below, the integer codes
2923 - are incremented backwards.
2924 -
2925 - This routine assumes, but does not check, that all of the entries in
2926 - lens[] are in the range 0..MAXBITS. The caller must assure this.
2927 - 1..MAXBITS is interpreted as that code length. zero means that that
2928 - symbol does not occur in this code.
2929 -
2930 - The codes are sorted by computing a count of codes for each length,
2931 - creating from that a table of starting indices for each length in the
2932 - sorted table, and then entering the symbols in order in the sorted
2933 - table. The sorted table is work[], with that space being provided by
2934 - the caller.
2935 -
2936 - The length counts are used for other purposes as well, i.e. finding
2937 - the minimum and maximum length codes, determining if there are any
2938 - codes at all, checking for a valid set of lengths, and looking ahead
2939 - at length counts to determine sub-table sizes when building the
2940 - decoding tables.
2941 - */
2942 -
2943 - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
2944 - for (len = 0; len <= MAXBITS; len++)
2945 - count[len] = 0;
2946 - for (sym = 0; sym < codes; sym++)
2947 - count[lens[lens_offset + sym]]++;
2948 -
2949 - /* bound code lengths, force root to be within code lengths */
2950 - root = bits;
2951 -
2952 - for (max = MAXBITS; max >= 1; max--)
2953 - if (count[max] != 0) break;
2954 - if (root > max) root = max;
2955 - if (max == 0) {
2956 - /* no symbols to code at all */
2957 - /* invalid code marker */
2958 - here = {op:64, bits:1, val:0};
2959 - state_codes[table++] = here; /* make a table to force an error */
2960 - state_codes[table++] = here;
2961 - if(type == DISTS) state.distbits = 1; else state.lenbits = 1; // *bits = 1;
2962 - state.next = table;
2963 - return 0; /* no symbols, but wait for decoding to report error */
2964 - }
2965 - for (min = 1; min < max; min++)
2966 - if (count[min] != 0) break;
2967 - if (root < min) root = min;
2968 -
2969 - /* check for an over-subscribed or incomplete set of lengths */
2970 - left = 1;
2971 - for (len = 1; len <= MAXBITS; len++) {
2972 - left <<= 1;
2973 - left -= count[len];
2974 - if (left < 0) return -1; /* over-subscribed */
2975 - }
2976 - if (left > 0 && (type == CODES || max != 1)) {
2977 - state.next = table;
2978 - return -1; /* incomplete set */
2979 - }
2980 -
2981 - /* generate offsets into symbol table for each length for sorting */
2982 - offs[1] = 0;
2983 - for (len = 1; len < MAXBITS; len++)
2984 - offs[len + 1] = offs[len] + count[len];
2985 -
2986 - /* sort symbols by length, by symbol order within each length */
2987 - for (sym = 0; sym < codes; sym++)
2988 - if (lens[lens_offset + sym] != 0) work[offs[lens[lens_offset + sym]]++] = sym;
2989 -
2990 - /*
2991 - Create and fill in decoding tables. In this loop, the table being
2992 - filled is at next and has curr index bits. The code being used is huff
2993 - with length len. That code is converted to an index by dropping drop
2994 - bits off of the bottom. For codes where len is less than drop + curr,
2995 - those top drop + curr - len bits are incremented through all values to
2996 - fill the table with replicated entries.
2997 -
2998 - root is the number of index bits for the root table. When len exceeds
2999 - root, sub-tables are created pointed to by the root entry with an index
3000 - of the low root bits of huff. This is saved in low to check for when a
3001 - new sub-table should be started. drop is zero when the root table is
3002 - being filled, and drop is root when sub-tables are being filled.
3003 -
3004 - When a new sub-table is needed, it is necessary to look ahead in the
3005 - code lengths to determine what size sub-table is needed. The length
3006 - counts are used for this, and so count[] is decremented as codes are
3007 - entered in the tables.
3008 -
3009 - used keeps track of how many table entries have been allocated from the
3010 - provided *table space. It is checked for LENS and DIST tables against
3011 - the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
3012 - the initial root table size constants. See the comments in inftrees.h
3013 - for more information.
3014 -
3015 - sym increments through all symbols, and the loop terminates when
3016 - all codes of length max, i.e. all codes, have been processed. This
3017 - routine permits incomplete codes, so another loop after this one fills
3018 - in the rest of the decoding tables with invalid code markers.
3019 - */
3020 -
3021 - /* set up for code type */
3022 - switch (type) {
3023 - case CODES:
3024 - base = extra = work; /* dummy value--not used */
3025 - base_offset = 0;
3026 - extra_offset = 0;
3027 - end = 19;
3028 - break;
3029 - case LENS:
3030 - base = inflate_table_lbase;
3031 - base_offset = -257; // base -= 257;
3032 - extra = inflate_table_lext;
3033 - extra_offset = -257; // extra -= 257;
3034 - end = 256;
3035 - break;
3036 - default: /* DISTS */
3037 - base = inflate_table_dbase;
3038 - extra = inflate_table_dext;
3039 - base_offset = 0;
3040 - extra_offset = 0;
3041 - end = -1;
3042 - }
3043 -
3044 - /* initialize state for loop */
3045 - huff = 0; /* starting code */
3046 - sym = 0; /* starting code symbol */
3047 - len = min; /* starting code length */
3048 - next = table; /* current table to fill in */
3049 - curr = root; /* current table index bits */
3050 - drop = 0; /* current bits to drop from code for index */
3051 - low = -1; /* trigger new sub-table when len > root */
3052 - used = 1 << root; /* use root table entries */
3053 - mask = used - 1; /* mask for comparing low */
3054 -
3055 - /* check available table space */
3056 - if ((type == LENS && used >= ENOUGH_LENS) ||
3057 - (type == DISTS && used >= ENOUGH_DISTS)) {
3058 - state.next = table;
3059 - return 1;
3060 - }
3061 -
3062 - /* process all codes and make table entries */
3063 - for (;;) {
3064 - /* create table entry */
3065 - here = {op:0, bits:len - drop, val:0};
3066 - if (work[sym] < end) {
3067 - here.val = work[sym];
3068 - }
3069 - else if (work[sym] > end) {
3070 - here.op = extra[extra_offset + work[sym]];
3071 - here.val = base[base_offset + work[sym]];
3072 - }
3073 - else {
3074 - here.op = 32 + 64; /* end of block */
3075 - }
3076 -
3077 - /* replicate for those indices with low len bits equal to huff */
3078 - incr = 1 << (len - drop);
3079 - fill = 1 << curr;
3080 - min = fill; /* save offset to next table */
3081 - do {
3082 - fill -= incr;
3083 - state_codes[next + (huff >>> drop) + fill] = here;
3084 - } while (fill != 0);
3085 -
3086 - /* backwards increment the len-bit code huff */
3087 - incr = 1 << (len - 1);
3088 - while (huff & incr)
3089 - incr >>>= 1;
3090 - if (incr != 0) {
3091 - huff &= incr - 1;
3092 - huff += incr;
3093 - }
3094 - else
3095 - huff = 0;
3096 -
3097 - /* go to next symbol, update count, len */
3098 - sym++;
3099 - if (--(count[len]) == 0) {
3100 - if (len == max) break;
3101 - len = lens[lens_offset + work[sym]];
3102 - }
3103 -
3104 - /* create new sub-table if needed */
3105 - if (len > root && (huff & mask) != low) {
3106 - /* if first time, transition to sub-tables */
3107 - if (drop == 0)
3108 - drop = root;
3109 -
3110 - /* increment past last table */
3111 - next += min; /* here min is 1 << curr */
3112 -
3113 - /* determine length of next table */
3114 - curr = len - drop;
3115 - left = (1 << curr);
3116 - while (curr + drop < max) {
3117 - left -= count[curr + drop];
3118 - if (left <= 0) break;
3119 - curr++;
3120 - left <<= 1;
3121 - }
3122 -
3123 - /* check for enough space */
3124 - used += 1 << curr;
3125 - if ((type == LENS && used >= ENOUGH_LENS) ||
3126 - (type == DISTS && used >= ENOUGH_DISTS)) {
3127 - state.next = table;
3128 - return 1;
3129 - }
3130 -
3131 - /* point entry in root table to sub-table */
3132 - low = huff & mask;
3133 - state_codes[table + low] = {op:curr, bits:root, val:next - table};
3134 - }
3135 - }
3136 -
3137 - /* fill in remaining table entry if code is incomplete (guaranteed to have
3138 - at most one remaining entry, since if the code is incomplete, the
3139 - maximum code length that was allowed to get this far is one bit) */
3140 - if (huff != 0) {
3141 - state_codes[next + huff] = {op:64, bits:len - drop, val:0};
3142 - }
3143 -
3144 - /* set return parameters */
3145 - state.next = table + used;
3146 - if(type == DISTS) state.distbits = root; else state.lenbits = root; //*bits = root;
3147 - return 0;
3148 -}
3149 -
3150 -/* inffast.c -- fast decoding
3151 - * Copyright (C) 1995-2008, 2010 Mark Adler
3152 - * For conditions of distribution and use, see copyright notice in zlib.h
3153 - */
3154 -
3155 -/*
3156 - Decode literal, length, and distance codes and write out the resulting
3157 - literal and match bytes until either not enough input or output is
3158 - available, an end-of-block is encountered, or a data error is encountered.
3159 - When large enough input and output buffers are supplied to inflate(), for
3160 - example, a 16K input buffer and a 64K output buffer, more than 95% of the
3161 - inflate execution time is spent in this routine.
3162 -
3163 - Entry assumptions:
3164 -
3165 - state->mode == LEN
3166 - strm->avail_in >= 6
3167 - strm->avail_out >= 258
3168 - start >= strm->avail_out
3169 - state->bits < 8
3170 -
3171 - On return, state->mode is one of:
3172 -
3173 - LEN -- ran out of enough output space or enough available input
3174 - TYPE -- reached end of block code, inflate() to interpret next block
3175 - BAD -- error in block data
3176 -
3177 - Notes:
3178 -
3179 - - The maximum input bits used by a length/distance pair is 15 bits for the
3180 - length code, 5 bits for the length extra, 15 bits for the distance code,
3181 - and 13 bits for the distance extra. This totals 48 bits, or six bytes.
3182 - Therefore if strm->avail_in >= 6, then there is enough input to avoid
3183 - checking for available input while decoding.
3184 -
3185 - - The maximum bytes that a single length/distance pair can output is 258
3186 - bytes, which is the maximum length that can be coded. inflate_fast()
3187 - requires strm->avail_out >= 258 for each loop to avoid checking for
3188 - output space.
3189 - */
3190 -function inflate_fast(strm,
3191 - start) /* inflate()'s starting value for strm->avail_out */
3192 -{
3193 - var state;
3194 - var input_data; /* local strm->input_data */
3195 - var next_in; /* zlib.js: index of input_data */
3196 - var last; /* while next_in < last, enough input available */
3197 - var out; /* local strm.next_out */
3198 - var beg; /* inflate()'s initial strm.next_out */
3199 - var end; /* while out < end, enough space available */
3200 -//NOSPRT #ifdef INFLATE_STRICT
3201 -// unsigned dmax; /* maximum distance from zlib header */
3202 -//#endif
3203 - var wsize; /* window size or zero if not using window */
3204 - var whave; /* valid bytes in the window */
3205 - var wnext; /* window write index */
3206 - var window; /* allocated sliding window, if wsize != 0 */
3207 - var hold; /* local strm->hold */
3208 - var bits; /* local strm->bits */
3209 - var codes; /* zlib.js: local state.codes */
3210 - var lcode; /* local strm->lencode */
3211 - var dcode; /* local strm->distcode */
3212 - var lmask; /* mask for first level of length codes */
3213 - var dmask; /* mask for first level of distance codes */
3214 - var here; /* retrieved table entry */
3215 - var op; /* code bits, operation, extra bits, or */
3216 - /* window position, window bytes to copy */
3217 - var len; /* match length, unused bytes */
3218 - var dist; /* match distance */
3219 - // var from; /* where to copy match from */
3220 - var from_window_offset = -1; /* index of window[] */
3221 - var from_out_offset = -1; /* index of next_out[] */
3222 -
3223 - /* copy state to local variables */
3224 - state = strm.state;
3225 - input_data = strm.input_data;
3226 - next_in = strm.next_in;
3227 - last = next_in + strm.avail_in - 5;
3228 - out = strm.next_out;
3229 - beg = out - (start - strm.avail_out);
3230 - end = out + (strm.avail_out - 257);
3231 -//NOSPRT #ifdef INFLATE_STRICT
3232 -// dmax = state->dmax;
3233 -//#endif
3234 - wsize = state.wsize;
3235 - whave = state.whave;
3236 - wnext = state.wnext;
3237 - window = state.window;
3238 - hold = state.hold;
3239 - bits = state.bits;
3240 - codes = state.codes;
3241 - lcode = state.lencode;
3242 - dcode = state.distcode;
3243 - lmask = (1 << state.lenbits) - 1;
3244 - dmask = (1 << state.distbits) - 1;
3245 -
3246 - /* decode literals and length/distances until end-of-block or not enough
3247 - input data or output space */
3248 -loop: do {
3249 - if (bits < 15) {
3250 - hold += (input_data.charCodeAt(next_in++) & 0xff) << bits;
3251 - bits += 8;
3252 - hold += (input_data.charCodeAt(next_in++) & 0xff) << bits;
3253 - bits += 8;
3254 - }
3255 - here = codes[lcode + (hold & lmask)];
3256 - dolen: while(true) {
3257 - op = here.bits;
3258 - hold >>>= op;
3259 - bits -= op;
3260 - op = here.op;
3261 - if (op == 0) { /* literal */
3262 -// Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
3263 -// "inflate: literal '%c'\n" :
3264 -// "inflate: literal 0x%02x\n", here.val));
3265 - strm.output_data += String.fromCharCode(here.val);
3266 - out++;
3267 - }
3268 - else if (op & 16) { /* length base */
3269 - len = here.val;
3270 - op &= 15; /* number of extra bits */
3271 - if (op) {
3272 - if (bits < op) {
3273 - hold += (input_data.charCodeAt(next_in++) & 0xff) << bits;
3274 - bits += 8;
3275 - }
3276 - len += hold & ((1 << op) - 1);
3277 - hold >>>= op;
3278 - bits -= op;
3279 - }
3280 -// Tracevv((stderr, "inflate: length %u\n", len));
3281 - if (bits < 15) {
3282 - hold += (input_data.charCodeAt(next_in++) & 0xff) << bits;
3283 - bits += 8;
3284 - hold += (input_data.charCodeAt(next_in++) & 0xff) << bits;
3285 - bits += 8;
3286 - }
3287 - here = codes[dcode + (hold & dmask)];
3288 - dodist: while(true) {
3289 - op = here.bits;
3290 - hold >>>= op;
3291 - bits -= op;
3292 - op = here.op;
3293 - if (op & 16) { /* distance base */
3294 - dist = here.val;
3295 - op &= 15; /* number of extra bits */
3296 - if (bits < op) {
3297 - hold += (input_data.charCodeAt(next_in++) & 0xff) << bits;
3298 - bits += 8;
3299 - if (bits < op) {
3300 - hold += (input_data.charCodeAt(next_in++) & 0xff) << bits;
3301 - bits += 8;
3302 - }
3303 - }
3304 - dist += hold & ((1 << op) - 1);
3305 -//NOSPRT #ifdef INFLATE_STRICT
3306 -// if (dist > dmax) {
3307 -// strm->msg = (char *)"invalid distance too far back";
3308 -// state->mode = BAD;
3309 -// break loop;
3310 -// }
3311 -//#endif
3312 - hold >>>= op;
3313 - bits -= op;
3314 -// Tracevv((stderr, "inflate: distance %u\n", dist));
3315 - op = out - beg; /* max distance in output */
3316 - if (dist > op) { /* see if copy from window */
3317 - op = dist - op; /* distance back in window */
3318 - if (op > whave) {
3319 - if (state.sane) {
3320 - strm.msg = 'invalid distance too far back';
3321 - state.mode = BAD;
3322 - break loop;
3323 - }
3324 -//NOSPRT #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
3325 -// if (len <= op - whave) {
3326 -// do {
3327 -// PUP(out) = 0;
3328 -// } while (--len);
3329 -// continue;
3330 -// }
3331 -// len -= op - whave;
3332 -// do {
3333 -// PUP(out) = 0;
3334 -// } while (--op > whave);
3335 -// if (op == 0) {
3336 -// from = out - dist;
3337 -// do {
3338 -// PUP(out) = PUP(from);
3339 -// } while (--len);
3340 -// continue;
3341 -// }
3342 -//#endif
3343 - } // if (op > whave)
3344 -
3345 - from_window_offset = 0;
3346 - from_out_offset = -1;
3347 - if (wnext == 0) { /* very common case */
3348 - from_window_offset += wsize - op;
3349 - if (op < len) { /* some from window */
3350 - len -= op;
3351 - strm.output_data += window.substring(from_window_offset, from_window_offset + op);
3352 - out += op;
3353 - op = 0;
3354 - from_window_offset = -1;
3355 - from_out_offset = out - dist; /* rest from output */
3356 - }
3357 - }
3358 -//NOTREACHED else if (wnext < op) { /* wrap around window */
3359 -//NOTREACHED from += wsize + wnext - op;
3360 -//NOTREACHED op -= wnext;
3361 -//NOTREACHED if (op < len) { /* some from end of window */
3362 -//NOTREACHED len -= op;
3363 -//NOTREACHED do {
3364 -//NOTREACHED PUP(out) = PUP(from);
3365 -//NOTREACHED } while (--op);
3366 -//NOTREACHED from = window - OFF;
3367 -//NOTREACHED if (wnext < len) { /* some from start of window */
3368 -//NOTREACHED op = wnext;
3369 -//NOTREACHED len -= op;
3370 -//NOTREACHED do {
3371 -//NOTREACHED PUP(out) = PUP(from);
3372 -//NOTREACHED } while (--op);
3373 -//NOTREACHED from = out - dist; /* rest from output */
3374 -//NOTREACHED }
3375 -//NOTREACHED }
3376 -//NOTREACHED }
3377 - else { /* contiguous in window */
3378 - from_window_offset += wnext - op;
3379 - if (op < len) { /* some from window */
3380 - len -= op;
3381 - strm.output_data += window.substring(from_window_offset, from_window_offset + op);
3382 - out += op;
3383 - from_window_offset = -1;
3384 - from_out_offset = out - dist; /* rest from output */
3385 - }
3386 - }
3387 - }
3388 - else {
3389 - from_window_offset = -1;
3390 - from_out_offset = out - dist; /* copy direct from output */
3391 - }
3392 -
3393 - if (from_window_offset >= 0) {
3394 - strm.output_data += window.substring(from_window_offset, from_window_offset + len);
3395 - out += len;
3396 - from_window_offset += len;
3397 - } else {
3398 - var len_inner = len;
3399 - if(len_inner > out - from_out_offset)
3400 - len_inner = out - from_out_offset;
3401 - strm.output_data += strm.output_data.substring(
3402 - from_out_offset, from_out_offset + len_inner);
3403 - out += len_inner;
3404 - len -= len_inner;
3405 - from_out_offset += len_inner;
3406 - out += len;
3407 - while (len > 2) {
3408 - strm.output_data += strm.output_data.charAt(from_out_offset++);
3409 - strm.output_data += strm.output_data.charAt(from_out_offset++);
3410 - strm.output_data += strm.output_data.charAt(from_out_offset++);
3411 - len -= 3;
3412 - }
3413 - if (len) {
3414 - strm.output_data += strm.output_data.charAt(from_out_offset++);
3415 - if (len > 1)
3416 - strm.output_data += strm.output_data.charAt(from_out_offset++);
3417 - }
3418 - }
3419 - }
3420 - else if ((op & 64) == 0) { /* 2nd level distance code */
3421 - here = codes[dcode + (here.val + (hold & ((1 << op) - 1)))];
3422 - continue dodist; // goto dodist
3423 - }
3424 - else {
3425 - strm.msg = 'invalid distance code';
3426 - state.mode = BAD;
3427 - break loop;
3428 - }
3429 - break dodist; }
3430 - }
3431 - else if ((op & 64) == 0) { /* 2nd level length code */
3432 - here = codes[lcode + (here.val + (hold & ((1 << op) - 1)))];
3433 - continue dolen; // goto dolen;
3434 - }
3435 - else if (op & 32) { /* end-of-block */
3436 - // Tracevv((stderr, "inflate: end of block\n"));
3437 - state.mode = TYPE;
3438 - break loop;
3439 - }
3440 - else {
3441 - strm.msg = 'invalid literal/length code';
3442 - state.mode = BAD;
3443 - break loop;
3444 - }
3445 - break dolen; }
3446 - } while (next_in < last && out < end);
3447 -
3448 - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
3449 - len = bits >>> 3;
3450 - next_in -= len;
3451 - bits -= len << 3;
3452 - hold &= (1 << bits) - 1;
3453 -
3454 - /* update state and return */
3455 - strm.next_in = next_in;
3456 - strm.next_out = out;
3457 - strm.avail_in = (next_in < last ? 5 + (last - next_in) : 5 - (next_in - last));
3458 - strm.avail_out = (out < end ?
3459 - 257 + (end - out) : 257 - (out - end));
3460 - state.hold = hold;
3461 - state.bits = bits;
3462 -}
3463 -
3464 -function new_array(size)
3465 -{
3466 - var i;
3467 - var ary = new Array(size);
3468 - for(i = 0; i < size; i++)
3469 - ary[i] = 0;
3470 - return ary;
3471 -}
3472 -
3473 -function getarg(opts, name, def_value)
3474 -{
3475 - return (opts && (name in opts)) ? opts[name] : def_value;
3476 -}
3477 -
3478 -function checksum_none()
3479 -{
3480 - return 0;
3481 -}
3482 -
3483 -/**
3484 - * z_stream constructor
3485 - * @constructor
3486 - */
3487 -function inflate_state()
3488 -{
3489 - var i;
3490 -
3491 - this.mode = 0; /* current inflate mode */
3492 - this.last = 0; /* true if processing last block */
3493 - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
3494 - this.havedict = 0; /* true if dictionary provided */
3495 - this.flags = 0; /* gzip header method and flags (0 if zlib) */
3496 - this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */
3497 - this.check = 0; /* protected copy of check value */
3498 - this.total = 0; /* protected copy of output count */
3499 - this.head = null; /* where to save gzip header information */
3500 - /* sliding window */
3501 - this.wbits = 0; /* log base 2 of requested window size */
3502 - this.wsize = 0; /* window size or zero if not using window */
3503 - this.whave = 0; /* valid bytes in the window */
3504 - this.wnext = 0; /* window write index (TODO remove) */
3505 - this.window = null; /* allocated sliding window, if needed */
3506 - /* bit accumulator */
3507 - this.hold = 0; /* input bit accumulator */
3508 - this.bits = 0; /* number of bits in "in" */
3509 - /* for string and stored block copying */
3510 - this.length = 0; /* literal or length of data to copy */
3511 - this.offset = 0; /* distance back to copy string from */
3512 - /* for table and code decoding */
3513 - this.extra = 0; /* extra bits needed */
3514 - /* fixed and dynamic code tables */
3515 -
3516 - /* zlib.js: modified implementation: lencode, distcode, next are offset of codes[] */
3517 - this.lencode = 0; /* starting table for length/literal codes */
3518 - this.distcode = 0; /* starting table for distance codes */
3519 - this.lenbits = 0; /* index bits for lencode */
3520 - this.distbits = 0; /* index bits for distcode */
3521 - /* dynamic table building */
3522 - this.ncode = 0; /* number of code length code lengths */
3523 - this.nlen = 0; /* number of length code lengths */
3524 - this.ndist = 0; /* number of distance code lengths */
3525 - this.have = 0; /* number of code lengths in lens[] */
3526 - this.next = 0; /* next available space in codes[] */
3527 - this.lens = new_array(320); /* temporary storage for code lengths */
3528 - this.work = new_array(288); /* work area for code table building */
3529 - this.codes = new Array(ENOUGH); /* space for code tables */
3530 - var c = {op:0, bits:0, val:0};
3531 - for(i = 0; i < ENOUGH; i++)
3532 - this.codes[i] = c;
3533 - this.sane = 0; /* if false, allow invalid distance too far */
3534 - this.back = 0; /* bits back of last unprocessed length/lit */
3535 - this.was = 0; /* initial length of match */
3536 -}
3537 -
3538 -ZLIB.inflateResetKeep = function(strm)
3539 -{
3540 - var state;
3541 -
3542 - if (!strm || !strm.state) return ZLIB.Z_STREAM_ERROR;
3543 - state = strm.state;
3544 - strm.total_in = strm.total_out = state.total = 0;
3545 - strm.msg = null;
3546 - if (state.wrap) { /* to support ill-conceived Java test suite */
3547 - strm.adler = state.wrap & 1;
3548 - }
3549 -
3550 - state.mode = HEAD;
3551 - state.last = 0;
3552 - state.havedict = 0;
3553 - state.dmax = 32768;
3554 - state.head = null;
3555 - state.hold = 0;
3556 - state.bits = 0;
3557 - state.lencode = 0;
3558 - state.distcode = 0;
3559 - state.next = 0;
3560 - state.sane = 1;
3561 - state.back = -1;
3562 - return ZLIB.Z_OK;
3563 -};
3564 -
3565 -// Usage: strm = ZLIB.inflateReset(z_stream [, windowBits]);
3566 -ZLIB.inflateReset = function(strm, windowBits)
3567 -{
3568 - var wrap;
3569 - var state;
3570 -
3571 - /* get the state */
3572 - if (!strm || !strm.state) return ZLIB.Z_STREAM_ERROR;
3573 - state = strm.state;
3574 -
3575 - if(typeof windowBits === "undefined")
3576 - windowBits = DEF_WBITS;
3577 -
3578 - /* extract wrap request from windowBits parameter */
3579 - if (windowBits < 0) {
3580 - wrap = 0;
3581 - windowBits = -windowBits;
3582 - }
3583 - else {
3584 - wrap = (windowBits >>> 4) + 1;
3585 - if (windowBits < 48)
3586 - windowBits &= 15;
3587 - }
3588 -
3589 - if(wrap == 1 && (typeof ZLIB.adler32 === 'function')) {
3590 - strm.checksum_function = ZLIB.adler32;
3591 - } else if(wrap == 2 && (typeof ZLIB.crc32 === 'function')) {
3592 - strm.checksum_function = ZLIB.crc32;
3593 - } else {
3594 - strm.checksum_function = checksum_none;
3595 - }
3596 -
3597 - /* set number of window bits, free window if different */
3598 - if (windowBits && (windowBits < 8 || windowBits > 15))
3599 - return ZLIB.Z_STREAM_ERROR;
3600 - if (state.window && state.wbits != windowBits) {
3601 - state.window = null;
3602 - }
3603 -
3604 - /* update state and reset the rest of it */
3605 - state.wrap = wrap;
3606 - state.wbits = windowBits;
3607 - state.wsize = 0;
3608 - state.whave = 0;
3609 - state.wnext = 0;
3610 - return ZLIB.inflateResetKeep(strm);
3611 -};
3612 -
3613 -// Usage: strm = ZLIB.inflateInit([windowBits]);
3614 -ZLIB.inflateInit = function(windowBits)
3615 -{
3616 - var strm = new ZLIB.z_stream();
3617 - strm.state = new inflate_state();
3618 - ZLIB.inflateReset(strm, windowBits);
3619 - return strm;
3620 -};
3621 -
3622 -ZLIB.inflatePrime = function(strm, bits, value)
3623 -{
3624 - var state;
3625 -
3626 - if (!strm || !strm.state) return ZLIB.Z_STREAM_ERROR;
3627 - state = strm.state;
3628 - if (bits < 0) {
3629 - state.hold = 0;
3630 - state.bits = 0;
3631 - return ZLIB.Z_OK;
3632 - }
3633 - if (bits > 16 || state.bits + bits > 32) return ZLIB.Z_STREAM_ERROR;
3634 - value &= (1 << bits) - 1;
3635 - state.hold += value << state.bits;
3636 - state.bits += bits;
3637 - return ZLIB.Z_OK;
3638 -};
3639 -
3640 -var lenfix_ary = null;
3641 -var distfix_ary = null;
3642 -function fixedtables(state)
3643 -{
3644 - var i;
3645 - if (!lenfix_ary) lenfix_ary = [ { op: 96, bits: 7, val: 0 }, { op: 0, bits: 8, val: 80 }, { op: 0, bits: 8, val: 16 }, { op: 20, bits: 8, val: 115 }, { op: 18, bits: 7, val: 31 }, { op: 0, bits: 8, val: 112 }, { op: 0, bits: 8, val: 48 }, { op: 0, bits: 9, val: 192 }, { op: 16, bits: 7, val: 10 }, { op: 0, bits: 8, val: 96 }, { op: 0, bits: 8, val: 32 }, { op: 0, bits: 9, val: 160 }, { op: 0, bits: 8, val: 0 }, { op: 0, bits: 8, val: 128 }, { op: 0, bits: 8, val: 64 }, { op: 0, bits: 9, val: 224 }, { op: 16, bits: 7, val: 6 }, { op: 0, bits: 8, val: 88 }, { op: 0, bits: 8, val: 24 }, { op: 0, bits: 9, val: 144 }, { op: 19, bits: 7, val: 59 }, { op: 0, bits: 8, val: 120 }, { op: 0, bits: 8, val: 56 }, { op: 0, bits: 9, val: 208 }, { op: 17, bits: 7, val: 17 }, { op: 0, bits: 8, val: 104 }, { op: 0, bits: 8, val: 40 }, { op: 0, bits: 9, val: 176 }, { op: 0, bits: 8, val: 8 }, { op: 0, bits: 8, val: 136 }, { op: 0, bits: 8, val: 72 }, { op: 0, bits: 9, val: 240 }, { op: 16, bits: 7, val: 4 }, { op: 0, bits: 8, val: 84 }, { op: 0, bits: 8, val: 20 }, { op: 21, bits: 8, val: 227 }, { op: 19, bits: 7, val: 43 }, { op: 0, bits: 8, val: 116 }, { op: 0, bits: 8, val: 52 }, { op: 0, bits: 9, val: 200 }, { op: 17, bits: 7, val: 13 }, { op: 0, bits: 8, val: 100 }, { op: 0, bits: 8, val: 36 }, { op: 0, bits: 9, val: 168 }, { op: 0, bits: 8, val: 4 }, { op: 0, bits: 8, val: 132 }, { op: 0, bits: 8, val: 68 }, { op: 0, bits: 9, val: 232 }, { op: 16, bits: 7, val: 8 }, { op: 0, bits: 8, val: 92 }, { op: 0, bits: 8, val: 28 }, { op: 0, bits: 9, val: 152 }, { op: 20, bits: 7, val: 83 }, { op: 0, bits: 8, val: 124 }, { op: 0, bits: 8, val: 60 }, { op: 0, bits: 9, val: 216 }, { op: 18, bits: 7, val: 23 }, { op: 0, bits: 8, val: 108 }, { op: 0, bits: 8, val: 44 }, { op: 0, bits: 9, val: 184 }, { op: 0, bits: 8, val: 12 }, { op: 0, bits: 8, val: 140 }, { op: 0, bits: 8, val: 76 }, { op: 0, bits: 9, val: 248 }, { op: 16, bits: 7, val: 3 }, { op: 0, bits: 8, val: 82 }, { op: 0, bits: 8, val: 18 }, { op: 21, bits: 8, val: 163 }, { op: 19, bits: 7, val: 35 }, { op: 0, bits: 8, val: 114 }, { op: 0, bits: 8, val: 50 }, { op: 0, bits: 9, val: 196 }, { op: 17, bits: 7, val: 11 }, { op: 0, bits: 8, val: 98 }, { op: 0, bits: 8, val: 34 }, { op: 0, bits: 9, val: 164 }, { op: 0, bits: 8, val: 2 }, { op: 0, bits: 8, val: 130 }, { op: 0, bits: 8, val: 66 }, { op: 0, bits: 9, val: 228 }, { op: 16, bits: 7, val: 7 }, { op: 0, bits: 8, val: 90 }, { op: 0, bits: 8, val: 26 }, { op: 0, bits: 9, val: 148 }, { op: 20, bits: 7, val: 67 }, { op: 0, bits: 8, val: 122 }, { op: 0, bits: 8, val: 58 }, { op: 0, bits: 9, val: 212 }, { op: 18, bits: 7, val: 19 }, { op: 0, bits: 8, val: 106 }, { op: 0, bits: 8, val: 42 }, { op: 0, bits: 9, val: 180 }, { op: 0, bits: 8, val: 10 }, { op: 0, bits: 8, val: 138 }, { op: 0, bits: 8, val: 74 }, { op: 0, bits: 9, val: 244 }, { op: 16, bits: 7, val: 5 }, { op: 0, bits: 8, val: 86 }, { op: 0, bits: 8, val: 22 }, { op: 64, bits: 8, val: 0 }, { op: 19, bits: 7, val: 51 }, { op: 0, bits: 8, val: 118 }, { op: 0, bits: 8, val: 54 }, { op: 0, bits: 9, val: 204 }, { op: 17, bits: 7, val: 15 }, { op: 0, bits: 8, val: 102 }, { op: 0, bits: 8, val: 38 }, { op: 0, bits: 9, val: 172 }, { op: 0, bits: 8, val: 6 }, { op: 0, bits: 8, val: 134 }, { op: 0, bits: 8, val: 70 }, { op: 0, bits: 9, val: 236 }, { op: 16, bits: 7, val: 9 }, { op: 0, bits: 8, val: 94 }, { op: 0, bits: 8, val: 30 }, { op: 0, bits: 9, val: 156 }, { op: 20, bits: 7, val: 99 }, { op: 0, bits: 8, val: 126 }, { op: 0, bits: 8, val: 62 }, { op: 0, bits: 9, val: 220 }, { op: 18, bits: 7, val: 27 }, { op: 0, bits: 8, val: 110 }, { op: 0, bits: 8, val: 46 }, { op: 0, bits: 9, val: 188 }, { op: 0, bits: 8, val: 14 }, { op: 0, bits: 8, val: 142 }, { op: 0, bits: 8, val: 78 }, { op: 0, bits: 9, val: 252 }, { op: 96, bits: 7, val: 0 }, { op: 0, bits: 8, val: 81 }, { op: 0, bits: 8, val: 17 }, { op: 21, bits: 8, val: 131 }, { op: 18, bits: 7, val: 31 }, { op: 0, bits: 8, val: 113 }, { op: 0, bits: 8, val: 49 }, { op: 0, bits: 9, val: 194 }, { op: 16, bits: 7, val: 10 }, { op: 0, bits: 8, val: 97 }, { op: 0, bits: 8, val: 33 }, { op: 0, bits: 9, val: 162 }, { op: 0, bits: 8, val: 1 }, { op: 0, bits: 8, val: 129 }, { op: 0, bits: 8, val: 65 }, { op: 0, bits: 9, val: 226 }, { op: 16, bits: 7, val: 6 }, { op: 0, bits: 8, val: 89 }, { op: 0, bits: 8, val: 25 }, { op: 0, bits: 9, val: 146 }, { op: 19, bits: 7, val: 59 }, { op: 0, bits: 8, val: 121 }, { op: 0, bits: 8, val: 57 }, { op: 0, bits: 9, val: 210 }, { op: 17, bits: 7, val: 17 }, { op: 0, bits: 8, val: 105 }, { op: 0, bits: 8, val: 41 }, { op: 0, bits: 9, val: 178 }, { op: 0, bits: 8, val: 9 }, { op: 0, bits: 8, val: 137 }, { op: 0, bits: 8, val: 73 }, { op: 0, bits: 9, val: 242 }, { op: 16, bits: 7, val: 4 }, { op: 0, bits: 8, val: 85 }, { op: 0, bits: 8, val: 21 }, { op: 16, bits: 8, val: 258 }, { op: 19, bits: 7, val: 43 }, { op: 0, bits: 8, val: 117 }, { op: 0, bits: 8, val: 53 }, { op: 0, bits: 9, val: 202 }, { op: 17, bits: 7, val: 13 }, { op: 0, bits: 8, val: 101 }, { op: 0, bits: 8, val: 37 }, { op: 0, bits: 9, val: 170 }, { op: 0, bits: 8, val: 5 }, { op: 0, bits: 8, val: 133 }, { op: 0, bits: 8, val: 69 }, { op: 0, bits: 9, val: 234 }, { op: 16, bits: 7, val: 8 }, { op: 0, bits: 8, val: 93 }, { op: 0, bits: 8, val: 29 }, { op: 0, bits: 9, val: 154 }, { op: 20, bits: 7, val: 83 }, { op: 0, bits: 8, val: 125 }, { op: 0, bits: 8, val: 61 }, { op: 0, bits: 9, val: 218 }, { op: 18, bits: 7, val: 23 }, { op: 0, bits: 8, val: 109 }, { op: 0, bits: 8, val: 45 }, { op: 0, bits: 9, val: 186 }, { op: 0, bits: 8, val: 13 }, { op: 0, bits: 8, val: 141 }, { op: 0, bits: 8, val: 77 }, { op: 0, bits: 9, val: 250 }, { op: 16, bits: 7, val: 3 }, { op: 0, bits: 8, val: 83 }, { op: 0, bits: 8, val: 19 }, { op: 21, bits: 8, val: 195 }, { op: 19, bits: 7, val: 35 }, { op: 0, bits: 8, val: 115 }, { op: 0, bits: 8, val: 51 }, { op: 0, bits: 9, val: 198 }, { op: 17, bits: 7, val: 11 }, { op: 0, bits: 8, val: 99 }, { op: 0, bits: 8, val: 35 }, { op: 0, bits: 9, val: 166 }, { op: 0, bits: 8, val: 3 }, { op: 0, bits: 8, val: 131 }, { op: 0, bits: 8, val: 67 }, { op: 0, bits: 9, val: 230 }, { op: 16, bits: 7, val: 7 }, { op: 0, bits: 8, val: 91 }, { op: 0, bits: 8, val: 27 }, { op: 0, bits: 9, val: 150 }, { op: 20, bits: 7, val: 67 }, { op: 0, bits: 8, val: 123 }, { op: 0, bits: 8, val: 59 }, { op: 0, bits: 9, val: 214 }, { op: 18, bits: 7, val: 19 }, { op: 0, bits: 8, val: 107 }, { op: 0, bits: 8, val: 43 }, { op: 0, bits: 9, val: 182 }, { op: 0, bits: 8, val: 11 }, { op: 0, bits: 8, val: 139 }, { op: 0, bits: 8, val: 75 }, { op: 0, bits: 9, val: 246 }, { op: 16, bits: 7, val: 5 }, { op: 0, bits: 8, val: 87 }, { op: 0, bits: 8, val: 23 }, { op: 64, bits: 8, val: 0 }, { op: 19, bits: 7, val: 51 }, { op: 0, bits: 8, val: 119 }, { op: 0, bits: 8, val: 55 }, { op: 0, bits: 9, val: 206 }, { op: 17, bits: 7, val: 15 }, { op: 0, bits: 8, val: 103 }, { op: 0, bits: 8, val: 39 }, { op: 0, bits: 9, val: 174 }, { op: 0, bits: 8, val: 7 }, { op: 0, bits: 8, val: 135 }, { op: 0, bits: 8, val: 71 }, { op: 0, bits: 9, val: 238 }, { op: 16, bits: 7, val: 9 }, { op: 0, bits: 8, val: 95 }, { op: 0, bits: 8, val: 31 }, { op: 0, bits: 9, val: 158 }, { op: 20, bits: 7, val: 99 }, { op: 0, bits: 8, val: 127 }, { op: 0, bits: 8, val: 63 }, { op: 0, bits: 9, val: 222 }, { op: 18, bits: 7, val: 27 }, { op: 0, bits: 8, val: 111 }, { op: 0, bits: 8, val: 47 }, { op: 0, bits: 9, val: 190 }, { op: 0, bits: 8, val: 15 }, { op: 0, bits: 8, val: 143 }, { op: 0, bits: 8, val: 79 }, { op: 0, bits: 9, val: 254 }, { op: 96, bits: 7, val: 0 }, { op: 0, bits: 8, val: 80 }, { op: 0, bits: 8, val: 16 }, { op: 20, bits: 8, val: 115 }, { op: 18, bits: 7, val: 31 }, { op: 0, bits: 8, val: 112 }, { op: 0, bits: 8, val: 48 }, { op: 0, bits: 9, val: 193 }, { op: 16, bits: 7, val: 10 }, { op: 0, bits: 8, val: 96 }, { op: 0, bits: 8, val: 32 }, { op: 0, bits: 9, val: 161 }, { op: 0, bits: 8, val: 0 }, { op: 0, bits: 8, val: 128 }, { op: 0, bits: 8, val: 64 }, { op: 0, bits: 9, val: 225 }, { op: 16, bits: 7, val: 6 }, { op: 0, bits: 8, val: 88 }, { op: 0, bits: 8, val: 24 }, { op: 0, bits: 9, val: 145 }, { op: 19, bits: 7, val: 59 }, { op: 0, bits: 8, val: 120 }, { op: 0, bits: 8, val: 56 }, { op: 0, bits: 9, val: 209 }, { op: 17, bits: 7, val: 17 }, { op: 0, bits: 8, val: 104 }, { op: 0, bits: 8, val: 40 }, { op: 0, bits: 9, val: 177 }, { op: 0, bits: 8, val: 8 }, { op: 0, bits: 8, val: 136 }, { op: 0, bits: 8, val: 72 }, { op: 0, bits: 9, val: 241 }, { op: 16, bits: 7, val: 4 }, { op: 0, bits: 8, val: 84 }, { op: 0, bits: 8, val: 20 }, { op: 21, bits: 8, val: 227 }, { op: 19, bits: 7, val: 43 }, { op: 0, bits: 8, val: 116 }, { op: 0, bits: 8, val: 52 }, { op: 0, bits: 9, val: 201 }, { op: 17, bits: 7, val: 13 }, { op: 0, bits: 8, val: 100 }, { op: 0, bits: 8, val: 36 }, { op: 0, bits: 9, val: 169 }, { op: 0, bits: 8, val: 4 }, { op: 0, bits: 8, val: 132 }, { op: 0, bits: 8, val: 68 }, { op: 0, bits: 9, val: 233 }, { op: 16, bits: 7, val: 8 }, { op: 0, bits: 8, val: 92 }, { op: 0, bits: 8, val: 28 }, { op: 0, bits: 9, val: 153 }, { op: 20, bits: 7, val: 83 }, { op: 0, bits: 8, val: 124 }, { op: 0, bits: 8, val: 60 }, { op: 0, bits: 9, val: 217 }, { op: 18, bits: 7, val: 23 }, { op: 0, bits: 8, val: 108 }, { op: 0, bits: 8, val: 44 }, { op: 0, bits: 9, val: 185 }, { op: 0, bits: 8, val: 12 }, { op: 0, bits: 8, val: 140 }, { op: 0, bits: 8, val: 76 }, { op: 0, bits: 9, val: 249 }, { op: 16, bits: 7, val: 3 }, { op: 0, bits: 8, val: 82 }, { op: 0, bits: 8, val: 18 }, { op: 21, bits: 8, val: 163 }, { op: 19, bits: 7, val: 35 }, { op: 0, bits: 8, val: 114 }, { op: 0, bits: 8, val: 50 }, { op: 0, bits: 9, val: 197 }, { op: 17, bits: 7, val: 11 }, { op: 0, bits: 8, val: 98 }, { op: 0, bits: 8, val: 34 }, { op: 0, bits: 9, val: 165 }, { op: 0, bits: 8, val: 2 }, { op: 0, bits: 8, val: 130 }, { op: 0, bits: 8, val: 66 }, { op: 0, bits: 9, val: 229 }, { op: 16, bits: 7, val: 7 }, { op: 0, bits: 8, val: 90 }, { op: 0, bits: 8, val: 26 }, { op: 0, bits: 9, val: 149 }, { op: 20, bits: 7, val: 67 }, { op: 0, bits: 8, val: 122 }, { op: 0, bits: 8, val: 58 },{ op: 0, bits: 9, val: 213 }, { op: 18, bits: 7, val: 19 }, { op: 0, bits: 8, val: 106 }, { op: 0, bits: 8, val: 42 }, { op: 0, bits: 9, val: 181 }, { op: 0, bits: 8, val: 10 }, { op: 0, bits: 8, val: 138 },{ op: 0, bits: 8, val: 74 }, { op: 0, bits: 9, val: 245 }, { op: 16, bits: 7, val: 5 }, { op: 0, bits: 8, val: 86 }, { op: 0, bits: 8, val: 22 }, { op: 64, bits: 8, val: 0 }, { op: 19, bits: 7, val: 51 },{ op: 0, bits: 8, val: 118 }, { op: 0, bits: 8, val: 54 }, { op: 0, bits: 9, val: 205 }, { op: 17, bits: 7, val: 15 }, { op: 0, bits: 8, val: 102 }, { op: 0, bits: 8, val: 38 }, { op: 0, bits: 9, val: 173 },{ op: 0, bits: 8, val: 6 }, { op: 0, bits: 8, val: 134 }, { op: 0, bits: 8, val: 70 }, { op: 0, bits: 9, val: 237 }, { op: 16, bits: 7, val: 9 }, { op: 0, bits: 8, val: 94 }, { op: 0, bits: 8, val: 30 },{ op: 0, bits: 9, val: 157 }, { op: 20, bits: 7, val: 99 }, { op: 0, bits: 8, val: 126 }, { op: 0, bits: 8, val: 62 }, { op: 0, bits: 9, val: 221 }, { op: 18, bits: 7, val: 27 }, { op: 0, bits: 8, val: 110 }, { op: 0, bits: 8, val: 46 }, { op: 0, bits: 9, val: 189 }, { op: 0, bits: 8, val: 14 }, { op: 0, bits: 8, val: 142 }, { op: 0, bits: 8, val: 78 }, { op: 0, bits: 9, val: 253 }, { op: 96, bits: 7, val: 0 }, { op: 0, bits: 8, val: 81 }, { op: 0, bits: 8, val: 17 }, { op: 21, bits: 8, val: 131 }, { op: 18, bits: 7, val: 31 }, { op: 0, bits: 8, val: 113 }, { op: 0, bits: 8, val: 49 }, { op: 0, bits: 9, val: 195 }, { op: 16, bits: 7, val: 10 }, { op: 0, bits: 8, val: 97 }, { op: 0, bits: 8, val: 33 }, { op: 0, bits: 9, val: 163 }, { op: 0, bits: 8, val: 1 }, { op: 0, bits: 8, val: 129 }, { op: 0, bits: 8, val: 65 }, { op: 0, bits: 9, val: 227 }, { op: 16, bits: 7, val: 6 }, { op: 0, bits: 8, val: 89 }, { op: 0, bits: 8, val: 25 }, { op: 0, bits: 9, val: 147 }, { op: 19, bits: 7, val: 59 }, { op: 0, bits: 8, val: 121 }, { op: 0, bits: 8, val: 57 }, { op: 0, bits: 9, val: 211 }, { op: 17, bits: 7, val: 17 }, { op: 0, bits: 8, val: 105 }, { op: 0, bits: 8, val: 41 }, { op: 0, bits: 9, val: 179 }, { op: 0, bits: 8, val: 9 },{ op: 0, bits: 8, val: 137 }, { op: 0, bits: 8, val: 73 }, { op: 0, bits: 9, val: 243 }, { op: 16, bits: 7, val: 4 }, { op: 0, bits: 8, val: 85 }, { op: 0, bits: 8, val: 21 }, { op: 16, bits: 8, val: 258 },{ op: 19, bits: 7, val: 43 }, { op: 0, bits: 8, val: 117 }, { op: 0, bits: 8, val: 53 }, { op: 0, bits: 9, val: 203 }, { op: 17, bits: 7, val: 13 }, { op: 0, bits: 8, val: 101 }, { op: 0, bits: 8, val: 37 },{ op: 0, bits: 9, val: 171 }, { op: 0, bits: 8, val: 5 }, { op: 0, bits: 8, val: 133 }, { op: 0, bits: 8, val: 69 }, { op: 0, bits: 9, val: 235 }, { op: 16, bits: 7, val: 8 }, { op: 0, bits: 8, val: 93 },{ op: 0, bits: 8, val: 29 }, { op: 0, bits: 9, val: 155 }, { op: 20, bits: 7, val: 83 }, { op: 0, bits: 8, val: 125 }, { op: 0, bits: 8, val: 61 }, { op: 0, bits: 9, val: 219 }, { op: 18, bits: 7, val: 23 },{ op: 0, bits: 8, val: 109 }, { op: 0, bits: 8, val: 45 }, { op: 0, bits: 9, val: 187 }, { op: 0, bits: 8, val: 13 }, { op: 0, bits: 8, val: 141 }, { op: 0, bits: 8, val: 77 }, { op: 0, bits: 9, val: 251 }, { op: 16, bits: 7, val: 3 }, { op: 0, bits: 8, val: 83 }, { op: 0, bits: 8, val: 19 }, { op: 21, bits: 8, val: 195 }, { op: 19, bits: 7, val: 35 }, { op: 0, bits: 8, val: 115 }, { op: 0, bits: 8, val: 51 }, { op: 0, bits: 9, val: 199 }, { op: 17, bits: 7, val: 11 }, { op: 0, bits: 8, val: 99 }, { op: 0, bits: 8, val: 35 }, { op: 0, bits: 9, val: 167 }, { op: 0, bits: 8, val: 3 }, { op: 0, bits: 8, val: 131 }, { op: 0, bits: 8, val: 67 }, { op: 0, bits: 9, val: 231 }, { op: 16, bits: 7, val: 7 }, { op: 0, bits: 8, val: 91 }, { op: 0, bits: 8, val: 27 }, { op: 0, bits: 9, val: 151 }, { op: 20, bits: 7, val: 67 }, { op: 0, bits: 8, val: 123 }, { op: 0, bits: 8, val: 59 }, { op: 0, bits: 9, val: 215 }, { op: 18, bits: 7, val: 19 }, { op: 0, bits: 8, val: 107 }, { op: 0, bits: 8, val: 43 }, { op: 0, bits: 9, val: 183 }, { op: 0, bits: 8, val: 11 }, { op: 0, bits: 8, val: 139 }, { op: 0, bits: 8, val: 75 }, { op: 0, bits: 9, val: 247 }, { op: 16, bits: 7, val: 5 }, { op: 0, bits: 8, val: 87 }, { op: 0, bits: 8, val: 23 }, { op: 64, bits: 8, val: 0 }, { op: 19, bits: 7, val: 51 }, { op: 0, bits: 8, val: 119 }, { op: 0, bits: 8, val: 55 }, { op: 0, bits: 9, val: 207 }, { op: 17, bits: 7, val: 15 }, { op: 0, bits: 8, val: 103 }, { op: 0, bits: 8, val: 39 }, { op: 0, bits: 9, val: 175 }, { op: 0, bits: 8, val: 7 }, { op: 0, bits: 8, val: 135 }, { op: 0, bits: 8, val: 71 }, { op: 0, bits: 9, val: 239 }, { op: 16, bits: 7, val: 9 }, { op: 0, bits: 8, val: 95 }, { op: 0, bits: 8, val: 31 }, { op: 0, bits: 9, val: 159 }, { op: 20, bits: 7, val: 99 }, { op: 0, bits: 8, val: 127 }, { op: 0, bits: 8, val: 63 }, { op: 0, bits: 9, val: 223 }, { op: 18, bits: 7, val: 27 }, { op: 0, bits: 8, val: 111 }, { op: 0, bits: 8, val: 47 }, { op: 0, bits: 9, val: 191 }, { op: 0, bits: 8, val: 15 }, { op: 0, bits: 8, val: 143 }, { op: 0, bits: 8, val: 79 }, { op: 0, bits: 9, val: 255 } ];
3646 - if (!distfix_ary) distfix_ary = [ { op: 16, bits: 5, val: 1 }, { op: 23, bits: 5, val: 257 }, { op: 19, bits: 5, val: 17 }, { op: 27, bits: 5, val: 4097 }, { op: 17, bits: 5, val: 5 }, { op: 25, bits: 5, val: 1025 }, { op: 21, bits: 5, val: 65 }, { op: 29, bits: 5, val: 16385 }, { op: 16, bits: 5, val: 3 }, { op: 24, bits: 5, val: 513 }, { op: 20, bits: 5, val: 33 }, { op: 28, bits: 5, val: 8193 }, { op: 18, bits: 5, val: 9 }, { op: 26, bits: 5, val: 2049 }, { op: 22, bits: 5, val: 129 }, { op: 64, bits: 5, val: 0 }, { op: 16, bits: 5, val: 2 }, { op: 23, bits: 5, val: 385 }, { op: 19, bits: 5, val: 25 }, { op: 27, bits: 5, val: 6145 }, { op: 17, bits: 5, val: 7 }, { op: 25, bits: 5, val: 1537 }, { op: 21, bits: 5, val: 97 }, { op: 29, bits: 5, val: 24577 }, { op: 16, bits: 5, val: 4 }, { op: 24, bits: 5, val: 769 }, { op: 20, bits: 5, val: 49 }, { op: 28, bits: 5, val: 12289 }, { op: 18, bits: 5, val: 13 }, { op: 26, bits: 5, val: 3073 }, { op: 22, bits: 5, val: 193 }, { op: 64, bits: 5, val: 0 } ];
3647 - state.lencode = 0;
3648 - state.distcode = 512;
3649 - for (i = 0; i < 512; i++) { state.codes[i] = lenfix_ary[i]; }
3650 - for (i = 0; i < 32; i++) { state.codes[i + 512] = distfix_ary[i]; }
3651 - state.lenbits = 9;
3652 - state.distbits = 5;
3653 -}
3654 -
3655 -/*
3656 - Update the window with the last wsize (normally 32K) bytes written before
3657 - returning. If window does not exist yet, create it. This is only called
3658 - when a window is already in use, or when output has been written during this
3659 - inflate call, but the end of the deflate stream has not been reached yet.
3660 - It is also called to create a window for dictionary data when a dictionary
3661 - is loaded.
3662 -
3663 - Providing output buffers larger than 32K to inflate() should provide a speed
3664 - advantage, since only the last 32K of output is copied to the sliding window
3665 - upon return from inflate(), and since all distances after the first 32K of
3666 - output will fall in the output data, making match copies simpler and faster.
3667 - The advantage may be dependent on the size of the processor's data caches.
3668 -*/
3669 -function updatewindow(strm)
3670 -{
3671 - var state = strm.state;
3672 - var out = strm.output_data.length;
3673 -
3674 - /* if it hasn't been done already, allocate space for the window */
3675 - if (state.window === null) {
3676 - state.window = '';
3677 - }
3678 -
3679 - /* if window not in use yet, initialize */
3680 - if (state.wsize == 0) {
3681 - state.wsize = 1 << state.wbits;
3682 - }
3683 -
3684 - // zlib.js: Sliding window
3685 - if (out >= state.wsize) {
3686 - state.window = strm.output_data.substring(out - state.wsize);
3687 - } else {
3688 - if(state.whave + out < state.wsize) {
3689 - state.window += strm.output_data;
3690 - } else {
3691 - state.window = state.window.substring(state.whave - (state.wsize - out)) + strm.output_data;
3692 - }
3693 - }
3694 - state.whave = state.window.length;
3695 - if(state.whave < state.wsize) {
3696 - state.wnext = state.whave;
3697 - } else {
3698 - state.wnext = 0;
3699 - }
3700 - return 0;
3701 -}
3702 -
3703 -
3704 -// #ifdef GUNZIP
3705 -function CRC2(strm, word)
3706 -{
3707 - var hbuf = [word & 0xff, (word >>> 8) & 0xff];
3708 - strm.state.check = strm.checksum_function(strm.state.check, hbuf, 0, 2);
3709 -}
3710 -
3711 -function CRC4(strm, word)
3712 -{
3713 - var hbuf = [word & 0xff,
3714 - (word >>> 8) & 0xff,
3715 - (word >>> 16) & 0xff,
3716 - (word >>> 24) & 0xff];
3717 - strm.state.check = strm.checksum_function(strm.state.check, hbuf, 0, 4);
3718 -}
3719 -
3720 -/* Load registers with state in inflate() for speed */
3721 -function LOAD(strm, s)
3722 -{
3723 - s.strm = strm; /* z_stream */
3724 - s.left = strm.avail_out; /* available output */
3725 - s.next = strm.next_in; /* next input */
3726 - s.have = strm.avail_in; /* available input */
3727 - s.hold = strm.state.hold; /* bit buffer */
3728 - s.bits = strm.state.bits; /* bits in bit buffer */
3729 - return s;
3730 -}
3731 -
3732 -/* Restore state from registers in inflate() */
3733 -function RESTORE(s)
3734 -{
3735 - var strm = s.strm;
3736 - strm.next_in = s.next;
3737 - strm.avail_out = s.left;
3738 - strm.avail_in = s.have;
3739 - strm.state.hold = s.hold;
3740 - strm.state.bits = s.bits;
3741 -}
3742 -
3743 -/* Clear the input bit accumulator */
3744 -function INITBITS(s)
3745 -{
3746 - s.hold = 0;
3747 - s.bits = 0;
3748 -}
3749 -
3750 -/* Get a byte of input into the bit accumulator, or return from inflate()
3751 - if there is no input available. */
3752 -function PULLBYTE(s)
3753 -{
3754 - if (s.have == 0) return false;
3755 - s.have--;
3756 - s.hold += (s.strm.input_data.charCodeAt(s.next++) & 0xff) << s.bits;
3757 - s.bits += 8;
3758 - return true;
3759 -}
3760 -
3761 -/* Assure that there are at least n bits in the bit accumulator. If there is
3762 - not enough available input to do that, then return from inflate(). */
3763 -function NEEDBITS(s, n)
3764 -{
3765 - // if(typeof n != 'number') throw 'ERROR';
3766 - while (s.bits < n) {
3767 - if(!PULLBYTE(s))
3768 - return false;
3769 - }
3770 - return true;
3771 -}
3772 -
3773 -/* Return the low n bits of the bit accumulator (n < 16) */
3774 -function BITS(s, n)
3775 -{
3776 - return s.hold & ((1 << n) - 1);
3777 -}
3778 -
3779 -/* Remove n bits from the bit accumulator */
3780 -function DROPBITS(s, n)
3781 -{
3782 - // if(typeof n != 'number') throw 'ERROR';
3783 - s.hold >>>= n;
3784 - s.bits -= n;
3785 -}
3786 -
3787 -/* Remove zero to seven bits as needed to go to a byte boundary */
3788 -function BYTEBITS(s)
3789 -{
3790 - s.hold >>>= s.bits & 7;
3791 - s.bits -= s.bits & 7;
3792 -}
3793 -
3794 -/* Reverse the bytes in a 32-bit value */
3795 -function REVERSE(q)
3796 -{
3797 - return ((q >>> 24) & 0xff) +
3798 - ((q >>> 8) & 0xff00) +
3799 - ((q & 0xff00) << 8) +
3800 - ((q & 0xff) << 24);
3801 -}
3802 -
3803 -/*
3804 - inflate() uses a state machine to process as much input data and generate as
3805 - much output data as possible before returning. The state machine is
3806 - structured roughly as follows:
3807 -
3808 - for (;;) switch (state) {
3809 - ...
3810 - case STATEn:
3811 - if (not enough input data or output space to make progress)
3812 - return;
3813 - ... make progress ...
3814 - state = STATEm;
3815 - break;
3816 - ...
3817 - }
3818 -
3819 - so when inflate() is called again, the same case is attempted again, and
3820 - if the appropriate resources are provided, the machine proceeds to the
3821 - next state. The NEEDBITS() macro is usually the way the state evaluates
3822 - whether it can proceed or should return. NEEDBITS() does the return if
3823 - the requested bits are not available. The typical use of the BITS macros
3824 - is:
3825 -
3826 - NEEDBITS(n);
3827 - ... do something with BITS(n) ...
3828 - DROPBITS(n);
3829 -
3830 - where NEEDBITS(n) either returns from inflate() if there isn't enough
3831 - input left to load n bits into the accumulator, or it continues. BITS(n)
3832 - gives the low n bits in the accumulator. When done, DROPBITS(n) drops
3833 - the low n bits off the accumulator. INITBITS() clears the accumulator
3834 - and sets the number of available bits to zero. BYTEBITS() discards just
3835 - enough bits to put the accumulator on a byte boundary. After BYTEBITS()
3836 - and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
3837 -
3838 - NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
3839 - if there is no input available. The decoding of variable length codes uses
3840 - PULLBYTE() directly in order to pull just enough bytes to decode the next
3841 - code, and no more.
3842 -
3843 - Some states loop until they get enough input, making sure that enough
3844 - state information is maintained to continue the loop where it left off
3845 - if NEEDBITS() returns in the loop. For example, want, need, and keep
3846 - would all have to actually be part of the saved state in case NEEDBITS()
3847 - returns:
3848 -
3849 - case STATEw:
3850 - while (want < need) {
3851 - NEEDBITS(n);
3852 - keep[want++] = BITS(n);
3853 - DROPBITS(n);
3854 - }
3855 - state = STATEx;
3856 - case STATEx:
3857 -
3858 - As shown above, if the next state is also the next case, then the break
3859 - is omitted.
3860 -
3861 - A state may also return if there is not enough output space available to
3862 - complete that state. Those states are copying stored data, writing a
3863 - literal byte, and copying a matching string.
3864 -
3865 - When returning, a "goto inf_leave" is used to update the total counters,
3866 - update the check value, and determine whether any progress has been made
3867 - during that inflate() call in order to return the proper return code.
3868 - Progress is defined as a change in either strm->avail_in or strm->avail_out.
3869 - When there is a window, goto inf_leave will update the window with the last
3870 - output written. If a goto inf_leave occurs in the middle of decompression
3871 - and there is no window currently, goto inf_leave will create one and copy
3872 - output to the window for the next call of inflate().
3873 -
3874 - In this implementation, the flush parameter of inflate() only affects the
3875 - return code (per zlib.h). inflate() always writes as much as possible to
3876 - strm->next_out, given the space available and the provided input--the effect
3877 - documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers
3878 - the allocation of and copying into a sliding window until necessary, which
3879 - provides the effect documented in zlib.h for Z_FINISH when the entire input
3880 - stream available. So the only thing the flush parameter actually does is:
3881 - when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it
3882 - will return Z_BUF_ERROR if it has not reached the end of the stream.
3883 - */
3884 -
3885 -/* permutation of code lengths */
3886 -var inflate_order = [
3887 - 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
3888 -ZLIB.inflate = function(strm, flush)
3889 -{
3890 - var state;
3891 - var s;
3892 - var _in, out; /* save starting available input and output */
3893 - var copy; /* number of stored or match bytes to copy */
3894 - var from_window_offset = -1; /* index of window[] */
3895 - var from_out_offset = -1; /* index of next_out[] */
3896 - var here; /* current decoding table entry */
3897 - var last; /* parent table entry */
3898 - var len; /* length to copy for repeats, bits to drop */
3899 - var ret; /* return code */
3900 -
3901 - if (!strm || !strm.state ||
3902 - (!strm.input_data && strm.avail_in != 0))
3903 - return ZLIB.Z_STREAM_ERROR;
3904 -
3905 - state = strm.state;
3906 - if (state.mode == TYPE) state.mode = TYPEDO; /* skip check */
3907 -
3908 - // LOAD
3909 - s = {};
3910 - LOAD(strm, s);
3911 -
3912 - _in = s.have;
3913 - out = s.left;
3914 - ret = ZLIB.Z_OK;
3915 -inf_leave: for (;;) {
3916 - switch (state.mode) {
3917 - case HEAD:
3918 - if (state.wrap == 0) {
3919 - state.mode = TYPEDO;
3920 - break;
3921 - }
3922 - if(!NEEDBITS(s, 16)) break inf_leave;
3923 -// #ifdef GUNZIP
3924 - if ((state.wrap & 2) && s.hold == 0x8b1f) { /* gzip header */
3925 - state.check = strm.checksum_function(0, null, 0, 0);
3926 - CRC2(strm, s.hold);
3927 - INITBITS(s);
3928 - state.mode = FLAGS;
3929 - break;
3930 - }
3931 - state.flags = 0; /* expect zlib header */
3932 - if (state.head !== null)
3933 - state.head.done = -1;
3934 - if (!(state.wrap & 1) || /* check if zlib header allowed */
3935 -//#else
3936 -// if (
3937 -//#endif
3938 - ((BITS(s, 8) << 8) + (s.hold >>> 8)) % 31) {
3939 - strm.msg = 'incorrect header check';
3940 - state.mode = BAD;
3941 - break;
3942 - }
3943 - if (BITS(s, 4) != ZLIB.Z_DEFLATED) {
3944 - strm.msg = 'unknown compression method';
3945 - state.mode = BAD;
3946 - break;
3947 - }
3948 -
3949 - DROPBITS(s, 4);
3950 - len = BITS(s, 4) + 8;
3951 - if (state.wbits == 0)
3952 - state.wbits = len;
3953 - else if (len > state.wbits) {
3954 - strm.msg = 'invalid window size';
3955 - state.mode = BAD;
3956 - break;
3957 - }
3958 - state.dmax = 1 << len;
3959 -// Tracev((stderr, "inflate: zlib header ok\n"));
3960 - strm.adler = state.check = strm.checksum_function(0, null, 0, 0);
3961 - state.mode = s.hold & 0x200 ? DICTID : TYPE;
3962 - INITBITS(s);
3963 - break;
3964 -// #ifdef GUNZIP
3965 - case FLAGS:
3966 - if(!NEEDBITS(s, 16)) break inf_leave;
3967 - state.flags = s.hold;
3968 - if ((state.flags & 0xff) != ZLIB.Z_DEFLATED) {
3969 - strm.msg = "unknown compression method";
3970 - state.mode = BAD;
3971 - break;
3972 - }
3973 - if (state.flags & 0xe000) {
3974 - strm.msg = "unknown header flags set";
3975 - state.mode = BAD;
3976 - break;
3977 - }
3978 - if (state.head !== null)
3979 - state.head.text = (s.hold >>> 8) & 1;
3980 - if (state.flags & 0x0200) {
3981 - CRC2(strm, s.hold);
3982 - }
3983 - INITBITS(s);
3984 - state.mode = TIME;
3985 - case TIME:
3986 - if(!NEEDBITS(s, 32)) break inf_leave;
3987 - if (state.head !== null)
3988 - state.head.time = s.hold;
3989 - if (state.flags & 0x0200) {
3990 - CRC4(strm, s.hold);
3991 - }
3992 - INITBITS(s);
3993 - state.mode = OS;
3994 - case OS:
3995 - if(!NEEDBITS(s, 16)) break inf_leave;
3996 - if (state.head !== null) {
3997 - state.head.xflags = s.hold & 0xff;
3998 - state.head.os = s.hold >>> 8;
3999 - }
4000 - if (state.flags & 0x0200) {
4001 - CRC2(strm, s.hold);
4002 - }
4003 - INITBITS(s);
4004 - state.mode = EXLEN;
4005 - case EXLEN:
4006 - if (state.flags & 0x0400) {
4007 - if(!NEEDBITS(s, 16)) break inf_leave;
4008 - state.length = s.hold;
4009 - if (state.head !== null) {
4010 - state.head.extra_len = s.hold;
4011 - }
4012 - if (state.flags & 0x0200) {
4013 - CRC2(strm, s.hold);
4014 - }
4015 - INITBITS(s);
4016 - state.head.extra = "";
4017 - }
4018 - else if (state.head !== null) {
4019 - state.head.extra = null;
4020 - }
4021 - state.mode = EXTRA;
4022 - case EXTRA:
4023 - if (state.flags & 0x0400) {
4024 - copy = state.length;
4025 - if (copy > s.have) copy = s.have;
4026 - if (copy) {
4027 - if (state.head !== null &&
4028 - state.head.extra !== null) {
4029 - len = state.head.extra_len - state.length;
4030 -/*
4031 - zmemcpy(state->head->extra + len, next,
4032 - len + copy > state->head->extra_max ?
4033 - state->head->extra_max - len : copy);
4034 -*/
4035 - state.head.extra += strm.input_data.substring(
4036 - s.next, s.next + (len + copy > state.head.extra_max ?
4037 - state.head.extra_max - len : copy));
4038 -
4039 - }
4040 - if (state.flags & 0x0200)
4041 - state.check = strm.checksum_function(state.check, strm.input_data, s.next, copy);
4042 - s.have -= copy;
4043 - s.next += copy;
4044 - state.length -= copy;
4045 - }
4046 - if (state.length) break inf_leave;
4047 - }
4048 - state.length = 0;
4049 - state.mode = NAME;
4050 - case NAME:
4051 - if (state.flags & 0x0800) {
4052 - if (s.have == 0) break inf_leave;
4053 - if (state.head !== null && state.head.name === null) {
4054 - state.head.name = "";
4055 - }
4056 - copy = 0;
4057 - // TODO end = strm.input_data.indexOf("\0", s.next);
4058 - // TODO state.length => state.head.name.length
4059 - do {
4060 - len = strm.input_data.charAt(s.next + copy); copy++;
4061 - if(len === "\0")
4062 - break;
4063 - if (state.head !== null &&
4064 - state.length < state.head.name_max) {
4065 - state.head.name += len;
4066 - state.length++;
4067 - }
4068 - } while (copy < s.have);
4069 - if (state.flags & 0x0200) {
4070 - state.check = strm.checksum_function(state.check, strm.input_data, s.next, copy);
4071 - }
4072 - s.have -= copy;
4073 - s.next += copy;
4074 - if (len !== "\0") break inf_leave;
4075 - }
4076 - else if (state.head !== null)
4077 - state.head.name = null;
4078 - state.length = 0;
4079 - state.mode = COMMENT;
4080 - case COMMENT:
4081 - if (state.flags & 0x1000) {
4082 - if (s.have == 0) break inf_leave;
4083 - copy = 0;
4084 - if (state.head !== null && state.head.comment === null) {
4085 - state.head.comment = "";
4086 - }
4087 - // TODO end = strm.input_data.indexOf("\0", s.next);
4088 - // TODO state.length => state.head.comment.length
4089 - do {
4090 - len = strm.input_data.charAt(s.next + copy); copy++;
4091 - if(len === "\0")
4092 - break;
4093 - if (state.head !== null &&
4094 - state.length < state.head.comm_max) {
4095 - state.head.comment += len;
4096 - state.length++;
4097 - }
4098 - } while (copy < s.have);
4099 - if (state.flags & 0x0200)
4100 - state.check = strm.checksum_function(state.check, strm.input_data, s.next, copy);
4101 - s.have -= copy;
4102 - s.next += copy;
4103 - if (len !== "\0") break inf_leave;
4104 - }
4105 - else if (state.head !== null)
4106 - state.head.comment = null;
4107 - state.mode = HCRC;
4108 - case HCRC:
4109 - if (state.flags & 0x0200) {
4110 - if(!NEEDBITS(s, 16)) break inf_leave;
4111 - if (s.hold != (state.check & 0xffff)) {
4112 - strm.msg = "header crc mismatch";
4113 - state.mode = BAD;
4114 - break;
4115 - }
4116 - INITBITS(s);
4117 - }
4118 - if (state.head !== null) {
4119 - state.head.hcrc = (state.flags >>> 9) & 1;
4120 - state.head.done = 1;
4121 - }
4122 - strm.adler = state.check = strm.checksum_function(0, null, 0, 0);
4123 - state.mode = TYPE;
4124 - break;
4125 -//#endif
4126 - case DICTID:
4127 - if(!NEEDBITS(s, 32)) break inf_leave;
4128 - strm.adler = state.check = REVERSE(s.hold);
4129 - INITBITS(s);
4130 - state.mode = DICT;
4131 - case DICT:
4132 - if (state.havedict == 0) {
4133 - RESTORE(s);
4134 - return ZLIB.Z_NEED_DICT;
4135 - }
4136 - strm.adler = state.check = strm.checksum_function(0, null, 0, 0);
4137 - state.mode = TYPE;
4138 - case TYPE:
4139 - if (flush == ZLIB.Z_BLOCK || flush == ZLIB.Z_TREES) break inf_leave;
4140 - case TYPEDO:
4141 - if (state.last) {
4142 - BYTEBITS(s);
4143 - state.mode = CHECK;
4144 - break;
4145 - }
4146 - if(!NEEDBITS(s, 3)) break inf_leave;
4147 - state.last = BITS(s, 1);
4148 - DROPBITS(s, 1);
4149 - switch (BITS(s, 2)) {
4150 - case 0: /* stored block */
4151 -// Tracev((stderr, "inflate: stored block%s\n",
4152 -// state->last ? " (last)" : ""));
4153 - state.mode = STORED;
4154 - break;
4155 - case 1: /* fixed block */
4156 - fixedtables(state);
4157 -// Tracev((stderr, "inflate: fixed codes block%s\n",
4158 -// state->last ? " (last)" : ""));
4159 - state.mode = LEN_; /* decode codes */
4160 - if (flush == ZLIB.Z_TREES) {
4161 - DROPBITS(s, 2);
4162 - break inf_leave;
4163 - }
4164 - break;
4165 - case 2: /* dynamic block */
4166 -// Tracev((stderr, "inflate: dynamic codes block%s\n",
4167 -// state->last ? " (last)" : ""));
4168 - state.mode = TABLE;
4169 - break;
4170 - case 3:
4171 - strm.msg = 'invalid block type';
4172 - state.mode = BAD;
4173 - }
4174 - DROPBITS(s, 2);
4175 - break;
4176 - case STORED:
4177 - BYTEBITS(s); /* go to byte boundary */
4178 - if(!NEEDBITS(s, 32)) break inf_leave;
4179 - if ((s.hold & 0xffff) != (((s.hold >>> 16) & 0xffff) ^ 0xffff)) {
4180 - strm.msg = 'invalid stored block lengths';
4181 - state.mode = BAD;
4182 - break;
4183 - }
4184 - state.length = s.hold & 0xffff;
4185 -// Tracev((stderr, "inflate: stored length %u\n",
4186 -// state->length));
4187 - INITBITS(s);
4188 - state.mode = COPY_;
4189 - if (flush == ZLIB.Z_TREES) break inf_leave;
4190 - case COPY_:
4191 - state.mode = COPY;
4192 - case COPY:
4193 - copy = state.length;
4194 - if (copy) {
4195 - if (copy > s.have) copy = s.have;
4196 - if (copy > s.left) copy = s.left;
4197 - if (copy == 0) break inf_leave;
4198 - strm.output_data += strm.input_data.substring(s.next, s.next + copy);
4199 - strm.next_out += copy;
4200 - s.have -= copy;
4201 - s.next += copy;
4202 - s.left -= copy;
4203 - state.length -= copy;
4204 - break;
4205 - }
4206 -// Tracev((stderr, "inflate: stored end\n"));
4207 - state.mode = TYPE;
4208 - break;
4209 - case TABLE:
4210 - if(!NEEDBITS(s, 14)) break inf_leave;
4211 - state.nlen = BITS(s, 5) + 257;
4212 - DROPBITS(s, 5);
4213 - state.ndist = BITS(s, 5) + 1;
4214 - DROPBITS(s, 5);
4215 - state.ncode = BITS(s, 4) + 4;
4216 - DROPBITS(s, 4);
4217 -//#ifndef PKZIP_BUG_WORKAROUND
4218 - if (state.nlen > 286 || state.ndist > 30) {
4219 - strm.msg = 'too many length or distance symbols';
4220 - state.mode = BAD;
4221 - break;
4222 - }
4223 -//#endif
4224 -// Tracev((stderr, "inflate: table sizes ok\n"));
4225 - state.have = 0;
4226 - state.mode = LENLENS;
4227 - case LENLENS:
4228 - while (state.have < state.ncode) {
4229 - if(!NEEDBITS(s, 3)) break inf_leave;
4230 - var tmp = BITS(s, 3);
4231 - state.lens[inflate_order[state.have++]] = tmp;
4232 - DROPBITS(s, 3);
4233 - }
4234 - while (state.have < 19)
4235 - state.lens[inflate_order[state.have++]] = 0;
4236 - state.next = 0;
4237 - state.lencode = 0;
4238 - state.lenbits = 7;
4239 -
4240 -// ret = inflate_table(CODES, state->lens, 19, &(state->next),
4241 -// &(state->lenbits), state->work);
4242 - ret = inflate_table(state, CODES);
4243 -
4244 - if (ret) {
4245 - strm.msg = 'invalid code lengths set';
4246 - state.mode = BAD;
4247 - break;
4248 - }
4249 -// Tracev((stderr, "inflate: code lengths ok\n"));
4250 - state.have = 0;
4251 - state.mode = CODELENS;
4252 - case CODELENS:
4253 - while (state.have < state.nlen + state.ndist) {
4254 - for (;;) {
4255 - here = state.codes[state.lencode + BITS(s, state.lenbits)];
4256 - if (here.bits <= s.bits) break;
4257 - if(!PULLBYTE(s)) break inf_leave;
4258 - }
4259 - if (here.val < 16) {
4260 - DROPBITS(s, here.bits);
4261 - state.lens[state.have++] = here.val;
4262 - }
4263 - else {
4264 - if (here.val == 16) {
4265 - if(!NEEDBITS(s, here.bits + 2)) break inf_leave;
4266 - DROPBITS(s, here.bits);
4267 - if (state.have == 0) {
4268 - strm.msg = 'invalid bit length repeat';
4269 - state.mode = BAD;
4270 - break;
4271 - }
4272 - len = state.lens[state.have - 1];
4273 - copy = 3 + BITS(s, 2);
4274 - DROPBITS(s, 2);
4275 - }
4276 - else if (here.val == 17) {
4277 - if(!NEEDBITS(s, here.bits + 3)) break inf_leave;
4278 - DROPBITS(s, here.bits);
4279 - len = 0;
4280 - copy = 3 + BITS(s, 3);
4281 - DROPBITS(s, 3);
4282 - }
4283 - else {
4284 - if(!NEEDBITS(s, here.bits + 7)) break inf_leave;
4285 - DROPBITS(s, here.bits);
4286 - len = 0;
4287 - copy = 11 + BITS(s, 7);
4288 - DROPBITS(s, 7);
4289 - }
4290 - if (state.have + copy > state.nlen + state.ndist) {
4291 - strm.msg = 'invalid bit length repeat';
4292 - state.mode = BAD;
4293 - break;
4294 - }
4295 - while (copy--)
4296 - state.lens[state.have++] = len;
4297 - }
4298 - }
4299 -
4300 - /* handle error breaks in while */
4301 - if (state.mode == BAD) break;
4302 -
4303 - /* check for end-of-block code (better have one) */
4304 - if (state.lens[256] == 0) {
4305 - strm.msg = 'invalid code -- missing end-of-block';
4306 - state.mode = BAD;
4307 - break;
4308 - }
4309 -
4310 - /* build code tables -- note: do not change the lenbits or distbits
4311 - values here (9 and 6) without reading the comments in inftrees.h
4312 - concerning the ENOUGH constants, which depend on those values */
4313 - state.next = 0;
4314 - state.lencode = state.next;
4315 - state.lenbits = 9;
4316 -// ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
4317 -// &(state->lenbits), state->work);
4318 - ret = inflate_table(state, LENS);
4319 - if (ret) {
4320 - strm.msg = 'invalid literal/lengths set';
4321 - state.mode = BAD;
4322 - break;
4323 - }
4324 - state.distcode = state.next;
4325 - state.distbits = 6;
4326 -// ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, &(state->next),
4327 -// &(state->distbits), state->work);
4328 - ret = inflate_table(state, DISTS);
4329 - if (ret) {
4330 - strm.msg = 'invalid distances set';
4331 - state.mode = BAD;
4332 - break;
4333 - }
4334 -// Tracev((stderr, "inflate: codes ok\n"));
4335 - state.mode = LEN_;
4336 - if (flush == ZLIB.Z_TREES) break inf_leave;
4337 - case LEN_:
4338 - state.mode = LEN;
4339 - case LEN:
4340 - if (s.have >= 6 && s.left >= 258) {
4341 - RESTORE(s);
4342 - inflate_fast(strm, out);
4343 - LOAD(strm, s);
4344 - if (state.mode == TYPE)
4345 - state.back = -1;
4346 - break;
4347 - }
4348 - state.back = 0;
4349 - for (;;) {
4350 - here = state.codes[state.lencode + BITS(s, state.lenbits)];
4351 - if (here.bits <= s.bits) break;
4352 - if(!PULLBYTE(s)) break inf_leave;
4353 - }
4354 - if (here.op && (here.op & 0xf0) == 0) {
4355 - last = here;
4356 - for (;;) {
4357 - here = state.codes[state.lencode + last.val +
4358 - (BITS(s, last.bits + last.op) >>> last.bits)];
4359 - if (last.bits + here.bits <= s.bits) break;
4360 - if(!PULLBYTE(s)) break inf_leave;
4361 - }
4362 - DROPBITS(s, last.bits);
4363 - state.back += last.bits;
4364 - }
4365 - DROPBITS(s, here.bits);
4366 - state.back += here.bits;
4367 - state.length = here.val;
4368 - if (here.op == 0) {
4369 -// Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
4370 -// "inflate: literal '%c'\n" :
4371 -// "inflate: literal 0x%02x\n", here.val));
4372 - state.mode = LIT;
4373 - break;
4374 - }
4375 - if (here.op & 32) {
4376 -// Tracevv((stderr, "inflate: end of block\n"));
4377 - state.back = -1;
4378 - state.mode = TYPE;
4379 - break;
4380 - }
4381 - if (here.op & 64) {
4382 - strm.msg = 'invalid literal/length code';
4383 - state.mode = BAD;
4384 - break;
4385 - }
4386 - state.extra = here.op & 15;
4387 - state.mode = LENEXT;
4388 - case LENEXT:
4389 - if (state.extra) {
4390 - if(!NEEDBITS(s, state.extra)) break inf_leave;
4391 - state.length += BITS(s, state.extra);
4392 - DROPBITS(s, state.extra);
4393 - state.back += state.extra;
4394 - }
4395 - //Tracevv((stderr, "inflate: length %u\n", state->length));
4396 - state.was = state.length;
4397 - state.mode = DIST;
4398 - case DIST:
4399 - for (;;) {
4400 - here = state.codes[state.distcode + BITS(s, state.distbits)];
4401 - if (here.bits <= s.bits) break;
4402 - if(!PULLBYTE(s)) break inf_leave;
4403 - }
4404 - if ((here.op & 0xf0) == 0) {
4405 - last = here;
4406 - for (;;) {
4407 - here = state.codes[state.distcode + last.val +
4408 - (BITS(s, last.bits + last.op) >>> last.bits)];
4409 - if ((last.bits + here.bits) <= s.bits) break;
4410 - if(!PULLBYTE(s)) break inf_leave;
4411 - }
4412 - DROPBITS(s, last.bits);
4413 - state.back += last.bits;
4414 - }
4415 - DROPBITS(s, here.bits);
4416 - state.back += here.bits;
4417 - if (here.op & 64) {
4418 - strm.msg = 'invalid distance code';
4419 - state.mode = BAD;
4420 - break;
4421 - }
4422 - state.offset = here.val;
4423 - state.extra = here.op & 15;
4424 - state.mode = DISTEXT;
4425 - case DISTEXT:
4426 - if (state.extra) {
4427 - if(!NEEDBITS(s, state.extra)) break inf_leave;
4428 - state.offset += BITS(s, state.extra);
4429 - DROPBITS(s, state.extra);
4430 - state.back += state.extra;
4431 - }
4432 -//NOSPRT #ifdef INFLATE_STRICT
4433 -// if (state->offset > state->dmax) {
4434 -// strm->msg = (char *)"invalid distance too far back";
4435 -// state->mode = BAD;
4436 -// break;
4437 -// }
4438 -//#endif
4439 -// Tracevv((stderr, "inflate: distance %u\n", state->offset));
4440 - state.mode = MATCH;
4441 - case MATCH:
4442 - if (s.left == 0) break inf_leave;
4443 - copy = out - s.left;
4444 - if (state.offset > copy) { /* copy from window */
4445 - copy = state.offset - copy;
4446 - if (copy > state.whave) {
4447 - if (state.sane) {
4448 - strm.msg = 'invalid distance too far back';
4449 - state.mode = BAD;
4450 - break;
4451 - }
4452 -//NOSPRT #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
4453 -// Trace((stderr, "inflate.c too far\n"));
4454 -// copy -= state->whave;
4455 -// if (copy > state->length) copy = state->length;
4456 -// if (copy > left) copy = left;
4457 -// left -= copy;
4458 -// state->length -= copy;
4459 -// do {
4460 -// *put++ = 0;
4461 -// } while (--copy);
4462 -// if (state->length == 0) state->mode = LEN;
4463 -// break;
4464 -//#endif
4465 - }
4466 - if (copy > state.wnext) {
4467 - copy -= state.wnext;
4468 - // from = state->window + (state->wsize - copy);
4469 - from_window_offset = state.wsize - copy;
4470 - from_out_offset = -1;
4471 - }
4472 - else {
4473 - // from = state->window + (state->wnext - copy);
4474 - from_window_offset = state.wnext - copy;
4475 - from_out_offset = -1;
4476 - }
4477 - if (copy > state.length) copy = state.length;
4478 - }
4479 - else { /* copy from output */
4480 - // from = put - state->offset;
4481 - from_window_offset = -1;
4482 - from_out_offset = strm.next_out - state.offset;
4483 - copy = state.length;
4484 - }
4485 - if (copy > s.left) copy = s.left;
4486 - s.left -= copy;
4487 - state.length -= copy;
4488 - if( from_window_offset >= 0 ) {
4489 - strm.output_data += state.window.substring(from_window_offset, from_window_offset + copy);
4490 - strm.next_out += copy;
4491 - copy = 0;
4492 - } else {
4493 - strm.next_out += copy;
4494 - do {
4495 - strm.output_data += strm.output_data.charAt(from_out_offset++);
4496 - } while (--copy);
4497 - }
4498 - if (state.length == 0) state.mode = LEN;
4499 - break;
4500 - case LIT:
4501 - if (s.left == 0) break inf_leave;
4502 -
4503 - strm.output_data += String.fromCharCode(state.length);
4504 - strm.next_out++;
4505 - //*put++ = (unsigned char)(state->length);
4506 -
4507 - s.left--;
4508 - state.mode = LEN;
4509 - break;
4510 - case CHECK:
4511 - if (state.wrap) {
4512 - if(!NEEDBITS(s, 32)) break inf_leave;
4513 - out -= s.left;
4514 - strm.total_out += out;
4515 - state.total += out;
4516 - if (out)
4517 - strm.adler = state.check =
4518 - strm.checksum_function(state.check, strm.output_data, strm.output_data.length - out, out);
4519 - out = s.left;
4520 - if ((
4521 -// #ifdef GUNZIP
4522 - state.flags ? s.hold :
4523 -//#endif
4524 - REVERSE(s.hold)) != state.check) {
4525 - strm.msg = "incorrect data check";
4526 - state.mode = BAD;
4527 - break;
4528 - }
4529 - INITBITS(s);
4530 -//debug("## inflate: check matches trailer\n");
4531 -// Tracev((stderr, "inflate: check matches trailer\n"));
4532 - }
4533 -//#ifdef GUNZIP
4534 - state.mode = LENGTH;
4535 - case LENGTH:
4536 - if (state.wrap && state.flags) {
4537 - if(!NEEDBITS(s, 32)) break inf_leave;
4538 - if (s.hold != (state.total & 0xffffffff)) {
4539 - strm.msg = 'incorrect length check';
4540 - state.mode = BAD;
4541 - break;
4542 - }
4543 - INITBITS(s);
4544 - //Tracev((stderr, "inflate: length matches trailer\n"));
4545 - }
4546 -//#endif
4547 - state.mode = DONE;
4548 - case DONE:
4549 - ret = ZLIB.Z_STREAM_END;
4550 - break inf_leave;
4551 - case BAD:
4552 - ret = ZLIB.Z_DATA_ERROR;
4553 - break inf_leave;
4554 - case MEM:
4555 - return ZLIB.Z_MEM_ERROR;
4556 - case SYNC:
4557 - default:
4558 - return ZLIB.Z_STREAM_ERROR;
4559 - } }
4560 -
4561 - /*
4562 - Return from inflate(), updating the total counts and the check value.
4563 - If there was no progress during the inflate() call, return a buffer
4564 - error. Call updatewindow() to create and/or update the window state.
4565 - Note: a memory error from inflate() is non-recoverable.
4566 - */
4567 -inf_leave:
4568 - RESTORE(s);
4569 - if (state.wsize || (out != strm.avail_out && state.mode < BAD &&
4570 - (state.mode < CHECK || flush != ZLIB.Z_FINISH)))
4571 - if (updatewindow(strm)) {
4572 - state.mode = MEM;
4573 - return ZLIB.Z_MEM_ERROR;
4574 - }
4575 - _in -= strm.avail_in;
4576 - out -= strm.avail_out;
4577 - strm.total_in += _in;
4578 - strm.total_out += out;
4579 - state.total += out;
4580 - if (state.wrap && out)
4581 - strm.adler = state.check = strm.checksum_function(state.check, strm.output_data, 0, strm.output_data.length);
4582 - strm.data_type = state.bits + (state.last ? 64 : 0) +
4583 - (state.mode == TYPE ? 128 : 0) +
4584 - (state.mode == LEN_ || state.mode == COPY_ ? 256 : 0);
4585 - if (((_in == 0 && out == 0) || flush == ZLIB.Z_FINISH) && ret == ZLIB.Z_OK)
4586 - ret = ZLIB.Z_BUF_ERROR;
4587 - return ret;
4588 -};
4589 -
4590 -ZLIB.inflateEnd = function(strm)
4591 -{
4592 - var state;
4593 - if (!strm || !strm.state )
4594 - return ZLIB.Z_STREAM_ERROR;
4595 - state = strm.state;
4596 - state.window = null;
4597 - strm.state = null;
4598 - // Tracev((stderr, "inflate: end\n"));
4599 - return ZLIB.Z_OK;
4600 -};
4601 -
4602 -ZLIB.z_stream.prototype.inflate = function(input_string, opts)
4603 -{
4604 - var flush;
4605 - var avail_out;
4606 - var DEFAULT_BUFFER_SIZE = 16384;
4607 -
4608 - this.input_data = input_string;
4609 - this.next_in = getarg(opts, 'next_in', 0);
4610 - this.avail_in = getarg(opts, 'avail_in', input_string.length - this.next_in);
4611 -
4612 - flush = getarg(opts, 'flush', ZLIB.Z_SYNC_FLUSH);
4613 - avail_out = getarg(opts, 'avail_out', -1);
4614 -
4615 - var result = '';
4616 - do {
4617 - this.avail_out = (avail_out >= 0 ? avail_out : DEFAULT_BUFFER_SIZE);
4618 - this.output_data = '';
4619 - this.next_out = 0;
4620 - this.error = ZLIB.inflate(this, flush);
4621 - if(avail_out >= 0) {
4622 - return this.output_data;
4623 - }
4624 - result += this.output_data;
4625 - if(this.avail_out > 0) {
4626 - break;
4627 - }
4628 - } while(this.error == ZLIB.Z_OK);
4629 -
4630 - return result;
4631 -};
4632 -
4633 -ZLIB.z_stream.prototype.inflateReset = function(windowBits)
4634 -{
4635 - return ZLIB.inflateReset(this, windowBits);
4636 -};
4637 -
4638 -}());
4639 -/* zlib-adler32.js -- JavaScript implementation for the zlib adler32.
4640 - Version: 0.2.0
4641 - LastModified: Apr 12 2012
4642 - Copyright (C) 2012 Masanao Izumo <iz@onicos.co.jp>
4643 -
4644 - API documentation
4645 -==============================================================================
4646 -Usage: adler = ZLIB.adler32(adler, buf, offset, len);
4647 -
4648 - Update a running Adler-32 checksum with the bytes buf[offset..offset+len-1] and
4649 - return the updated checksum. If buf is null, this function returns the
4650 - required initial value for the checksum.
4651 -
4652 - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
4653 - much faster.
4654 -
4655 - Usage example:
4656 -
4657 - var adler = ZLIB.adler32(0, null, 0, 0);
4658 -
4659 - while (read_buffer(buffer, length) != EOF) {
4660 - adler = ZLIB.adler32(adler, buffer, 0, length);
4661 - }
4662 - if (adler != original_adler) error();
4663 -
4664 -==============================================================================
4665 -Usage: adler = ZLIB.adler32_combine(adler1, adler2, len2);
4666 -
4667 - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
4668 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
4669 - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
4670 - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note
4671 - that the z_off_t type (like off_t) is a signed integer. If len2 is
4672 - negative, the result has no meaning or utility.
4673 -*/
4674 -
4675 -if( typeof ZLIB === 'undefined' ) {
4676 - alert('ZLIB is not defined. SRC zlib.js before zlib-adler32.js')
4677 -}
4678 -
4679 -(function() {
4680 -
4681 -/* adler32.c -- compute the Adler-32 checksum of a data stream
4682 - * Copyright (C) 1995-2011 Mark Adler
4683 - * For conditions of distribution and use, see copyright notice in zlib.h
4684 - */
4685 -
4686 -var BASE = 65521; /* largest prime smaller than 65536 */
4687 -var NMAX = 5552;
4688 -/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
4689 -
4690 -/* ========================================================================= */
4691 -function adler32_string(adler, buf, offset, len)
4692 -{
4693 - var sum2;
4694 - var n;
4695 -
4696 - /* split Adler-32 into component sums */
4697 - sum2 = (adler >>> 16) & 0xffff;
4698 - adler &= 0xffff;
4699 -
4700 - /* in case user likes doing a byte at a time, keep it fast */
4701 - if (len == 1) {
4702 - adler += buf.charCodeAt(offset) & 0xff;
4703 - if (adler >= BASE)
4704 - adler -= BASE;
4705 - sum2 += adler;
4706 - if (sum2 >= BASE)
4707 - sum2 -= BASE;
4708 - return adler | (sum2 << 16);
4709 - }
4710 -
4711 - /* initial Adler-32 value (deferred check for len == 1 speed) */
4712 - if (buf === null)
4713 - return 1;
4714 -
4715 - /* in case short lengths are provided, keep it somewhat fast */
4716 - if (len < 16) {
4717 - while (len--) {
4718 - adler += buf.charCodeAt(offset++) & 0xff;
4719 - sum2 += adler;
4720 - }
4721 - if (adler >= BASE)
4722 - adler -= BASE;
4723 - sum2 %= BASE; /* only added so many BASE's */
4724 - return adler | (sum2 << 16);
4725 - }
4726 -
4727 - /* do length NMAX blocks -- requires just one modulo operation */
4728 - while (len >= NMAX) {
4729 - len -= NMAX;
4730 - n = NMAX >> 4; /* NMAX is divisible by 16 */
4731 - do {
4732 - /* 16 sums unrolled */
4733 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4734 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4735 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4736 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4737 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4738 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4739 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4740 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4741 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4742 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4743 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4744 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4745 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4746 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4747 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4748 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4749 - } while (--n);
4750 - adler %= BASE;
4751 - sum2 %= BASE;
4752 - }
4753 -
4754 - /* do remaining bytes (less than NMAX, still just one modulo) */
4755 - if (len) { /* avoid modulos if none remaining */
4756 - while (len >= 16) {
4757 - len -= 16;
4758 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4759 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4760 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4761 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4762 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4763 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4764 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4765 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4766 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4767 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4768 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4769 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4770 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4771 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4772 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4773 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4774 - }
4775 - while (len--) {
4776 - adler += buf.charCodeAt(offset++) & 0xff; sum2 += adler;
4777 - }
4778 - adler %= BASE;
4779 - sum2 %= BASE;
4780 - }
4781 -
4782 - /* return recombined sums */
4783 - return adler | (sum2 << 16);
4784 -}
4785 -
4786 -/* ========================================================================= */
4787 -function adler32_array(adler, buf, offset, len)
4788 -{
4789 - var sum2;
4790 - var n;
4791 -
4792 - /* split Adler-32 into component sums */
4793 - sum2 = (adler >>> 16) & 0xffff;
4794 - adler &= 0xffff;
4795 -
4796 - /* in case user likes doing a byte at a time, keep it fast */
4797 - if (len == 1) {
4798 - adler += buf[offset];
4799 - if (adler >= BASE)
4800 - adler -= BASE;
4801 - sum2 += adler;
4802 - if (sum2 >= BASE)
4803 - sum2 -= BASE;
4804 - return adler | (sum2 << 16);
4805 - }
4806 -
4807 - /* initial Adler-32 value (deferred check for len == 1 speed) */
4808 - if (buf === null)
4809 - return 1;
4810 -
4811 - /* in case short lengths are provided, keep it somewhat fast */
4812 - if (len < 16) {
4813 - while (len--) {
4814 - adler += buf[offset++];
4815 - sum2 += adler;
4816 - }
4817 - if (adler >= BASE)
4818 - adler -= BASE;
4819 - sum2 %= BASE; /* only added so many BASE's */
4820 - return adler | (sum2 << 16);
4821 - }
4822 -
4823 - /* do length NMAX blocks -- requires just one modulo operation */
4824 - while (len >= NMAX) {
4825 - len -= NMAX;
4826 - n = NMAX >> 4; /* NMAX is divisible by 16 */
4827 - do {
4828 - /* 16 sums unrolled */
4829 - adler += buf[offset++]; sum2 += adler;
4830 - adler += buf[offset++]; sum2 += adler;
4831 - adler += buf[offset++]; sum2 += adler;
4832 - adler += buf[offset++]; sum2 += adler;
4833 - adler += buf[offset++]; sum2 += adler;
4834 - adler += buf[offset++]; sum2 += adler;
4835 - adler += buf[offset++]; sum2 += adler;
4836 - adler += buf[offset++]; sum2 += adler;
4837 - adler += buf[offset++]; sum2 += adler;
4838 - adler += buf[offset++]; sum2 += adler;
4839 - adler += buf[offset++]; sum2 += adler;
4840 - adler += buf[offset++]; sum2 += adler;
4841 - adler += buf[offset++]; sum2 += adler;
4842 - adler += buf[offset++]; sum2 += adler;
4843 - adler += buf[offset++]; sum2 += adler;
4844 - adler += buf[offset++]; sum2 += adler;
4845 - } while (--n);
4846 - adler %= BASE;
4847 - sum2 %= BASE;
4848 - }
4849 -
4850 - /* do remaining bytes (less than NMAX, still just one modulo) */
4851 - if (len) { /* avoid modulos if none remaining */
4852 - while (len >= 16) {
4853 - len -= 16;
4854 - adler += buf[offset++]; sum2 += adler;
4855 - adler += buf[offset++]; sum2 += adler;
4856 - adler += buf[offset++]; sum2 += adler;
4857 - adler += buf[offset++]; sum2 += adler;
4858 - adler += buf[offset++]; sum2 += adler;
4859 - adler += buf[offset++]; sum2 += adler;
4860 - adler += buf[offset++]; sum2 += adler;
4861 - adler += buf[offset++]; sum2 += adler;
4862 - adler += buf[offset++]; sum2 += adler;
4863 - adler += buf[offset++]; sum2 += adler;
4864 - adler += buf[offset++]; sum2 += adler;
4865 - adler += buf[offset++]; sum2 += adler;
4866 - adler += buf[offset++]; sum2 += adler;
4867 - adler += buf[offset++]; sum2 += adler;
4868 - adler += buf[offset++]; sum2 += adler;
4869 - adler += buf[offset++]; sum2 += adler;
4870 - }
4871 - while (len--) {
4872 - adler += buf[offset++]; sum2 += adler;
4873 - }
4874 - adler %= BASE;
4875 - sum2 %= BASE;
4876 - }
4877 -
4878 - /* return recombined sums */
4879 - return adler | (sum2 << 16);
4880 -}
4881 -
4882 -/* ========================================================================= */
4883 -ZLIB.adler32 = function(adler, buf, offset, len)
4884 -{
4885 - if(typeof buf === 'string') {
4886 - return adler32_string(adler, buf, offset, len);
4887 - } else {
4888 - return adler32_array(adler, buf, offset, len);
4889 - }
4890 -};
4891 -
4892 -ZLIB.adler32_combine = function(adler1, adler2, len2)
4893 -{
4894 - var sum1;
4895 - var sum2;
4896 - var rem;
4897 -
4898 - /* for negative len, return invalid adler32 as a clue for debugging */
4899 - if (len2 < 0)
4900 - return 0xffffffff;
4901 -
4902 - /* the derivation of this formula is left as an exercise for the reader */
4903 - len2 %= BASE; /* assumes len2 >= 0 */
4904 - rem = len2;
4905 - sum1 = adler1 & 0xffff;
4906 - sum2 = rem * sum1;
4907 - sum2 %= BASE;
4908 - sum1 += (adler2 & 0xffff) + BASE - 1;
4909 - sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
4910 - if (sum1 >= BASE) sum1 -= BASE;
4911 - if (sum1 >= BASE) sum1 -= BASE;
4912 - if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
4913 - if (sum2 >= BASE) sum2 -= BASE;
4914 - return sum1 | (sum2 << 16);
4915 -}
4916 -
4917 -}());
4918 -/* zlib-adler32.js -- JavaScript implementation for the zlib crc32.
4919 - Version: 0.2.0
4920 - LastModified: Apr 12 2012
4921 - Copyright (C) 2012 Masanao Izumo <iz@onicos.co.jp>
4922 -
4923 - API documentation
4924 -==============================================================================
4925 -Usage: crc = ZLIB.crc32(crc, buf, offset, len);
4926 -
4927 - Update a running CRC-32 with the bytes buf[offset..offset+len-1] and return the
4928 - updated CRC-32. If buf is null, this function returns the required
4929 - initial value for the for the crc. Pre- and post-conditioning (one's
4930 - complement) is performed within this function so it shouldn't be done by the
4931 - application.
4932 -
4933 - Usage example:
4934 -
4935 - var crc = ZLIB.crc32(0, null, 0, 0);
4936 -
4937 - while (read_buffer(buffer, length) != EOF) {
4938 - crc = ZLIB.crc32(crc, buffer, 0, length);
4939 - }
4940 - if (crc != original_crc) error();
4941 -
4942 -==============================================================================
4943 -Usage: crc = crc32_combine(crc1, crc2, len2);
4944 -
4945 - Combine two CRC-32 check values into one. For two sequences of bytes,
4946 - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
4947 - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
4948 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
4949 - len2.
4950 -*/
4951 -
4952 -if( typeof ZLIB === 'undefined' ) {
4953 - alert('ZLIB is not defined. SRC zlib.js before zlib-crc32.js')
4954 -}
4955 -
4956 -(function() {
4957 -
4958 -/* crc32.c -- compute the CRC-32 of a data stream
4959 - * Copyright (C) 1995-2006, 2010, 2011 Mark Adler
4960 - * For conditions of distribution and use, see copyright notice in zlib.h
4961 - *
4962 - * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
4963 - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
4964 - * tables for updating the shift register in one step with three exclusive-ors
4965 - * instead of four steps with four exclusive-ors. This results in about a
4966 - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
4967 - */
4968 -
4969 -var crc_table = [
4970 - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
4971 - 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
4972 - 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
4973 - 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
4974 - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
4975 - 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
4976 - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
4977 - 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
4978 - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
4979 - 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
4980 - 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
4981 - 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
4982 - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
4983 - 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
4984 - 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
4985 - 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
4986 - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
4987 - 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
4988 - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
4989 - 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
4990 - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
4991 - 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
4992 - 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
4993 - 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
4994 - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
4995 - 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
4996 - 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
4997 - 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
4998 - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
4999 - 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,

This file is too large to show in full.

views/default-mobile-min.handlebars
+1 -1
@@ -1 +1 @@
1 -<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <link rel="shortcut icon" type="image/x-icon" href="{{{domainurl}}}favicon.ico"> <script type="text/javascript" src="scripts/filesaver.js"></script> <title>{{{title}}}</title> <style> a{color:#036;text-decoration:underline;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;border:none;}.m0{background:url(../images/images16.png) -32px 0px;height:16px;width:16px;border:none;float:left;}.m1{background:url(../images/images16.png) -16px 0px;height:16px;width:16px;border:none;float:left;}.m2{background:url(../images/images16.png) -96px 0px;height:16px;width:16px;border:none;float:left;}.m3{background:url(../images/images16.png) -112px 0px;height:16px;width:16px;border:none;float:left;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); }.DevSt{padding-left:5px;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}</style> </head> <body onload="if (typeof(startup) !== 'undefined') startup();" style="overflow-y:hidden;margin:0;padding:0;border:0;color:black;font-size:13px;font-family:\'Trebuchet MS\', Arial, Helvetica, sans-serif"> <div id="container"> <div id="mastheadx"></div> <div id="masthead" style="background:url(logo.png) 0px 0px;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"> <div style="width:calc(100% - 50px);overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px"> <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px"> <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> </div> <img id="topMenuIcon" class="noselect" style="position:absolute;right:0;top:10px;bottom:50px;color:#c8c8c8;font-size:44px;margin-right:8px;cursor:pointer;display:none" onclick="topMenu()" src="/images/3bars-30.png" width="30" height="30"> </div> <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%"> <div id="column_l" style="width:100%;padding:0;position:absolute;bottom:0px;top:0px"> <div id="p0" style="display:none;width:100%;height:100%"> <div style="display:flex;align-items:center;width:100%;height:100%"> <div id="p0message" style="text-align:center;width:100%"><span id="p0span">Server disconnected</span>, <href onclick="reload()" style="cursor:pointer"><u>click to reconnect</u></href>.</div> </div> </div> <div id="p1" style="display:none;width:100%;height:100%"> <div style="display:flex;align-items:center;width:100%;height:100%"> <div id="p1message" style="text-align:center;width:100%"></div> </div> </div> <div id="p2" style="display:none"> <div id="xdevices"></div> </div> <div id="p3" style="display:none;position:absolute;bottom:0;top:0;width:100%"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div> </td> <td> <img src="/images/user-50.png" width="50" height="50"> </td> <td> <div style="margin-left:5px"> <strong style="font-size:large"><span id="p3userName"></span></strong><br> </div> </td> </tr> </table> <div id="p3info" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <div style="margin-left:8px"> <div id="p3AccountActions"> <p><strong>Account Security</strong></p> <div style="margin-left:9px;margin-bottom:8px"> <div id="manageAuthApp" style="margin-top:5px;display:none"><a onclick="account_manageAuthApp()" style="cursor:pointer">Manage authenticator app</a></div> <div id="manageOtp" style="margin-top:5px;display:none"><a onclick="account_manageOtp(0)" style="cursor:pointer">Manage backup codes</a></div> </div> <p><strong>Account Actions</strong></p> <div style="margin-left:9px;margin-bottom:8px"> <div style="margin-top:5px"><span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a></span></div> <div style="margin-top:5px"><span id="changeEmailId" style="display:none"><a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a></span></div> <div style="margin-top:5px"><a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><span id="p2nextPasswordUpdateTime"></span></div> <div style="margin-top:5px"><a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a></div> </div> <br style="clear:both"> </div> <strong>Device Groups</strong> <span id="p3createMeshLink1">( <a onclick="account_createMesh()" style="cursor:pointer"><img src="images/icon-addnew.png" width="12" height="12" border="0"> New</a> )</span> <br><br> <div id="p3meshes"></div> <div id="p3noMeshFound" style="margin-left:9px;display:none">No device groups.<span id="p3createMeshLink2"> <a onclick="account_createMesh()" style="cursor:pointer"><strong>Get started here!</strong></a></span></div> <br style="clear:both"> </div> </div> </div> <div id="p5" style="display:none"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div> </td> <td> <img src="/images/user-50.png" width="50" height="50"> </td> <td> <div style="margin-left:5px"> <strong style="font-size:large">My Files</strong><br> </div> </td> </tr> </table> <div id="p5myfiles" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <table id="p5toolbar" style="width:100%;height:78px" cellpadding="0" cellspacing="0"> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5FolderUp" disabled="disabled" onclick="p5folderup()" value="Up"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile()" value="SelectAll" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5RenameFileButton" disabled="disabled" value="Rename" onclick="p5renamefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5DeleteFileButton" disabled="disabled" value="Delete" onclick="p5deletefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5NewFolderButton" disabled="disabled" value="Folder" onclick="p5createfolder()" onkeypress="return false" onkeydown="return false"> </div> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5UploadButton" disabled="disabled" value="Upload" onclick="p5uploadFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5CutButton" disabled="disabled" value="Cut" onclick="p5copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5CopyButton" disabled="disabled" value="Copy" onclick="p5copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5PasteButton" disabled="disabled" value="Paste" onclick="p5pasteFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5RefreshButton" value="Refresh" onclick="p5refreshFiles()" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <table style="width:100%"> <tr> <td id="p5currentpath" style="overflow:hidden;padding-left:4px;padding-top:2px"></td> <td style="text-align:right;padding-right:4px"> <select id="p5sortdropdown" onchange="updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </td> </tr> </table> </td> </tr> </table> <div id="p5filetable" style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"> <span id="p5files"></span> </div> <table id="p5toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px;background-color:#D3D9D6" cellpadding="0" cellspacing="0"> <tr> <td style="text-align:left;padding:3px">&nbsp;<span id="p5bottomstatus"></span></td> <td id="p5rightOfButtons" style="text-align:right;padding:3px"></td> </tr> </table> </div> </div> <div id="p10" style="display:none;position:absolute;bottom:0;top:0;width:100%;overflow:hidden"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;position:absolute;top:0"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div> </td> <td> <a id="MainComputerImage" style="cursor:pointer" onclick="p10showiconselector()"></a> </td> <td> <div style="margin-left:5px"> <strong><span id="p10deviceName"></span></strong><br> <span id="MainComputerState"></span> </div> </td> </tr> </table> <div id="p10general" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <div id="p10html" style="margin-left:8px;margin-right:8px"></div> <div id="p10html2"></div> <div id="p10html3"></div> </div> <div id="p10desktop" style="overflow:hidden;position:absolute;top:55px;bottom:0px;width:100%;display:none"> <div id="deskarea1" style="position:absolute;top:0px;width:100%;height:25px"> <div style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <span id="p14power"></span>&nbsp; <input id="DeskSoftInput" type="text" style="width:25px;display:none;opacity:.2" onblur="toggleSoftKeys(0)" onkeypress="return ondeskkeypress(event)" onkeydown="return ondeskkeydown(event)" onkeyup="return ondeskkeyup(event)"> </div> <div style="margin-left:3px"> <input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"> <input type="button" id="connectbutton1h" value="HW Connect" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"> <input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"> <span id="deskstatus">Disconnected</span> </div> </div> </div> <div id="deskarea3" style="position:absolute;top:25px;width:100%;height:calc(100% - 50px)"> <div id="deskarea3x" style="background:black;text-align:center;height:100%;position:relative"> <div id="DeskParent" style="height:100%"> <canvas id="Desk" width="640" height="200" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)" onmousewheel="dmousewheel(event)"></canvas> </div> <div id="DeskTools" style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none"> <a id="DeskToolsRefreshButton" style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Refresh</a> <div id="DeskToolsBar" style="position:absolute;padding:3px;border-radius:3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer">Processes</div> <div style="position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left"> <div style="border-bottom:1px solid darkgray;padding:3px"><a style="width:50px;padding-right:5px;float:left;cursor:pointer" title="Sort by process id" onclick="sortProcess(0)">PID</a><a style="cursor:pointer" title="Sort by name" onclick="sortProcess(1)">Name</a></div> <div id="DeskToolsProcesses" style="overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%"></div> </div> </div> </div> </div> <div id="deskarea4" style="position:absolute;bottom:0px;width:100%;height:25px"> <div style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onclick="deskGetDisplayNumbers(event)"></select>&nbsp; <span id="DeskToastButton" title="Display a notification on the remote computer"><img src='images/icon-notify.png' onclick="deviceToastFunction()" height="16" width="16" style="padding-top:2px"></span>&nbsp; </div> <div> <input id="deskActionsBtn" type="button" style="margin-left:3px" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()"> <input type="button" value="Settings" title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()"> <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="display:none"> <input id="DeskSpecialKeys" type="button" value="Special Keys" onkeypress="return false" onkeydown="return false" onclick="sendSpecialKeys()"> <input id="DeskSoftKeys" type="button" value="Keyboard" onkeypress="return false" onkeydown="return false" onclick="toggleSoftKeys(1)"> <label><span id="DeskControlSpan" style="display:none" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false">Input</span></label> </div> </div> </div> </div> <div id="p10files" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%;display:none"> <table id="p13toolbar" style="width:100%;height:111px" cellpadding="0" cellspacing="0"> <tr> <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px"> <div style="float:right;text-align:right"> <input id="filesActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:2px"> </div> <div style="margin-left:2px"> <input id="p13AutoConnect" value="AutoConnect" onclick="autoConnectFiles(event)" onkeypress="return false" onkeydown="return false" type="button" style="display:none"> <input id="p13Connect" value="Connect" onclick="connectFiles(event)" onkeypress="return false" onkeydown="return false" type="button"> <span id="p13Status">Disconnected</span> </div> </td> </tr> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Up"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="SelectAll" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13RenameFileButton" disabled="disabled" value="Rename" onclick="p13renamefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13DeleteFileButton" disabled="disabled" value="Delete" onclick="p13deletefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13NewFolderButton" disabled="disabled" value="Folder" onclick="p13createfolder()" onkeypress="return false" onkeydown="return false"> </div> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13UploadButton" disabled="disabled" value="Upload" onclick="p13uploadFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13CutButton" disabled="disabled" value="Cut" onclick="p13copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13CopyButton" disabled="disabled" value="Copy" onclick="p13copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13PasteButton" disabled="disabled" value="Paste" onclick="p13pasteFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13RefreshButton" disabled="disabled" value="Refresh" onclick="p13folderup(9999)" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <table style="width:100%"> <tr> <td id="p13currentpath" style="overflow:hidden;padding-left:4px;padding-top:2px"></td> <td style="text-align:right;padding-right:4px"> <select id="p13sortdropdown" onchange="p13updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </td> </tr> </table> </td> </tr> </table> <div id="p13filetable" style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"> <span id="p13files"></span> </div> <table id="p13toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px" cellpadding="0" cellspacing="0"> <tr><td style="text-align:left;padding:3px;text-align:center;background-color:#D3D9D6">&nbsp;<span id="p13bottomstatus"></span></td></tr> </table> </div> </div> <div id="p20" style="display:none;position:absolute;bottom:0;top:0;width:100%"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div> </td> <td onclick="p20editmesh(1)"> <img src="/images/meshicon50.png" width="50" height="50"> </td> <td onclick="p20editmesh(1)"> <div style="margin-left:5px"> <strong style="font-size:large"><span id="p20meshName"></span></strong><br> </div> </td> </tr> </table> <div id="p20info" style="margin-left:8px;margin-right:8px"></div> </div> </div> </div> <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px"> <table id="footerMenu" cellpadding="0" cellspacing="0" style="height:32px;width:100%;color:white;cursor:pointer;table-layout:fixed"></table> </div> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:90px;width:300px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> <div id="dialog3" style="margin:auto;margin:3px"> <select id="deskkeys" style="width:100%"> <option value="10">Ctrl+Alt+Del <option value="11">Tab <option value="5">Win <option value="0">Win+Down <option value="1">Win+Up <option value="2">Win+L <option value="3">Win+M <option value="4">Shift+Win+M <option value="6">Win+R <option value="7">Alt-F4 <option value="8">Ctrl-W <option value="9">Alt-Tab </select> </div> <div id="dialog7" style="margin:auto;margin:3px"> <div id="d7meshkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Agent Remote Desktop</h4> <div style="margin:3px 0 3px 0"> <select id="d7bitmapquality" style="float:right;width:200px;height:20px" dir="rtl"></select> <div style="height:20px">Quality</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7bitmapscaling" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="1024">100% <option value="896">87.5% <option value="768">75% <option value="640">62.5% <option value="512">50% <option value="384">37.5% <option value="256">25% <option value="128">12.5% </select> <div style="height:20px">Scaling</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7framelimiter" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="50">Fast <option value="100">Medium <option value="400">Slow <option value="1000">Very slow </select> <div style="height:20px">Rate</div> </div> </div> <div id="d7amtkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Intel&reg; AMT Hardware KVM</h4> <div style='height:26px'> <select id="d7desktopmode" style="float:right;width:200px"> <option value="1">RLE8, Fastest <option value="2">RLE16, Recommended <option value="3">RAW8, Slow <option value="4">RAW16, Very Slow </select> <div>Encoding</div> </div> <div style="height:60px"> <div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white"> <label><input type="checkbox" id='d7showfocus'>Show Focus Tool<br></label> <label><input type="checkbox" id='d7showcursor'>Show Local Mouse Cursor<></label>> </div> <div>Other</div> </div> </div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> </div> </div> <div id="topMenu" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:0px 0px 5px 5px;position:fixed;top:50px;right:5px;width:170px;display:none"> <div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer" onclick="topMenu(2)">My Files</div> <div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer" onclick="topMenu(1)">My Account</div> <div id="logoutMenuOption"><a href="/logout"><div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer">Logout</div></a></div> </div> <iframe name="fileUploadFrame" style="display:none"></iframe> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function QC(a){try{return Q(a).classList}catch(a){}}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}function zeroPad(b,a){if(a==null){a=2}var d="00000000"+b;return d.substr(d.length-a)}var MeshServerCreateControl=function(b,a){var c={};c.State=0;c.connectstate=0;c.pingTimer=null;c.authCookie=a;c.trace=false;c.xxStateChange=function(e,d){if(c.State==e){return}var f=c.State;c.State=e;if(c.onStateChanged){c.onStateChanged(c,c.State,f,d)}};c.Start=function(){if(c.connectstate!=0){return}c.connectstate=0;var d=window.location.protocol.replace("http","ws")+"//"+window.location.host+b+"control.ashx";if(c.authCookie&&(c.authCookie!="")){d+="?auth="+c.authCookie}c.socket=new WebSocket(d);c.socket.onopen=function(f){c.connectstate=1};c.socket.onmessage=c.xxOnMessage;c.socket.onclose=function(f){c.Stop(f.code)};c.xxStateChange(1,0);if(c.pingTimer!=null){clearInterval(c.pingTimer)}c.pingTimer=setInterval(function(){c.send({action:"ping"})},29000)};c.Stop=function(d){c.connectstate=0;if(c.socket){c.socket.close();delete c.socket}if(c.pingTimer!=null){clearInterval(c.pingTimer);c.pingTimer=null}c.xxStateChange(0,d)};c.xxOnMessage=function(d){if(c.State==1){c.xxStateChange(2)}var f;try{f=JSON.parse(d.data)}catch(d){return}if((typeof f!="object")||(f.action=="pong")){return}if(f.action=="close"){if(f.msg){console.log(f.msg)}c.Stop(f.cause);return}if(c.trace){console.log("RECV",f)}if(c.onMessage){c.onMessage(c,f)}};c.send=function(d){if(c.socket!=null&&c.connectstate==1){if(c.trace){console.log("SEND",d)}c.socket.send(JSON.stringify(d))}};return c};var CreateAgentRedirect=function(f,g,l,a,k,b){var h={};h.m=g;g.parent=h;h.meshserver=f;h.authCookie=a;h.rauthCookie=k;h.State=0;h.nodeid=null;h.socket=null;h.connectstate=-1;h.tunnelid=Math.random().toString(36).substring(2);h.protocol=g.protocol;h.onStateChanged=null;h.ctrlMsgAllowed=true;h.attemptWebRTC=false;h.webRtcActive=false;h.webSwitchOk=false;h.webchannel=null;h.webrtc=null;h.debugmode=0;h.serverIsRecording=false;if(b==null){b="/"}h.consoleMessage=null;h.onConsoleMessageChange=null;h.Start=function(m){var p,o=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?browser=1&p="+h.protocol+"&nodeid="+m+"&id="+h.tunnelid;if((a!=null)&&(a!="")){o+="&auth="+a}h.nodeid=m;h.connectstate=0;h.socket=new WebSocket(o);h.socket.onopen=h.xxOnSocketConnected;h.socket.onmessage=h.xxOnMessage;h.socket.onerror=function(q){};h.socket.onclose=h.xxOnSocketClosed;h.xxStateChange(1);var n="*"+b+"meshrelay.ashx?p="+h.protocol+"&nodeid="+m+"&id="+h.tunnelid;if((k!=null)&&(k!="")){n+=("&rauth="+k)}h.meshserver.send({action:"msg",type:"tunnel",nodeid:h.nodeid,value:n,usage:h.protocol})};h.xxOnSocketConnected=function(){if(h.debugmode==1){console.log("onSocketConnected")}h.xxStateChange(2)};h.xxOnControlCommand=function(o){var m;try{m=JSON.parse(o)}catch(n){return}if(m.ctrlChannel!="102938"){h.xxOnSocketData(o);return}if(m.type=="console"){h.consoleMessage=m.msg;if(h.onConsoleMessageChange){h.onConsoleMessageChange(h,h.consoleMessage)}}else{if(h.webrtc!=null){if(m.type=="answer"){h.webrtc.setRemoteDescription(new RTCSessionDescription(m),function(){},h.xxCloseWebRTC)}else{if(m.type=="webrtc0"){h.webSwitchOk=true;j()}else{if(m.type=="webrtc1"){h.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}')}else{if(m.type=="webrtc2"){}}}}}}};h.sendCtrlMsg=function(n){if(h.ctrlMsgAllowed==true){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof n,n)}try{h.socket.send(n)}catch(m){}}};function j(){if((h.webSwitchOk==true)&&(h.webRtcActive==true)){h.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}');h.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}');if(h.onStateChanged!=null){h.onStateChanged(h,h.State)}}}h.xxOnMessage=function(p){if(h.State<3){if((p.data=="c")||(p.data=="cr")){if(p.data=="cr"){h.serverIsRecording=true}try{h.socket.send(h.protocol)}catch(q){}h.xxStateChange(3);if(h.attemptWebRTC==true){var o=null;if(typeof RTCPeerConnection!=="undefined"){h.webrtc=new RTCPeerConnection(o)}else{if(typeof webkitRTCPeerConnection!=="undefined"){h.webrtc=new webkitRTCPeerConnection(o)}}if(h.webrtc!=null){h.webchannel=h.webrtc.createDataChannel("DataChannel",{});h.webchannel.onmessage=h.xxOnMessage;h.webchannel.onopen=function(){h.webRtcActive=true;j()};h.webchannel.onclose=function(t){if(h.webRtcActive){h.Stop()}};h.webrtc.onicecandidate=function(t){if(t.candidate==null){try{h.socket.send(JSON.stringify(h.webrtcoffer))}catch(u){}}else{h.webrtcoffer.sdp+=("a="+t.candidate.candidate+"\r\n")}};h.webrtc.oniceconnectionstatechange=function(){if(h.webrtc!=null){if(h.webrtc.iceConnectionState=="disconnected"){if(h.webRtcActive==true){h.Stop()}else{h.xxCloseWebRTC()}}else{if(h.webrtc.iceConnectionState=="failed"){h.xxCloseWebRTC()}}}};h.webrtc.createOffer(function(t){h.webrtcoffer=t;h.webrtc.setLocalDescription(t,function(){},h.xxCloseWebRTC)},h.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:false,OfferToReceiveVideo:false}})}}return}}if(typeof p.data=="string"){h.xxOnControlCommand(p.data);return}if(typeof p.data=="object"){if(e==true){d.push(p.data);return}if(c.readAsBinaryString){e=true;c.readAsBinaryString(new Blob([p.data]))}else{if(c.readAsArrayBuffer){e=true;c.readAsArrayBuffer(p.data)}else{var m="",n=new Uint8Array(p.data),s=n.byteLength;for(var r=0;r<s;r++){m+=String.fromCharCode(n[r])}h.xxOnSocketData(m)}}}else{h.xxOnSocketData(p.data)}};var c=new FileReader();var e=false,d=[];if(c.readAsBinaryString){c.onload=function(m){h.xxOnSocketData(m.target.result);if(d.length==0){e=false}else{c.readAsBinaryString(new Blob([d.shift()]))}}}else{if(c.readAsArrayBuffer){c.onloadend=function(m){h.xxOnSocketData(m.target.result);if(d.length==0){e=false}else{c.readAsArrayBuffer(d.shift())}}}}h.xxOnSocketData=function(o){if(!o||h.connectstate==-1){return}if(typeof o==="object"){var m="",n=new Uint8Array(o),q=n.byteLength;for(var p=0;p<q;p++){m+=String.fromCharCode(n[p])}o=m}else{if(typeof o!=="string"){return}}if((typeof args!="undefined")&&args.redirtrace){console.log("RedirRecv",typeof o,o.length,o)}return h.m.ProcessData(o)};h.sendText=function(m){if(typeof m!="string"){m=JSON.stringify(m)}h.send(encode_utf8(m))};h.send=function(q){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof q,q.length,q)}try{if(h.socket!=null&&h.socket.readyState==WebSocket.OPEN){if(typeof q=="string"){if(h.debugmode==1){var m=new Uint8Array(q.length),n=[];for(var p=0;p<q.length;++p){m[p]=q.charCodeAt(p);n.push(q.charCodeAt(p))}if(h.webRtcActive==true){h.webchannel.send(m.buffer)}else{h.socket.send(m.buffer)}}else{var m=new Uint8Array(q.length);for(var p=0;p<q.length;++p){m[p]=q.charCodeAt(p)}if(h.webRtcActive==true){h.webchannel.send(m.buffer)}else{h.socket.send(m.buffer)}}}else{if(h.webRtcActive==true){h.webchannel.send(q)}else{h.socket.send(q)}}}}catch(o){}};h.xxOnSocketClosed=function(){h.Stop(1)};h.xxStateChange=function(m){if(h.State==m){return}h.State=m;h.m.xxStateChange(h.State);if(h.onStateChanged!=null){h.onStateChanged(h,h.State)}};h.xxCloseWebRTC=function(){if(h.webchannel!=null){try{h.webchannel.close()}catch(m){}h.webchannel=null}if(h.webrtc!=null){try{h.webrtc.close()}catch(m){}h.webrtc=null}h.webRtcActive=false};h.Stop=function(n){if(h.debugmode==1){console.log("stop",n)}h.xxCloseWebRTC();h.connectstate=-1;if(h.socket!=null){try{if(h.socket.readyState==1){h.sendCtrlMsg('{"ctrlChannel":"102938","type":"close"}');h.socket.close()}}catch(m){}h.socket=null}h.xxStateChange(0)};return h};var CreateAgentRemoteDesktop=function(a,f){var e={};e.CanvasId=a;if(typeof a==="string"){e.CanvasId=Q(a)}e.Canvas=e.CanvasId.getContext("2d");e.scrolldiv=f;e.State=0;e.PendingOperations=[];e.tilesReceived=0;e.TilesDrawn=0;e.KillDraw=0;e.ipad=false;e.tabletKeyboardVisible=false;e.LastX=0;e.LastY=0;e.touchenabled=0;e.submenuoffset=0;e.touchtimer=null;e.TouchArray={};e.connectmode=0;e.connectioncount=0;e.rotation=0;e.protocol=2;e.debugmode=0;e.firstUpKeys=[];e.stopInput=false;e.localKeyMap=true;e.altPressed=false;e.ctrlPressed=false;e.shiftPressed=false;e.sessionid=0;e.username;e.oldie=false;e.CompressionLevel=50;e.ScalingLevel=1024;e.FrameRateTimer=50;e.FirstDraw=false;e.ScreenWidth=960;e.ScreenHeight=700;e.width=960;e.height=960;e.onScreenSizeChange=null;e.onMessage=null;e.onConnectCountChanged=null;e.onDebugMessage=null;e.onTouchEnabledChanged=null;e.onDisplayinfo=null;e.accumulator=null;var d=["default","progress","crosshair","pointer","help","text","no-drop","move","nesw-resize","ns-resize","nwse-resize","w-resize","alias","wait","none"];e.Start=function(){e.State=0;e.accumulator=null};e.Stop=function(){e.setRotation(0);e.UnGrabKeyInput();e.UnGrabMouseInput();e.touchenabled=0;if(e.onScreenSizeChange!=null){e.onScreenSizeChange(e,e.ScreenWidth,e.ScreenHeight,e.CanvasId)}e.Canvas.clearRect(0,0,e.CanvasId.width,e.CanvasId.height)};e.xxStateChange=function(g){if(e.State==g){return}e.State=g;e.CanvasId.style.cursor="default";switch(g){case 0:e.Stop();break;case 3:break}};e.send=function(g){if(e.debugmode>1){console.log("KSend("+g.length+"): "+rstr2hex(g))}if(e.parent!=null){e.parent.send(g)}};e.ProcessPictureMsg=function(h,k,l){var j=new Image();j.xcount=e.tilesReceived++;var g=e.tilesReceived;j.src="data:image/jpeg;base64,"+btoa(h.substring(4,h.length));j.onload=function(){if(e.Canvas!=null&&e.KillDraw<g&&e.State!=0){e.PendingOperations.push([g,2,j,k,l]);while(e.DoPendingOperations()){}}};j.error=function(){console.log("DecodeTileError")}};e.DoPendingOperations=function(){if(e.PendingOperations.length==0){return false}for(var g=0;g<e.PendingOperations.length;g++){var h=e.PendingOperations[g];if(h[0]==(e.TilesDrawn+1)){if(h[1]==1){e.ProcessCopyRectMsg(h[2])}else{if(h[1]==2){e.Canvas.drawImage(h[2],e.rotX(h[3],h[4]),e.rotY(h[3],h[4]));delete h[2]}}e.PendingOperations.splice(g,1);delete h;e.TilesDrawn++;if(e.TilesDrawn==e.tilesReceived&&e.KillDraw<e.TilesDrawn){e.KillDraw=e.TilesDrawn=e.tilesReceived=0}return true}}if(e.oldie&&e.PendingOperations.length>0){e.TilesDrawn++}return false};e.ProcessCopyRectMsg=function(k){var l=((k.charCodeAt(0)&255)<<8)+(k.charCodeAt(1)&255);var m=((k.charCodeAt(2)&255)<<8)+(k.charCodeAt(3)&255);var g=((k.charCodeAt(4)&255)<<8)+(k.charCodeAt(5)&255);var h=((k.charCodeAt(6)&255)<<8)+(k.charCodeAt(7)&255);var n=((k.charCodeAt(8)&255)<<8)+(k.charCodeAt(9)&255);var j=((k.charCodeAt(10)&255)<<8)+(k.charCodeAt(11)&255);e.Canvas.drawImage(Canvas.canvas,l,m,n,j,g,h,n,j)};e.SendUnPause=function(){e.send(String.fromCharCode(0,8,0,5,0))};e.SendPause=function(){e.send(String.fromCharCode(0,8,0,5,1))};e.SendCompressionLevel=function(k,h,j,g){if(h){e.CompressionLevel=h}if(j){e.ScalingLevel=j}if(g){e.FrameRateTimer=g}e.send(String.fromCharCode(0,5,0,10,k,e.CompressionLevel)+e.shortToStr(e.ScalingLevel)+e.shortToStr(e.FrameRateTimer))};e.SendRefresh=function(){e.send(String.fromCharCode(0,6,0,4))};e.ProcessScreenMsg=function(h,g){if(e.debugmode>0){console.log("ScreenSize: "+h+" x "+g)}e.Canvas.setTransform(1,0,0,1,0,0);e.rotation=0;e.FirstDraw=true;e.ScreenWidth=e.width=h;e.ScreenHeight=e.height=g;e.KillDraw=e.tilesReceived;while(e.PendingOperations.length>0){e.PendingOperations.shift()}e.SendCompressionLevel(1);e.SendUnPause();if(e.onScreenSizeChange!=null){e.onScreenSizeChange(e,e.ScreenWidth,e.ScreenHeight,e.CanvasId)}};e.ProcessData=function(h){var g=0;while(g<h.length){g+=e.ProcessDataEx(h.substring(g))}};e.ProcessDataEx=function(r){if(e.accumulator!=null){r=e.accumulator+r;e.accumulator=null}if(e.debugmode>1){console.log("KRecv("+r.length+"): "+rstr2hex(r.substring(0,Math.min(r.length,40))))}if(r.length<4){return}var g=null,s=0,t=0,j=ReadShort(r,0),h=ReadShort(r,2),p=0;if((j==27)&&(h==8)){if(r.length<12){return}j=ReadShort(r,8);h=ReadInt(r,4);if((h+8)>r.length){e.accumulator=r;return}r=r.substring(8);p=8}if((h!=r.length)&&(e.debugmode>0)){console.log(h,r.length,h==r.length)}if((j>=18)&&(j!=65)&&(j!=88)){console.error("Invalid KVM command "+j+" of size "+h);console.log("Invalid KVM data",r.length,rstr2hex(r.substring(0,40))+"...");return}if(h>r.length){e.accumulator=r;return}if(j==3||j==4||j==7){g=r.substring(4,h);s=((g.charCodeAt(0)&255)<<8)+(g.charCodeAt(1)&255);t=((g.charCodeAt(2)&255)<<8)+(g.charCodeAt(3)&255);if(e.debugmode>0){console.log("CMD"+j+" at X="+s+" Y="+t)}}switch(j){case 3:if(e.FirstDraw){e.onResize()}e.ProcessPictureMsg(g,s,t);break;case 4:if(e.FirstDraw){e.onResize()}if(e.TilesDrawn==e.tilesReceived){e.ProcessCopyRectMsg(g)}else{e.PendingOperations.push([++tilesReceived,1,g])}break;case 7:e.ProcessScreenMsg(s,t);e.SendKeyMsgKC(e.KeyAction.UP,16);e.SendKeyMsgKC(e.KeyAction.UP,17);e.SendKeyMsgKC(e.KeyAction.UP,18);e.SendKeyMsgKC(e.KeyAction.UP,91);e.SendKeyMsgKC(e.KeyAction.UP,92);e.SendKeyMsgKC(e.KeyAction.UP,16);e.send(String.fromCharCode(0,14,0,4));break;case 11:var q=0,n={},l=((r.charCodeAt(4)&255)<<8)+(r.charCodeAt(5)&255);if(l>0){q=((r.charCodeAt(6+(l*2))&255)<<8)+(r.charCodeAt(7+(l*2))&255);for(var o=0;o<l;o++){var m=((r.charCodeAt(6+(o*2))&255)<<8)+(r.charCodeAt(7+(o*2))&255);if(m==65535){n[m]="All Displays"}else{n[m]="Display "+m}}}if(e.onDisplayinfo!=null){e.onDisplayinfo(e,n,q)}break;case 12:break;case 14:e.touchenabled=1;e.TouchArray={};if(e.onTouchEnabledChanged!=null){e.onTouchEnabledChanged(e.touchenabled)}break;case 15:e.TouchArray={};break;case 16:e.connectioncount=ReadInt(r,4);if(e.onConnectCountChanged!=null){e.onConnectCountChanged(e.connectioncount,e)}break;case 17:if(e.onMessage!=null){e.onMessage(r.substring(4,h),e)}break;case 65:r=r.substring(4);if(r[0]!="."){console.log(r);if(e.parent!=null){e.parent.consoleMessage=r;if(e.parent.onConsoleMessageChange){e.parent.onConsoleMessageChange(e.parent,r)}}}else{console.log("KVM: "+r.substring(1))}break;case 88:if(h!=5){break}var k=r.charCodeAt(4);if(k>d.length){k=0}e.CanvasId.style.cursor=d[k];break}return h+p};e.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};e.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5,DBLCLICK:6};e.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};e.Alternate=0;var c={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 b(g){if(g.code.startsWith("Key")&&g.code.length==4){return g.code.charCodeAt(3)}if(g.code.startsWith("Digit")&&g.code.length==6){return g.code.charCodeAt(5)}if(g.code.startsWith("Numpad")&&g.code.length==7){return g.code.charCodeAt(6)+48}return c[g.code]}e.SendKeyMsg=function(g,h){if(g==null){return}if(!h){h=window.event}if(h.code&&(e.localKeyMap==false)){var j=b(h);if(j!=null){e.SendKeyMsgKC(g,j)}}else{var j=h.keyCode;if(j==59){j=186}else{if(j==173){j=189}else{if(j==61){j=187}}}e.SendKeyMsgKC(g,j)}};e.SendMessage=function(g){if(e.State==3){e.send(String.fromCharCode(0,17)+e.shortToStr(4+g.length)+g)}};e.SendKeyMsgKC=function(g,j){if(e.State!=3){return}if(typeof g=="object"){for(var h in g){e.SendKeyMsgKC(g[h][0],g[h][1])}}else{e.send(String.fromCharCode(0,e.InputType.KEY,0,6,(g-1),j))}};e.sendcad=function(){e.SendCtrlAltDelMsg()};e.SendCtrlAltDelMsg=function(){if(e.State==3){e.send(String.fromCharCode(0,e.InputType.CTRLALTDEL,0,4))}};e.SendEscKey=function(){if(e.State==3){e.send(String.fromCharCode(0,e.InputType.KEY,0,6,0,27,0,e.InputType.KEY,0,6,1,27))}};e.SendStartMsg=function(){e.SendKeyMsgKC(e.KeyAction.EXDOWN,91);e.SendKeyMsgKC(e.KeyAction.EXUP,91)};e.SendCharmsMsg=function(){e.SendKeyMsgKC(e.KeyAction.EXDOWN,91);e.SendKeyMsgKC(e.KeyAction.DOWN,67);e.SendKeyMsgKC(e.KeyAction.UP,67);e.SendKeyMsgKC(e.KeyAction.EXUP,91)};e.SendTouchMsg1=function(h,g,j,k){if(e.State==3){e.send(String.fromCharCode(0,e.InputType.TOUCH)+e.shortToStr(14)+String.fromCharCode(1,h)+e.intToStr(g)+e.shortToStr(j)+e.shortToStr(k))}};e.SendTouchMsg2=function(j,g){var m="";var h;var n="TOUCHSEND: ";for(var l in e.TouchArray){if(l==j){h=g}else{if(e.TouchArray[l].f==1){h=65536|2|4;e.TouchArray[l].f=3;n+="START"+l}else{if(e.TouchArray[l].f==2){h=262144;n+="STOP"+l}else{h=2|4|131072}}}m+=String.fromCharCode(l)+e.intToStr(h)+e.shortToStr(e.TouchArray[l].x)+e.shortToStr(e.TouchArray[l].y);if(e.TouchArray[l].f==2){delete e.TouchArray[l]}}if(e.State==3){e.send(String.fromCharCode(0,e.InputType.TOUCH)+e.shortToStr(5+m.length)+String.fromCharCode(2)+m)}if(Object.keys(e.TouchArray).length==0&&e.touchtimer!=null){clearInterval(e.touchtimer);e.touchtimer=null}};e.SendMouseMsg=function(g,k){if(e.State!=3){return}if(g!=null&&e.Canvas!=null){if(!k){var k=window.event}var n=(e.Canvas.canvas.height/e.CanvasId.clientHeight);var o=(e.Canvas.canvas.width/e.CanvasId.clientWidth);var m=e.GetPositionOfControl(e.Canvas.canvas);var p=((k.pageX-m[0])*o);var q=((k.pageY-m[1])*n);if(k.addx){p+=k.addx}if(k.addy){q+=k.addy}if(p>=0&&p<=e.Canvas.canvas.width&&q>=0&&q<=e.Canvas.canvas.height){var h=0;var j=0;if(g==e.KeyAction.UP||g==e.KeyAction.DOWN){if(k.which){((k.which==1)?(h=e.MouseButton.LEFT):((k.which==2)?(h=e.MouseButton.MIDDLE):(h=e.MouseButton.RIGHT)))}else{if(k.button){((k.button==0)?(h=e.MouseButton.LEFT):((k.button==1)?(h=e.MouseButton.MIDDLE):(h=e.MouseButton.RIGHT)))}}}else{if(g==e.KeyAction.SCROLL){if(k.detail){j=(-1*(k.detail*120))}else{if(k.wheelDelta){j=(k.wheelDelta*3)}}}}var l="";if(g==e.KeyAction.DBLCLICK){l=String.fromCharCode(0,e.InputType.MOUSE,0,10,0,136,((p/256)&255),(p&255),((q/256)&255),(q&255))}else{if(g==e.KeyAction.SCROLL){l=String.fromCharCode(0,e.InputType.MOUSE,0,12,0,0,((p/256)&255),(p&255),((q/256)&255),(q&255),((j/256)&255),(j&255))}else{l=String.fromCharCode(0,e.InputType.MOUSE,0,10,0,((g==e.KeyAction.DOWN)?h:((h*2)&255)),((p/256)&255),(p&255),((q/256)&255),(q&255))}}if(e.Action==e.KeyAction.NONE){if(e.Alternate==0||e.ipad){e.send(l);e.Alternate=1}else{e.Alternate=0}}else{e.send(l)}}}};e.GetDisplayNumbers=function(){e.send(String.fromCharCode(0,11,0,4))};e.SetDisplay=function(g){console.log("Set display",g);e.send(String.fromCharCode(0,12,0,6,g>>8,g&255))};e.intToStr=function(g){return String.fromCharCode((g>>24)&255,(g>>16)&255,(g>>8)&255,g&255)};e.shortToStr=function(g){return String.fromCharCode((g>>8)&255,g&255)};e.onResize=function(){if(e.ScreenWidth==0||e.ScreenHeight==0){return}if(e.Canvas.canvas.width==e.ScreenWidth&&e.Canvas.canvas.height==e.ScreenHeight){return}if(e.FirstDraw){e.Canvas.canvas.width=e.ScreenWidth;e.Canvas.canvas.height=e.ScreenHeight;e.Canvas.fillRect(0,0,e.ScreenWidth,e.ScreenHeight);if(e.onScreenSizeChange!=null){e.onScreenSizeChange(e,e.ScreenWidth,e.ScreenHeight,e.CanvasId)}}e.FirstDraw=false};e.xxMouseInputGrab=false;e.xxKeyInputGrab=false;e.xxMouseMove=function(g){if(e.State==3){e.SendMouseMsg(e.KeyAction.NONE,g)}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.xxMouseUp=function(g){if(e.State==3){e.SendMouseMsg(e.KeyAction.UP,g)}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.xxMouseDown=function(g){if(e.State==3){e.SendMouseMsg(e.KeyAction.DOWN,g)}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.xxMouseDblClick=function(g){if(e.State==3){e.SendMouseMsg(e.KeyAction.DBLCLICK,g)}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.xxDOMMouseScroll=function(g){if(e.State==3){e.SendMouseMsg(e.KeyAction.SCROLL,g);return false}return true};e.xxMouseWheel=function(g){if(e.State==3){e.SendMouseMsg(e.KeyAction.SCROLL,g);return false}return true};e.xxKeyUp=function(g){if(e.State==3){e.SendKeyMsg(e.KeyAction.UP,g)}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.xxKeyDown=function(g){if(e.State==3){e.SendKeyMsg(e.KeyAction.DOWN,g)}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.xxKeyPress=function(g){if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.handleKeys=function(g){if(e.stopInput==true||desktop.State!=3){return false}return e.xxKeyPress(g)};e.handleKeyUp=function(g){if(e.stopInput==true||desktop.State!=3){return false}if(e.firstUpKeys.length<5){e.firstUpKeys.push(g.keyCode);if((e.firstUpKeys.length==5)){var h=e.firstUpKeys.join(",");if((h=="16,17,91,91,16")||(h=="16,17,18,91,92")){e.stopInput=true}}}if(g.keyCode==16){e.shiftPressed=false}if(g.keyCode==17){e.ctrlPressed=false}if(g.keyCode==18){e.altPressed=false}return e.xxKeyUp(g)};e.handleKeyDown=function(g){if(e.stopInput==true||desktop.State!=3){return false}if(g.keyCode==16){e.shiftPressed=true}if(g.keyCode==17){e.ctrlPressed=true}if(g.keyCode==18){e.altPressed=true}return e.xxKeyDown(g)};e.handleReleaseKeys=function(){if(e.shiftPressed){e.SendKeyMsgKC(e.KeyAction.UP,16)}if(e.ctrlPressed){e.SendKeyMsgKC(e.KeyAction.UP,17)}if(e.altPressed){e.SendKeyMsgKC(e.KeyAction.UP,18)}e.shiftPressed=e.ctrlPressed=e.altPressed=false};e.mousedblclick=function(g){if(e.stopInput==true){return false}return e.xxMouseDblClick(g)};e.mousedown=function(g){if(e.stopInput==true){return false}return e.xxMouseDown(g)};e.mouseup=function(g){if(e.stopInput==true){return false}return e.xxMouseUp(g)};e.mousemove=function(g){if(e.stopInput==true){return false}return e.xxMouseMove(g)};e.mousewheel=function(g){if(e.stopInput==true){return false}return e.xxMouseWheel(g)};e.xxMsTouchEvent=function(g){if(g.originalEvent.pointerType==4){return}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}if(g.type=="MSPointerDown"||g.type=="MSPointerMove"||g.type=="MSPointerUp"){var h=0;var j=g.originalEvent.pointerId%256;var k=g.offsetX*(Canvas.canvas.width/e.CanvasId.clientWidth);var l=g.offsetY*(Canvas.canvas.height/e.CanvasId.clientHeight);if(g.type=="MSPointerDown"){h=65536|2|4}else{if(g.type=="MSPointerMove"){h=131072|2|4}else{if(g.type=="MSPointerUp"){h=262144}}}if(!e.TouchArray[j]){e.TouchArray[j]={x:k,y:l}}e.SendTouchMsg2(j,h);if(g.type=="MSPointerUp"){delete e.TouchArray[j]}}else{alert(g.type)}return true};e.xxTouchStart=function(g){if(e.State!=3){return}if(g.preventDefault){g.preventDefault()}if(e.touchenabled==0||e.touchenabled==1){if(g.originalEvent.touches.length>1){return}var l=g.originalEvent.touches[0];g.which=1;e.LastX=g.pageX=l.pageX;e.LastY=g.pageY=l.pageY;e.SendMouseMsg(KeyAction.DOWN,g)}else{var k=e.GetPositionOfControl(Canvas.canvas);for(var h in g.originalEvent.changedTouches){if(!g.originalEvent.changedTouches[h].identifier){continue}var j=g.originalEvent.changedTouches[h].identifier%256;if(!e.TouchArray[j]){e.TouchArray[j]={x:(g.originalEvent.touches[h].pageX-k[0])*(Canvas.canvas.width/e.CanvasId.clientWidth),y:(g.originalEvent.touches[h].pageY-k[1])*(Canvas.canvas.height/e.CanvasId.clientHeight),f:1}}}if(Object.keys(e.TouchArray).length>0&&touchtimer==null){e.touchtimer=setInterval(function(){e.SendTouchMsg2(256,0)},50)}}};e.xxTouchMove=function(g){if(e.State!=3){return}if(g.preventDefault){g.preventDefault()}if(e.touchenabled==0||e.touchenabled==1){if(g.originalEvent.touches.length>1){return}var l=g.originalEvent.touches[0];g.which=1;e.LastX=g.pageX=l.pageX;e.LastY=g.pageY=l.pageY;e.SendMouseMsg(e.KeyAction.NONE,g)}else{var k=e.GetPositionOfControl(Canvas.canvas);for(var h in g.originalEvent.changedTouches){if(!g.originalEvent.changedTouches[h].identifier){continue}var j=g.originalEvent.changedTouches[h].identifier%256;if(e.TouchArray[j]){e.TouchArray[j].x=(g.originalEvent.touches[h].pageX-k[0])*(e.Canvas.canvas.width/e.CanvasId.clientWidth);e.TouchArray[j].y=(g.originalEvent.touches[h].pageY-k[1])*(e.Canvas.canvas.height/e.CanvasId.clientHeight)}}}};e.xxTouchEnd=function(g){if(e.State!=3){return}if(g.preventDefault){g.preventDefault()}if(e.touchenabled==0||e.touchenabled==1){if(g.originalEvent.touches.length>1){return}g.which=1;g.pageX=LastX;g.pageY=LastY;e.SendMouseMsg(KeyAction.UP,g)}else{for(var h in g.originalEvent.changedTouches){if(!g.originalEvent.changedTouches[h].identifier){continue}var j=g.originalEvent.changedTouches[h].identifier%256;if(e.TouchArray[j]){e.TouchArray[j].f=2}}}};e.GrabMouseInput=function(){if(e.xxMouseInputGrab==true){return}var g=e.CanvasId;g.onmousemove=e.xxMouseMove;g.onmouseup=e.xxMouseUp;g.onmousedown=e.xxMouseDown;g.touchstart=e.xxTouchStart;g.touchmove=e.xxTouchMove;g.touchend=e.xxTouchEnd;g.MSPointerDown=e.xxMsTouchEvent;g.MSPointerMove=e.xxMsTouchEvent;g.MSPointerUp=e.xxMsTouchEvent;if(navigator.userAgent.match(/mozilla/i)){g.DOMMouseScroll=e.xxDOMMouseScroll}else{g.onmousewheel=e.xxMouseWheel}e.xxMouseInputGrab=true};e.UnGrabMouseInput=function(){if(e.xxMouseInputGrab==false){return}var g=e.CanvasId;g.onmousemove=null;g.onmouseup=null;g.onmousedown=null;g.touchstart=null;g.touchmove=null;g.touchend=null;g.MSPointerDown=null;g.MSPointerMove=null;g.MSPointerUp=null;if(navigator.userAgent.match(/mozilla/i)){g.DOMMouseScroll=null}else{g.onmousewheel=null}e.xxMouseInputGrab=false};e.GrabKeyInput=function(){if(e.xxKeyInputGrab==true){return}document.onkeyup=e.xxKeyUp;document.onkeydown=e.xxKeyDown;document.onkeypress=e.xxKeyPress;e.xxKeyInputGrab=true};e.UnGrabKeyInput=function(){if(e.xxKeyInputGrab==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;e.xxKeyInputGrab=false};e.GetPositionOfControl=function(g){var h=Array(2);h[0]=h[1]=0;while(g){h[0]+=g.offsetLeft;h[1]+=g.offsetTop;g=g.offsetParent}return h};e.crotX=function(g,h){if(e.rotation==0){return g}if(e.rotation==1){return h}if(e.rotation==2){return e.Canvas.canvas.width-g}if(e.rotation==3){return e.Canvas.canvas.height-h}};e.crotY=function(g,h){if(e.rotation==0){return h}if(e.rotation==1){return e.Canvas.canvas.width-g}if(e.rotation==2){return e.Canvas.canvas.height-h}if(e.rotation==3){return g}};e.rotX=function(g,h){if(e.rotation==0||e.rotation==1){return g}if(e.rotation==2){return g-e.Canvas.canvas.width}if(e.rotation==3){return g-e.Canvas.canvas.height}};e.rotY=function(g,h){if(e.rotation==0||e.rotation==3){return h}if(e.rotation==1){return h-e.Canvas.canvas.width}if(e.rotation==2){return h-e.Canvas.canvas.height}};e.tcanvas=null;e.setRotation=function(l){while(l<0){l+=4}var g=l%4;if(g==e.rotation){return true}var j=e.Canvas.canvas.width;var h=e.Canvas.canvas.height;if(e.rotation==1||e.rotation==3){j=e.Canvas.canvas.height;h=e.Canvas.canvas.width}if(e.tcanvas==null){e.tcanvas=document.createElement("canvas")}var k=e.tcanvas.getContext("2d");k.setTransform(1,0,0,1,0,0);k.canvas.width=j;k.canvas.height=h;k.rotate((e.rotation*-90)*Math.PI/180);if(e.rotation==0){k.drawImage(e.Canvas.canvas,0,0)}if(e.rotation==1){k.drawImage(e.Canvas.canvas,-e.Canvas.canvas.width,0)}if(e.rotation==2){k.drawImage(e.Canvas.canvas,-e.Canvas.canvas.width,-e.Canvas.canvas.height)}if(e.rotation==3){k.drawImage(e.Canvas.canvas,0,-e.Canvas.canvas.height)}if(e.rotation==0||e.rotation==2){e.Canvas.canvas.height=j;e.Canvas.canvas.width=h}if(e.rotation==1||e.rotation==3){e.Canvas.canvas.height=h;e.Canvas.canvas.width=j}e.Canvas.setTransform(1,0,0,1,0,0);e.Canvas.rotate((g*90)*Math.PI/180);e.rotation=g;e.Canvas.drawImage(e.tcanvas,e.rotX(0,0),e.rotY(0,0));e.ScreenWidth=e.Canvas.canvas.width;e.ScreenHeight=e.Canvas.canvas.height;if(e.onScreenSizeChange!=null){e.onScreenSizeChange(e,e.ScreenWidth,e.ScreenHeight,e.CanvasId)}return true};e.MuchTheSame=function(g,h){return(Math.abs(g-h)<4)};e.Debug=function(g){console.log(g)};e.getIEVersion=function(){var g=-1;if(navigator.appName=="Microsoft Internet Explorer"){var j=navigator.userAgent;var h=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(h.exec(j)!=null){g=parseFloat(RegExp.$1)}}return g};e.haltEvent=function(g){if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};return e};function AmtStackCreateService(s){var r=new Object();r.wsman=s;r.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];r.PendingEnums=[];r.PendingBatchOperations=0;r.ActiveEnumsCount=0;r.MaxActiveEnumsCount=1;r.onProcessChanged=null;var m=0;var l=0;r.GetPendingActions=function(){return(r.PendingEnums.length*2)+(r.ActiveEnumsCount)+r.wsman.comm.PendingAjax.length+r.wsman.comm.ActiveAjaxCount+r.PendingBatchOperations};function q(){var t=r.GetPendingActions();if(m<t){m=t}if(r.onProcessChanged!=null&&l!=t){l=t;r.onProcessChanged(t,m)}if(t==0){m=0}}r.Subscribe=function(v,u,B,t,A,y,z,w,C,x){r.wsman.ExecSubscribe(r.CompleteName(v),u,B,function(F,E,D,G){q();t(r,v,D,G,A)},0,y,z,w,C,x);q()};r.UnSubscribe=function(u,t,x,v,w){r.wsman.ExecUnSubscribe(r.CompleteName(u),function(A,z,y,B){q();t(r,u,y,B,x)},0,v,w);q()};r.Get=function(u,t,w,v){r.wsman.ExecGet(r.CompleteName(u),function(z,y,x,A){q();t(r,u,x,A,w)},0,v);q()};r.Put=function(u,w,t,y,v,x){r.wsman.ExecPut(r.CompleteName(u),w,function(B,A,z,C){q();t(r,u,z,C,y)},0,v,x);q()};r.Create=function(u,w,t,x,v){r.wsman.ExecCreate(r.CompleteName(u),w,function(A,z,y,B){q();t(r,u,y,B,x)},0,v);q()};r.Delete=function(u,w,t,x,v){r.wsman.ExecDelete(r.CompleteName(u),w,function(A,z,y,B){q();t(r,u,y,B,x)},0,v);q()};r.Exec=function(w,v,t,u,z,x,y){r.wsman.ExecMethod(r.CompleteName(w),v,t,function(C,B,A,D){q();u(r,w,r.CompleteExecResponse(A),D,z)},0,x,y);q()};r.ExecWithXml=function(w,v,t,u,z,x,y){r.wsman.ExecMethodXml(r.CompleteName(w),v,execArgumentsToXml(t),function(C,B,A,D){q();u(r,w,r.CompleteExecResponse(A),D,z)},0,x,y);q()};r.Enum=function(u,t,w,v){if(r.ActiveEnumsCount<r.MaxActiveEnumsCount){r.ActiveEnumsCount++;r.wsman.ExecEnum(r.CompleteName(u),function(A,y,x,B,z){q();d(u,x,t,y,B,z)},w,v)}else{r.PendingEnums.push([u,t,w,v])}q()};function d(v,x,t,y,z,A,w){if(z!=200){t(r,v,null,z,A);c(1);return}if(x==null||x.Header.Method!="EnumerateResponse"||!x.Body.EnumerationContext){t(r,v,null,603,A);c(1);return}var u=x.Body.EnumerationContext;r.wsman.ExecPull(y,u,function(D,C,B,E){b(v,B,t,C,[],E,A,w)})}function b(y,A,t,B,w,C,D,z){if(C!=200){t(r,y,null,C,D);c(1);return}if(A==null||A.Header.Method!="PullResponse"){t(r,y,null,604,D);c(1);return}for(var v in A.Body.Items){if(A.Body.Items[v] instanceof Array){for(var x in A.Body.Items[v]){w.push(A.Body.Items[v][x])}}else{w.push(A.Body.Items[v])}}if(A.Body.EnumerationContext){var u=A.Body.EnumerationContext;r.wsman.ExecPull(B,u,function(G,F,E,H){b(y,E,t,F,w,H,D,1)})}else{c(1);t(r,y,w,C,D);q()}}function c(t){r.ActiveEnumsCount-=t;if(r.ActiveEnumsCount>=r.MaxActiveEnumsCount||r.PendingEnums.length==0){return}var u=r.PendingEnums.shift();r.Enum(u[0],u[1],u[2]);c(0)}r.BatchEnum=function(t,w,u,y,v,x){r.PendingBatchOperations+=(w.length*2);a(t,Clone(w),u,y,{},v,x);q()};function a(t,y,u,B,A,v,z){r.PendingBatchOperations-=2;var x=y.shift(),w=r.Enum;if(x[0]=="*"){w=r.Get;x=x.substring(1)}w(x,function(E,C,D,F,G){G[2][C]={response:(D==null?null:D.Body),responses:D,status:F};if(G[1].length==0||F==401||(v!=true&&F!=200&&F!=400)){r.PendingBatchOperations-=(y.length*2);q();u(r,t,G[2],F,B)}else{q();a(t,y,u,B,G[2],z)}},[t,y,A],z);q()}r.BatchGet=function(t,v,u,x,w){g({name:t,names:v,callback:u,current:0,responses:{},tag:x,pri:w});q()};function g(t){if(t.names.length<=t.current){t.callback(r,t.name,t.responses,200,t.tag)}else{r.wsman.ExecGet(r.CompleteName(t.names[t.current]),function(w,v,u,x){f(t,u,x)},t.pri);t.current++}q()}function f(t,u,v){if(u==null||v!=200){t.callback(r,t.name,null,v,t.tag)}else{t.responses[u.Header.Method]=u;g(t)}}r.CompleteName=function(t){if(t.indexOf("AMT_")==0){return r.pfx[0]+t}if(t.indexOf("CIM_")==0){return r.pfx[1]+t}if(t.indexOf("IPS_")==0){return r.pfx[2]+t}};r.CompleteExecResponse=function(t){if(t&&t!=null&&t.Body&&t.Body.ReturnValue){t.Body.ReturnValueStr=r.AmtStatusToStr(t.Body.ReturnValue)}return t};r.RequestPowerStateChange=function(u,t){r.CIM_PowerManagementService_RequestPowerStateChange(u,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',null,null,t)};r.SetBootConfigRole=function(u,t){r.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',u,t)};r.CancelAllQueries=function(t){r.wsman.CancelAllQueries(t)};r.AMT_AgentPresenceWatchdog_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdog_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AddAction=function(y,x,w,u,t,v,B,z,A){r.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:y,NewState:x,EventOnTransition:w,ActionSd:u,ActionEac:t},v,B,z,A)};r.AMT_AgentPresenceWatchdog_DeleteAllActions=function(t,w,u,v){r.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},t,w,u,v)};r.AMT_AgentPresenceWatchdogAction_GetActionEac=function(t){r.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},t)};r.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdogVA_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AddAction=function(y,x,w,u,t,v){r.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:y,NewState:x,EventOnTransition:w,ActionSd:u,ActionEac:t},v)};r.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(t,u){r.Exec("AMT_AgentPresenceWatchdogVA","DeleteAllActions",{_method_dummy:t},u)};r.AMT_AuditLog_ClearLog=function(t){r.Exec("AMT_AuditLog","ClearLog",{},t)};r.AMT_AuditLog_RequestStateChange=function(u,v,t){r.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_AuditLog_ReadRecords=function(u,t,v){r.Exec("AMT_AuditLog","ReadRecords",{StartIndex:u},t,v)};r.AMT_AuditLog_SetAuditLock=function(w,u,v,t){r.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:w,Flag:u,Handle:v},t)};r.AMT_AuditLog_ExportAuditLogSignature=function(u,t){r.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:u},t)};r.AMT_AuditLog_SetSigningKeyMaterial=function(x,w,v,u,t){r.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:x,SigningKey:w,LengthOfCertificates:v,Certificates:u},t)};r.AMT_AuditPolicyRule_SetAuditPolicy=function(v,t,w,x,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:x},u)};r.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(v,t,w,x,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicyBulk",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:x},u)};r.AMT_AuthorizationService_AddUserAclEntryEx=function(w,v,x,t,y,u){r.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:w,DigestPassword:v,KerberosUserSid:x,AccessPermission:t,Realms:y},u)};r.AMT_AuthorizationService_EnumerateUserAclEntries=function(u,t){r.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:u},t)};r.AMT_AuthorizationService_GetUserAclEntryEx=function(u,t,v){r.Exec("AMT_AuthorizationService","GetUserAclEntryEx",{Handle:u},t,v)};r.AMT_AuthorizationService_UpdateUserAclEntryEx=function(x,w,v,y,t,z,u){r.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:x,DigestUsername:w,DigestPassword:v,KerberosUserSid:y,AccessPermission:t,Realms:z},u)};r.AMT_AuthorizationService_RemoveUserAclEntry=function(u,t){r.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:u},t)};r.AMT_AuthorizationService_SetAdminAclEntryEx=function(v,u,t){r.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",{Username:v,DigestPassword:u},t)};r.AMT_AuthorizationService_GetAdminAclEntry=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},t)};r.AMT_AuthorizationService_GetAdminAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},t)};r.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},t)};r.AMT_AuthorizationService_SetAclEnabledState=function(v,u,t,w){r.Exec("AMT_AuthorizationService","SetAclEnabledState",{Handle:v,Enabled:u},t,w)};r.AMT_AuthorizationService_GetAclEnabledState=function(u,t,v){r.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:u},t,v)};r.AMT_EndpointAccessControlService_RequestStateChange=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_EndpointAccessControlService_GetPosture=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:u},t)};r.AMT_EndpointAccessControlService_GetPostureHash=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:u},t)};r.AMT_EndpointAccessControlService_UpdatePostureState=function(u,t){r.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:u},t)};r.AMT_EndpointAccessControlService_GetEacOptions=function(t){r.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},t)};r.AMT_EndpointAccessControlService_SetEacOptions=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:u,PostureHashAlgorithm:v},t)};r.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","SetSystemDefensePolicy",{Policy:u},t)};r.AMT_EnvironmentDetectionSettingData_EnableVpnRouting=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","EnableVpnRouting",{Enable:u},t)};r.AMT_EthernetPortSettings_SetLinkPreference=function(u,v,t){r.Exec("AMT_EthernetPortSettings","SetLinkPreference",{LinkPreference:u,Timeout:v},t)};r.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats=function(u,t){r.Exec("AMT_HeuristicPacketFilterStatistics","ResetSelectedStats",{SelectedStatistics:u},t)};r.AMT_KerberosSettingData_GetCredentialCacheState=function(t){r.Exec("AMT_KerberosSettingData","GetCredentialCacheState",{},t)};r.AMT_KerberosSettingData_SetCredentialCacheState=function(u,t){r.Exec("AMT_KerberosSettingData","SetCredentialCacheState",{Enable:u},t)};r.AMT_MessageLog_CancelIteration=function(u,t){r.Exec("AMT_MessageLog","CancelIteration",{IterationIdentifier:u},t)};r.AMT_MessageLog_RequestStateChange=function(u,v,t){r.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_MessageLog_ClearLog=function(t){r.Exec("AMT_MessageLog","ClearLog",{},t)};r.AMT_MessageLog_GetRecords=function(u,v,t,w){r.Exec("AMT_MessageLog","GetRecords",{IterationIdentifier:u,MaxReadRecords:v},t,w)};r.AMT_MessageLog_GetRecord=function(u,v,t){r.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:u,PositionToNext:v},t)};r.AMT_MessageLog_PositionAtRecord=function(u,v,w,t){r.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:u,MoveAbsolute:v,RecordNumber:w},t)};r.AMT_MessageLog_PositionToFirstRecord=function(t,u){r.Exec("AMT_MessageLog","PositionToFirstRecord",{},t,u)};r.AMT_MessageLog_FreezeLog=function(u,t){r.Exec("AMT_MessageLog","FreezeLog",{Freeze:u},t)};r.AMT_PublicKeyManagementService_AddCRL=function(v,u,t){r.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:v,SerialNumbers:u},t)};r.AMT_PublicKeyManagementService_ResetCRLList=function(t,u){r.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:t},u)};r.AMT_PublicKeyManagementService_AddCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddKey=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:u},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(v,u,w,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:v,DNName:u,Usage:w},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(u,w,v,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:u,SigningAlgorithm:w,NullSignedCertificateRequest:v},t)};r.AMT_PublicKeyManagementService_GenerateKeyPair=function(u,v,t){r.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:u,KeyLength:v},t)};r.AMT_RedirectionService_RequestStateChange=function(u,t){r.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:u},t)};r.AMT_RedirectionService_TerminateSession=function(u,t){r.Exec("AMT_RedirectionService","TerminateSession",{SessionType:u},t)};r.AMT_RemoteAccessService_AddMpServer=function(t,y,A,u,w,B,z,x,v){r.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:t,InfoFormat:y,Port:A,AuthMethod:u,Certificate:w,Username:B,Password:z,CN:x},v)};r.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(w,x,u,v,t){r.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:w,TunnelLifeTime:x,ExtendedData:u,MpServer:v},t)};r.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(t,u){r.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_CommitChanges=function(t,u){r.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_Unprovision=function(u,t){r.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:u},t)};r.AMT_SetupAndConfigurationService_PartialUnprovision=function(t,u){r.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(t,u){r.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(u,t){r.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:u},t)};r.AMT_SetupAndConfigurationService_SetMEBxPassword=function(u,t){r.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:u},t)};r.AMT_SetupAndConfigurationService_SetTLSPSK=function(u,v,t){r.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:u,PPS:v},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},t)};r.AMT_SetupAndConfigurationService_GetUuid=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUuid",{},t)};r.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},t)};r.AMT_SystemDefensePolicy_GetTimeout=function(t){r.Exec("AMT_SystemDefensePolicy","GetTimeout",{},t)};r.AMT_SystemDefensePolicy_SetTimeout=function(u,t){r.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:u},t)};r.AMT_SystemDefensePolicy_UpdateStatistics=function(u,w,t,y,v,x){r.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:u,ResetOnRead:w},t,y,v,x)};r.AMT_SystemPowerScheme_SetPowerScheme=function(t,u,v){r.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},t,v,0,{InstanceID:u})};r.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(t,u){r.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},t,u)};r.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(u,w,x,t,v){r.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:u,Tm1:w,Tm2:x},t,v)};r.AMT_UserInitiatedConnectionService_RequestStateChange=function(u,v,t){r.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WebUIService_RequestStateChange=function(u,v,t){r.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(x,y,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:x,WiFiEndpointSettingsInput:y,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(x,y,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:x,WiFiEndpointSettingsInput:y,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:t},u)};r.CIM_Account_RequestStateChange=function(u,v,t){r.Exec("CIM_Account","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_AccountManagementService_CreateAccount=function(v,t,u){r.Exec("CIM_AccountManagementService","CreateAccount",{System:v,AccountTemplate:t},u)};r.CIM_BootConfigSetting_ChangeBootOrder=function(u,t){r.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:u},t)};r.CIM_BootService_SetBootConfigRole=function(t,v,u){r.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:t,Role:v},u,0,1)};r.CIM_Card_ConnectorPower=function(u,v,t){r.Exec("CIM_Card","ConnectorPower",{Connector:u,PoweredOn:v},t)};r.CIM_Card_IsCompatible=function(u,t){r.Exec("CIM_Card","IsCompatible",{ElementToCheck:u},t)};r.CIM_Chassis_IsCompatible=function(u,t){r.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:u},t)};r.CIM_Fan_SetSpeed=function(u,t){r.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:u},t)};r.CIM_KVMRedirectionSAP_RequestStateChange=function(u,v,t){r.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:u},t)};r.CIM_MediaAccessDevice_LockMedia=function(u,t){r.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:u},t)};r.CIM_MediaAccessDevice_SetPowerState=function(u,v,t){r.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_MediaAccessDevice_Reset=function(t){r.Exec("CIM_MediaAccessDevice","Reset",{},t)};r.CIM_MediaAccessDevice_EnableDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:u},t)};r.CIM_MediaAccessDevice_OnlineDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:u},t)};r.CIM_MediaAccessDevice_QuiesceDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:u},t)};r.CIM_MediaAccessDevice_SaveProperties=function(t){r.Exec("CIM_MediaAccessDevice","SaveProperties",{},t)};r.CIM_MediaAccessDevice_RestoreProperties=function(t){r.Exec("CIM_MediaAccessDevice","RestoreProperties",{},t)};r.CIM_MediaAccessDevice_RequestStateChange=function(u,v,t){r.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_PhysicalFrame_IsCompatible=function(u,t){r.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:u},t)};r.CIM_PhysicalPackage_IsCompatible=function(u,t){r.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:u},t)};r.CIM_PowerManagementService_RequestPowerStateChange=function(v,u,w,x,t){r.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:v,ManagedElement:u,Time:w,TimeoutPeriod:x},t,0,1)};r.CIM_PowerSupply_SetPowerState=function(u,v,t){r.Exec("CIM_PowerSupply","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_PowerSupply_Reset=function(t){r.Exec("CIM_PowerSupply","Reset",{},t)};r.CIM_PowerSupply_EnableDevice=function(u,t){r.Exec("CIM_PowerSupply","EnableDevice",{Enabled:u},t)};r.CIM_PowerSupply_OnlineDevice=function(u,t){r.Exec("CIM_PowerSupply","OnlineDevice",{Online:u},t)};r.CIM_PowerSupply_QuiesceDevice=function(u,t){r.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:u},t)};r.CIM_PowerSupply_SaveProperties=function(t){r.Exec("CIM_PowerSupply","SaveProperties",{},t)};r.CIM_PowerSupply_RestoreProperties=function(t){r.Exec("CIM_PowerSupply","RestoreProperties",{},t)};r.CIM_PowerSupply_RequestStateChange=function(u,v,t){r.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Processor_SetPowerState=function(u,v,t){r.Exec("CIM_Processor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Processor_Reset=function(t){r.Exec("CIM_Processor","Reset",{},t)};r.CIM_Processor_EnableDevice=function(u,t){r.Exec("CIM_Processor","EnableDevice",{Enabled:u},t)};r.CIM_Processor_OnlineDevice=function(u,t){r.Exec("CIM_Processor","OnlineDevice",{Online:u},t)};r.CIM_Processor_QuiesceDevice=function(u,t){r.Exec("CIM_Processor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Processor_SaveProperties=function(t){r.Exec("CIM_Processor","SaveProperties",{},t)};r.CIM_Processor_RestoreProperties=function(t){r.Exec("CIM_Processor","RestoreProperties",{},t)};r.CIM_Processor_RequestStateChange=function(u,v,t){r.Exec("CIM_Processor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RecordLog_ClearLog=function(t){r.Exec("CIM_RecordLog","ClearLog",{},t)};r.CIM_RecordLog_RequestStateChange=function(u,v,t){r.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RedirectionService_RequestStateChange=function(u,v,t){r.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Sensor_SetPowerState=function(u,v,t){r.Exec("CIM_Sensor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Sensor_Reset=function(t){r.Exec("CIM_Sensor","Reset",{},t)};r.CIM_Sensor_EnableDevice=function(u,t){r.Exec("CIM_Sensor","EnableDevice",{Enabled:u},t)};r.CIM_Sensor_OnlineDevice=function(u,t){r.Exec("CIM_Sensor","OnlineDevice",{Online:u},t)};r.CIM_Sensor_QuiesceDevice=function(u,t){r.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Sensor_SaveProperties=function(t){r.Exec("CIM_Sensor","SaveProperties",{},t)};r.CIM_Sensor_RestoreProperties=function(t){r.Exec("CIM_Sensor","RestoreProperties",{},t)};r.CIM_Sensor_RequestStateChange=function(u,v,t){r.Exec("CIM_Sensor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_StatisticalData_ResetSelectedStats=function(u,t){r.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:u},t)};r.CIM_Watchdog_KeepAlive=function(t){r.Exec("CIM_Watchdog","KeepAlive",{},t)};r.CIM_Watchdog_SetPowerState=function(u,v,t){r.Exec("CIM_Watchdog","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Watchdog_Reset=function(t){r.Exec("CIM_Watchdog","Reset",{},t)};r.CIM_Watchdog_EnableDevice=function(u,t){r.Exec("CIM_Watchdog","EnableDevice",{Enabled:u},t)};r.CIM_Watchdog_OnlineDevice=function(u,t){r.Exec("CIM_Watchdog","OnlineDevice",{Online:u},t)};r.CIM_Watchdog_QuiesceDevice=function(u,t){r.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:u},t)};r.CIM_Watchdog_SaveProperties=function(t){r.Exec("CIM_Watchdog","SaveProperties",{},t)};r.CIM_Watchdog_RestoreProperties=function(t){r.Exec("CIM_Watchdog","RestoreProperties",{},t)};r.CIM_Watchdog_RequestStateChange=function(u,v,t){r.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_WiFiPort_SetPowerState=function(u,v,t){r.Exec("CIM_WiFiPort","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_WiFiPort_Reset=function(t){r.Exec("CIM_WiFiPort","Reset",{},t)};r.CIM_WiFiPort_EnableDevice=function(u,t){r.Exec("CIM_WiFiPort","EnableDevice",{Enabled:u},t)};r.CIM_WiFiPort_OnlineDevice=function(u,t){r.Exec("CIM_WiFiPort","OnlineDevice",{Online:u},t)};r.CIM_WiFiPort_QuiesceDevice=function(u,t){r.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:u},t)};r.CIM_WiFiPort_SaveProperties=function(t){r.Exec("CIM_WiFiPort","SaveProperties",{},t)};r.CIM_WiFiPort_RestoreProperties=function(t){r.Exec("CIM_WiFiPort","RestoreProperties",{},t)};r.CIM_WiFiPort_RequestStateChange=function(u,v,t){r.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_HostBasedSetupService_Setup=function(x,y,w,u,z,v,t){r.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:x,NetworkAdminPassword:y,McNonce:w,Certificate:u,SigningAlgorithm:z,DigitalSignature:v},t)};r.IPS_HostBasedSetupService_AddNextCertInChain=function(w,u,v,t){r.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:w,IsLeafCertificate:u,IsRootCertificate:v},t)};r.IPS_HostBasedSetupService_AdminSetup=function(w,x,v,y,u,t){r.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:w,NetworkAdminPassword:x,McNonce:v,SigningAlgorithm:y,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(v,w,u,t){r.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:v,SigningAlgorithm:w,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_DisableClientControlMode=function(t,u){r.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:t},u)};r.IPS_KVMRedirectionSettingData_TerminateSession=function(t){r.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},t)};r.IPS_OptInService_StartOptIn=function(t){r.Exec("IPS_OptInService","StartOptIn",{},t)};r.IPS_OptInService_CancelOptIn=function(t){r.Exec("IPS_OptInService","CancelOptIn",{},t)};r.IPS_OptInService_SendOptInCode=function(u,t){r.Exec("IPS_OptInService","SendOptInCode",{OptInCode:u},t)};r.IPS_OptInService_StartService=function(t){r.Exec("IPS_OptInService","StartService",{},t)};r.IPS_OptInService_StopService=function(t){r.Exec("IPS_OptInService","StopService",{},t)};r.IPS_OptInService_RequestStateChange=function(u,v,t){r.Exec("IPS_OptInService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_RequestStateChange=function(u,v,t){r.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_ClearLog=function(t,u){r.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:t},u)};r.IPS_SecIOService_RequestStateChange=function(u,v,t){r.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AmtStatusToStr=function(t){if(r.AmtStatusCodes[t]){return r.AmtStatusCodes[t]}else{return"UNKNOWN_ERROR"}};r.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};r.GetMessageLog=function(t,u){r.AMT_MessageLog_PositionToFirstRecord(j,[t,u,[]])};function j(v,t,u,w,x){if(w!=200||u.Body.ReturnValue!="0"){x[0](r,null,x[2]);return}r.AMT_MessageLog_GetRecords(u.Body.IterationIdentifier,390,k,x)}function k(D,A,C,E,G){if(E!=200||C.Body.ReturnValue!="0"){G[0](r,null,G[2]);return}var y,z,I,v,u=G[2],F=new Date(),H,B=C.Body.RecordArray;if(typeof B==="string"){C.Body.RecordArray=[C.Body.RecordArray]}for(y in B){v=null;try{v=window.atob(B[y])}catch(w){}if(v!=null){H=ReadIntX(v,0);if((H>0)&&(H<4294967295)){I={DeviceAddress:v.charCodeAt(4),EventSensorType:v.charCodeAt(5),EventType:v.charCodeAt(6),EventOffset:v.charCodeAt(7),EventSourceType:v.charCodeAt(8),EventSeverity:v.charCodeAt(9),SensorNumber:v.charCodeAt(10),Entity:v.charCodeAt(11),EntityInstance:v.charCodeAt(12),EventData:[],Time:new Date((H+(F.getTimezoneOffset()*60))*1000)};for(z=13;z<21;z++){I.EventData.push(v.charCodeAt(z))}I.EntityStr=n[I.Entity];I.Desc=h(I.EventSensorType,I.EventOffset,I.EventData,I.Entity);if(!I.EntityStr){I.EntityStr="Unknown"}u.push(I)}}}if(C.Body.NoMoreRecords!=true){r.AMT_MessageLog_GetRecords(C.Body.IterationIdentifier,390,k,[G[0],u,G[2]])}else{G[0](r,u,G[2])}}var e="Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split("|");var o="Unspecified.|No system memory is physically installed in the system.|No usable system memory, all installed memory has experienced an unrecoverable failure.|Unrecoverable hard-disk/ATAPI/IDE device failure.|Unrecoverable system-board failure.|Unrecoverable diskette subsystem failure.|Unrecoverable hard-disk controller failure.|Unrecoverable PS/2 or USB keyboard failure.|Removable boot media not found.|Unrecoverable video controller failure.|No video device detected.|Firmware (BIOS) ROM corruption detected.|CPU voltage mismatch (processors that share same supply have mismatched voltage requirements)|CPU speed matching failure".split("|");var p="Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split("|");var n="Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split("|");r.RealmNames="||Redirection|PT Administration|Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split("|");r.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};function h(w,v,u,t){if(w==15){if(u[0]==235){return"Invalid Data"}if(v==0){return o[u[1]]}return p[u[1]]}if(w==18&&u[0]==170){return"Agent watchdog "+char2hex(u[4])+char2hex(u[3])+char2hex(u[2])+char2hex(u[1])+"-"+char2hex(u[6])+char2hex(u[5])+"-... changed to "+r.WatchdogCurrentStates[u[7]]}if(w==6){return"Authentication failed "+(u[1]+(u[2]<<8))+" times. The system may be under attack."}if(w==30){return"No bootable media"}if(w==32){return"Operating system lockup or power interrupt"}if(w==35){return"System boot failure"}if(w==37){return"System firmware started (at least one CPU is properly executing)."}return"Unknown Sensor Type #"+w}return r}var md5_k=[];for(var i=0;i<64;){md5_k[i]=0|(Math.abs(Math.sin(++i))*4294967296)}function hex_md5(o){var f,g,k,n,q=[],p=unescape(encodeURI(o)),e=p.length,l=[f=1732584193,g=-271733879,~f,~g],m=0;for(;m<=e;){q[m>>2]|=(p.charCodeAt(m)||128)<<8*(m++%4)}q[o=(e+8>>6)*16+14]=e*8;m=0;for(;m<o;m+=16){e=l;n=0;for(;n<64;){e=[k=e[3],((f=e[1]|0)+((k=((e[0]+[f&(g=e[2])|~f&k,k&f|~k&g,f^g^k,g^(f|~k)][e=n>>4])+(md5_k[n]+(q[[n,5*n+1,3*n+5,7*n][e]%16+m]|0))))<<(e=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*e+n++%4])|k>>>32-e)),f,g]}for(n=4;n;){l[--n]=l[n]+e[n]}}o="";for(;n<32;){o+=((l[n>>3]>>((1^n++&7)*4))&15).toString(16)}return o}function rstr_md5(a){return hex2rstr(hex_md5(a))}function execArgumentsToXml(c){if(c===undefined||c===null){return null}var d="";for(var b in c){var a=c[b];if(!a){continue}if(a.__parameterType==="reference"){d+=referenceToXml(b,a)}else{d+=instanceToXml(b,a)}}return d}function instanceToXml(d,c){if(c===undefined||c===null){return null}var b=!!c.__namespace;var h=b?"<q:":"<";var a=b?"</q:":"</";var e=b?(' xmlns:q="'+c.__namespace+'"'):"";var g="<r:"+d+e+">";for(var f in c){if(!c.hasOwnProperty(f)||f.indexOf("__")===0){continue}if(typeof c[f]==="function"||Array.isArray(c[f])){continue}if(typeof c[f]==="object"){console.error("only convert one level down...")}else{g+=h+f+">"+c[f].toString()+a+f+">"}}g+="</r:"+d+">";return g}function referenceToXml(b,a){if(a===undefined||a===null){return null}var c="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+a.__resourceUri+"</w:ResourceURI><w:SelectorSet>";for(var d in a){if(!a.hasOwnProperty(d)||d.indexOf("__")===0){continue}if(typeof a[d]==="function"||typeof a[d]==="object"||Array.isArray(a[d])){continue}c+='<w:Selector Name="'+d+'">'+a[d].toString()+"</w:Selector>"}c+="</w:SelectorSet></a:ReferenceParameters></r:"+b+">";return c}function GetSidString(c){var b="S-"+c.charCodeAt(0)+"-"+c.charCodeAt(7);for(var a=2;a<(c.length/4);a++){b+="-"+ReadIntX(c,a*4)}return b}function GetSidByteArray(d){if(!d||d==null){return null}var c=d.split("-");if(c.length<4||(c[0]!="s"&&c[0]!="S")){return null}for(var a=1;a<c.length;a++){var e=parseInt(c[a]);if(e!=c[a]){return null}c[a]=e}var b=String.fromCharCode(c[1])+String.fromCharCode(c.length-3)+ShortToStr(Math.floor(c[2]/Math.pow(2,32)))+IntToStr((c[2])&65535);for(var a=3;a<c.length;a++){b+=IntToStrX(c[a])}return b}var CreateAmtRedirect=function(e,a){var f={};f.m=e;e.parent=f;f.authCookie=a;f.State=0;f.socket=null;f.host=null;f.port=0;f.user=null;f.pass=null;f.authuri="/RedirectionService";f.tlsv1only=0;f.inDataCount=0;f.connectstate=0;f.protocol=e.protocol;f.debugmode=0;f.amtaccumulator="";f.amtsequence=1;f.amtkeepalivetimer=null;f.onStateChanged=null;f.Start=function(g,j,m,h,k){f.host=g;f.port=j;f.user=m;f.pass=h;f.connectstate=0;f.inDataCount=0;var l=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+g+"&port="+j+"&tls="+k+((m=="*")?"&serverauth=1":"")+((typeof h==="undefined")?("&serverauth=1&user="+m):"");if((a!=null)&&(a!="")){l+="&auth="+a}f.socket=new WebSocket(l);f.socket.onopen=f.xxOnSocketConnected;f.socket.onmessage=f.xxOnMessage;f.socket.onclose=f.xxOnSocketClosed;f.xxStateChange(1)};f.xxOnSocketConnected=function(){if(f.debugmode==1){console.log("onSocketConnected")}f.xxStateChange(2);if(f.protocol==1){f.xxSend(f.RedirectStartSol)}if(f.protocol==2){f.xxSend(f.RedirectStartKvm)}if(f.protocol==3){f.xxSend(f.RedirectStartIder)}};var b=new FileReader();var d=false,c=[];if(b.readAsBinaryString){b.onload=function(g){f.xxOnSocketData(g.target.result);if(c.length==0){d=false}else{b.readAsBinaryString(new Blob([c.shift()]))}}}else{if(b.readAsArrayBuffer){b.onloadend=function(g){f.xxOnSocketData(g.target.result);if(c.length==0){d=false}else{b.readAsArrayBuffer(c.shift())}}}}f.xxOnMessage=function(j){f.inDataCount++;if(typeof j.data=="object"){if(d==true){c.push(j.data);return}if(b.readAsBinaryString){d=true;b.readAsBinaryString(new Blob([j.data]))}else{if(b.readAsArrayBuffer){d=true;b.readAsArrayBuffer(j.data)}else{var g="",h=new Uint8Array(j.data),l=h.byteLength;for(var k=0;k<l;k++){g+=String.fromCharCode(h[k])}f.xxOnSocketData(g)}}}else{f.xxOnSocketData(j.data)}};f.xxOnSocketData=function(s){if(!s||f.connectstate==-1){return}if(typeof s==="object"){var l="";var n=new Uint8Array(s);var x=n.byteLength;for(var w=0;w<x;w++){l+=String.fromCharCode(n[w])}s=l}else{if(typeof s!=="string"){return}}if((f.protocol==2||f.protocol==3)&&f.connectstate==1){return f.m.ProcessData(s)}f.amtaccumulator+=s;while(f.amtaccumulator.length>=1){var o=0;switch(f.amtaccumulator.charCodeAt(0)){case 17:if(f.amtaccumulator.length<4){return}var K=f.amtaccumulator.charCodeAt(1);switch(K){case 0:if(f.amtaccumulator.length<13){return}var B=f.amtaccumulator.charCodeAt(12);if(f.amtaccumulator.length<13+B){return}f.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));o=(13+B);break;default:f.Stop(1);break}break;case 20:if(f.amtaccumulator.length<9){return}var j=ReadIntX(f.amtaccumulator,5);if(f.amtaccumulator.length<9+j){return}var J=f.amtaccumulator.charCodeAt(1);var k=f.amtaccumulator.charCodeAt(4);var g=[];for(w=0;w<j;w++){g.push(f.amtaccumulator.charCodeAt(9+w))}var h=f.amtaccumulator.substring(9,9+j);o=9+j;if(k==0){if(g.indexOf(4)>=0){f.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(f.user.length+f.authuri.length+8)+String.fromCharCode(f.user.length)+f.user+String.fromCharCode(0,0)+String.fromCharCode(f.authuri.length)+f.authuri+String.fromCharCode(0,0,0,0))}else{if(g.indexOf(3)>=0){f.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(f.user.length+f.authuri.length+7)+String.fromCharCode(f.user.length)+f.user+String.fromCharCode(0,0)+String.fromCharCode(f.authuri.length)+f.authuri+String.fromCharCode(0,0,0))}else{if(g.indexOf(1)>=0){f.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(f.user.length+f.pass.length+2)+String.fromCharCode(f.user.length)+f.user+String.fromCharCode(f.pass.length)+f.pass)}else{f.Stop(2)}}}}else{if((k==3||k==4)&&J==1){var r=0;var F=h.charCodeAt(r);var E=h.substring(r+1,r+1+F);r+=(F+1);var A=h.charCodeAt(r);var z=h.substring(r+1,r+1+A);r+=(A+1);var D=0;var C=null;var p=f.xxRandomNonce(32);var I="00000002";var u="";if(k==4){D=h.charCodeAt(r);C=h.substring(r+1,r+1+D);r+=(D+1);u=I+":"+p+":"+C+":"}var t=hex_md5(hex_md5(f.user+":"+E+":"+f.pass)+":"+z+":"+u+hex_md5("POST:"+f.authuri));var L=f.user.length+E.length+z.length+f.authuri.length+p.length+I.length+t.length+7;if(k==4){L+=(C.length+1)}var m=String.fromCharCode(19,0,0,0,k)+IntToStrX(L)+String.fromCharCode(f.user.length)+f.user+String.fromCharCode(E.length)+E+String.fromCharCode(z.length)+z+String.fromCharCode(f.authuri.length)+f.authuri+String.fromCharCode(p.length)+p+String.fromCharCode(I.length)+I+String.fromCharCode(t.length)+t;if(k==4){m+=(String.fromCharCode(C.length)+C)}f.xxSend(m)}else{if(J==0){if(f.protocol==1){var y=10000;var N=100;var M=0;var H=10000;var G=100;var v=0;f.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(f.amtsequence++)+ShortToStrX(y)+ShortToStrX(N)+ShortToStrX(M)+ShortToStrX(H)+ShortToStrX(G)+ShortToStrX(v)+IntToStrX(0))}if(f.protocol==2){f.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0))}if(f.protocol==3){f.connectstate=1;f.xxStateChange(3)}}else{f.Stop(3)}}}break;case 33:if(f.amtaccumulator.length<23){break}o=23;f.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(f.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));if(f.protocol==1){f.amtkeepalivetimer=setInterval(f.xxSendAmtKeepAlive,2000)}f.connectstate=1;f.xxStateChange(3);break;case 41:if(f.amtaccumulator.length<10){break}o=10;break;case 42:if(f.amtaccumulator.length<10){break}var q=(10+((f.amtaccumulator.charCodeAt(9)&255)<<8)+(f.amtaccumulator.charCodeAt(8)&255));if(f.amtaccumulator.length<q){break}f.m.ProcessData(f.amtaccumulator.substring(10,q));o=q;break;case 43:if(f.amtaccumulator.length<8){break}o=8;break;case 65:if(f.amtaccumulator.length<8){break}f.connectstate=1;f.m.Start();if(f.amtaccumulator.length>8){f.m.ProcessData(f.amtaccumulator.substring(8))}o=f.amtaccumulator.length;break;case 240:f.serverIsRecording=true;o=1;break;default:console.log("Unknown Intel AMT command: "+f.amtaccumulator.charCodeAt(0)+" acclen="+f.amtaccumulator.length);f.Stop(4);return}if(o==0){return}f.amtaccumulator=f.amtaccumulator.substring(o)}};f.xxSend=function(k){if(f.socket!=null&&f.socket.readyState==WebSocket.OPEN){if(f.debugmode==1){console.log("Send",k)}var g=new Uint8Array(k.length);for(var j=0;j<k.length;++j){g[j]=k.charCodeAt(j)}try{f.socket.send(g.buffer)}catch(h){}}};f.send=function(g){if(f.socket==null||f.connectstate!=1){return}if(f.protocol==1){f.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(f.amtsequence++)+ShortToStrX(g.length)+g)}else{f.xxSend(g)}};f.xxSendAmtKeepAlive=function(){if(f.socket==null){return}f.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(f.amtsequence++))};f.xxRandomNonceX="abcdef0123456789";f.xxRandomNonce=function(h){var j="";for(var g=0;g<h;g++){j+=f.xxRandomNonceX.charAt(Math.floor(Math.random()*f.xxRandomNonceX.length))}return j};f.xxOnSocketClosed=function(){if(f.debugmode==1){console.log("onSocketClosed")}if((f.inDataCount==0)&&(f.tlsv1only==0)){f.tlsv1only=1;f.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+f.host+"&port="+f.port+"&tls="+f.tls+"&tls1only=1"+((f.user=="*")?"&serverauth=1":"")+((typeof pass==="undefined")?("&serverauth=1&user="+f.user):""));f.socket.onopen=f.xxOnSocketConnected;f.socket.onmessage=f.xxOnMessage;f.socket.onclose=f.xxOnSocketClosed}else{f.Stop(5)}};f.xxStateChange=function(g){if(f.State==g){return}f.State=g;f.m.xxStateChange(f.State);if(f.onStateChanged!=null){f.onStateChanged(f,f.State)}};f.Stop=function(g){if(f.debugmode==1){console.log("onSocketStop",g)}f.xxStateChange(0);f.connectstate=-1;f.amtaccumulator="";if(f.socket!=null){f.socket.close();f.socket=null}if(f.amtkeepalivetimer!=null){clearInterval(f.amtkeepalivetimer);f.amtkeepalivetimer=null}};f.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);f.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);f.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return f};var CreateAmtRemoteDesktop=function(o,r){var q={};q.canvasid=o;q.CanvasId=Q(o);q.scrolldiv=r;q.canvas=Q(o).getContext("2d");q.protocol=2;q.state=0;q.acc="";q.ScreenWidth=960;q.ScreenHeight=700;q.width=0;q.height=0;q.rwidth=0;q.rheight=0;q.bpp=2;q.useZRLE=true;q.showmouse=true;q.buttonmask=0;q.localKeyMap=true;q.spare=null;q.sparew=0;q.spareh=0;q.sparew2=0;q.spareh2=0;q.sparecache={};q.ZRLEfirst=1;q.onScreenSizeChange=null;q.frameRateDelay=0;q.kvmDataSupported=false;q.onKvmData=null;q.onKvmDataPending=[];q.onKvmDataAck=-1;q.holding=false;q.lastKeepAlive=Date.now();q.mNagleTimer=null;q.mx=0;q.my=0;q.Debug=function(s){console.log(s)};q.xxStateChange=function(s){if(s==0){q.canvas.fillStyle="#000000";q.canvas.fillRect(0,0,q.width,q.height);q.canvas.canvas.width=q.rwidth=q.width=640;q.canvas.canvas.height=q.rheight=q.height=400;QS(q.canvasid).cursor="default"}else{QS(q.canvasid).cursor=q.showmouse?"default":"none"}};q.ProcessData=function(v){if(!v){return}q.acc+=v;while(q.acc.length>0){var t=0;if(q.state==0&&q.acc.length>=12){t=12;q.state=1;q.send("RFB 003.008\n")}else{if(q.state==1&&q.acc.length>=1){t=q.acc.charCodeAt(0)+1;q.send(String.fromCharCode(1));q.state=2}else{if(q.state==2&&q.acc.length>=4){t=4;if(ReadInt(q.acc,0)!=0){return q.Stop()}q.send(String.fromCharCode(1));q.state=3}else{if(q.state==3&&q.acc.length>=24){var G=ReadInt(q.acc,20);if(q.acc.length<24+G){return}t=24+G;q.canvas.canvas.width=q.rwidth=q.width=q.ScreenWidth=ReadShort(q.acc,0);q.canvas.canvas.height=q.rheight=q.height=q.ScreenHeight=ReadShort(q.acc,2);var J="";if(q.useZRLE){J+=IntToStr(16)}J+=IntToStr(0);J+=IntToStr(1092);q.send(String.fromCharCode(2,0)+ShortToStr((J.length/4)+1)+J+IntToStr(-223));if(q.bpp==1){q.send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0))}q.state=4;if(q.parent){q.parent.xxStateChange(3)}g();if(q.onScreenSizeChange!=null){q.onScreenSizeChange(q,q.ScreenWidth,q.ScreenHeight)}}else{if(q.state==4){switch(q.acc.charCodeAt(0)){case 0:if(q.acc.length<4){return}q.state=100+ReadShort(q.acc,2);t=4;break;case 2:t=1;break;case 3:if(q.acc.length<8){return}var F=ReadInt(q.acc,4)+8;if(q.acc.length<F){return}t=p(q.acc);break}}else{if(q.state>100&&q.acc.length>=12){var L=ReadShort(q.acc,0),N=ReadShort(q.acc,2),K=ReadShort(q.acc,4),C=ReadShort(q.acc,6),I=K*C,B=ReadInt(q.acc,8);if(B<17){if(K<1||K>64||C<1||C>64){console.log("Invalid tile size ("+K+","+C+"), disconnecting.");return q.Stop()}if(q.sparew!=K||q.spareh!=C){q.sparew=q.sparew2=K;q.spareh=q.spareh2=C;var M=q.sparew2+"x"+q.spareh2;q.spare=q.sparecache[M];if(!q.spare){q.sparecache[M]=q.spare=q.canvas.createImageData(q.sparew2,q.spareh2);var E=(q.sparew2*q.spareh2)<<2;for(var D=3;D<E;D+=4){q.spare.data[D]=255}}}}if(B==4294967073){q.canvas.canvas.width=q.rwidth=q.width=K;q.canvas.canvas.height=q.rheight=q.height=C;q.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(q.width)+ShortToStr(q.height));t=12;if(q.onScreenSizeChange!=null){q.onScreenSizeChange(q,q.ScreenWidth,q.ScreenHeight)}}else{if(B==0){var H=12,u=12+(I*q.bpp);if(q.acc.length<u){return}t=u;if(q.bpp==2){for(var D=0;D<I;D++){h(q.acc.charCodeAt(H++)+(q.acc.charCodeAt(H++)<<8),D)}}else{for(var D=0;D<I;D++){k(q.acc.charCodeAt(H++),D)}}f(q.spare,L,N)}else{if(B==16){if(q.acc.length<16){return}var w=ReadInt(q.acc,12);if(q.acc.length<(16+w)){return}var H=16,z=5,A=0;if(w>5&&q.acc.charCodeAt(H)==0&&ReadShortX(q.acc,H+1)==(w-z)){a(q.acc,H+5,L,N,K,C,I,w)}t=16+w}else{q.Debug("Unknown Encoding: "+B);return q.Stop()}}}if(--q.state==100){q.state=4;if(q.frameRateDelay==0){g()}else{setTimeout(g,q.frameRateDelay)}}}}}}}}if(t==0){return}q.acc=q.acc.substring(t)}};function a(w,E,M,N,L,A,I,z){var J=w.charCodeAt(E++),C,K,H,D={},F=0,G=0,B;if(J==0){if(q.bpp==2){for(B=0;B<I;B++){h(w.charCodeAt(E++)+(w.charCodeAt(E++)<<8),B)}}else{for(B=0;B<I;B++){k(w.charCodeAt(E++),B)}}f(q.spare,M,N)}else{if(J==1){K=w.charCodeAt(E++)+((q.bpp==2)?(w.charCodeAt(E++)<<8):0);q.canvas.fillStyle="rgb("+((q.bpp==1)?((K&224)+","+((K&28)<<3)+","+b((K&3)<<6)):(((K>>8)&248)+","+((K>>3)&252)+","+((K&31)<<3)))+")";q.canvas.fillRect(M,N,L,A)}else{if(J>1&&J<17){var u=4,t=15;if(q.bpp==2){for(B=0;B<J;B++){D[B]=w.charCodeAt(E++)+(w.charCodeAt(E++)<<8)}if(J==2){u=1;t=1}else{if(J<=4){u=2;t=3}}while(F<I&&E<w.length){K=w.charCodeAt(E++);for(B=(8-u);B>=0;B-=u){h(D[(K>>B)&t],F++)}}}else{for(B=0;B<J;B++){D[B]=w.charCodeAt(E++)}if(J==2){u=1;t=1}else{if(J<=4){u=2;t=3}}while(F<I&&E<w.length){K=w.charCodeAt(E++);for(B=(8-u);B>=0;B-=u){k(D[(K>>B)&t],F++)}}}f(q.spare,M,N)}else{if(J==128){if(q.bpp==2){while(F<I&&E<w.length){K=w.charCodeAt(E++)+(w.charCodeAt(E++)<<8);G=1;do{G+=(H=w.charCodeAt(E++))}while(H==255);if(q.rotation==0){j(K,F,G);F+=G}else{while(--G>=0){h(K,F++)}}}}else{while(F<I&&E<w.length){K=w.charCodeAt(E++);G=1;do{G+=(H=w.charCodeAt(E++))}while(H==255);if(q.rotation==0){l(K,F,G);F+=G}else{while(--G>=0){k(K,F++)}}}}f(q.spare,M,N)}else{if(J>129){if(q.bpp==2){for(B=0;B<(J-128);B++){D[B]=w.charCodeAt(E++)+(w.charCodeAt(E++)<<8)}}else{for(B=0;B<(J-128);B++){D[B]=w.charCodeAt(E++)}}while(F<I&&E<w.length){G=1;C=w.charCodeAt(E++);K=D[C%128];if(C>127){do{G+=(H=w.charCodeAt(E++))}while(H==255)}if(q.rotation==0){if(q.bpp==2){j(K,F,G);F+=G}else{l(K,F,G);F+=G}}else{if(q.bpp==2){while(--G>=0){h(K,F++)}}else{while(--G>=0){k(K,F++)}}}}f(q.spare,M,N)}}}}}}q.hold=function(s){if(q.holding==s){return}q.holding=s;q.canvas.fillStyle="#000000";q.canvas.fillRect(0,0,q.width,q.height);if(q.holding==false){if((q.canvas.canvas.width!=q.width)||(q.canvas.canvas.height!=q.height)){q.canvas.canvas.width=q.width;q.canvas.canvas.height=q.height;if(q.onScreenSizeChange!=null){q.onScreenSizeChange(q,q.ScreenWidth,q.ScreenHeight)}}q.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(q.width)+ShortToStr(q.height))}else{q.UnGrabMouseInput();q.UnGrabKeyInput()}};function f(s,t,u){if(q.holding==true){return}q.canvas.putImageData(s,t,u)}function k(u,s){var t=s<<2;q.spare.data[t]=u&224;q.spare.data[t+1]=(u&28)<<3;q.spare.data[t+2]=b((u&3)<<6)}function h(u,s){var t=s<<2;q.spare.data[t]=(u>>8)&248;q.spare.data[t+1]=(u>>3)&252;q.spare.data[t+2]=(u&31)<<3}function l(z,u,y){var w=(u<<2),x=(z&224),t=((z&28)<<3),s=(b((z&3)<<6));while(--y>=0){q.spare.data[w]=x;q.spare.data[w+1]=t;q.spare.data[w+2]=s;w+=4}}function j(z,u,y){var w=(u<<2),x=((z>>8)&248),t=((z>>3)&252),s=((z&31)<<3);while(--y>=0){q.spare.data[w]=x;q.spare.data[w+1]=t;q.spare.data[w+2]=s;w+=4}}function b(s){return(s>127)?(s+32):s}function g(){if(q.holding==true){return}q.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(q.rwidth)+ShortToStr(q.rheight))}q.Start=function(){q.state=0;q.acc="";q.ZRLEfirst=1;q.onKvmDataPending=[];q.onKvmDataAck=-1;q.kvmDataSupported=false;for(var s in q.sparecache){delete q.sparecache[s]}};q.Stop=function(){q.UnGrabMouseInput();q.UnGrabKeyInput();if(q.parent){q.parent.Stop()}};q.send=function(s){if(q.parent){q.parent.send(s)}};var n={Pause:19,CapsLock:20,Space:32,Quote:39,Minus:45,NumpadMultiply:42,NumpadAdd:43,PrintScreen:44,Comma:44,NumpadSubtract:45,NumpadDecimal:46,Period:46,Slash:47,NumpadDivide:47,Semicolon:59,Equal:61,OSLeft:91,BracketLeft:91,OSRight:91,Backslash:92,BracketRight:93,ContextMenu:93,Backquote:96,NumLock:144,ScrollLock:145,Backspace:65288,Tab:65289,Enter:65293,NumpadEnter:65293,Escape:65307,Delete:65535,Home:65360,PageUp:65365,PageDown:65366,ArrowLeft:65361,ArrowUp:65362,ArrowRight:65363,ArrowDown:65364,End:65367,Insert:65379,F1:65470,F2:65471,F3:65472,F4:65473,F5:65474,F6:65475,F7:65476,F8:65477,F9:65478,F10:65479,F11:65480,F12:65481,ShiftLeft:65505,ShiftRight:65506,ControlLeft:65507,ControlRight:65508,AltLeft:65513,AltRight:65514,MetaLeft:65511,MetaRight:65512};function m(s){if(s.code.startsWith("Key")&&s.code.length==4){return s.code.charCodeAt(3)+((s.shiftKey==false)?32:0)}if(s.code.startsWith("Digit")&&s.code.length==6){return s.code.charCodeAt(5)}if(s.code.startsWith("Numpad")&&s.code.length==7){return s.code.charCodeAt(6)}return n[s.code]}function c(s,t){if(!t){t=window.event}if(t.code&&(q.localKeyMap==false)){var u=m(t);if(u!=null){q.sendkey(u,s)}}else{var u=t.keyCode,v=u;if(t.shiftKey==false&&u>=65&&u<=90){v=u+32}if(u>=112&&u<=124){v=u+65358}if(u==8){v=65288}if(u==9){v=65289}if(u==13){v=65293}if(u==16){v=65505}if(u==17){v=65507}if(u==18){v=65513}if(u==27){v=65307}if(u==33){v=65365}if(u==34){v=65366}if(u==35){v=65367}if(u==36){v=65360}if(u==37){v=65361}if(u==38){v=65362}if(u==39){v=65363}if(u==40){v=65364}if(u==45){v=65379}if(u==46){v=65535}if(u>=96&&u<=105){v=u-48}if(u==106){v=42}if(u==107){v=43}if(u==109){v=45}if(u==110){v=46}if(u==111){v=47}if(u==186){v=59}if(u==187){v=61}if(u==188){v=44}if(u==189){v=45}if(u==190){v=46}if(u==191){v=47}if(u==192){v=96}if(u==219){v=91}if(u==220){v=92}if(u==221){v=93}if(u==222){v=39}q.sendkey(v,s)}return q.haltEvent(t)}q.sendkey=function(v,t){if(typeof v=="object"){var s="";for(var u in v){s+=(String.fromCharCode(4,v[u][1],0,0)+IntToStr(v[u][0]))}q.send(s)}else{q.send(String.fromCharCode(4,t,0,0)+IntToStr(v))}};function p(s){if(s.length<8){return 0}var u=ReadInt(q.acc,4)+8;if(s.length<u){return 0}if(q.onKvmData!=null){var t=s.substring(8,u);if((t.length>=16)&&(t.substring(0,15)=="\0KvmDataChannel")){if(q.kvmDataSupported==false){q.kvmDataSupported=true;console.log("KVM Data Channel Supported.")}if(((q.onKvmDataAck==-1)&&(t.length==16))||(t.charCodeAt(15)!=0)){q.onKvmDataAck=true}if(t.length>=16){q.onKvmData(t.substring(16))}if((q.onKvmDataAck==true)&&(q.onKvmDataPending.length>0)){q.sendKvmData(q.onKvmDataPending.shift())}}}return u}q.sendKvmData=function(s){if(q.onKvmDataAck!==true){q.onKvmDataPending.push(s)}else{s="\0KvmDataChannel\0"+s;q.send(String.fromCharCode(6,0,0,0)+IntToStr(s.length)+s);q.onKvmDataAck=false}};q.sendKeepAlive=function(){if(q.lastKeepAlive<Date.now()-5000){q.lastKeepAlive=Date.now();q.send(String.fromCharCode(6,0,0,0)+IntToStr(16)+"\0KvmDataChannel\0")}};q.SendCtrlAltDelMsg=function(){q.sendcad()};q.sendcad=function(){q.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var e=false;var d=false;q.GrabMouseInput=function(){if(e==true){return}var s=q.canvas.canvas;s.onmouseup=q.mouseup;s.onmousedown=q.mousedown;s.onmousemove=q.mousemove;e=true};q.UnGrabMouseInput=function(){if(e==false){return}var s=q.canvas.canvas;s.onmousemove=null;s.onmouseup=null;s.onmousedown=null;e=false};q.GrabKeyInput=function(){if(d==true){return}document.onkeyup=q.handleKeyUp;document.onkeydown=q.handleKeyDown;document.onkeypress=q.handleKeys;d=true};q.UnGrabKeyInput=function(){if(d==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d=false};q.handleKeys=function(s){return q.haltEvent(s)};q.handleKeyUp=function(s){return c(0,s)};q.handleKeyDown=function(s){return c(1,s)};q.haltEvent=function(s){if(s.preventDefault){s.preventDefault()}if(s.stopPropagation){s.stopPropagation()}return false};q.mousedblclick=function(s){};q.mousedown=function(s){q.buttonmask|=(1<<s.button);return q.mousemove(s,1)};q.mouseup=function(s){q.buttonmask&=(65535-(1<<s.button));return q.mousemove(s,1)};q.mousemove=function(s,t){if(q.state<4){return true}var v=(q.canvas.canvas.height/Q(q.canvasid).offsetHeight);var w=(q.canvas.canvas.width/Q(q.canvasid).offsetWidth);var u=q.getPositionOfControl(Q(q.canvasid));q.mx=((event.pageX-u[0])*w);q.my=((event.pageY-u[1])*v);if(event.addx){q.mx+=event.addx}if(event.addy){q.my+=event.addy}if(t==1){q.send(String.fromCharCode(5,q.buttonmask)+ShortToStr(q.mx)+ShortToStr(q.my));if(q.mNagleTimer!=null){clearTimeout(q.mNagleTimer);q.mNagleTimer=null}}else{if(q.mNagleTimer==null){q.mNagleTimer=setTimeout(function(){q.send(String.fromCharCode(5,q.buttonmask)+ShortToStr(q.mx)+ShortToStr(q.my));q.mNagleTimer=null},50)}}return q.haltEvent(s)};q.getPositionOfControl=function(s){var t=Array(2);t[0]=t[1]=0;while(s){t[0]+=s.offsetLeft;t[1]+=s.offsetTop;s=s.offsetParent}return t};return q};var ZLIB=(ZLIB||{});if(typeof ZLIB.common_initialized==="undefined"){ZLIB.Z_NO_FLUSH=0;ZLIB.Z_PARTIAL_FLUSH=1;ZLIB.Z_SYNC_FLUSH=2;ZLIB.Z_FULL_FLUSH=3;ZLIB.Z_FINISH=4;ZLIB.Z_BLOCK=5;ZLIB.Z_TREES=6;ZLIB.Z_OK=0;ZLIB.Z_STREAM_END=1;ZLIB.Z_NEED_DICT=2;ZLIB.Z_ERRNO=(-1);ZLIB.Z_STREAM_ERROR=(-2);ZLIB.Z_DATA_ERROR=(-3);ZLIB.Z_MEM_ERROR=(-4);ZLIB.Z_BUF_ERROR=(-5);ZLIB.Z_VERSION_ERROR=(-6);ZLIB.Z_DEFLATED=8;ZLIB.z_stream=function(){this.next_in=0;this.avail_in=0;this.total_in=0;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg=null;this.state=null;this.data_type=0;this.adler=0;this.input_data="";this.output_data="";this.error=0;this.checksum_function=null};ZLIB.gz_header=function(){this.text=0;this.time=0;this.xflags=0;this.os=255;this.extra=null;this.extra_len=0;this.extra_max=0;this.name=null;this.name_max=0;this.comment=null;this.comm_max=0;this.hcrc=0;this.done=0};ZLIB.common_initialized=true}if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js")}(function(){var n=15;var F=0;var C=1;var al=2;var ae=3;var z=4;var A=5;var ab=6;var h=7;var E=8;var p=9;var o=10;var am=11;var an=12;var ai=13;var k=14;var j=15;var ak=16;var V=17;var f=18;var R=19;var P=20;var S=21;var q=22;var r=23;var Z=24;var X=25;var d=26;var U=27;var u=28;var a=29;var aa=30;var aj=31;var y=852;var x=592;var w=(y+x);var g=0;var W=1;var t=2;var M=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var N=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69];var K=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var L=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ZLIB.inflate_copyright=" inflate 1.2.6 Copyright 1995-2012 Mark Adler ";function J(aQ,aU){var aL=15;var aT=aQ.next;var ar=(aU==t?aQ.distbits:aQ.lenbits);var aW=aQ.work;var aG=aQ.lens;var aH=(aU==t?aQ.nlen:0);var aR=aQ.codes;var at;if(aU==W){at=aQ.nlen}else{if(aU==t){at=aQ.ndist}else{at=19}}var aF;var aS;var aM,aK;var aP;var av;var aw;var aE;var aV;var aC;var aD;var aA;var aI;var aJ;var aB;var aN;var ap;var aq;var ay;var az;var ax;var au=new Array(aL+1);var aO=new Array(aL+1);for(aF=0;aF<=aL;aF++){au[aF]=0}for(aS=0;aS<at;aS++){au[aG[aH+aS]]++}aP=ar;for(aK=aL;aK>=1;aK--){if(au[aK]!=0){break}}if(aP>aK){aP=aK}if(aK==0){aB={op:64,bits:1,val:0};aR[aT++]=aB;aR[aT++]=aB;if(aU==t){aQ.distbits=1}else{aQ.lenbits=1}aQ.next=aT;return 0}for(aM=1;aM<aK;aM++){if(au[aM]!=0){break}}if(aP<aM){aP=aM}aE=1;for(aF=1;aF<=aL;aF++){aE<<=1;aE-=au[aF];if(aE<0){return -1}}if(aE>0&&(aU==g||aK!=1)){aQ.next=aT;return -1}aO[1]=0;for(aF=1;aF<aL;aF++){aO[aF+1]=aO[aF]+au[aF]}for(aS=0;aS<at;aS++){if(aG[aH+aS]!=0){aW[aO[aG[aH+aS]]++]=aS}}switch(aU){case g:ap=ay=aW;aq=0;az=0;ax=19;break;case W:ap=M;aq=-257;ay=N;az=-257;ax=256;break;default:ap=K;ay=L;aq=0;az=0;ax=-1}aC=0;aS=0;aF=aM;aN=aT;av=aP;aw=0;aI=-1;aV=1<<aP;aJ=aV-1;if((aU==W&&aV>=y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}for(;;){aB={op:0,bits:aF-aw,val:0};if(aW[aS]<ax){aB.val=aW[aS]}else{if(aW[aS]>ax){aB.op=ay[az+aW[aS]];aB.val=ap[aq+aW[aS]]}else{aB.op=32+64}}aD=1<<(aF-aw);aA=1<<av;aM=aA;do{aA-=aD;aR[aN+(aC>>>aw)+aA]=aB}while(aA!=0);aD=1<<(aF-1);while(aC&aD){aD>>>=1}if(aD!=0){aC&=aD-1;aC+=aD}else{aC=0}aS++;if(--(au[aF])==0){if(aF==aK){break}aF=aG[aH+aW[aS]]}if(aF>aP&&(aC&aJ)!=aI){if(aw==0){aw=aP}aN+=aM;av=aF-aw;aE=(1<<av);while(av+aw<aK){aE-=au[av+aw];if(aE<=0){break}av++;aE<<=1}aV+=1<<av;if((aU==W&&aV>=y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}aI=aC&aJ;aR[aT+aI]={op:av,bits:aP,val:aN-aT}}}if(aC!=0){aR[aN+aC]={op:64,bits:aF-aw,val:0}}aQ.next=aT+aV;if(aU==t){aQ.distbits=aP}else{aQ.lenbits=aP}return 0}function G(aM,aK){var aL;var aB;var aH;var aC;var aJ;var ap;var aw;var aQ;var aN;var aP;var aO;var aA;var aq;var ar;var aD;var at;var aG;var av;var az;var aI;var aE;var au;var ay=-1;var ax=-1;aL=aM.state;aB=aM.input_data;aH=aM.next_in;aC=aH+aM.avail_in-5;aJ=aM.next_out;ap=aJ-(aK-aM.avail_out);aw=aJ+(aM.avail_out-257);aQ=aL.wsize;aN=aL.whave;aP=aL.wnext;aO=aL.window;aA=aL.hold;aq=aL.bits;ar=aL.codes;aD=aL.lencode;at=aL.distcode;aG=(1<<aL.lenbits)-1;av=(1<<aL.distbits)-1;loop:do{if(aq<15){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}az=ar[aD+(aA&aG)];dolen:while(true){aI=az.bits;aA>>>=aI;aq-=aI;aI=az.op;if(aI==0){aM.output_data+=String.fromCharCode(az.val);aJ++}else{if(aI&16){aE=az.val;aI&=15;if(aI){if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}aE+=aA&((1<<aI)-1);aA>>>=aI;aq-=aI}if(aq<15){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}az=ar[at+(aA&av)];dodist:while(true){aI=az.bits;aA>>>=aI;aq-=aI;aI=az.op;if(aI&16){au=az.val;aI&=15;if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}}au+=aA&((1<<aI)-1);aA>>>=aI;aq-=aI;aI=aJ-ap;if(au>aI){aI=au-aI;if(aI>aN){if(aL.sane){aM.msg="invalid distance too far back";aL.mode=a;break loop}}ay=0;ax=-1;if(aP==0){ay+=aQ-aI;if(aI<aE){aE-=aI;aM.output_data+=aO.substring(ay,ay+aI);aJ+=aI;aI=0;ay=-1;ax=aJ-au}}else{ay+=aP-aI;if(aI<aE){aE-=aI;aM.output_data+=aO.substring(ay,ay+aI);aJ+=aI;ay=-1;ax=aJ-au}}}else{ay=-1;ax=aJ-au}if(ay>=0){aM.output_data+=aO.substring(ay,ay+aE);aJ+=aE;ay+=aE}else{var aF=aE;if(aF>aJ-ax){aF=aJ-ax}aM.output_data+=aM.output_data.substring(ax,ax+aF);aJ+=aF;aE-=aF;ax+=aF;aJ+=aE;while(aE>2){aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aE-=3}if(aE){aM.output_data+=aM.output_data.charAt(ax++);if(aE>1){aM.output_data+=aM.output_data.charAt(ax++)}}}}else{if((aI&64)==0){az=ar[at+(az.val+(aA&((1<<aI)-1)))];continue dodist}else{aM.msg="invalid distance code";aL.mode=a;break loop}}break dodist}}else{if((aI&64)==0){az=ar[aD+(az.val+(aA&((1<<aI)-1)))];continue dolen}else{if(aI&32){aL.mode=am;break loop}else{aM.msg="invalid literal/length code";aL.mode=a;break loop}}}}break dolen}}while(aH<aC&&aJ<aw);aE=aq>>>3;aH-=aE;aq-=aE<<3;aA&=(1<<aq)-1;aM.next_in=aH;aM.next_out=aJ;aM.avail_in=(aH<aC?5+(aC-aH):5-(aH-aC));aM.avail_out=(aJ<aw?257+(aw-aJ):257-(aJ-aw));aL.hold=aA;aL.bits=aq}function ad(ar){var aq;var ap=new Array(ar);for(aq=0;aq<ar;aq++){ap[aq]=0}return ap}function D(ar,aq,ap){return(ar&&(aq in ar))?ar[aq]:ap}function e(){return 0}function I(){var aq;this.mode=0;this.last=0;this.wrap=0;this.havedict=0;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=0;this.distcode=0;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=0;this.lens=ad(320);this.work=ad(288);this.codes=new Array(w);var ap={op:0,bits:0,val:0};for(aq=0;aq<w;aq++){this.codes[aq]=ap}this.sane=0;this.back=0;this.was=0}ZLIB.inflateResetKeep=function(aq){var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;aq.total_in=aq.total_out=ap.total=0;aq.msg=null;if(ap.wrap){aq.adler=ap.wrap&1}ap.mode=F;ap.last=0;ap.havedict=0;ap.dmax=32768;ap.head=null;ap.hold=0;ap.bits=0;ap.lencode=0;ap.distcode=0;ap.next=0;ap.sane=1;ap.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(aq,ar){var at;var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;if(typeof ar==="undefined"){ar=n}if(ar<0){at=0;ar=-ar}else{at=(ar>>>4)+1;if(ar<48){ar&=15}}if(at==1&&(typeof ZLIB.adler32==="function")){aq.checksum_function=ZLIB.adler32}else{if(at==2&&(typeof ZLIB.crc32==="function")){aq.checksum_function=ZLIB.crc32}else{aq.checksum_function=e}}if(ar&&(ar<8||ar>15)){return ZLIB.Z_STREAM_ERROR}if(ap.window&&ap.wbits!=ar){ap.window=null}ap.wrap=at;ap.wbits=ar;ap.wsize=0;ap.whave=0;ap.wnext=0;return ZLIB.inflateResetKeep(aq)};ZLIB.inflateInit=function(aq){var ap=new ZLIB.z_stream();ap.state=new I();ZLIB.inflateReset(ap,aq);return ap};ZLIB.inflatePrime=function(ar,ap,at){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;if(ap<0){aq.hold=0;aq.bits=0;return ZLIB.Z_OK}if(ap>16||aq.bits+ap>32){return ZLIB.Z_STREAM_ERROR}at&=(1<<ap)-1;aq.hold+=at<<aq.bits;aq.bits+=ap;return ZLIB.Z_OK};var T=null;var s=null;function B(aq){var ap;if(!T){T=[{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:192},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:160},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:224},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:144},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:208},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:176},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:240},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:200},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:168},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:232},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:152},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:216},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:184},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:248},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:196},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:164},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:228},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:148},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:212},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:180},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:244},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:204},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:172},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:236},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:156},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:220},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:188},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:252},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:194},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:162},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:226},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:146},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:210},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:178},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:242},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:202},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:170},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:234},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:154},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:218},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:186},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:250},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:198},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:166},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:230},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:150},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:214},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:182},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:246},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:206},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:174},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:238},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:158},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:222},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:190},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:254},{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:193},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:161},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:225},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:145},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:209},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:177},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:241},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:201},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:169},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:233},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:153},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:217},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:185},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:249},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:197},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:165},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:229},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:149},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:213},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:181},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:245},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:205},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:173},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:237},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:157},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:221},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:189},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:253},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:195},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:163},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:227},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:147},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:211},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:243},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:203},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:171},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:235},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:155},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:219},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:187},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:251},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:199},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:167},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:231},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:151},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:215},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:183},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:247},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:207},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:175},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:239},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:159},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:223},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:191},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:255}]}if(!s){s=[{op:16,bits:5,val:1},{op:23,bits:5,val:257},{op:19,bits:5,val:17},{op:27,bits:5,val:4097},{op:17,bits:5,val:5},{op:25,bits:5,val:1025},{op:21,bits:5,val:65},{op:29,bits:5,val:16385},{op:16,bits:5,val:3},{op:24,bits:5,val:513},{op:20,bits:5,val:33},{op:28,bits:5,val:8193},{op:18,bits:5,val:9},{op:26,bits:5,val:2049},{op:22,bits:5,val:129},{op:64,bits:5,val:0},{op:16,bits:5,val:2},{op:23,bits:5,val:385},{op:19,bits:5,val:25},{op:27,bits:5,val:6145},{op:17,bits:5,val:7},{op:25,bits:5,val:1537},{op:21,bits:5,val:97},{op:29,bits:5,val:24577},{op:16,bits:5,val:4},{op:24,bits:5,val:769},{op:20,bits:5,val:49},{op:28,bits:5,val:12289},{op:18,bits:5,val:13},{op:26,bits:5,val:3073},{op:22,bits:5,val:193},{op:64,bits:5,val:0}]}aq.lencode=0;aq.distcode=512;for(ap=0;ap<512;ap++){aq.codes[ap]=T[ap]}for(ap=0;ap<32;ap++){aq.codes[ap+512]=s[ap]}aq.lenbits=9;aq.distbits=5}function ao(ar){var aq=ar.state;var ap=ar.output_data.length;if(aq.window===null){aq.window=""}if(aq.wsize==0){aq.wsize=1<<aq.wbits}if(ap>=aq.wsize){aq.window=ar.output_data.substring(ap-aq.wsize)}else{if(aq.whave+ap<aq.wsize){aq.window+=ar.output_data}else{aq.window=aq.window.substring(aq.whave-(aq.wsize-ap))+ar.output_data}}aq.whave=aq.window.length;if(aq.whave<aq.wsize){aq.wnext=aq.whave}else{aq.wnext=0}return 0}function l(aq,ar){var ap=[ar&255,(ar>>>8)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,2)}function m(aq,ar){var ap=[ar&255,(ar>>>8)&255,(ar>>>16)&255,(ar>>>24)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,4)}function Y(aq,ap){ap.strm=aq;ap.left=aq.avail_out;ap.next=aq.next_in;ap.have=aq.avail_in;ap.hold=aq.state.hold;ap.bits=aq.state.bits;return ap}function ag(ap){var aq=ap.strm;aq.next_in=ap.next;aq.avail_out=ap.left;aq.avail_in=ap.have;aq.state.hold=ap.hold;aq.state.bits=ap.bits}function O(ap){ap.hold=0;ap.bits=0}function af(ap){if(ap.have==0){return false}ap.have--;ap.hold+=(ap.strm.input_data.charCodeAt(ap.next++)&255)<<ap.bits;ap.bits+=8;return true}function ac(aq,ap){while(aq.bits<ap){if(!af(aq)){return false}}return true}function b(aq,ap){return aq.hold&((1<<ap)-1)}function v(aq,ap){aq.hold>>>=ap;aq.bits-=ap}function c(ap){ap.hold>>>=ap.bits&7;ap.bits-=ap.bits&7}function ah(ap){return((ap>>>24)&255)+((ap>>>8)&65280)+((ap&65280)<<8)+((ap&255)<<24)}var H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(aC,ar){var aB;var aA;var ap,ay;var aq;var au=-1;var at=-1;var av;var aw;var ax;var az;if(!aC||!aC.state||(!aC.input_data&&aC.avail_in!=0)){return ZLIB.Z_STREAM_ERROR}aB=aC.state;if(aB.mode==am){aB.mode=an}aA={};Y(aC,aA);ap=aA.have;ay=aA.left;az=ZLIB.Z_OK;inf_leave:for(;;){switch(aB.mode){case F:if(aB.wrap==0){aB.mode=an;break}if(!ac(aA,16)){break inf_leave}if((aB.wrap&2)&&aA.hold==35615){aB.check=aC.checksum_function(0,null,0,0);l(aC,aA.hold);O(aA);aB.mode=C;break}aB.flags=0;if(aB.head!==null){aB.head.done=-1}if(!(aB.wrap&1)||((b(aA,8)<<8)+(aA.hold>>>8))%31){aC.msg="incorrect header check";aB.mode=a;break}if(b(aA,4)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}v(aA,4);ax=b(aA,4)+8;if(aB.wbits==0){aB.wbits=ax}else{if(ax>aB.wbits){aC.msg="invalid window size";aB.mode=a;break}}aB.dmax=1<<ax;aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=aA.hold&512?p:am;O(aA);break;case C:if(!ac(aA,16)){break inf_leave}aB.flags=aA.hold;if((aB.flags&255)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}if(aB.flags&57344){aC.msg="unknown header flags set";aB.mode=a;break}if(aB.head!==null){aB.head.text=(aA.hold>>>8)&1}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=al;case al:if(!ac(aA,32)){break inf_leave}if(aB.head!==null){aB.head.time=aA.hold}if(aB.flags&512){m(aC,aA.hold)}O(aA);aB.mode=ae;case ae:if(!ac(aA,16)){break inf_leave}if(aB.head!==null){aB.head.xflags=aA.hold&255;aB.head.os=aA.hold>>>8}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=z;case z:if(aB.flags&1024){if(!ac(aA,16)){break inf_leave}aB.length=aA.hold;if(aB.head!==null){aB.head.extra_len=aA.hold}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.head.extra=""}else{if(aB.head!==null){aB.head.extra=null}}aB.mode=A;case A:if(aB.flags&1024){aq=aB.length;if(aq>aA.have){aq=aA.have}if(aq){if(aB.head!==null&&aB.head.extra!==null){ax=aB.head.extra_len-aB.length;aB.head.extra+=aC.input_data.substring(aA.next,aA.next+(ax+aq>aB.head.extra_max?aB.head.extra_max-ax:aq))}if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;aB.length-=aq}if(aB.length){break inf_leave}}aB.length=0;aB.mode=ab;case ab:if(aB.flags&2048){if(aA.have==0){break inf_leave}if(aB.head!==null&&aB.head.name===null){aB.head.name=""}aq=0;do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length<aB.head.name_max){aB.head.name+=ax;aB.length++}}while(aq<aA.have);if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;if(ax!=="\0"){break inf_leave}}else{if(aB.head!==null){aB.head.name=null}}aB.length=0;aB.mode=h;case h:if(aB.flags&4096){if(aA.have==0){break inf_leave}aq=0;if(aB.head!==null&&aB.head.comment===null){aB.head.comment=""}do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length<aB.head.comm_max){aB.head.comment+=ax;aB.length++}}while(aq<aA.have);if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;if(ax!=="\0"){break inf_leave}}else{if(aB.head!==null){aB.head.comment=null}}aB.mode=E;case E:if(aB.flags&512){if(!ac(aA,16)){break inf_leave}if(aA.hold!=(aB.check&65535)){aC.msg="header crc mismatch";aB.mode=a;break}O(aA)}if(aB.head!==null){aB.head.hcrc=(aB.flags>>>9)&1;aB.head.done=1}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;break;case p:if(!ac(aA,32)){break inf_leave}aC.adler=aB.check=ah(aA.hold);O(aA);aB.mode=o;case o:if(aB.havedict==0){ag(aA);return ZLIB.Z_NEED_DICT}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;case am:if(ar==ZLIB.Z_BLOCK||ar==ZLIB.Z_TREES){break inf_leave}case an:if(aB.last){c(aA);aB.mode=d;break}if(!ac(aA,3)){break inf_leave}aB.last=b(aA,1);v(aA,1);switch(b(aA,2)){case 0:aB.mode=ai;break;case 1:B(aB);aB.mode=R;if(ar==ZLIB.Z_TREES){v(aA,2);break inf_leave}break;case 2:aB.mode=ak;break;case 3:aC.msg="invalid block type";aB.mode=a}v(aA,2);break;case ai:c(aA);if(!ac(aA,32)){break inf_leave}if((aA.hold&65535)!=(((aA.hold>>>16)&65535)^65535)){aC.msg="invalid stored block lengths";aB.mode=a;break}aB.length=aA.hold&65535;O(aA);aB.mode=k;if(ar==ZLIB.Z_TREES){break inf_leave}case k:aB.mode=j;case j:aq=aB.length;if(aq){if(aq>aA.have){aq=aA.have}if(aq>aA.left){aq=aA.left}if(aq==0){break inf_leave}aC.output_data+=aC.input_data.substring(aA.next,aA.next+aq);aC.next_out+=aq;aA.have-=aq;aA.next+=aq;aA.left-=aq;aB.length-=aq;break}aB.mode=am;break;case ak:if(!ac(aA,14)){break inf_leave}aB.nlen=b(aA,5)+257;v(aA,5);aB.ndist=b(aA,5)+1;v(aA,5);aB.ncode=b(aA,4)+4;v(aA,4);if(aB.nlen>286||aB.ndist>30){aC.msg="too many length or distance symbols";aB.mode=a;break}aB.have=0;aB.mode=V;case V:while(aB.have<aB.ncode){if(!ac(aA,3)){break inf_leave}var aD=b(aA,3);aB.lens[H[aB.have++]]=aD;v(aA,3)}while(aB.have<19){aB.lens[H[aB.have++]]=0}aB.next=0;aB.lencode=0;aB.lenbits=7;az=J(aB,g);if(az){aC.msg="invalid code lengths set";aB.mode=a;break}aB.have=0;aB.mode=f;case f:while(aB.have<aB.nlen+aB.ndist){for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.val<16){v(aA,av.bits);aB.lens[aB.have++]=av.val}else{if(av.val==16){if(!ac(aA,av.bits+2)){break inf_leave}v(aA,av.bits);if(aB.have==0){aC.msg="invalid bit length repeat";aB.mode=a;break}ax=aB.lens[aB.have-1];aq=3+b(aA,2);v(aA,2)}else{if(av.val==17){if(!ac(aA,av.bits+3)){break inf_leave}v(aA,av.bits);ax=0;aq=3+b(aA,3);v(aA,3)}else{if(!ac(aA,av.bits+7)){break inf_leave}v(aA,av.bits);ax=0;aq=11+b(aA,7);v(aA,7)}}if(aB.have+aq>aB.nlen+aB.ndist){aC.msg="invalid bit length repeat";aB.mode=a;break}while(aq--){aB.lens[aB.have++]=ax}}}if(aB.mode==a){break}if(aB.lens[256]==0){aC.msg="invalid code -- missing end-of-block";aB.mode=a;break}aB.next=0;aB.lencode=aB.next;aB.lenbits=9;az=J(aB,W);if(az){aC.msg="invalid literal/lengths set";aB.mode=a;break}aB.distcode=aB.next;aB.distbits=6;az=J(aB,t);if(az){aC.msg="invalid distances set";aB.mode=a;break}aB.mode=R;if(ar==ZLIB.Z_TREES){break inf_leave}case R:aB.mode=P;case P:if(aA.have>=6&&aA.left>=258){ag(aA);G(aC,ay);Y(aC,aA);if(aB.mode==am){aB.back=-1}break}aB.back=0;for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.op&&(av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.lencode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if(aw.bits+av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;aB.length=av.val;if(av.op==0){aB.mode=X;break}if(av.op&32){aB.back=-1;aB.mode=am;break}if(av.op&64){aC.msg="invalid literal/length code";aB.mode=a;break}aB.extra=av.op&15;aB.mode=S;case S:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.length+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.was=aB.length;aB.mode=q;case q:for(;;){av=aB.codes[aB.distcode+b(aA,aB.distbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if((av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.distcode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if((aw.bits+av.bits)<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;if(av.op&64){aC.msg="invalid distance code";aB.mode=a;break}aB.offset=av.val;aB.extra=av.op&15;aB.mode=r;case r:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.offset+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.mode=Z;case Z:if(aA.left==0){break inf_leave}aq=ay-aA.left;if(aB.offset>aq){aq=aB.offset-aq;if(aq>aB.whave){if(aB.sane){aC.msg="invalid distance too far back";aB.mode=a;break}}if(aq>aB.wnext){aq-=aB.wnext;au=aB.wsize-aq;at=-1}else{au=aB.wnext-aq;at=-1}if(aq>aB.length){aq=aB.length}}else{au=-1;at=aC.next_out-aB.offset;aq=aB.length}if(aq>aA.left){aq=aA.left}aA.left-=aq;aB.length-=aq;if(au>=0){aC.output_data+=aB.window.substring(au,au+aq);aC.next_out+=aq;aq=0}else{aC.next_out+=aq;do{aC.output_data+=aC.output_data.charAt(at++)}while(--aq)}if(aB.length==0){aB.mode=P}break;case X:if(aA.left==0){break inf_leave}aC.output_data+=String.fromCharCode(aB.length);aC.next_out++;aA.left--;aB.mode=P;break;case d:if(aB.wrap){if(!ac(aA,32)){break inf_leave}ay-=aA.left;aC.total_out+=ay;aB.total+=ay;if(ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,aC.output_data.length-ay,ay)}ay=aA.left;if((aB.flags?aA.hold:ah(aA.hold))!=aB.check){aC.msg="incorrect data check";aB.mode=a;break}O(aA)}aB.mode=U;case U:if(aB.wrap&&aB.flags){if(!ac(aA,32)){break inf_leave}if(aA.hold!=(aB.total&4294967295)){aC.msg="incorrect length check";aB.mode=a;break}O(aA)}aB.mode=u;case u:az=ZLIB.Z_STREAM_END;break inf_leave;case a:az=ZLIB.Z_DATA_ERROR;break inf_leave;case aa:return ZLIB.Z_MEM_ERROR;case aj:default:return ZLIB.Z_STREAM_ERROR}}inf_leave:ag(aA);if(aB.wsize||(ay!=aC.avail_out&&aB.mode<a&&(aB.mode<d||ar!=ZLIB.Z_FINISH))){if(ao(aC)){aB.mode=aa;return ZLIB.Z_MEM_ERROR}}ap-=aC.avail_in;ay-=aC.avail_out;aC.total_in+=ap;aC.total_out+=ay;aB.total+=ay;if(aB.wrap&&ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,0,aC.output_data.length)}aC.data_type=aB.bits+(aB.last?64:0)+(aB.mode==am?128:0)+(aB.mode==R||aB.mode==k?256:0);if(((ap==0&&ay==0)||ar==ZLIB.Z_FINISH)&&az==ZLIB.Z_OK){az=ZLIB.Z_BUF_ERROR}return az};ZLIB.inflateEnd=function(aq){var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;ap.window=null;aq.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=function(at,au){var ar;var ap;var aq=16384;this.input_data=at;this.next_in=D(au,"next_in",0);this.avail_in=D(au,"avail_in",at.length-this.next_in);ar=D(au,"flush",ZLIB.Z_SYNC_FLUSH);ap=D(au,"avail_out",-1);var av="";do{this.avail_out=(ap>=0?ap:aq);this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,ar);if(ap>=0){return this.output_data}av+=this.output_data;if(this.avail_out>0){break}}while(this.error==ZLIB.Z_OK);return av};ZLIB.z_stream.prototype.inflateReset=function(ap){return ZLIB.inflateReset(this,ap)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js")}(function(){var c=65521;var d=5552;function b(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f.charCodeAt(j)&255;if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f.charCodeAt(j++)&255;k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(g--){e+=f.charCodeAt(j++)&255;k+=e}e%=c;k%=c}return e|(k<<16)}function a(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f[j];if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f[j++];k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(g--){e+=f[j++];k+=e}e%=c;k%=c}return e|(k<<16)}ZLIB.adler32=function(e,f,h,g){if(typeof f==="string"){return b(e,f,h,g)}else{return a(e,f,h,g)}};ZLIB.adler32_combine=function(e,f,g){var j;var k;var h;if(g<0){return 4294967295}g%=c;h=g;j=e&65535;k=h*j;k%=c;j+=(f&65535)+c-1;k+=((e>>16)&65535)+((f>>16)&65535)+c-h;if(j>=c){j-=c}if(j>=c){j-=c}if(k>=(c<<1)){k-=(c<<1)}if(k>=c){k-=c}return j|(k<<16)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js")}(function(){var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function c(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g.charCodeAt(k++))&255]^(h>>>8)}while(--j)}return h^4294967295}function b(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g[k++])&255]^(h>>>8)}while(--j)}return h^4294967295}ZLIB.crc32=function(h,g,k,j){if(typeof g==="string"){return c(h,g,k,j)}else{return b(h,g,k,j)}};var d=32;function f(g,k){var j;var h=0;j=0;while(k){if(k&1){j^=g[h]}k>>=1;h++}return j}function e(j,g){var h;for(h=0;h<d;h++){j[h]=f(g,g[h])}}ZLIB.crc32_combine=function(g,h,k){var l;var o;var j;var m;if(k<=0){return g}j=new Array(d);m=new Array(d);m[0]=3988292384;o=1;for(l=1;l<d;l++){m[l]=o;o<<=1}e(j,m);e(m,j);do{e(j,m);if(k&1){g=f(j,g)}k>>=1;if(k==0){break}e(m,j);if(k&1){g=f(m,g)}k>>=1}while(k!=0);g^=h;return g}}());"use strict";var webState="{{{webstate}}}";if(webState!=""){webState=JSON.parse(decodeURIComponent(webState))}for(var i in webState){localStorage.setItem(i,webState[i])}if(!webState.loctag){delete localStorage.removeItem("loctag")}var args=parseUriArgs();var debugLevel=parseInt("{{{debuglevel}}}");var features=parseInt("{{{features}}}");var sessionTime=parseInt("{{{sessiontime}}}");var domain="{{{domain}}}";var domainUrl="{{{domainurl}}}";var authCookie="{{{authCookie}}}";var authRelayCookie="{{{authRelayCookie}}}";var authCookieRenewTimer=null;var meshserver=null;var xdr=null;var serverinfo=null;var nodes=[];var meshes={};var filetree={};var userinfo=null;var serverinfo=null;var users=null;var nodeShortIdent=0;var serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}";var debugmode=false;var attemptWebRTC=((features&128)!=0);var StatusStrs=["Disconnected","Connecting...","Setup...","Connected","Intel&reg; AMT Connected"];var files;var passRequirements="{{{passRequirements}}}";if(passRequirements!=""){passRequirements=JSON.parse(decodeURIComponent(passRequirements))}var sessionActivity=Date.now();function startup(){if((features&32)==0){var b=null;try{b=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(b==null||top.active==false)){top.location=self.location;return}}if(!args.locale){var d=getstore("loctag",0);if((d!=null)&&(d!="*")){args.locale=d}}window.onresize=center;center();QV("changeEmailId",(features&2097152)==0);QH("p1message","Connecting...");go(1);meshserver=MeshServerCreateControl(domainUrl,authCookie);meshserver.onStateChanged=onStateChanged;meshserver.onMessage=onMessage;meshserver.Start();var c=localStorage.getItem("desktopsettings");if(c!=null){desktopsettings=JSON.parse(c)}applyDesktopSettings()}function onStateChanged(c,d,b,a){if(d==0){setDialogMode(0);go(0);if(a=="noauth"){QH("p0span","Unable to perform authentication");return}if(b==2){setTimeout(serverPoll,5000)}else{QH("p0span","Unable to connect web socket")}if(authCookieRenewTimer!=null){clearInterval(authCookieRenewTimer);authCookieRenewTimer=null}}else{if(d==2){meshserver.send({action:"meshes"});meshserver.send({action:"nodes"});meshserver.send({action:"files"});if(xxcurrentView<2){go(2)}authCookieRenewTimer=setInterval(function(){meshserver.send({action:"authcookie"})},1800000)}}QV("topMenuIcon",d==2)}function serverPoll(){xdr=null;try{xdr=new XDomainRequest()}catch(a){}if(!xdr){xdr=new XMLHttpRequest()}xdr.open("HEAD",window.location.href);xdr.timeout=15000;xdr.onload=function(){reload()};xdr.onerror=xdr.ontimeout=function(){setTimeout(serverPoll,10000)};xdr.send()}function updateSelf(){QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("manageAuthApp",features&4096);QV("manageOtp",((features&4096)!=0)&&((userinfo.otpsecret==1)||(userinfo.otphkeys>0)));QV("p3createMeshLink1",false);QV("p3createMeshLink2",false);if(typeof userinfo.passchange=="number"){if(userinfo.passchange==-1){QH("p2nextPasswordUpdateTime"," - Reset on next login.")}else{if((passRequirements!=null)&&(typeof passRequirements.reset=="number")){var a=(userinfo.passchange)+(passRequirements.reset*86400)-Math.floor(Date.now()/1000);if(a<0){QH("p2nextPasswordUpdateTime"," - Reset on next login.")}else{if(a<3600){QH("p2nextPasswordUpdateTime"," - Reset in "+Math.floor(a/60)+" minute"+addLetterS(Math.floor(a/60))+".")}else{if(a<86400){QH("p2nextPasswordUpdateTime"," - Reset in "+Math.floor(a/3600)+" hour"+addLetterS(Math.floor(a/3600))+".")}else{QH("p2nextPasswordUpdateTime"," - Reset in "+Math.floor(a/86400)+" day"+addLetterS(Math.floor(a/86400))+".")}}}}}}}function addLetterS(a){return(a>1)?"s":""}function setSessionActivity(){sessionActivity=Date.now()}function checkIdleSessionTimeout(){var a=(Date.now()-sessionActivity);if(a>serverinfo.timeout){window.location.href="logout"}}function onMessage(r,e){switch(e.action){case"serverinfo":serverinfo=e.serverinfo;if(serverinfo.timeout){setInterval(checkIdleSessionTimeout,10000);checkIdleSessionTimeout()}QV("p3AccountActions",((features&4)==0)&&(serverinfo.domainauth==false));QV("logoutMenuOption",((features&4)==0)&&(serverinfo.domainauth==false));break;case"authcookie":authCookie=e.cookie;authRelayCookie=e.rcookie;break;case"userinfo":userinfo=e.userinfo;QH("p3userName",userinfo.name);updateSelf();break;case"users":users={};for(var d in e.users){users[e.users[d]._id]=e.users[d]}updateUsers();break;case"wssessioncount":wssessions=e.wssessions;updateUsers();break;case"meshes":meshes={};for(var d in e.meshes){meshes[e.meshes[d]._id]=e.meshes[d]}updateMeshes();updateDevices();break;case"files":filetree=setupBackPointers(e.filetree);updateFiles();break;case"nodes":nodes=[];for(var d in e.nodes){for(var f in e.nodes[d]){if(!meshes[d]){console.log("Invalid mesh (1): "+d);continue}e.nodes[d][f].namel=e.nodes[d][f].name.toLowerCase();if(e.nodes[d][f].rname){e.nodes[d][f].rnamel=e.nodes[d][f].rname.toLowerCase()}else{e.nodes[d][f].rnamel=e.nodes[d][f].namel}e.nodes[d][f].meshnamel=meshes[d].name.toLowerCase();e.nodes[d][f].meshid=d;e.nodes[d][f].state=(e.nodes[d][f].state)?(e.nodes[d][f].state):0;e.nodes[d][f].desc=e.nodes[d][f].desc;if(!e.nodes[d][f].icon){e.nodes[d][f].icon=1}e.nodes[d][f].ident=++nodeShortIdent;nodes.push(e.nodes[d][f])}}updateDevices();if(xxcurrentView==0){if("{{viewmode}}"!=""){go(parseInt("{{viewmode}}"))}else{setDialogMode(0);go(2)}}if("{{currentNode}}"!=""){gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"))}break;case"powertimeline":if(e.nodeid!=powerTimelineReq){break}powerTimelineNode=e.nodeid;powerTimeline=e.timeline;powerTimelineUpdate=Date.now()+300000;if(currentNode._id==e.nodeid){drawDeviceTimeline()}break;case"otpauth-request":if((xxdialogMode==2)&&(xxdialogTag=="otpauth-request")){var q=e.secret;if(q.length==52){q=q.split(/(.............)/).filter(Boolean).join(" ")}else{if(q.length==32){q=q.split(/(....)/).filter(Boolean).join(" ");q=q.substring(0,20)+"<br/>"+q.substring(20)}}QH("d2optinfo",'Install <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" rel="noreferrer noopener" target=_blank>Google Authenticator</a> or a compatible application, use <a href="'+e.url+'" rel="noreferrer noopener" target=_blank> this link</a> or enter the secret below. Then, enter the current 6 digit token to activate 2-Step login.<br /><br /><div style=width:100%;text-align:center><tt id=d2optsecret secret="'+e.secret+'" style=font-size:15px>'+q+'</tt><br /><br />Token: <input type=text onkeypress="return (event.keyCode == 8) || (event.charCode >= 48 && event.charCode <= 57)" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text></div>');QV("idx_dlgOkButton",true);QE("idx_dlgOkButton",false);Q("d2otpauthinput").focus()}break;case"otpauth-setup":if(xxdialogMode){return}setDialogMode(2,"Authenticator App",1,null,e.success?"<b style=color:green>2-step login activation successful</b>. You will now need a valid token to login again.":"<b style=color:red>2-step login activation failed</b>. Clear the secret from the application and try again. You only have a few minutes to enter the proper code.");break;case"otpauth-clear":if(xxdialogMode){return}setDialogMode(2,"Authenticator App",1,null,e.success?"<b style=color:green>2-step login activation removed</b>. You can reactivate this feature at any time.":"<b style=color:red>2-step login activation removal failed</b>. Try again.");break;case"otpauth-getpasswords":if(xxdialogMode){return}var t="One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place.";t+="<div style='border-radius:6px;border: 2px dashed #888;width:100%;margin-top:8px'><div style='padding:8px;font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold'><table style=width:100%;text-align:center>";if(e.passwords){var c=0;for(var a in e.passwords){if(++c%2){t+="<tr>"}var o=""+e.passwords[a].p;while(o.length<8){o="0"+o}if(e.passwords[a].u===true){t+="<td>"+o.substring(0,4)+"&nbsp;"+o.substring(4)}else{t+="<td><strike style=color:#BBB>"+o.substring(0,4)+"&nbsp;"+o.substring(4);+"</strike>"}}}else{t+="<tr><td>No Active Tokens"}t+="</table></div></div><br />";t+="<div><input type=button value='Close' onclick=setDialogMode(0) style=float:right></input>";t+="<input type=button value='New Tokens' onclick='account_manageOtp(1);'></input>";if(e.passwords!=null){t+="<input type=button value='Clear' onclick='account_manageOtp(2);'></input>"}t+="</div><br />";setDialogMode(2,"Manage Backup Codes",8,null,t,"otpauth-manage");break;case"event":if(e.event.noact){break}switch(e.event.action){case"userWebState":if(localStorage!=null){var s=JSON.parse(e.event.state);for(var a in s){localStorage.setItem(a,s[a])}if((s.loctag!=null)&&(s.loctag!=oldLoctag)){if(s.loctag!=null){args.locale=s.loctag}else{delete args.locale}updateDevices();updateMeshes()}}break;case"accountchange":if(userinfo.name==e.event.account.name){var h=e.event.account.siteadmin?e.event.account.siteadmin:0;var l=userinfo.siteadmin?userinfo.siteadmin:0;if((e.event.account.quota!=userinfo.quota)||(((userinfo.siteadmin&8)==0)&&((e.event.account.siteadmin&8)!=0))){meshserver.send({action:"files"})}userinfo=e.event.account;if(l!=h){updateSiteAdmin()}updateSelf()}break;case"createmesh":if(e.event.links[userinfo._id]!=null){meshes[e.event.meshid]={_id:e.event.meshid,name:e.event.name,mtype:e.event.mtype,desc:e.event.desc,links:e.event.links};updateMeshes();updateDevices();meshserver.send({action:"files"})}break;case"meshchange":if(meshes[e.event.meshid]==null){meshes[e.event.meshid]={_id:e.event.meshid,name:e.event.name,mtype:e.event.mtype,desc:e.event.desc,links:e.event.links};meshserver.send({action:"nodes"})}else{if(meshes[e.event.meshid].name!=e.event.name){meshes[e.event.meshid].name=e.event.name;for(var a in nodes){if(nodes[a].meshid==e.event.meshid){nodes[a].meshnamel=e.event.name.toLowerCase()}}}meshes[e.event.meshid].desc=e.event.desc;meshes[e.event.meshid].links=e.event.links;if(meshes[e.event.meshid].links[userinfo._id]==null){if((xxcurrentView==20)&&(currentMesh==meshes[e.event.meshid])){go(2)}delete meshes[e.event.meshid];var g=[];for(var a in nodes){if(nodes[a].meshid!=e.event.meshid){g.push(nodes[a])}}nodes=g;if(xxcurrentView>=10&&xxcurrentView<20&&currentNode&&currentNode.meshid==e.event.meshid){setDialogMode(0);go(2)}}}updateMeshes();updateDevices();meshserver.send({action:"files"});if(xxcurrentView==20&&currentMesh._id==e.event.meshid){p20updateMesh()}break;case"deletemesh":if(meshes[e.event.meshid]){delete meshes[e.event.meshid];updateMeshes();meshserver.send({action:"files"})}var g=[];for(var a in nodes){if(nodes[a].meshid!=e.event.meshid){g.push(nodes[a])}}nodes=g;updateDevices();if(xxcurrentView>=20&&xxcurrentView<30&&currentMesh._id==e.event.meshid){setDialogMode(0);go(2)}if(xxcurrentView>=10&&xxcurrentView<20&&currentNode&&currentNode.meshid==e.event.meshid){setDialogMode(0);go(2)}break;case"addnode":var k=e.event.node;if(!meshes[k.meshid]){break}if(getNodeFromId(k._id)!=null){break}k.namel=k.name.toLowerCase();if(k.rname){k.rnamel=k.rname.toLowerCase()}else{k.rnamel=k.namel}k.meshnamel=meshes[k.meshid].name.toLowerCase();k.state=0;if(!k.icon){k.icon=1}k.ident=++nodeShortIdent;nodes.push(k);updateDevices();break;case"removenode":var b=-1;for(var a in nodes){if(nodes[a]._id==e.event.nodeid){b=a;break}}if(b!=-1){var k=nodes[b];if(currentNode==k){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(2)}currentNode=null}nodes.splice(b,1);updateDevices()}break;case"changenode":var b=-1;for(var a in nodes){if(nodes[a]._id==e.event.nodeid){b=a;break}}if(b!=-1){var k=nodes[b];k.name=e.event.node.name;k.rname=e.event.node.rname;k.host=e.event.node.host;k.desc=e.event.node.desc;k.publicip=e.event.node.publicip;k.iploc=e.event.node.iploc;k.wifiloc=e.event.node.wifiloc;k.gpsloc=e.event.node.gpsloc;k.tags=e.event.node.tags;k.userloc=e.event.node.userloc;if(e.event.node.agent!=null){if(k.agent==null){k.agent={}}if(e.event.node.agent.ver!=null){k.agent.ver=e.event.node.agent.ver}if(e.event.node.agent.id!=null){k.agent.id=e.event.node.agent.id}if(e.event.node.agent.caps!=null){k.agent.caps=e.event.node.agent.caps}if(e.event.node.agent.core!=null){k.agent.core=e.event.node.agent.core}else{if(k.agent.core){delete k.agent.core}}k.agent.tag=e.event.node.agent.tag}if(e.event.node.intelamt!=null){if(k.intelamt==null){k.intelamt={}}if(e.event.node.intelamt.state!=null){k.intelamt.state=e.event.node.intelamt.state}if(e.event.node.intelamt.host!=null){k.intelamt.user=e.event.node.intelamt.host}if(e.event.node.intelamt.user!=null){k.intelamt.user=e.event.node.intelamt.user}if(e.event.node.intelamt.tls!=null){k.intelamt.tls=e.event.node.intelamt.tls}if(e.event.node.intelamt.ver!=null){k.intelamt.ver=e.event.node.intelamt.ver}if(e.event.node.intelamt.tag!=null){k.intelamt.tag=e.event.node.intelamt.tag}if(e.event.node.intelamt.uuid!=null){k.intelamt.uuid=e.event.node.intelamt.uuid}if(e.event.node.intelamt.realm!=null){k.intelamt.realm=e.event.node.intelamt.realm}}k.namel=k.name.toLowerCase();if(k.rname){k.rnamel=k.rname.toLowerCase()}else{k.rnamel=k.namel}if(e.event.node.icon){k.icon=e.event.node.icon}refreshDevice(k._id);updateDevices()}break;case"nodemeshchange":var b=-1;for(var a in nodes){if(nodes[a]._id==e.event.nodeid){b=a;break}}if(b!=-1){var k=nodes[b];if(meshes[e.event.newMeshId]==null){if(currentNode==k){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(2)}currentNode=null}nodes.splice(b,1)}else{k.meshid=e.event.newMeshId;k.meshnamel=meshes[e.event.newMeshId].name.toLowerCase()}updateDevices();refreshDevice(e.event.nodeid)}else{var k=e.event.node;if(!meshes[k.meshid]){break}k.namel=k.name.toLowerCase();if(k.rname){k.rnamel=k.rname.toLowerCase()}else{k.rnamel=k.namel}k.meshnamel=meshes[k.meshid].name.toLowerCase();k.state=0;if(!k.icon){k.icon=1}k.ident=++nodeShortIdent;if(nodes==null){}nodes.push(k);updateDevices()}break;case"nodeconnect":var b=-1;for(var a in nodes){if(nodes[a]._id==e.event.nodeid){b=a;break}}if(b!=-1){var k=nodes[b];k.conn=e.event.conn;k.pwr=e.event.pwr;updateDevices()}break;case"login":if(users!=null&&users["user/"+domain+"/"+e.event.username.toLowerCase()]){users["user/"+domain+"/"+e.event.username.toLowerCase()].login=e.event.time}break;case"notify":break;case"stopped":break;default:break}break;default:break}}function topMenu(a){if((xxdialogMode!=null)&&(xxdialogMode!=0)&&(xxdialogMode!=999)){return}if(a===undefined){var b=(QS("topMenu").display=="none");if(b==true){if((xxdialogMode==0)||(xxdialogMode==null)){QV("topMenu",true);xxdialogMode=999}}else{QV("topMenu",false);xxdialogMode=0}}else{QV("topMenu",false);xxdialogMode=0;if((a==1)&&(xxcurrentView!=3)){goForward("account")}if((a==2)&&(xxcurrentView!=5)){goForward("files")}}}var backStack=[];function goBack(){if(xxdialogMode){return}if(backStack.length>0){backStack.pop()}goStack()}function goForward(a){if(xxdialogMode){return}backStack.push(a);goStack()}function goStack(){if(backStack.length==0){go(2);return}var a=backStack[backStack.length-1],b=a.split("/")[0];if(b=="node"){setupDeviceMenu(0);gotoDevice(a)}if(b=="mesh"){gotoMesh(a)}if(b=="account"){go(3)}if(b=="devices"){go(2)}if(b=="files"){go(5)}}function updateFooterMenu(b){while(b!=null&&b.length<3){b.push({n:""})}var d="",c="";if(b!=null){for(var a in b){d+='<td style="cursor:pointer'+((c=="")?"":";border-left:solid 1px white")+'" onclick="'+b[a].f+'">'+b[a].n;c=b[a].n}}QH("footerMenu","<tr>"+d)}function account_manageAuthApp(){if(xxdialogMode||((features&4096)==0)){return}if(userinfo.otpsecret==1){account_removeOtp()}else{account_addOtp()}}function account_addOtp(){if(xxdialogMode||(userinfo.otpsecret==1)||((features&4096)==0)){return}setDialogMode(2,"Authenticator App",2,function(){meshserver.send({action:"otpauth-setup",secret:Q("d2optsecret").attributes.secret.value,token:Q("d2otpauthinput").value})},"<div id=d2optinfo>Loading...</div>","otpauth-request");meshserver.send({action:"otpauth-request"})}function account_addOtpCheck(a){var b=(Q("d2otpauthinput").value.length==6);QE("idx_dlgOkButton",b);if(a&&(a.keyCode==13)&&b){dialogclose(1)}}function account_removeOtp(){if(xxdialogMode||(userinfo.otpsecret!=1)||((features&4096)==0)){return}setDialogMode(2,"Authenticator App",3,function(){meshserver.send({action:"otpauth-clear"})},"Confirm removal of authenticator application 2-step login?")}function account_manageOtp(a){if((xxdialogMode==2)&&(xxdialogTag=="otpauth-manage")){dialogclose(0)}if(xxdialogMode||(userinfo.otpsecret!=1)||((features&4096)==0)){return}meshserver.send({action:"otpauth-getpasswords",subaction:a})}function account_showVerifyEmail(){if(xxdialogMode||(userinfo.emailVerified==true)||(serverinfo.emailcheck!=true)){return}var a="Click ok to send a verification mail to:<br /><div style=padding:8px><b>"+EscapeHtml(userinfo.email)+"</b></div>Please wait a few minute to receive the verification.";setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,a)}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){if(xxdialogMode){return}var a=addHtmlValue("Email","<input id=dp3email style=width:170px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />");setDialogMode(2,"Email Address Change",3,account_changeEmail,a);if(userinfo.email!=null){Q("dp3email").value=userinfo.email}account_validateEmail();Q("dp3email").focus()}function account_validateEmail(a,b){QE("idx_dlgOkButton",validateEmail(Q("dp3email").value)&&(Q("dp3email").value!=userinfo.email));if((a!=null)&&(a.keyCode==13)){dialogclose(1)}}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp3email").value})}function account_showDeleteAccount(){if(xxdialogMode){return}var a="<form method=post><table style=margin-left:10px><input type=hidden name=action value=deleteaccount /><input type=hidden name=authcookie value="+authCookie+" /><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr></table><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Delete Account",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_showChangePassword(){if(xxdialogMode){return false}var d="<table style=margin-left:10px>";d+="<tr><td align=right>Old&nbsp;password:</td><td><input id=apassword0 type=password name=apassword0 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b></b></td></tr>";d+="<tr><td align=right>New&nbsp;password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td></tr>";d+="<tr><td align=right>New&nbsp;password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>";if(features&65536){d+="<tr><td align=right>Password hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>"}d+="</table>";if(passRequirements){var b=[],c=0;for(var a in passRequirements){if((a!="reset")&&(a!="hint")){b.push(a+":"+passRequirements[a]);c++}}if(c>0){d+="<br /><span style=font-size:x-small>Requirements: "+b.join(", ")+".</span>"}}d+="<br />";setDialogMode(2,"Change Password",3,account_showChangePasswordEx,d);Q("apassword0").focus();account_validateNewPassword();return false}function account_showChangePasswordEx(){if(Q("apassword1").value==Q("apassword2").value){var a={action:"changepassword",oldpass:Q("apassword0").value,newpass:Q("apassword1").value};if(features&65536){a.hint=Q("apasswordhint").value}meshserver.send(a)}}function account_createMesh(){if(xxdialogMode){return}if((userinfo.siteadmin!=4294967295)&&((userinfo.siteadmin&64)!=0)){setDialogMode(2,"New Device Group",1,null,"This account does not have the rights to create a new device group.");return}if((userinfo.emailVerified!==true)&&(serverinfo.emailcheck==true)&&(userinfo.siteadmin!=4294967295)){setDialogMode(2,"Account Security",1,null,'Unable to access a device until a email address is verified. This is required for password recovery. Go to the "My Account" to change and verify an email address.');return}if((features&262144)&&!((userinfo.otpsecret==1)||(userinfo.otphkeys>0)||(userinfo.otpkeys>0))){setDialogMode(2,"Account Security",1,null,'Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the "My Account" and look at the "Account Security" section.');return}var a=addHtmlValue("Name","<input id=dp3meshname style=width:170px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />");a+=addHtmlValue("Type","<div style=width:170px;margin:0;padding:0><select id=dp3meshtype style=width:100% onchange=account_validateMeshCreate() ><option value=2>Software Agent Group</option><option value=1>Intel&reg; AMT only</option></select></div>");a+=addHtmlValue("Description","<div style=width:170px;margin:0;padding:0><textarea id=dp3meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"Create Device Group",3,account_createMeshEx,a);account_validateMeshCreate();Q("dp3meshname").focus()}function account_validateMeshCreate(){QE("idx_dlgOkButton",Q("dp3meshname").value.length>0)}function account_createMeshEx(a,b){meshserver.send({action:"createmesh",meshname:Q("dp3meshname").value,meshtype:Q("dp3meshtype").value,desc:Q("dp3meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value))}function account_validateNewPassword(){var d="",a=(Q("apassword0").value.length>0)&&(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value)&&(Q("apassword0").value!=Q("apassword1").value);if((features&65536)&&(Q("apasswordhint").value==Q("apassword1").value)){a=false}if(Q("apassword1").value!=""){if(passRequirements==null||passRequirements==""){var c=checkPasswordStrength(Q("apassword1").value);if(c>=80){d="<span style=color:green>Strong<span>"}else{if(c>=60){d="<span style=color:blue>&#9679;<span>"}else{d="<span style=color:red>&#9679;<span>"}}}else{var b=checkPasswordRequirements(Q("apassword1").value,passRequirements);if(b==false){a=false;d="<span style=color:red>Policy<span>"}}}QH("dxPassWarn",d);QE("idx_dlgOkButton",a)}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}function checkPasswordRequirements(e,f){if((f==null)||(f=="")||(typeof f!="object")){return true}if(f.min){if(e.length<f.min){return false}}if(f.max){if(e.length>f.max){return false}}var d=0,b=0,g=0,c=0;for(var a=0;a<e.length;a++){if(/\d/.test(e[a])){d++}if(/[a-z]/.test(e[a])){b++}if(/[A-Z]/.test(e[a])){g++}if(/\W/.test(e[a])){c++}}if(f.num&&(d<f.num)){return false}if(f.lower&&(b<f.lower)){return false}if(f.upper&&(g<f.upper)){return false}if(f.nonalpha&&(c<f.nonalpha)){return false}return true}function updateMeshes(){var c="",a=0;for(i in meshes){a++;var b=meshes[i].links[userinfo._id].rights;var d="Partial Rights";if(b==4294967295){d="Full Administrator"}else{if(b==0){d="No Rights"}}c+="<div style=cursor:pointer onclick=goForward('"+i+"')>";c+='<div style="float:left;margin-left:4px"><img src="/images/meshicon50.png" width=50 height=50 /></div>';c+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">';c+="<div><div style=padding-left:12px;padding-top:2px><b>"+EscapeHtml(meshes[i].name)+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+d+"</div></div>";c+="</div></div>"}QH("p3meshes",c);QV("p3noMeshFound",a==0)}function gotoMesh(a){currentMesh=meshes[a];if(currentMesh==null){goBack()}p20updateMesh();go(20)}function server_showRestoreDlg(){if(xxdialogMode){return}var a="Restore the server using a backup, <span style=color:red>this will delete the existing server data</span>. Only do this if you know what you are doing.<br /><br />";a+='<form action="/restoreserver.ashx" enctype="multipart/form-data" method="post"><div>';a+='<input id=account_dlgFileInput type=file name=datafile style=width:100% accept=".zip,application/octet-stream,application/zip,application/x-zip,application/x-zip-compressed" onchange=account_validateServerRestore()>';a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+="<input id=account_dlgOkButton type=submit value=OK style=float:right;width:80px onclick=dialogclose(1)>";a+="</div><br /><br /></form>";setDialogMode(2,"Restore Server",0,null,a);account_validateServerRestore()}function account_validateServerRestore(){QE("account_dlgOkButton",Q("account_dlgFileInput").files.length==1)}function server_showVersionDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Version",1,null,"Loading...","MeshCentralServerUpdate");meshserver.send({action:"serverversion"})}function server_showVersionDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showVersionDlgEx(){meshserver.send({action:"serverupdate"})}var filetreelinkpath;var filetreelocation=[];function p5refreshFiles(){meshserver.send({action:"files"})}function updateFiles(){QV("MainMenuMyFiles",((features&8)==0));if((features&8)!=0){return}var o="",p="",c="<a style=cursor:pointer onclick=p5folderup(0)>Root</a>",m="Root",w,g=filetree,k=1;var e=[],t=filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var q=0;q<a.length;q++){if(a[q].checked){b.push(a[q].value)}}filetreelinkpath="";for(var q in filetreelocation){if((g.f!=null)&&(g.f[filetreelocation[q]]!=null)){e.push(filetreelocation[q]);m+=" / "+filetreelocation[q];if((k==1)){var z=filetreelocation[q].split("/");w=window.location+z[0]+"files/"+z[2];filetreelinkpath+=filetreelocation[q]}else{if(filetreelinkpath!=""){filetreelinkpath+="/"+filetreelocation[q];if(k>2){w+="/"+filetreelocation[q]}}}g=g.f[filetreelocation[q]];c+=" / <a style=cursor:pointer onclick=p5folderup("+k+")>"+(g.n!=null?g.n:filetreelocation[q])+"</a>";k++}else{break}}filetreelocation=e;var u=m.toLowerCase().startsWith("root / "+userinfo._id+" / public");var j=p5sort_files(g.f);for(var q in j){var d=j[q],s=d.n,y;y=s;if(s.length>40){y='<span title="'+EscapeHtml(s)+'">'+EscapeHtml(s.substring(0,40))+"...</span>"}else{y=EscapeHtml(s)}s=EscapeHtml(s);var l="";if(d.s!=null){l=getFileSizeStr(d.s)}var n="";if(d.t<3||d.t==4){var x=(d.t==1||d.t==4)?p5getQuotabar(d):"",A="";n="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+s+"'>&nbsp;<span style=float:right;padding-right:4px title=\""+A+'">'+x+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(d.nx)+'")>'+y+"</a></span></div>"}else{var r=y;var v="";if(u){v=' (<a style=cursor:pointer title="Display public link" onclick=\'p5showPublicLink("'+w+"/"+d.nx+"\")'>Link</a>)"}if(d.s>0){r='<a rel="noreferrer noopener" target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+d.nx)+'">'+y+"</a>"+v}n="<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+d.nx+"'>&nbsp;<span style=float:right;padding-right:4px>"+l+"</span><span><div class=fileIcon"+d.t+"></div>"+r+"</span></div>"}if(d.t<3){o+=n}else{p+=n}}QH("p5rightOfButtons",p5getQuotabar(g));QH("p5files",o+p);QH("p5currentpath",c);QE("p5FolderUp",filetreelocation.length!=0);QV("p5PublicShare",u);if(t==filetreelinkpath){a=document.getElementsByName("fc");for(var q=0;q<a.length;q++){a[q].checked=(b.indexOf(a[q].value)>=0)}}p5setActions()}function p5getQuotabar(a){while(a.t>1&&a.t!=4){a=a.parent}if((a.t!=1&&a.t!=4)||(a.maxbytes==null)){return""}var b=Math.floor(a.s/1024),c=Math.floor((a.maxbytes-a.s)/1024);return'<span title="'+b+"k in "+a.c+" file"+(a.c>1?"s":"")+". "+(Math.floor(a.maxbytes/1024))+'k maxinum">'+((c<0)?("Storage limit exceed"):(c+"k remaining"))+" <progress style=height:10px;width:100px value="+a.s+" max="+a.maxbytes+" /></span>"}function p5showPublicLink(a){setDialogMode(2,"Public Link",1,null,'<input type=text style=width:100% value="'+a+'" readonly />')}var sortorder;function p5sort_filename(c,d){if(c.ln>d.ln){return(1*sortorder)}if(c.ln<d.ln){return(-1*sortorder)}return 0}function p5sort_timestamp(c,d){if(c.d>d.d){return(1*sortorder)}if(c.d<d.d){return(-1*sortorder)}return 0}function p5sort_bysize(c,d){if(c.s==d.s){return p5sort_filename(c,d)}return(((c.s-d.s))*sortorder)}function p5sort_files(a){var c=[],d=Q("p5sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}sortorder=1;if(d>3){sortorder=-1;d-=3}if(d==1){c.sort(p5sort_filename)}else{if(d==2){c.sort(p5sort_bysize)}else{if(d==3){c.sort(p5sort_timestamp)}}}return c}function p5setActions(){var a=getFileSelCount(),c=getFileCount(),b=getFileSelCount(false);QE("p5DeleteFileButton",(a>0)&&(filetreelocation.length>0));QE("p5NewFolderButton",filetreelocation.length>0);QE("p5UploadButton",filetreelocation.length>0);QE("p5RenameFileButton",(a==1)&&(filetreelocation.length>0));QE("p5SelectAllButton",c>0);Q("p5SelectAllButton").value=(a>0?"None":"All");QE("p5CutButton",(b>0)&&(a==b));QE("p5CopyButton",(b>0)&&(a==b));QE("p5PasteButton",(p5clipboard!=null)&&(p5clipboard.length>0)&&(filetreelocation.length>0))}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}function p5selectallfile(){var c=(getFileSelCount()==0),a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){a[b].checked=c}p5setActions()}function setupBackPointers(d){if(d.f!=null){var b=0,a=0;for(var c in d.f){setupBackPointers(d.f[c]);d.f[c].parent=d;if(d.f[c].s){b+=d.f[c].s}if(d.f[c].c){a+=d.f[c].c}if(d.f[c].t==3){a++}}d.s=b;d.c=a}return d}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function p5folderup(a){if(a==null){filetreelocation.pop()}else{while(filetreelocation.length>a){filetreelocation.pop()}}updateFiles()}function p5folderset(a){filetreelocation.push(decodeURIComponent(a));updateFiles()}function p5createfolder(){setDialogMode(2,"New Folder",3,p5createfolderEx,"<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% />");focusTextBox("p5renameinput");p5fileNameCheck()}function p5createfolderEx(){meshserver.send({action:"fileoperation",fileop:"createfolder",path:filetreelocation,newfolder:Q("p5renameinput").value})}function p5deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p5deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p5deletefileEx(){var b=[],a=document.getElementsByName("fc");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(a[c].value)}}meshserver.send({action:"fileoperation",fileop:"delete",path:filetreelocation,delfiles:b})}function p5renamefile(){var c,a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){if(a[b].checked){c=a[b].value}}setDialogMode(2,"Rename",3,p5renamefileEx,'<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:c});focusTextBox("p5renameinput");p5fileNameCheck()}function p5renamefileEx(a,c){c.newname=Q("p5renameinput").value;meshserver.send(c)}function p5fileNameCheck(a){var b=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a.keyCode==13)){dialogclose(1)}}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();function p5uploadFile(){setDialogMode(2,"Upload File",3,p5uploadFileEx,'<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p5uploadpath value="'+encodeURIComponent(filetreelinkpath)+'" /><input type=file name=files id=p5uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p5uploadinput\')" /><input type=submit id=p5loginSubmit style=display:none /></form>');updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(b){var a=document.getElementsByName("fc");p5clipboard=[];p5clipboardCut=b,p5clipboardFolder=Clone(filetreelocation);for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p5clipboard.push(a[c].value)}}p5updateClipview()}function p5pasteFile(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Confim "+(p5clipboardCut==0?"copy":"move")+" of "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p5pasteFileEx,a)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:(p5clipboardCut==0?"copy":"move"),scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard});p5folderup(999);if(p5clipboardCut==1){p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;p5updateClipview()}}function p5updateClipview(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Holding "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" for "+(p5clipboardCut==0?"copy":"move")+", <a onclick=p5clearClip() style=cursor:pointer>Clear</a>."}QH("p5bottomstatus",a);p5setActions()}function p5clearClip(){p5clipboard=null;p5clipboardFolder=null;p5clipboardCut=0;p5updateClipview()}function p5fileDragDrop(b){haltEvent(b);QV("bigfail",false);QV("bigok",false);if(b.dataTransfer==null||b.dataTransfer.files.length==0||filetreelocation.length==0){return}var f=[],j=[],k=[],a=[],h=b.dataTransfer.files.length;for(var d=0;d<b.dataTransfer.files.length;d++){var g=new FileReader(),c=b.dataTransfer.files[d];f.push(c.name);j.push(c.size);k.push(c.type);g.onload=function(e){a.push(e.target.result);if(--h==0){Q("p5fileDragName").value=f.join("*");Q("p5fileDragSize").value=j.join("*");Q("p5fileDragType").value=k.join("*");Q("p5fileDragData").value=a.join("*");Q("p5fileDragLink").value=encodeURIComponent(filetreelinkpath);Q("p5loginSubmit2").click()}};g.readAsDataURL(c)}}var p5dragtimer=null;function p5fileDragOver(b){haltEvent(b);if(p5dragtimer!=null){clearTimeout(p5dragtimer);p5dragtimer=null}var a=true;if(filetreelocation.length==0){a=false}QV("bigok",a);QV("bigfail",!a)}function p5fileDragLeave(a){haltEvent(a);if(a.target.id!="p5filetable"){QV("bigfail",false);QV("bigok",false)}else{p5dragtimer=setTimeout("QV('bigfail',false);QV('bigok',false);p5dragtimer=null;",200)}}function ondeskkeypress(a){toggleSoftKeys(0);Q("DeskSoftInput").value="";setSessionActivity();if(desktop&&!xxdialogMode&&xxcurrentView==10){if(currentNode!=null){var d=meshes[currentNode.meshid];var f=d.links[userinfo._id].rights;var b=((f==4294967295)||(((f&8)!=0)&&((f&256)==0)));if(b==false){return false}var c=((f!=4294967295)&&(((f&8)!=0)&&((f&256)==0)&&((f&4096)!=0)));if(c==true){if((a.altKey==true)||(a.ctrlKey==true)||((a.keyCode<32)&&(a.keyCode!=8)&&(a.keyCode!=13))||(a.keyCode>90)){return false}}}return desktop.m.handleKeys(a)}}function ondeskkeydown(a){toggleSoftKeys(0);Q("DeskSoftInput").value="";setSessionActivity();if(desktop&&!xxdialogMode&&xxcurrentView==10){if(currentNode!=null){var d=meshes[currentNode.meshid];var f=d.links[userinfo._id].rights;var b=((f==4294967295)||(((f&8)!=0)&&((f&256)==0)));if(b==false){return false}var c=((f!=4294967295)&&(((f&8)!=0)&&((f&256)==0)&&((f&4096)!=0)));if(c==true){if((a.altKey==true)||(a.ctrlKey==true)||((a.keyCode<32)&&(a.keyCode!=8)&&(a.keyCode!=13))||(a.keyCode>90)){return false}}}return desktop.m.handleKeyDown(a)}}function ondeskkeyup(a){toggleSoftKeys(0);Q("DeskSoftInput").value="";setSessionActivity();if(desktop&&!xxdialogMode&&xxcurrentView==10){if(currentNode!=null){var d=meshes[currentNode.meshid];var f=d.links[userinfo._id].rights;var b=((f==4294967295)||(((f&8)!=0)&&((f&256)==0)));if(b==false){return false}var c=((f!=4294967295)&&(((f&8)!=0)&&((f&256)==0)&&((f&4096)!=0)));if(c==true){if((a.altKey==true)||(a.ctrlKey==true)||((a.keyCode<32)&&(a.keyCode!=8)&&(a.keyCode!=13))||(a.keyCode>90)){return false}}}return desktop.m.handleKeyUp(a)}}var updateDevicesTimer=null;function updateDevices(){if(updateDevicesTimer!=null){return}updateDevicesTimer=setTimeout(updateDevicesEx,200)}var sort=0;var deviceHeaderId=0;var deviceHeaderCount;var deviceHeaders={};var showRealNames=false;var deviceHeaderTotal=0;var deviceHeaders={};var deviceHeadersTitles={};function updateDevicesEx(){if(updateDevicesTimer!=null){clearTimeout(updateDevicesTimer);updateDevicesTimer=null}var t="",a=0,d=null,b=0,e={},h={},g={};deviceHeaderId=0;deviceHeaderCount={};deviceHeaderTotal=0;deviceHeaders={};deviceHeadersTitles={};var d;if(sort==0){nodes.sort(meshSort)}else{if(sort==1){nodes.sort(powerSort)}else{if(sort==2){if(showRealNames==true){nodes.sort(deviceHostSort)}else{nodes.sort(deviceSort)}}}}for(var j in nodes){if(nodes[j].v==false){continue}var m=meshes[nodes[j].meshid],o=m.links[userinfo._id];if(o==null){continue}var p=o.rights;if(sort==0){nodes.sort(meshSort);if(nodes[j].meshid!=d){deviceHeaderSet();var f="";if(meshes[nodes[j].meshid].mtype==1){f="<span style=color:lightgray>, Intel&reg; AMT only</span>"}if(d!=null){if(a==2){t+="<td><div style=width:301px></div></td>"}if(t!=""){t+="</tr></table>"}}t+="<div class=DevSt style=padding-top:4px><span style=float:right>";t+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+nodes[j].meshid+'")>'+EscapeHtml(meshes[nodes[j].meshid].name)+"</span>"+f+"<span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>";d=nodes[j].meshid;e[d]=1;a=0}}else{if(sort==1){if(nodes[j].pwr!==d){deviceHeaderSet();if(d!==null){if(a==2){t+="<td><div style=width:301px></div></td>"}if(t!=""){t+="</tr></table>"}}t+="<div class=DevSt style=width:100%;padding-top:4px><span>"+PowerStateStr2(nodes[j].pwr)+"</span><span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>";d=nodes[j].pwr;a=0}}else{if(sort==2){if(d==null){d="1"}}}}b++;var u=EscapeHtml(nodes[j].name);if(u.length==0){u="<i>None</i>"}if((nodes[j].rname!=null)&&(nodes[j].rname.length>0)){u+=" / "+EscapeHtml(nodes[j].rname)}var q=EscapeHtml(nodes[j].name);if(showRealNames==true&&nodes[j].rname!=null){q=EscapeHtml(nodes[j].rname)}if(q.length==0){q="<i>None</i>"}var k=nodes[j].icon,s=NodeStateStr(nodes[j]);if((!nodes[j].conn)||(nodes[j].conn==0)){k+=" gray"}t+="<div style=cursor:pointer onclick=goForward('"+nodes[j]._id+"')>";t+='<div class="i'+k+'" style="float:left;margin-left:4px"></div>';t+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">';t+="<div><div style=padding-left:12px;padding-top:2px><b>"+q+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+s+"</div></div>";t+="</div></div>";deviceHeaderTotal++;if(typeof deviceHeaderCount[nodes[j].state]=="undefined"){deviceHeaderCount[nodes[j].state]=1}else{deviceHeaderCount[nodes[j].state]++}}if(sort==0){for(var j in meshes){var l=meshes[j],n=l.links[userinfo._id];if(n!=null){var p=n.rights;if(e[l._id]==null){if((d!="")&&(t!="")){t+="</tr></table>"}t+="<div><div colspan=3 class=DevSt><span style=float:right>";t+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+l._id+'")>'+EscapeHtml(l.name)+"</span></div>";if(l.mtype==1){t+="<div style=padding:10px><i>No Intel&reg; AMT devices in this group"}if(l.mtype==2){t+="<div style=padding:10px><i>No devices in this group"}t+=".</i></div></div>";d=l._id;b++}}}}if(b==0){QH("xdevices",'<div style="margin-top:50px;text-align:center"><span style="font-size:30px">No devices</span><br /><br />Use the desktop version of this website to add devices.</div>')}else{QH("xdevices",t)}deviceHeaderSet();for(var j in deviceHeaders){QH(j,deviceHeaders[j])}for(var j in deviceHeadersTitles){Q(j).title=deviceHeadersTitles[j]}}var powerStatetable=["","Powered","Sleep","Sleep","Sleep","Hibernating","Power off","Present"];var powerStateStrings=["",'<span title="Device is powered on.">Powered</span>','<span title="Device is in sleep state (S1).">Sleeping</span>','<span title="Device is in sleep state (S2).">Sleeping</span>','<span title="Device is in deep sleep state (S3).">Deep Sleep</span>','<span title="Device is in hibernating state (S4).">Hibernating</span>','<span title="Device is in powered off state (S5).">Soft-Off</span>','<span title="Device is detected but power state could not be obtained.">Present</span>'];var powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"];var powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(a){var b=[];if(a.state>0&&a.state<powerStatetable.length){state.push(powerStatetable[a.state])}if(a.conn){if((a.conn&1)!=0){b.push('<span title="Mesh agent is connected and ready for use.">Agent</span>')}if((a.conn&2)!=0){b.push('<span title="Intel&reg; AMT CIRA is connected and ready for use.">CIRA</span>')}else{if((a.conn&4)!=0){b.push('<span title="Intel&reg; AMT is routable.">Intel&reg; AMT</span>')}}if((a.conn&8)!=0){b.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>')}if((a.conn&16)!=0){b.push('<span title="MQTT connection to the device is active.">MQTT</span>')}}if((a.pwr!=null)&&(a.pwr!=0)){b.push(powerStateStrings[a.pwr])}return b.join(", ")}function PowerStateStr(a){if(a<powerStatetable.length){return powerStatetable[a]}return""}function PowerStateStr2(a){if((a!=0)&&(a<powerStatetable.length)){return powerStatetable[a]}return"Unknown"}function onSortSelectChange(a){sort=document.getElementById("sortselect").selectedIndex;if(!a){putstore("sort",sort)}updateDevicesEx()}function deviceHeaderSet(){if(deviceHeaderId==0){deviceHeaderId=1;return}deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+((deviceHeaderTotal==1)?" node":" nodes");var a="";for(var b in deviceHeaderCount){if(a.length>0){a+=", "}a+=deviceHeaderCount[b]+" "+PowerStateStr2(b)}deviceHeadersTitles["DevxHeader"+deviceHeaderId]=a;deviceHeaderId++;deviceHeaderCount={};deviceHeaderTotal=0}function meshSort(c,d){if(c.meshnamel>d.meshnamel){return 1}if(c.meshnamel<d.meshnamel){return -1}if(c.meshid==d.meshid){if(showRealNames==true){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}else{if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}}return 0}function powerSort(c,e){var d=c.pwr?c.pwr:0;var f=e.pwr?e.pwr:0;if(d==f){if(showRealNames==true){if(c.rnamel>e.rnamel){return 1}if(c.rnamel<e.rnamel){return -1}return 0}else{if(c.namel>e.namel){return 1}if(c.namel<e.namel){return -1}return 0}}if(d>f){return 1}if(d<f){return -1}return 0}function deviceSort(c,d){if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}function deviceHostSort(c,d){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}function refreshDevice(a){if(!currentNode||currentNode._id!=a){return}gotoDevice(a,xxcurrentView,true)}function getNodeRights(c){var b=getNodeFromId(c),a=meshes[b.meshid];return a.links[userinfo._id].rights}var currentDevicePanel=0;var currentNode;var powerTimelineNode=null;var powerTimelineReq=null;var powerTimelineUpdate=null;var powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(m,n,q){if((userinfo.emailVerified!==true)&&(serverinfo.emailcheck==true)&&(userinfo.siteadmin!=4294967295)){setDialogMode(2,"Account Security",1,null,'Unable to access a device until a email address is verified. This is required for password recovery. Go to the "My Account" to change and verify an email address.');return}if((features&262144)&&!((userinfo.otpsecret==1)||(userinfo.otphkeys>0)||(userinfo.otpkeys>0))){setDialogMode(2,"Account Security",1,null,'Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the "My Account" and look at the "Account Security" section.');return}var l=getNodeFromId(m);if(l==null){goBack();return}var h=meshes[l.meshid];if(h==null){goBack();return}var j=h.links[userinfo._id].rights;if(!currentNode||currentNode._id!=l._id||q==true){currentNode=l;var k=EscapeHtml(l.name);if(k.length==0){k="<i>None</i>"}if((j&4)!=0){k="<span onclick=showEditNodeValueDialog(0) style=cursor:pointer>"+k+"</span>"}QH("p10deviceName",k);var t="<table style=width:100%>";t+=addDeviceAttribute('<span title="The name of the device group this computer belong to">Group</span>','<a title="The name of the device group this computer belong to" onclick=goForward("'+l.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[l.meshid].name)+"</a>");if(l.rname!=null){t+=addDeviceAttribute('<span title="The name of this computer as set in the operating system">Name</span>','<span title="The name of this computer as set in the operating system">'+EscapeHtml(l.rname)+"</span>")}if((h.mtype==1)||(l.name!=l.host)){if((j&4)!=0){if(l.host){t+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(l.host)+"</span>")}else{t+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>")}}else{t+=addDeviceAttribute("Hostname",EscapeHtml(l.host))}}var d=l.desc?EscapeHtml(l.desc):"<i>None</i>";if((j&4)!=0){t+=addDeviceAttribute("Description","<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+d+"</span>")}else{t+=addDeviceAttribute("Description",d)}var a=["Unknown","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","MacOS 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","MacOS 64bit","ChromeOS","Linux Poky x86-64bit","Linux NoKVM x86-32bit","Linux NoKVM x86-64bit","Windows MinCore console","Windows MinCore service","NodeJS","ARM-Linaro","ARMv6l / ARMv7l","ARMv8 64bit","ARMv6l / ARMv7l / NoKVM","Unknown","Unknown","FreeBSD x86-64"];if((l.agent!=null)&&(l.agent.id!=null)&&(l.agent.ver!=null)){var r="";if(l.agent.id<=a.length){r=a[l.agent.id]}else{r=a[0]}if(l.agent.ver!=0){r+=" v"+l.agent.ver}t+=addDeviceAttribute("Agent",r)}if(l.intelamt!=null){var r="";var p={0:"Not&nbsp;Activated&nbsp;(Pre)",1:"Not&nbsp;Activated&nbsp;(In)",2:"Activated"};if(l.intelamt.ver!=null&&l.intelamt.state==null){r+="<i>Unknown&nbsp;State</i>, v"+l.intelamt.ver}else{if((l.intelamt.ver==null)&&(l.intelamt.state==2)){r+="<i>Activated</i>"}else{if((l.intelamt.ver==null)||(l.intelamt.state==null)){r+="<i>Unknown Version & State</i>"}else{r+=p[l.intelamt.state];if(l.intelamt.flags){if(l.intelamt.flags&2){r=' <span title="Intel AMT is activated in Client Control Mode">CCM</span>'}else{if(l.intelamt.flags&4){r=' <span title="Intel AMT is activated in Admin Control Mode">ACM</span>'}}}r+=(", v"+l.intelamt.ver)}}}if(l.intelamt.tls==1){r+=', <span title="Intel AMT is setup with TLS network security">TLS</span>'}if(l.intelamt.state==2){if(l.intelamt.user==null||l.intelamt.user==""){if((j&4)!=0){r+=', <i style=color:#FF0000;cursor:pointer title="Edit Intel&reg; AMT credentials" onclick=editDeviceAmtSettings("'+l._id+'")>No&nbsp;Credentials</i>'}else{r+=", <i style=color:#FF0000>No Credentials</i>"}}r+=" ";if((j&4)!=0){r+='<img src=images/link4.png height=10 width=10 title="Edit Intel&reg; AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("'+l._id+'")>'}}var g="Intel&reg; ME";if(typeof l.intelamt.sku=="number"){if((l.intelamt.sku&8)!=0){g="Intel&reg; AMT"}else{if((l.intelamt.sku&16)!=0){g="Intel&reg; SM"}}}t+=addDeviceAttribute(g,r)}if((l.agent!=null)&&(l.agent.tag!=null)&&(l.agent.tag!="mailto:")){var s=EscapeHtml(l.agent.tag);if(s.startsWith("mailto:")){s='<a href="'+s+'">'+s.substring(7)+"</a>"}t+=addDeviceAttribute("Agent Tag",s)}var b=l.conn;if(b&&b>1){var c=[];if((l.conn&1)!=0){c.push('<span title="Software agent is connected and ready for use.">Agent</span>')}if((l.conn&2)!=0){c.push('<span title="Intel&reg; AMT CIRA is connected and ready for use.">Intel&reg; AMT CIRA</span>')}else{if((l.conn&4)!=0){c.push('<span title="Intel&reg; AMT is routable and ready for use.">Intel&reg; AMT</span>')}}if((l.conn&8)!=0){c.push('<span title="Software agent is reachable using another agent as relay.">Agent Relay</span>')}if((l.conn&16)!=0){c.push('<span title="MQTT connection to the device is active.">MQTT</span>')}t+=addDeviceAttribute("Connectivity",c.join(", "))}var e="<i>None</i>";if(l.tags!=null){e="";for(var f in l.tags){e+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+l.tags[f]+"</span>"}}if((j&4)!=0){t+=addDeviceAttribute("Tags","<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+e+"</span>")}else{t+=addDeviceAttribute("Tags",e)}t+="</table><br />";if((j&76)!=0){t+='<input type=button value=Actions title="Perform power actions on the device" onclick=deviceActionFunction() />'}QH("p10html",t);setupFiles();t="<div style=float:right;font-size:x-small;margin-right:10px>";if((j&4)!=0){t+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+l._id+'") title="Remove this device">Delete Device</a>'}t+="</div><div style=font-size:x-small>";t+="</div><br>";QH("p10html3",t);var o=PowerStateStr(l.state);if((b&1)!=0){if(o.length>0){o+=", "}o+='<span style=font-size:10px title="Agent connected">Mesh Agent</span>'}if((b&2)!=0){if(o.length>0){o+=", "}o+='<span style=font-size:10px title="Intel&reg; AMT connected">Intel&reg; AMT connected</span>'}else{if((b&4)!=0){if(o.length>0){o+=", "}o+='<span style=font-size:10px title="Intel&reg; AMT detected">Intel&reg; AMT detected</span>'}}if((b&16)!=0){if(o.length>0){o+="<br/>"}o+='<span style=font-size:12px title="MQTT connected">MQTT channel connected</span>'}QH("MainComputerState",o);QH("MainComputerImage",'<div class="i'+l.icon+'"></div>');if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}setupDesktop();if(!n){n=10}go(n);setupDeviceMenu()}function deviceToastFunction(){if(xxdialogMode){return}setDialogMode(2,"Device Toast",3,deviceToastFunctionEx,"<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function setupDeviceMenu(d,c){var b=0;if(currentNode){b=meshes[currentNode.meshid].links[userinfo._id].rights}if(d!=null){currentDevicePanel=d}QV("p10general",currentDevicePanel==0);QV("p10desktop",currentDevicePanel==1);QV("p10files",currentDevicePanel==2);var a=[];if(currentDevicePanel!=0){a.push({n:"General",f:"setupDeviceMenu(0)"})}if((currentDevicePanel!=1)&&(currentNode!=null)&&((b&8)||(b&256))&&(((meshes[currentNode.meshid].mtype==1)&&((typeof currentNode.intelamt.sku!=="number")||((currentNode.intelamt.sku&8)!=0)))||(currentNode.agent&&(currentNode.agent.caps&1)))){a.push({n:"Desktop",f:"setupDeviceMenu(1)"})}if((currentDevicePanel!=2)&&(currentNode!=null)&&(b&8)&&((b==4294967295)||((b&1024)==0))&&((currentNode.mtype==2)&&(currentNode.agent.caps&4))){a.push({n:"Files",f:"setupDeviceMenu(2)"})}updateFooterMenu(a)}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links[userinfo._id].rights;var b="Select an operation to perform on this device.<br /><br />";var c="<select id=d2deviceop style=float:right;width:170px>";if((a&64)!=0){c+="<option value=100>Wake-up</option>"}if((a&8)!=0){c+="<option value=4>Sleep</option><option value=3>Reset</option><option value=2>Power off</option>"}c+="</select>";b+=addHtmlValue("Operation",c);setDialogMode(2,"Device Action",3,deviceActionFunctionEx,b)}function deviceActionFunctionEx(){var a=Q("d2deviceop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:[currentNode._id]})}else{meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:a})}}function updateDeviceTimeline(){if((meshserver.State!=2)||(powerTimelineNode==null)||(powerTimelineUpdate==null)||(currentNode==null)){return}if((powerTimelineNode==powerTimelineReq)&&(currentNode._id==powerTimelineNode)&&(powerTimelineUpdate<Date.now())){powerTimelineUpdate=null;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}function drawDeviceTimeline(){var r=null,n=Date.now();if(currentNode._id==powerTimelineNode){r=powerTimeline}var e=new Date();e.setHours(0,0,0,0);e=new Date(e.getTime()-(1000*60*60*24*6));var t=e.getTime();var s=[];if(r!=null&&r.length>1){s.push([0,r[1],r[0]]);var c=r[1];for(var l=2;l<r.length;l+=2){var o=r[l],h=n;if(r.length>(l+1)){h=r[l+1]}s.push([c,c+h,o]);c=c+h}}var z="",b=1,g=new Date();var v=Q("masthead").offsetWidth-(90+9+9+14);g.setHours(0,0,0,0);for(var l=0;l<7;l++){var f="",p=g.getTime(),k=p+(1000*60*60*24);for(var m in s){var a=s[m];if(isTimeBlockInside(p,k,a[0],a[1])==true){var w=Math.max(p,a[0]);var q=Math.min(Math.min(k,a[1]),n);var y=Math.round(((q-w)*v)/86400000);if(y>0){var u=powerStateStrings2[a[2]]+" from "+printTime(new Date(w))+" to "+printTime(new Date(q))+".";f+='<div title="'+u+'" style=display:table-cell;width:'+y+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}z+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div>&nbsp;"+printDate(g)+"<div></div></div></td><td><div>"+f+"</div></td></tr>";++b;g=new Date(g.getTime()-(1000*60*60*24))}QH("p10html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse;width:calc(100% - 18px);margin:9px" border=0 cellpadding=2 cellspacing=0><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:90px>Day</th><th scope=col style=text-align:center>Power State</th></tr>'+z+"</tbody></table>")}function powerColor(a){if(a<powerColorTable.length){return powerColorTable[a]}return"yellow"}function isTimeBlockInside(d,c,b,a){if((b<d)&&(a>c)){return true}if((b>d)&&(b<c)){return true}if((a>d)&&(a<c)){return true}return false}function addDeviceAttribute(a,b){return"<tr><td style=width:100px;color:gray>"+a+"</td><td style=overflow:hidden>"+b+"</td></tr>"}function editDeviceAmtSettings(e,b){if(xxdialogMode){return}var f="",d=getNodeFromId(e),a=3,c=getNodeRights(e);if((c&4)==0){return}f+=addHtmlValue("Username",'<input id=dp10username style=width:170px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');f+=addHtmlValue("Password","<input id=dp10password type=password style=width:170px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />");f+=addHtmlValue("Security","<select id=dp10tls style=width:176px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");if((d.intelamt.user!=null)&&(d.intelamt.user!="")){a=7}setDialogMode(2,"Edit Intel&reg; AMT credentials",a,editDeviceAmtSettingsEx,f,{node:d,func:b});if((d.intelamt.user!=null)&&(d.intelamt.user!="")){Q("dp10username").value=d.intelamt.user}else{Q("dp10username").value="admin"}Q("dp10tls").value=d.intelamt.tls;validateDeviceAmtSettings()}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(c,d){if(c==2){meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:"",pass:""}})}else{var b=Q("dp10username").value;if(b==""){b="admin"}var a=Q("dp10password").value;if(a==""){b=""}meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:b,pass:a,tls:Q("dp10tls").value}});d.node.intelamt.user=b;d.node.intelamt.tls=Q("dp10tls").value;if(d.func){setTimeout(d.func,300)}}}function p10showDeleteNodeDialog(a){if(xxdialogMode){return}setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,'Delete "'+EscapeHtml(currentNode.name)+'"?<br /><br /><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm',a);p10validateDeleteNodeDialog()}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(a,b){meshserver.send({action:"removedevices",nodeids:[b]})}function p10showiconselector(){if(xxdialogMode){return}var a=meshes[currentNode.meshid];var b=a.links[userinfo._id].rights;if((b&4)==0){return}var c="<table align=center><td>";c+="<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>";c+="<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>";c+="<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div><br>";c+="<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>";c+="<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>";c+="<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div></table>";setDialogMode(2,"Icon Selection",0,null,c);QV("id_dialogclose",true)}function p10setIcon(a){setDialogMode(0);meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:a})}var showEditNodeValueDialog_modes=["Device Name","Hostname","Description","Tags"];var showEditNodeValueDialog_modes2=["name","host","desc","tags"];var showEditNodeValueDialog_modes3=["","","","Group1, Group2, Group3"];function showEditNodeValueDialog(a){if(xxdialogMode){return}var c=addHtmlValue(showEditNodeValueDialog_modes[a],'<input id=dp10devicevalue style=width:170px maxlength=64 placeholder="'+showEditNodeValueDialog_modes3[a]+'" onchange=p10editdevicevalueValidate('+a+",event) onkeyup=p10editdevicevalueValidate("+a+",event) />");setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,c,a);var b=currentNode[showEditNodeValueDialog_modes2[a]];if(b==null){b=""}if(Array.isArray(b)){b=b.join(", ")}Q("dp10devicevalue").value=b;p10editdevicevalueValidate();Q("dp10devicevalue").focus()}function showEditNodeValueDialogEx(a,b){var c={action:"changedevice",nodeid:currentNode._id};c[showEditNodeValueDialog_modes2[b]]=Q("dp10devicevalue").value;meshserver.send(c)}function p10editdevicevalueValidate(b,a){var c=((b>1)||(Q("dp10devicevalue").value.length>0));QE("idx_dlgOkButton",c);if((a!=null)&&(c==true)&&(a.keyCode==13)){dialogclose(1)}}var desktop;var desktopNode;var desktopsettings={encoding:2,showfocus:false,showmouse:true,showcad:true,quality:40,scaling:1024,framerate:50};function setupDesktop(){if((desktopNode!=currentNode)&&(desktop!=null)){desktop.Stop();desktopNode=null;desktop=null}if((desktopNode!=currentNode)||(desktop==null)){QH("DeskParent",'<canvas id=Desk width=640 height=200 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');desktopNode=currentNode;Q("Desk").addEventListener("DOMMouseScroll",function(a){return dmousewheel(a)});Q("Desk").addEventListener("mousewheel",function(a){return dmousewheel(a)})}desktopNode=currentNode;updateDesktopButtons();if(!Q("Desk")["toBlob"]){QV("deskSaveBtn",false)}}function updateDesktopButtons(){var c=meshes[currentNode.meshid];var a=0;if(desktop!=null){a=desktop.State}var d=c.links[userinfo._id].rights;QV("disconnectbutton1",(a!=0));QV("connectbutton1",(a==0)&&(c.mtype==2)&&((d&8)||(d&256)));QV("connectbutton1h",(a==0)&&(d&8)&&((c.mtype==1)||(currentNode.intelamt!=null)&&((currentNode.intelamt.state==2)&&(currentNode.intelamt.ver!=null)&&(typeof currentNode.intelamt.sku=="number")&&((currentNode.intelamt.sku&8)!=0))));QV("d7amtkvm",(currentNode.intelamt!=null&&((currentNode.intelamt.ver!=null)||(c.mtype==1)))&&((a==0)||(desktop.contype==2)));QV("d7meshkvm",(c.mtype==2)&&((a==false)||(desktop.contype==1)));var e=((currentNode.conn&1)!=0);QE("connectbutton1",e);var b=((currentNode.conn&6)!=0);QE("connectbutton1h",b);QV("DeskToastButton",((d&16384)!=0)&&(currentNode.agent)&&(currentNode.agent.id<5)&&(d&8));QV("deskActionsBtn",d&8);Q("DeskControl").checked=((d&8)!=0);if(e==false){QV("DeskTools",false)}}function connectDesktop(b,a){setSessionActivity();if(desktop==null){desktopNode=currentNode;if(a==2){if((desktopNode.intelamt.user==null)||(desktopNode.intelamt.user=="")){editDeviceAmtSettings(desktopNode._id,connectDesktop);return}desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"),authCookie);desktop.debugmode=debugmode;desktop.onStateChanged=onDesktopStateChange;desktop.m.bpp=(desktopsettings.encoding==1||desktopsettings.encoding==3)?1:2;desktop.m.useZRLE=(desktopsettings.encoding<3);desktop.m.showmouse=desktopsettings.showmouse;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id,16994,"*","*",0);desktop.contype=2}else{desktop=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("Desk"),serverPublicNamePort,authCookie,authRelayCookie,domainUrl);desktop.debugmode=debugmode;desktop.m.debugmode=debugmode;desktop.attemptWebRTC=attemptWebRTC;desktop.onStateChanged=onDesktopStateChange;desktop.m.CompressionLevel=desktopsettings.quality;desktop.m.ScalingLevel=desktopsettings.scaling;desktop.m.FrameRateTimer=desktopsettings.framerate;desktop.m.onDisplayinfo=deskDisplayInfo;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id);desktop.contype=1}}else{desktop.Stop();desktopNode=desktop=null}}function onDesktopStateChange(c,a){var d=a;if((d==3)&&(c.contype==2)){d++}var b=StatusStrs[d];if((desktop!=null)&&(desktop.webRtcActive==true)){b+=", WebRTC"}QH("deskstatus",b);switch(a){case 0:desktop.Stop();desktopNode=desktop=null;QV("termdisplays",false);if(fullscreen==true){deskToggleFull()}break;case 2:break;default:break}updateDesktopButtons();deskAdjust();setTimeout(deskAdjust,50)}function showDesktopSettings(){if(xxdialogMode){return}applyDesktopSettings();updateDesktopButtons();setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged)}function showDesktopSettingsChanged(){desktopsettings.encoding=d7desktopmode.value;desktopsettings.showfocus=d7showfocus.checked;desktopsettings.showmouse=d7showcursor.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;desktopsettings.framerate=d7framelimiter.value;localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings));applyDesktopSettings();if(desktop){if(desktop.contype==1){if(desktop.State!=0){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}}if(desktop.contype==2){if(desktop.State!=0){desktop.Stop();setTimeout(function(){connectDesktop(null,2)},50)}}}}function applyDesktopSettings(){var c="",b=(features&512)?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1];for(var a in b){c+="<option value="+b[a]+">"+b[a]+"%</option>"}QH("d7bitmapquality",c);d7desktopmode.value=desktopsettings.encoding;d7showfocus.checked=desktopsettings.showfocus;d7showcursor.checked=desktopsettings.showmouse;d7bitmapquality.value=40;if(b.indexOf(parseInt(desktopsettings.quality))>=0){d7bitmapquality.value=desktopsettings.quality}d7bitmapscaling.value=desktopsettings.scaling;if(desktopsettings.framerate){d7framelimiter.value=desktopsettings.framerate}}var fullscreen=false;function deskAdjust(){var c=(Q("DeskParent").clientHeight-Q("Desk").clientHeight)/2;if(c<0){var a=Q("DeskParent").clientHeight,b=9999;if(desktop){b=(desktop.m.width/desktop.m.height)*a}QS("Desk")["max-height"]=a+"px";QS("Desk")["max-width"]=b+"px";c=0}else{QS("Desk")["max-height"]=null;QS("Desk")["max-width"]=null}QS("Desk")["margin-top"]=c+"px";QS("Desk")["margin-bottom"]=c+"px"}function deskSendKeys(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=Q("deskkeys").value;if(a==0){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65364,1],[65364,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==1){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65362,1],[65362,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==2){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[108,1],[108,0],[65511,0]])}else{desktop.sendCtrlMsg('{"action":"lock"}')}}else{if(a==3){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[109,1],[109,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==4){if(desktop.contype==2){desktop.m.sendkey([[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91],[desktop.m.KeyAction.UP,16]])}}else{if(a==5){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==6){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[114,1],[114,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,82],[desktop.m.KeyAction.UP,82],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==7){if(desktop.contype==2){desktop.m.sendkey([[65513,1],[65473,1],[65473,0],[65513,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,18],[desktop.m.KeyAction.DOWN,115],[desktop.m.KeyAction.UP,115],[desktop.m.KeyAction.EXUP,18]])}}else{if(a==8){if(desktop.contype==2){desktop.m.sendkey([[65507,1],[119,1],[119,0],[65507,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,17],[desktop.m.KeyAction.DOWN,87],[desktop.m.KeyAction.UP,87],[desktop.m.KeyAction.EXUP,17]])}}else{if(a==9){if(desktop.contype==2){desktop.m.sendkey([[65513,1],[65289,1],[65289,0],[65513,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,18],[desktop.m.KeyAction.DOWN,9],[desktop.m.KeyAction.UP,9],[desktop.m.KeyAction.EXUP,18]])}}else{if(a==10){desktop.m.sendcad()}else{if(a==11){if(desktop.contype==2){desktop.m.sendkey([[65289,1],[65289,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,9],[desktop.m.KeyAction.UP,9]])}}}}}}}}}}}}}}function sendSpecialKeys(){if(xxdialogMode||desktop==null||desktop.State!=3){return}setDialogMode(3,"Special Keys",3,deskSendKeys)}function toggleSoftKeys(a){QV("DeskSoftInput",a==1);if(a==1){Q("DeskSoftInput").focus()}}function toggleDeskTools(){setSessionActivity();if(xxdialogMode){return}if(QS("DeskTools").display=="none"){QV("DeskTools",true);Q("DeskTools").nodeid=currentNode._id;refreshDeskTools()}else{QV("DeskTools",false)}}function refreshDeskTools(){setSessionActivity();QV("DeskToolsRefreshButton",false);setTimeout(refreshDeskToolsEx,500);meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",true)}var deskTools={sort:1,msg:null};function sortProcess(a){deskTools.sort=a;showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(c,d){if(c.p>d.p){return 1}if(c.p<d.p){return(-1)}return 0}function sortProcessName(c,d){if(c.d>d.d){return 1}if(c.d<d.d){return(-1)}return 0}function showDeskToolsProcesses(c){deskTools.msg=c;if(c==null){QH("DeskToolsProcesses","");return}if(Q("DeskTools").nodeid!=c.nodeid){return}var d=[],g=null;try{g=JSON.parse(c.value)}catch(a){}console.log(g);if(g!=null){for(var f in g){d.push({p:parseInt(f),c:g[f].cmd,d:g[f].cmd.toLowerCase(),u:g[f].user})}if(deskTools.sort==0){d.sort(sortProcessPid)}else{if(deskTools.sort==1){d.sort(sortProcessName)}}var h="";for(var b in d){if(d[b].p!=0){h+="<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>"+d[b].p+'</div><a style=float:right;padding-right:5px;cursor:pointer title="Stop process" onclick=stopProcess('+d[b].p+',"'+d[b].c+'")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>'+(d[b].u?d[b].u:"")+"</div><div>"+d[b].c+"</div></div>"}}QH("DeskToolsProcesses",h)}}function deskSaveImage(){setSessionActivity();if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=new Date(),b="Desktop-"+currentNode.name+"-"+a.getFullYear()+"-"+("0"+(a.getMonth()+1)).slice(-2)+"-"+("0"+a.getDate()).slice(-2)+"-"+("0"+a.getHours()).slice(-2)+"-"+("0"+a.getMinutes()).slice(-2);Q("Desk")["toBlob"](function(c){saveAs(c,b+".jpg")})}function deskDisplayInfo(e,a,c,d){var f=Q("termdisplays").value;if(a.length>0){var b="";for(var g in a){b+="<option"+((f==a[g])?" selected":"")+">"+a[g]+"</option>"}QH("termdisplays",b)}QV("termdisplays",a.length>0)}function deskGetDisplayNumbers(a){desktop.m.GetDisplayNumbers()}function deskSetDisplay(b){setSessionActivity();var a=0,c=Q("termdisplays").value;if(c=="All Displays"){a=65535}else{a=parseInt(c.substring(8))}desktop.m.SetDisplay(a)}function dmousedown(a){setSessionActivity();if((!xxdialogMode&&desktop!=null)){desktop.m.mousedown(a)}}function dmouseup(a){setSessionActivity();if((!xxdialogMode&&desktop!=null)){desktop.m.mouseup(a)}}function dmousemove(a){setSessionActivity();if((!xxdialogMode&&desktop!=null)){desktop.m.mousemove(a)}}function dmousewheel(a){setSessionActivity();if((!xxdialogMode&&desktop!=null)&&desktop.m.mousewheel){desktop.m.mousewheel(a);haltEvent(a);return true}return false}function drotate(a){if(!xxdialogMode&&desktop!=null){desktop.m.setRotation(desktop.m.rotation+a);deskAdjust();deskAdjust()}}function stopProcess(a,b){setDialogMode(2,"Process Control",3,stopProcessEx,"Stop process #"+a+' "'+b+'"?',a)}function stopProcessEx(a,b){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:b});setTimeout(refreshDeskTools,300)}var filesNode;function setupFiles(){var b=(filesNode==currentNode);filesNode=currentNode;var a=((filesNode.conn&1)!=0)?true:false;QE("p13Connect",a);if(((b==false)||(a==false))&&files){files.Stop();files=null}}function onFilesStateChange(c,a){setSessionActivity();p13Connect.value=(a==0)?"Connect":"Disconnect";var b=StatusStrs[a];if(files.webRtcActive==true){b+=", WebRTC"}Q("p13Status").textContent=b;switch(a){case 0:QH("p13files","");p13filetree=null;p13filetreelocation=[];QH("p13currentpath","");QE("p13FolderUp",false);p13setActions();if(files!=null){files.Stop();files=null}break;case 3:p13targetpath="";files.sendText({action:"ls",reqid:1,path:""});break;default:break}}function CreateRemoteFiles(b){var a={protocol:5};a.onFileUpdate=b;a.xxStateChange=function(c){};a.ProcessData=function(c){a.onFileUpdate(c)};return a}var autoConnectFilesTimer=null;function autoConnectFiles(a){if(autoConnectFilesTimer==null){autoConnectFilesTimer=setInterval(connectFiles,100)}else{clearInterval(autoConnectFilesTimer);autoConnectFilesTimer=null}}function connectFiles(a){if(!files){files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort,authCookie,authRelayCookie,domainUrl);files.attemptWebRTC=attemptWebRTC;files.onStateChanged=onFilesStateChange;files.Start(filesNode._id)}else{files.Stop();files=null}p13clipboard=p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}var p13filetree=null;var p13targetpath=null;var p13filetreelocation=[];function p13gotFiles(b){setSessionActivity();if((b.length>0)&&(b.charCodeAt(0)!=123)){p13gotDownloadBinaryData(b);return}b=JSON.parse(decode_utf8(b));if(b.action=="download"){p13gotDownloadCommand(b);return}b.path=b.path.replace(/\//g,"\\");if((p13filetree!=null)&&(b.path==p13filetree.path)){var a=p13getCheckedNames();p13filetree=b;p13updateFiles(a)}else{var c=b.path.replace(/\//g,"\\"),d=p13targetpath.replace(/\//g,"\\");while((c.length>0)&&(c[0]=="\\")){c=c.substring(1)}while((d.length>0)&&(d[0]=="\\")){d=d.substring(1)}if((c==d)||((b.path=="\\")&&(p13targetpath==""))){p13filetree=b;p13updateFiles()}}}function p13getCheckedNames(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}return b}function p13updateFiles(b){var l="",m="",c="<a style=cursor:pointer onclick=p13folderup(0)>Root</a>",j="Root";var u=p13filetree.path.split("\\");p13filetreelocation=[];for(var n in u){if(u[n]!=""){p13filetreelocation.push(u[n])}}for(var n in p13filetreelocation){c+=" / <a style=cursor:pointer onclick=p13folderup("+(parseInt(n)+1)+")>"+p13filetreelocation[n]+"</a>"}var q=p13filetreelocation.join("/");var e=p13sort_files(p13filetree.dir);for(var n in e){var d=e[n],p=d.n,s;s=p;if(p.length>70){s='<span title="'+EscapeHtml(p)+'">'+EscapeHtml(p.substring(0,70))+"...</span>"}else{s=EscapeHtml(p)}p=EscapeHtml(p);var g="";if(d.s!=null){g=getFileSizeStr(d.s)}var k="";if(d.t<3){var r="",t="";k="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span style=float:right title=\""+t+'">'+r+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p13folderset("'+encodeURIComponent(d.nx)+'")>'+s+"</a></span></div>"}else{var o=s;if(d.s>0){o='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick="p13downloadfile(\''+encodeURIComponent(q+"/"+p)+"','"+encodeURIComponent(p)+"',"+d.s+')">'+s+"</a>"}k="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span style=float:right;padding-right:4px>"+g+"</span><span><div class=fileIcon"+d.t+"></div>"+o+"</span></div>"}if(d.t<3){l+=k}else{m+=k}}QH("p13files",l+m);QH("p13currentpath",c);QE("p13FolderUp",p13filetreelocation.length!=0);if(b!=null){var a=document.getElementsByName("fd");for(var n=0;n<a.length;n++){if(b.indexOf(p13filetree.dir[a[n].value].n)>=0){a[n].checked=true}}}p13setActions()}function p13folderset(a){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[a].n).split("\\").join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(a){if(a==null){p13filetreelocation.pop()}else{while(p13filetreelocation.length>a){p13filetreelocation.pop()}}p13targetpath=p13filetreelocation.join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}var p13sortorder;function p13sort_filename(c,d){if(c.ln>d.ln){return(1*p13sortorder)}if(c.ln<d.ln){return(-1*p13sortorder)}return 0}function p13sort_timestamp(c,d){if(c.d>d.d){return(1*p13sortorder)}if(c.d<d.d){return(-1*p13sortorder)}return 0}function p13sort_bysize(c,d){if(c.s==d.s){return p13sort_filename(c,d)}return(((c.s-d.s))*p13sortorder)}function p13sort_files(a){var c=[],d=Q("p13sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].s==null){a[b].s=0}if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}p13sortorder=1;if(d>3){p13sortorder=-1;d-=3}if(d==1){c.sort(p13sort_filename)}else{if(d==2){c.sort(p13sort_bysize)}else{if(d==3){c.sort(p13sort_timestamp)}}}return c}function p13setActions(){if(p13filetree==null){QE("p13DeleteFileButton",false);QE("p13NewFolderButton",false);QE("p13UploadButton",false);QE("p13RenameFileButton",false);QE("p13SelectAllButton",false);Q("p13SelectAllButton").value="All";QE("p13RefreshButton",false);QE("p13CutButton",false);QE("p13CopyButton",false);QE("p13PasteButton",false)}else{var a=p13getFileSelCount(),c=p13getFileCount(),b=p13getFileSelCount(false);var d=((currentNode.agent.id>0)&&(currentNode.agent.id<5));QE("p13DeleteFileButton",(a>0)&&((p13filetreelocation.length>0)||(d==false)));QE("p13NewFolderButton",((p13filetreelocation.length>0)||(d==false)));QE("p13UploadButton",((p13filetreelocation.length>0)||(d==false)));QE("p13RenameFileButton",(a==1)&&((p13filetreelocation.length>0)||(d==false)));QE("p13SelectAllButton",c>0);Q("p13SelectAllButton").value=(a>0?"None":"All");QE("p13RefreshButton",true);QE("p13CutButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13CopyButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13PasteButton",((p13filetreelocation.length>0)||(d==false))&&((p13clipboard!=null)&&(p13clipboard.length>0)))}}function p13getFileSelCount(d){var a=0;var b=document.getElementsByName("fd");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function p13getFileCount(){var a=0;var b=document.getElementsByName("fd");return b.length}function p13selectallfile(){var c=(p13getFileSelCount()==0),a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){a[b].checked=c}p13setActions()}function p13createfolder(){setDialogMode(2,"New Folder",3,p13createfolderEx,"<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />");focusTextBox("p13renameinput");p13fileNameCheck()}function p13createfolderEx(){files.sendText({action:"mkdir",reqid:1,path:p13filetreelocation.join("/")+"/"+Q("p13renameinput").value});p13folderup(999)}function p13deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p13deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p13deletefileEx(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}files.sendText({action:"rm",reqid:1,path:p13filetreelocation.join("/"),delfiles:b});p13folderup(999)}function p13renamefile(){var c,a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){if(a[b].checked){c=p13filetree.dir[a[b].value].n}}setDialogMode(2,"Rename",3,p13renamefileEx,'<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"rename",path:p13filetreelocation.join("/"),oldname:c});focusTextBox("p13renameinput");p13fileNameCheck()}function p13renamefileEx(a,c){c.newname=Q("p13renameinput").value;files.sendText(c);p13folderup(999)}function p13fileNameCheck(a){var b=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function p13uploadFile(){setDialogMode(2,"Upload File",3,p13uploadFileEx,"<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p13uploadinput')\" />");updateUploadDialogOk("p13uploadinput")}function p13uploadFileEx(){p13doUploadFiles(Q("p13uploadinput").files)}var p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(b){var a=document.getElementsByName("fd");p13clipboard=[];p13clipboardCut=b,p13clipboardFolder=p13targetpath;for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p13clipboard.push(p13filetree.dir[a[c].value].n)}}p13updateClipview()}function p13pasteFile(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Confim "+(p13clipboardCut==0?"copy":"move")+" of "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p13pasteFileEx,a)}function p13pasteFileEx(){files.sendText({action:(p13clipboardCut==0?"copy":"move"),reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard});p13folderup(999);if(p13clipboardCut==1){p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;p13updateClipview()}}function p13updateClipview(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Holding "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" for "+(p13clipboardCut==0?"copy":"move")+", <a onclick=p13clearClip() style=cursor:pointer>Clear</a>."}QH("p13bottomstatus",a);p13setActions()}function p13clearClip(){p13clipboard=null;p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}var downloadFile;function p13downloadfile(a,b,c){if(xxdialogMode||downloadFile||!files){return}downloadFile={path:decodeURIComponent(a),file:decodeURIComponent(b),size:c,tsize:0,data:"",state:0,id:Math.random()};files.sendText({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path});setDialogMode(2,"Download File",10,p13downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+c+" />")}function p13downloadFileCancel(){setDialogMode(0);files.sendText({action:"download",sub:"cancel",id:downloadFile.id});downloadFile=null}function p13gotDownloadCommand(a){if((downloadFile==null)||(a.id!=downloadFile.id)){return}if(a.sub=="start"){downloadFile.state=1;files.sendText({action:"download",sub:"startack",id:downloadFile.id})}else{if(a.sub=="cancel"){downloadFile=null;setDialogMode(0)}}}function p13gotDownloadBinaryData(a){if(!downloadFile||downloadFile.state==0){return}if(a.length>4){downloadFile.tsize+=(a.length-4);downloadFile.data+=a.substring(4);Q("d2progressBar").value=downloadFile.tsize}if((ReadInt(a,0)&1)!=0){saveAs(data2blob(downloadFile.data),downloadFile.file);downloadFile=null;setDialogMode(0)}else{files.sendText({action:"download",sub:"ack",id:downloadFile.id})}}var uploadFile;function p13doUploadFiles(a){if(xxdialogMode){return}uploadFile={};uploadFile.xpath=p13filetreelocation.join("/");uploadFile.xfiles=a;uploadFile.xfilePtr=-1;setDialogMode(2,"Upload File",10,p13uploadFileCancel,"<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />");p13uploadReconnect()}function onFileUploadStateChange(b,a){switch(a){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break;default:console.log("Unknown onFileUploadStateChange state",a);break}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort,authCookie,authRelayCookie,domainUrl);uploadFile.ws.attemptWebRTC=false;uploadFile.ws.ctrlMsgAllowed=false;uploadFile.ws.onStateChanged=onFileUploadStateChange;uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){uploadFile.xfilePtr++;if(uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var a=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",a.name);Q("d2progressBar").max=a.size;Q("d2progressBar").value=0;uploadFile.xreader=new FileReader();uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result;uploadFile.ws.sendText({action:"upload",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:a.name,size:uploadFile.xdata.byteLength})};uploadFile.xreader.readAsArrayBuffer(a)}else{p13uploadFileCancel()}}function p13uploadFileCancel(a,b){if(uploadFile!=null){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}uploadFile=null}setDialogMode(0)}function p13gotUploadData(b){var a=JSON.parse(b);if((uploadFile==null)||(parseInt(uploadFile.xfilePtr)!=parseInt(a.reqid))){return}if(a.action=="uploadstart"){p13uploadNextPart(false);for(var c=0;c<8;c++){p13uploadNextPart(true)}}else{if(a.action=="uploadack"){p13uploadNextPart(false)}else{if(a.action=="uploaderror"){p13uploadFileCancel()}}}}function p13uploadNextPart(c){var a=uploadFile.xdata;var e=uploadFile.xptr;var d=uploadFile.xptr+4096;if(d>a.byteLength){if(c==true){return}d=a.byteLength}if(e==a.byteLength){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}if(uploadFile.xfiles.length>uploadFile.xfilePtr+1){p13uploadReconnect()}else{p13uploadFileCancel()}}else{var b=a.slice(e,d);uploadFile.ws.send(b);uploadFile.xptr=d;Q("d2progressBar").value=d}}var currentMesh;function p20updateMesh(){if(currentMesh==null){return}QH("p20meshName",EscapeHtml(currentMesh.name));var e="Unknown #"+currentMesh.mtype;var d=currentMesh.links[userinfo._id].rights;if(currentMesh.mtype==1){e="Intel&reg; AMT group"}if(currentMesh.mtype==2){e="Software agent group"}var k="";k+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",(d&1)!=0));k+=addHtmlValue("Description",addLinkConditional(((currentMesh.desc&&currentMesh.desc!="")?EscapeHtml(currentMesh.desc):"<i>None</i>"),"p20editmesh(2)",(d&1)!=0));k+=addHtmlValue("Type",e);k+="<br style=clear:both><br>";var b=currentMesh.links[userinfo._id];if(b&&((b.rights&2)!=0)){k+="<div style=margin-bottom:6px><a onclick=p20showAddMeshUserDialog() style=cursor:pointer><img src=images/icon-addnew.png border=0 height=12 width=12> Add User</a></div>"}k+='<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>User Authorizations</th></tr>';var a=1,h=[];for(var c in currentMesh.links){h.push({id:c,name:c.split("/")[2],rights:currentMesh.links[c].rights})}h.sort(function(l,m){if(l.name>m.name){return 1}if(l.name<m.name){return -1}return 0});for(var c in h){var j="",g="Partial&nbsp;Rights",f=h[c].rights;if(f==4294967295){g="Full&nbsp;Administrator"}else{if(f==0){g="No&nbsp;Rights"}}if((c!=userinfo._id)&&(d==4294967295||(((d&2)!=0)))){j='<a onclick=p20deleteUser(event,"'+encodeURIComponent(h[c].id)+'") title="Remote user rights to this mesh" style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'}k+='<tr onclick=p20viewuser("'+encodeURIComponent(h[c].id)+'") style=height:32px;cursor:pointer'+(((a%2)==0)?";background-color:#DDD":"")+"><td>";k+="<div style=float:right>"+j+"</div><div style=float:right;padding-right:4px>"+g+"</div><div class=m2></div><div>&nbsp;"+EscapeHtml(decodeURIComponent(h[c].name))+"<div></div></div>";k+="</td></tr>";++a}k+="</tbody></table>";if(d==4294967295){k+="<div style=font-size:small;text-align:right;margin-top:6px><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Mesh</a></span></div>"}QH("p20info",k)}function p20showDeleteMeshDialog(){if(xxdialogMode){return}var a='Are you sure you want to delete mesh "'+EscapeHtml(currentMesh.name)+'"? Deleting the mesh will also delete all information about computers within this mesh.<br /><br />';a+="<input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm";setDialogMode(2,"Delete Mesh",3,p20showDeleteMeshDialogEx,a);p20validateDeleteMeshDialog()}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(a,b){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(a){if(xxdialogMode){return}var b=addHtmlValue("Name","<input id=dp20meshname style=width:170px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />");b+=addHtmlValue("Description","<input id=dp20meshdesc style=width:170px maxlength=1024 onkeyup=p20editmeshValidate() />");setDialogMode(2,"Edit Device Group",3,p20editmeshEx,b);Q("dp20meshname").value=currentMesh.name;if(currentMesh.desc){Q("dp20meshdesc").value=currentMesh.desc}p20editmeshValidate();if(a==2){Q("dp20meshdesc").focus()}else{Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",Q("dp20meshname").value.length>0)}function p20showAddMeshUserDialog(){if(xxdialogMode){return}var a=addHtmlValue("User","<input id=dp20username style=width:170px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />");a+='<div style="border:2px groove gray;background-color:white;max-height:120px;overflow-y:scroll">';a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Device Group<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Device Group Users<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Device Group Computers<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remoteview style=margin-left:12px>Remote View Only<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20noterminal style=margin-left:12px>No Terminal Access<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20nofiles style=margin-left:12px>No File Access<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20noamt style=margin-left:12px>No Intel&reg; AMT<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Mesh Agent Console<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes<br>";a+="</div>";setDialogMode(2,"Add User to Mesh",3,p20showAddMeshUserDialogEx,a);p20validateAddMeshUserDialog();Q("dp20username").focus()}function p20validateAddMeshUserDialog(){var a=currentMesh.links[userinfo._id].rights;QE("idx_dlgOkButton",(Q("dp20username").value.length>0));QE("p20fulladmin",a==4294967295);QE("p20editmesh",(!Q("p20fulladmin").checked)&&(a==4294967295));QE("p20manageusers",!Q("p20fulladmin").checked);QE("p20managecomputers",!Q("p20fulladmin").checked);QE("p20remotecontrol",!Q("p20fulladmin").checked);QE("p20meshagentconsole",!Q("p20fulladmin").checked);QE("p20meshserverfiles",!Q("p20fulladmin").checked);QE("p20wakedevices",!Q("p20fulladmin").checked);QE("p20editnotes",!Q("p20fulladmin").checked);QE("p20remoteview",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked);QE("p20noterminal",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked);QE("p20nofiles",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked);QE("p20noamt",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked)}function p20showAddMeshUserDialogEx(){var a=0;if(Q("p20fulladmin").checked==true){a=4294967295}else{if(Q("p20editmesh").checked==true){a+=1}if(Q("p20manageusers").checked==true){a+=2}if(Q("p20managecomputers").checked==true){a+=4}if(Q("p20remotecontrol").checked==true){a+=8}if(Q("p20meshagentconsole").checked==true){a+=16}if(Q("p20meshserverfiles").checked==true){a+=32}if(Q("p20wakedevices").checked==true){a+=64}if(Q("p20editnotes").checked==true){a+=128}if(Q("p20remoteview").checked==true){a+=256}if(Q("p20noterminal").checked==true){a+=512}if(Q("p20nofiles").checked==true){a+=1024}if(Q("p20noamt").checked==true){a+=2048}}meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,username:Q("dp20username").value,meshadmin:a})}function p20viewuser(e){if(xxdialogMode){return}e=decodeURIComponent(e);var d="",b=currentMesh.links[userinfo._id].rights,c=currentMesh.links[e].rights;if(c==4294967295){d=", Full Administrator"}else{if((c&1)!=0){d+=", Edit Device Group"}if((c&2)!=0){d+=", Manage Device Group Users"}if((c&4)!=0){d+=", Manage Device Group Computers"}if((c&8)!=0){d+=", Remote Control"}if((c&16)!=0){d+=", Agent Console"}if((c&32)!=0){d+=", Server Files"}if((c&64)!=0){d+=", Wake Devices"}if((c&128)!=0){d+=", Edit Notes"}if((c&256)!=0){d+=", Remote View Only"}if((c&512)!=0){d+=", No Terminal"}if((c&1024)!=0){d+=", No Files"}if((c&2048)!=0){d+=", No Intel&reg; AMT"}}d=d.substring(2);if(d==""){d="No Rights"}var a=1,f=addHtmlValue("User",EscapeHtml(decodeURIComponent(e.split("/")[2])));f+=addHtmlValue("Permissions",d);if(((userinfo._id)!=e)&&(b==4294967295||(((b&2)!=0)&&(c!=4294967295)))){a+=4}setDialogMode(2,"Mesh User",a,p20viewuserEx,f,e)}function p20viewuserEx(a,b){if(a!=2){return}setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,"Confirm removal of user "+b.split("/")[2]+"?",b)}function p20deleteUser(a,b){haltEvent(a);p20viewuserEx(2,decodeURIComponent(b))}function p20viewuserEx2(a,b){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:b})}var xxcurrentView=-1;function go(b){setSessionActivity();if(xxdialogMode||xxcurrentView==b){return}updateFooterMenu();setDialogMode(0);for(var a=0;a<32;a++){QV("p"+a,a==b)}xxcurrentView=b}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;function setDialogMode(j,k,a,e,d,h){setSessionActivity();xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){setSessionActivity();var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function putstore(f,h){try{if((typeof(localStorage)==="undefined")||(localStorage.getItem(f)==h)){return}if(h==null){localStorage.removeItem(f)}else{localStorage.setItem(f,h)}}catch(a){}if(f[0]!="_"){var g={};for(var b=0,d=localStorage.length;b<d;++b){var c=localStorage.key(b);if(c[0]!="_"){g[c]=localStorage.getItem(c)}}meshserver.send({action:"userWebState",state:JSON.stringify(g)})}}function getstore(b,d){try{if(typeof(localStorage)==="undefined"){return d}var c=localStorage.getItem(b);if((c==null)||(c==null)){return d}return c}catch(a){return d}}function center(){QS("dialog").left=((((getDocWidth()-300)/2))+"px");deskAdjust();deskAdjust()}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function haltReturn(a){if(a.keyCode==13){haltEvent(a)}}function validateEmail(b){var a=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return a.test(b)}function reload(){window.location.href=window.location.href}function getNodeFromId(b){for(var a in nodes){if(nodes[a]._id==b){return nodes[a]}}return null}function addHtmlValue(a,b){return"<table><td style=width:120px>"+a+"<td><b>"+b+"</b></table>"}function addHtmlValue2(a,b){return"<div><div style=display:inline-block;float:right>"+b+"</div><div style=display:inline-block>"+a+"</div></div>"}function addLink(b,a){return"<a style=cursor:pointer;color:darkblue;text-decoration:none onclick='"+a+"'>&diams; "+b+"</a>"}function addLinkConditional(d,b,a){if(a){return addLink(d,b)}return d}function passwordcheck(a){var b=/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/;return b.test(a)}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function joinPaths(){var c=[];for(var a in arguments){var b=arguments[a];if((b!=null)&&(b!="")){while(b.endsWith("/")||b.endsWith("\\")){b=b.substring(0,b.length-1)}while(b.startsWith("/")||b.startsWith("\\")){b=b.substring(1)}c.push(b)}}return c.join("/")}function focusTextBox(a){setTimeout(function(){Q(a).selectionStart=Q(a).selectionEnd=65535;Q(a).focus()},0)}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();function parseUriArgs(){var a,c={},b=window.document.location.href.split(/[\?&|\=]/);b.splice(0,1);for(d in b){switch(d%2){case 0:a=decodeURIComponent(b[d]);break;case 1:c[a]=decodeURIComponent(b[d]);var d=parseInt(c[a]);if(d==c[a]){c[a]=d}break;default:break}}return c}function printDate(a){return a.toLocaleDateString(args.locale)}function printTime(a){return a.toLocaleTimeString(args.locale)}function printDateTime(a){return a.toLocaleString(args.locale)};</script></body></html>
\ No newline at end of file
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link rel="shortcut icon"type=image/x-icon href={{{domainurl}}}favicon.ico><script src=scripts/common-0.0.1.js></script><script src=scripts/meshcentral.js></script><script src=scripts/agent-redir-ws-0.1.1.js></script><script src=scripts/agent-desktop-0.0.2.js></script><script src=scripts/amt-0.2.0.js></script><script src=scripts/amt-redir-ws-0.1.0.js></script><script src=scripts/amt-desktop-0.0.2.js></script><script src=scripts/zlib.js></script><script src=scripts/zlib-inflate.js></script><script src=scripts/zlib-adler32.js></script><script src=scripts/zlib-crc32.js></script><script keeplink=1 src=scripts/filesaver.js></script><title>{{{title}}}</title><style>a{color:#036;text-decoration:underline}#footer a{color:#fff;text-decoration:underline}#footer a:hover{color:#fff;text-decoration:none}.i1{background:url(../images/icons50.png) 0 0;height:50px;width:50px;border:none}.i2{background:url(../images/icons50.png) -50px 0;height:50px;width:50px;border:none}.i3{background:url(../images/icons50.png) -100px 0;height:50px;width:50px;border:none}.i4{background:url(../images/icons50.png) -150px 0;height:50px;width:50px;border:none}.i5{background:url(../images/icons50.png) -200px 0;height:50px;width:50px;border:none}.i6{background:url(../images/icons50.png) -250px 0;height:50px;width:50px;border:none}.m0{background:url(../images/images16.png) -32px 0;height:16px;width:16px;border:none;float:left}.m1{background:url(../images/images16.png) -16px 0;height:16px;width:16px;border:none;float:left}.m2{background:url(../images/images16.png) -96px 0;height:16px;width:16px;border:none;float:left}.m3{background:url(../images/images16.png) -112px 0;height:16px;width:16px;border:none;float:left}.gray{filter:gray;-webkit-filter:grayscale(100%) opacity(60%)}.DevSt{padding-left:5px;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#ddd}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:#fff;clear:both}</style><body onload='"undefined"!=typeof startup&&startup()'style="overflow-y:hidden;margin:0;padding:0;border:0;color:#000;font-size:13px;font-family:\'Trebuchet MS\',Arial,Helvetica,sans-serif"><div id=container><div id=mastheadx></div><div id=masthead style="background:url(logo.png) 0 0;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"><div style="width:calc(100% - 50px);overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px><strong><font style=font-size:36px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px><strong><font style=font-size:12px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div></div><img id=topMenuIcon class=noselect style=position:absolute;right:0;top:10px;bottom:50px;color:#c8c8c8;font-size:44px;margin-right:8px;cursor:pointer;display:none onclick=topMenu() src=/images/3bars-30.png width=30 height=30></div><div id=page_content style=overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%><div id=column_l style=width:100%;padding:0;position:absolute;bottom:0;top:0><div id=p0 style=display:none;width:100%;height:100%><div style=display:flex;align-items:center;width:100%;height:100%><div id=p0message style=text-align:center;width:100%><span id=p0span>Server disconnected</span>,<href onclick=reload() style=cursor:pointer><u>click to reconnect</u></href>.</div></div></div><div id=p1 style=display:none;width:100%;height:100%><div style=display:flex;align-items:center;width:100%;height:100%><div id=p1message style=text-align:center;width:100%></div></div></div><div id=p2 style=display:none><div id=xdevices></div></div><div id=p3 style=display:none;position:absolute;bottom:0;top:0;width:100%><table cellspacing=0 style=margin:0;padding:0;border-spacing:0;border:0><tr style=padding:0><td style=padding:0;color:#c8c8c8;text-align:center;cursor:pointer width=60px valign=top onclick=goBack()><div style=padding:0;background-color:#036;width:10px;height:10px;float:right;border:0><div style="background-color:#fff;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid #fff;border-bottom:1px solid #fff"></div></div><div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div><td><img src=/images/user-50.png width=50 height=50><td><div style=margin-left:5px><strong style=font-size:large><span id=p3userName></span></strong><br></div></table><div id=p3info style=overflow-y:scroll;position:absolute;top:55px;bottom:0;width:100%><div style=margin-left:8px><div id=p3AccountActions><p><strong>Account Security</strong><div style=margin-left:9px;margin-bottom:8px><div id=manageAuthApp style=margin-top:5px;display:none><a onclick=account_manageAuthApp() style=cursor:pointer>Manage authenticator app</a></div><div id=manageOtp style=margin-top:5px;display:none><a onclick=account_manageOtp(0) style=cursor:pointer>Manage backup codes</a></div></div><p><strong>Account Actions</strong><div style=margin-left:9px;margin-bottom:8px><div style=margin-top:5px><span id=verifyEmailId style=display:none><a onclick=account_showVerifyEmail() style=cursor:pointer>Verify email</a></span></div><div style=margin-top:5px><span id=changeEmailId style=display:none><a onclick=account_showChangeEmail() style=cursor:pointer>Change email address</a></span></div><div style=margin-top:5px><a onclick=account_showChangePassword() style=cursor:pointer>Change password</a><span id=p2nextPasswordUpdateTime></span></div><div style=margin-top:5px><a onclick=account_showDeleteAccount() style=cursor:pointer>Delete account</a></div></div><br style=clear:both></div><strong>Device Groups</strong><span id=p3createMeshLink1>(<a onclick=account_createMesh() style=cursor:pointer><img src=images/icon-addnew.png width=12 height=12 border=0> New</a>)</span><br><br><div id=p3meshes></div><div id=p3noMeshFound style=margin-left:9px;display:none>No device groups.<span id=p3createMeshLink2><a onclick=account_createMesh() style=cursor:pointer><strong>Get started here!</strong></a></span></div><br style=clear:both></div></div></div><div id=p5 style=display:none><table cellspacing=0 style=margin:0;padding:0;border-spacing:0;border:0><tr style=padding:0><td style=padding:0;color:#c8c8c8;text-align:center;cursor:pointer width=60px valign=top onclick=goBack()><div style=padding:0;background-color:#036;width:10px;height:10px;float:right;border:0><div style="background-color:#fff;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid #fff;border-bottom:1px solid #fff"></div></div><div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div><td><img src=/images/user-50.png width=50 height=50><td><div style=margin-left:5px><strong style=font-size:large>My Files</strong><br></div></table><div id=p5myfiles style=overflow-y:scroll;position:absolute;top:55px;bottom:0;width:100%><table id=p5toolbar style=width:100%;height:78px cellpadding=0 cellspacing=0><tr><td style=width:100%;background-color:#d3d9d6;text-align:left;padding:4px valign=bottom><div style=width:100%;text-align:center><input type=button style="width:calc(100%/5 - 5px)"id=p5FolderUp disabled onclick=p5folderup() value=Up> <input type=button style="width:calc(100%/5 - 5px)"id=p5SelectAllButton disabled onclick=p5selectallfile() value=SelectAll onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5RenameFileButton disabled value=Rename onclick=p5renamefile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5DeleteFileButton disabled value=Delete onclick=p5deletefile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5NewFolderButton disabled value=Folder onclick=p5createfolder() onkeypress=return!1 onkeydown=return!1></div><div style=width:100%;text-align:center><input type=button style="width:calc(100%/5 - 5px)"id=p5UploadButton disabled value=Upload onclick=p5uploadFile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5CutButton disabled value=Cut onclick=p5copyFile(1) onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5CopyButton disabled value=Copy onclick=p5copyFile(0) onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5PasteButton disabled value=Paste onclick=p5pasteFile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5RefreshButton value=Refresh onclick=p5refreshFiles() onkeypress=return!1 onkeydown=return!1></div><tr><td style=background-color:#e4e9e7;height:28px><table style=width:100%><tr><td id=p5currentpath style=overflow:hidden;padding-left:4px;padding-top:2px><td style=text-align:right;padding-right:4px><select id=p5sortdropdown onchange=updateFiles()><option value=1 selected>Sort by name<option value=2>Sort by size<option value=3>Sort by date<option value=4>Descend by name<option value=5>Descend by size<option value=6>Descend by date</select></table></table><div id=p5filetable style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"><span id=p5files></span></div><table id=p5toolbarBottom style=width:100%;height:22px;position:absolute;bottom:0;background-color:#d3d9d6 cellpadding=0 cellspacing=0><tr><td style=text-align:left;padding:3px>&nbsp;<span id=p5bottomstatus></span><td id=p5rightOfButtons style=text-align:right;padding:3px></table></div></div><div id=p10 style=display:none;position:absolute;bottom:0;top:0;width:100%;overflow:hidden><table cellspacing=0 style=margin:0;padding:0;border-spacing:0;border:0;position:absolute;top:0><tr style=padding:0><td style=padding:0;color:#c8c8c8;text-align:center;cursor:pointer width=60px valign=top onclick=goBack()><div style=padding:0;background-color:#036;width:10px;height:10px;float:right;border:0><div style="background-color:#fff;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid #fff;border-bottom:1px solid #fff"></div></div><div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div><td><a id=MainComputerImage style=cursor:pointer onclick=p10showiconselector()></a><td><div style=margin-left:5px><strong><span id=p10deviceName></span></strong><br><span id=MainComputerState></span></div></table><div id=p10general style=overflow-y:scroll;position:absolute;top:55px;bottom:0;width:100%><div id=p10html style=margin-left:8px;margin-right:8px></div><div id=p10html2></div><div id=p10html3></div></div><div id=p10desktop style=overflow:hidden;position:absolute;top:55px;bottom:0;width:100%;display:none><div id=deskarea1 style=position:absolute;top:0;width:100%;height:25px><div style=padding-top:2px;padding-bottom:2px;background:silver><div style=float:right;text-align:right><span id=p14power></span>&nbsp; <input id=DeskSoftInput style=width:25px;display:none;opacity:.2 onblur=toggleSoftKeys(0) onkeypress="return ondeskkeypress(event)"onkeydown="return ondeskkeydown(event)"onkeyup="return ondeskkeyup(event)"></div><div style=margin-left:3px><input type=button id=connectbutton1 value=Connect onclick=connectDesktop(event,1) onkeypress=return!1 onkeydown=return!1 disabled> <input type=button id=connectbutton1h value="HW Connect"onclick=connectDesktop(event,2) onkeypress=return!1 onkeydown=return!1 disabled> <input type=button id=disconnectbutton1 value=Disconnect onclick=connectDesktop(event,0) onkeypress=return!1 onkeydown=return!1><span id=deskstatus>Disconnected</span></div></div></div><div id=deskarea3 style="position:absolute;top:25px;width:100%;height:calc(100% - 50px)"><div id=deskarea3x style=background:#000;text-align:center;height:100%;position:relative><div id=DeskParent style=height:100%><canvas id=Desk width=640 height=200 style=width:100%;-ms-touch-action:none;margin-left:0 oncontextmenu=return!1 onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event) onmousewheel=dmousewheel(event)></canvas></div><div id=DeskTools style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid #d3d3d3;display:none"><a id=DeskToolsRefreshButton style=float:right;padding:3px;cursor:pointer onclick=refreshDeskTools()>Refresh</a><div id=DeskToolsBar style="position:absolute;padding:3px;border-radius:3px 3px 0 0;top:5px;left:4px;bottom:26px;background-color:#d3d3d3;cursor:pointer">Processes</div><div style=position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:#d3d3d3;text-align:left><div style="border-bottom:1px solid #a9a9a9;padding:3px"><a style=width:50px;padding-right:5px;float:left;cursor:pointer onclick=sortProcess(0)>PID</a><a style=cursor:pointer onclick=sortProcess(1)>Name</a></div><div id=DeskToolsProcesses style=overflow-y:scroll;position:absolute;top:24px;bottom:0;width:100%></div></div></div></div></div><div id=deskarea4 style=position:absolute;bottom:0;width:100%;height:25px><div style=padding-top:2px;padding-bottom:2px;background:silver><div style=float:right;text-align:right><select id=termdisplays style=display:none onchange=deskSetDisplay(event) onclick=deskGetDisplayNumbers(event)></select>&nbsp;<span id=DeskToastButton><img src=images/icon-notify.png onclick=deviceToastFunction() height=16 width=16 style=padding-top:2px></span>&nbsp;</div><div><input id=deskActionsBtn type=button style=margin-left:3px onkeypress=return!1 onkeydown=return!1 value=Actions onclick=deviceActionFunction()> <input type=button value=Settings onkeypress=return!1 onkeydown=return!1 onclick=showDesktopSettings()> <input type=button onkeypress=return!1 onkeydown=return!1 value="Power Actions..."onclick=showPowerActionDlg() style=display:none> <input id=DeskSpecialKeys type=button value="Special Keys"onkeypress=return!1 onkeydown=return!1 onclick=sendSpecialKeys()> <input id=DeskSoftKeys type=button value=Keyboard onkeypress=return!1 onkeydown=return!1 onclick=toggleSoftKeys(1)><label><span id=DeskControlSpan style=display:none><input id=DeskControl type=checkbox onkeypress=return!1 onkeydown=return!1>Input</span></label></div></div></div></div><div id=p10files style=overflow-y:scroll;position:absolute;top:55px;bottom:0;width:100%;display:none><table id=p13toolbar style=width:100%;height:111px cellpadding=0 cellspacing=0><tr><td style="background-color:silver;border-bottom:2px solid #000;padding:2px"><div style=float:right;text-align:right><input id=filesActionsBtn type=button onkeypress=return!1 onkeydown=return!1 value=Actions onclick=deviceActionFunction() style=margin-right:2px></div><div style=margin-left:2px><input id=p13AutoConnect value=AutoConnect onclick=autoConnectFiles(event) onkeypress=return!1 onkeydown=return!1 type=button style=display:none> <input id=p13Connect value=Connect onclick=connectFiles(event) onkeypress=return!1 onkeydown=return!1 type=button><span id=p13Status>Disconnected</span></div><tr><td style=width:100%;background-color:#d3d9d6;text-align:left;padding:4px valign=bottom><div style=width:100%;text-align:center><input type=button style="width:calc(100%/5 - 5px)"id=p13FolderUp disabled onclick=p13folderup() value=Up> <input type=button style="width:calc(100%/5 - 5px)"id=p13SelectAllButton disabled onclick=p13selectallfile() value=SelectAll onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13RenameFileButton disabled value=Rename onclick=p13renamefile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13DeleteFileButton disabled value=Delete onclick=p13deletefile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13NewFolderButton disabled value=Folder onclick=p13createfolder() onkeypress=return!1 onkeydown=return!1></div><div style=width:100%;text-align:center><input type=button style="width:calc(100%/5 - 5px)"id=p13UploadButton disabled value=Upload onclick=p13uploadFile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13CutButton disabled value=Cut onclick=p13copyFile(1) onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13CopyButton disabled value=Copy onclick=p13copyFile(0) onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13PasteButton disabled value=Paste onclick=p13pasteFile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13RefreshButton disabled value=Refresh onclick=p13folderup(9999) onkeypress=return!1 onkeydown=return!1></div><tr><td style=background-color:#e4e9e7;height:28px><table style=width:100%><tr><td id=p13currentpath style=overflow:hidden;padding-left:4px;padding-top:2px><td style=text-align:right;padding-right:4px><select id=p13sortdropdown onchange=p13updateFiles()><option value=1 selected>Sort by name<option value=2>Sort by size<option value=3>Sort by date<option value=4>Descend by name<option value=5>Descend by size<option value=6>Descend by date</select></table></table><div id=p13filetable style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"><span id=p13files></span></div><table id=p13toolbarBottom style=width:100%;height:22px;position:absolute;bottom:0 cellpadding=0 cellspacing=0><tr><td style=text-align:left;padding:3px;text-align:center;background-color:#d3d9d6>&nbsp;<span id=p13bottomstatus></span></table></div></div><div id=p20 style=display:none;position:absolute;bottom:0;top:0;width:100%><table cellspacing=0 style=margin:0;padding:0;border-spacing:0;border:0><tr style=padding:0><td style=padding:0;color:#c8c8c8;text-align:center;cursor:pointer width=60px valign=top onclick=goBack()><div style=padding:0;background-color:#036;width:10px;height:10px;float:right;border:0><div style="background-color:#fff;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid #fff;border-bottom:1px solid #fff"></div></div><div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div><td onclick=p20editmesh(1)><img src=/images/meshicon50.png width=50 height=50><td onclick=p20editmesh(1)><div style=margin-left:5px><strong style=font-size:large><span id=p20meshName></span></strong><br></div></table><div id=p20info style=margin-left:8px;margin-right:8px></div></div></div></div><div id=footer style=height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0><table id=footerMenu cellpadding=0 cellspacing=0 style=height:32px;width:100%;color:#fff;cursor:pointer;table-layout:fixed></table></div></div><div id=dialog style="z-index:1000;background-color:#eee;box-shadow:0 0 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:90px;width:300px;display:none"><div style="width:100%;background-color:#036;color:#fff;border-radius:5px 5px 0 0"><div id=id_dialogclose style=float:right;padding:5px;cursor:pointer onclick=setDialogMode()><b>X</b></div><div id=id_dialogtitle style=padding:5px></div><div style=width:100%;margin:6px></div></div><div style=margin-right:16px;margin-left:8px><div id=dialog1 style=margin:auto;text-align:center;margin:3px><div id=id_dialogMessage style=padding:10px></div></div><div id=dialog2 style=margin:auto;margin:3px><div id=id_dialogOptions></div></div><div id=dialog3 style=margin:auto;margin:3px><select id=deskkeys style=width:100%><option value=10>Ctrl+Alt+Del<option value=11>Tab<option value=5>Win<option value=0>Win+Down<option value=1>Win+Up<option value=2>Win+L<option value=3>Win+M<option value=4>Shift+Win+M<option value=6>Win+R<option value=7>Alt-F4<option value=8>Ctrl-W<option value=9>Alt-Tab</select></div><div id=dialog7 style=margin:auto;margin:3px><div id=d7meshkvm><h4 style="width:100%;border-bottom:1px solid gray">Agent Remote Desktop</h4><div style="margin:3px 0 3px 0"><select id=d7bitmapquality style=float:right;width:200px;height:20px dir=rtl></select><div style=height:20px>Quality</div></div><div style="margin:3px 0 3px 0"><select id=d7bitmapscaling style=float:right;width:200px;height:20px dir=rtl><option selected value=1024>100%<option value=896>87.5%<option value=768>75%<option value=640>62.5%<option value=512>50%<option value=384>37.5%<option value=256>25%<option value=128>12.5%</select><div style=height:20px>Scaling</div></div><div style="margin:3px 0 3px 0"><select id=d7framelimiter style=float:right;width:200px;height:20px dir=rtl><option selected value=50>Fast<option value=100>Medium<option value=400>Slow<option value=1000>Very slow</select><div style=height:20px>Rate</div></div></div><div id=d7amtkvm><h4 style="width:100%;border-bottom:1px solid gray">Intel&reg; AMT Hardware KVM</h4><div style=height:26px><select id=d7desktopmode style=float:right;width:200px><option value=1>RLE8, Fastest<option value=2>RLE16, Recommended<option value=3>RAW8, Slow<option value=4>RAW16, Very Slow</select><div>Encoding</div></div><div style=height:60px><div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:#fff"><label><input type=checkbox id=d7showfocus>Show Focus Tool</label><br><label><input type=checkbox id=d7showcursor>Show Local Mouse Cursor</label><br></div><div>Other</div></div></div></div></div><div id=idx_dlgButtonBar style=padding:10px;margin-bottom:20px><input id=idx_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK style=float:right;width:80px onclick=dialogclose(1)></div></div><div id=topMenu style="z-index:1000;background-color:#eee;box-shadow:0 0 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:0 0 5px 5px;position:fixed;top:50px;right:5px;width:170px;display:none"><div style="padding:12px;border-top:1px solid gray;color:#000;cursor:pointer"onclick=topMenu(2)>My Files</div><div style="padding:12px;border-top:1px solid gray;color:#000;cursor:pointer"onclick=topMenu(1)>My Account</div><div id=logoutMenuOption><a href=/logout><div style="padding:12px;border-top:1px solid gray;color:#000;cursor:pointer">Logout</div></a></div></div><iframe name=fileUploadFrame style=display:none></iframe><script>"use strict";var webState="{{{webstate}}}";for(var i in""!=webState&&(webState=JSON.parse(decodeURIComponent(webState))),webState)localStorage.setItem(i,webState[i]);webState.loctag||localStorage.removeItem("loctag");var files,args=parseUriArgs(),debugLevel=parseInt("{{{debuglevel}}}"),features=parseInt("{{{features}}}"),sessionTime=parseInt("{{{sessiontime}}}"),domain="{{{domain}}}",domainUrl="{{{domainurl}}}",authCookie="{{{authCookie}}}",authRelayCookie="{{{authRelayCookie}}}",authCookieRenewTimer=null,meshserver=null,xdr=null,serverinfo=null,nodes=[],meshes={},filetree={},userinfo=null,users=(serverinfo=null,null),nodeShortIdent=0,serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}",debugmode=!1,attemptWebRTC=0!=(128&features),StatusStrs=["Disconnected","Connecting...","Setup...","Connected","Intel&reg; AMT Connected"],passRequirements="{{{passRequirements}}}";""!=passRequirements&&(passRequirements=JSON.parse(decodeURIComponent(passRequirements)));var sessionActivity=Date.now();function startup(){if(0==(32&features)){var e=null;try{e=top.location.toString().toLowerCase()}catch(e){}if(top!=self&&(null==e||0==top.active))return void(top.location=self.location)}if(!args.locale){var t=getstore("loctag",0);null!=t&&"*"!=t&&(args.locale=t)}(window.onresize=center)(),QV("changeEmailId",0==(2097152&features)),QH("p1message","Connecting..."),go(1),(meshserver=MeshServerCreateControl(domainUrl,authCookie)).onStateChanged=onStateChanged,meshserver.onMessage=onMessage,meshserver.Start();var o=localStorage.getItem("desktopsettings");null!=o&&(desktopsettings=JSON.parse(o)),applyDesktopSettings()}function onStateChanged(e,t,o,n){if(0==t){if(setDialogMode(0),go(0),"noauth"==n)return void QH("p0span","Unable to perform authentication");2==o?setTimeout(serverPoll,5e3):QH("p0span","Unable to connect web socket"),null!=authCookieRenewTimer&&(clearInterval(authCookieRenewTimer),authCookieRenewTimer=null)}else 2==t&&(meshserver.send({action:"meshes"}),meshserver.send({action:"nodes"}),meshserver.send({action:"files"}),xxcurrentView<2&&go(2),authCookieRenewTimer=setInterval(function(){meshserver.send({action:"authcookie"})},18e5));QV("topMenuIcon",2==t)}function serverPoll(){xdr=null;try{xdr=new XDomainRequest}catch(e){}(xdr=xdr||new XMLHttpRequest).open("HEAD",window.location.href),xdr.timeout=15e3,xdr.onload=function(){reload()},xdr.onerror=xdr.ontimeout=function(){setTimeout(serverPoll,1e4)},xdr.send()}function updateSelf(){if(QV("verifyEmailId",!0!==userinfo.emailVerified&&null!=userinfo.email&&1==serverinfo.emailcheck),QV("manageAuthApp",4096&features),QV("manageOtp",0!=(4096&features)&&(1==userinfo.otpsecret||0<userinfo.otphkeys)),QV("p3createMeshLink1",!1),QV("p3createMeshLink2",!1),"number"==typeof userinfo.passchange)if(-1==userinfo.passchange)QH("p2nextPasswordUpdateTime"," - Reset on next login.");else if(null!=passRequirements&&"number"==typeof passRequirements.reset){var e=userinfo.passchange+86400*passRequirements.reset-Math.floor(Date.now()/1e3);e<0?QH("p2nextPasswordUpdateTime"," - Reset on next login."):e<3600?QH("p2nextPasswordUpdateTime",format(" - Reset in {0} minute{1}.",Math.floor(e/60),addLetterS(Math.floor(e/60)))):e<86400?QH("p2nextPasswordUpdateTime",format(" - Reset in {0} hour{1}.",Math.floor(e/3600),addLetterS(Math.floor(e/3600)))):QH("p2nextPasswordUpdateTime",format(" - Reset in {0} day{1}."),Math.floor(e/86400),addLetterS(Math.floor(e/86400)))}}function addLetterS(e){return 1<e?"s":""}function setSessionActivity(){sessionActivity=Date.now()}function checkIdleSessionTimeout(){Date.now()-sessionActivity>serverinfo.timeout&&(window.location.href="logout")}function onMessage(e,t){switch(t.action){case"serverinfo":(serverinfo=t.serverinfo).timeout&&(setInterval(checkIdleSessionTimeout,1e4),checkIdleSessionTimeout()),QV("p3AccountActions",0==(4&features)&&0==serverinfo.domainauth),QV("logoutMenuOption",0==(4&features)&&0==serverinfo.domainauth);break;case"authcookie":authCookie=t.cookie,authRelayCookie=t.rcookie;break;case"userinfo":userinfo=t.userinfo,QH("p3userName",userinfo.name),updateSelf();break;case"users":for(var o in users={},t.users)users[t.users[o]._id]=t.users[o];updateUsers();break;case"wssessioncount":wssessions=t.wssessions,updateUsers();break;case"meshes":for(var o in meshes={},t.meshes)meshes[t.meshes[o]._id]=t.meshes[o];updateMeshes(),updateDevices();break;case"files":filetree=setupBackPointers(t.filetree),updateFiles();break;case"nodes":for(var o in nodes=[],t.nodes)for(var n in t.nodes[o])meshes[o]?(t.nodes[o][n].namel=t.nodes[o][n].name.toLowerCase(),t.nodes[o][n].rname?t.nodes[o][n].rnamel=t.nodes[o][n].rname.toLowerCase():t.nodes[o][n].rnamel=t.nodes[o][n].namel,t.nodes[o][n].meshnamel=meshes[o].name.toLowerCase(),t.nodes[o][n].meshid=o,t.nodes[o][n].state=t.nodes[o][n].state?t.nodes[o][n].state:0,t.nodes[o][n].desc=t.nodes[o][n].desc,t.nodes[o][n].icon||(t.nodes[o][n].icon=1),t.nodes[o][n].ident=++nodeShortIdent,nodes.push(t.nodes[o][n])):console.log("Invalid mesh (1): "+o);updateDevices(),0==xxcurrentView&&go(parseInt("{{viewmode}}")),gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"));break;case"powertimeline":if(t.nodeid!=powerTimelineReq)break;powerTimelineNode=t.nodeid,powerTimeline=t.timeline,powerTimelineUpdate=Date.now()+3e5,currentNode._id==t.nodeid&&drawDeviceTimeline();break;case"otpauth-request":if(2==xxdialogMode&&"otpauth-request"==xxdialogTag){var i=t.secret;52==i.length?i=i.split(/(.............)/).filter(Boolean).join(" "):32==i.length&&(i=(i=i.split(/(....)/).filter(Boolean).join(" ")).substring(0,20)+"<br/>"+i.substring(20)),QH("d2optinfo",'Install <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" rel="noreferrer noopener" target=_blank>Google Authenticator</a> or a compatible application, use <a href="\' + message.url + \'" rel="noreferrer noopener" target=_blank> this link</a> or enter the secret below. Then, enter the current 6 digit token to activate 2-Step login.<br /><br /><div style=width:100%;text-align:center><tt id=d2optsecret secret="'+t.secret+'" style=font-size:15px>'+i+'</tt><br /><br />Token: <input type=text onkeypress="return (event.keyCode == 8) || (event.charCode >= 48 && event.charCode <= 57)" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text></div>'),QV("idx_dlgOkButton",!0),QE("idx_dlgOkButton",!1),Q("d2otpauthinput").focus()}break;case"otpauth-setup":if(xxdialogMode)return;setDialogMode(2,"Authenticator App",1,null,t.success?"<b style=color:green>2-step login activation successful</b>. You will now need a valid token to login again.":"<b style=color:red>2-step login activation failed</b>. Clear the secret from the application and try again. You only have a few minutes to enter the proper code.");break;case"otpauth-clear":if(xxdialogMode)return;setDialogMode(2,"Authenticator App",1,null,t.success?"<b style=color:green>2-step login activation removed</b>. You can reactivate this feature at any time.":"<b style=color:red>2-step login activation removal failed</b>. Try again.");break;case"otpauth-getpasswords":if(xxdialogMode)return;var a="One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place.";if(a+="<div style='border-radius:6px;border: 2px dashed #888;width:100%;margin-top:8px'><div style='padding:8px;font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold'><table style=width:100%;text-align:center>",t.passwords){var s=0;for(var l in t.passwords){++s%2&&(a+="<tr>");for(var r=""+t.passwords[l].p;r.length<8;)r="0"+r;!0===t.passwords[l].u?a+="<td>"+r.substring(0,4)+"&nbsp;"+r.substring(4):a+="<td><strike style=color:#BBB>"+r.substring(0,4)+"&nbsp;"+r.substring(4)}}else a+="<tr><td>No Active Tokens";a+="</table></div></div><br />",a+="<div><input type=button value='Close' onclick=setDialogMode(0) style=float:right></input>",a+="<input type=button value='New Tokens' onclick='account_manageOtp(1);'></input>",null!=t.passwords&&(a+="<input type=button value='Clear' onclick='account_manageOtp(2);'></input>"),setDialogMode(2,"Manage Backup Codes",8,null,a+="</div><br />","otpauth-manage");break;case"event":if(t.event.noact)break;switch(t.event.action){case"userWebState":if(null!=localStorage){var d=JSON.parse(t.event.state);for(var l in d)localStorage.setItem(l,d[l]);null!=d.loctag&&d.loctag!=oldLoctag&&(null!=d.loctag?args.locale=d.loctag:delete args.locale,updateDevices(),updateMeshes())}break;case"accountchange":if(userinfo.name==t.event.account.name){var p=t.event.account.siteadmin?t.event.account.siteadmin:0,c=userinfo.siteadmin?userinfo.siteadmin:0;(t.event.account.quota!=userinfo.quota||0==(8&userinfo.siteadmin)&&0!=(8&t.event.account.siteadmin))&&meshserver.send({action:"files"}),userinfo=t.event.account,c!=p&&updateSiteAdmin(),updateSelf()}break;case"createmesh":null!=t.event.links[userinfo._id]&&(meshes[t.event.meshid]={_id:t.event.meshid,name:t.event.name,mtype:t.event.mtype,desc:t.event.desc,links:t.event.links},updateMeshes(),updateDevices(),meshserver.send({action:"files"}));break;case"meshchange":if(null==meshes[t.event.meshid])meshes[t.event.meshid]={_id:t.event.meshid,name:t.event.name,mtype:t.event.mtype,desc:t.event.desc,links:t.event.links},meshserver.send({action:"nodes"});else{if(meshes[t.event.meshid].name!=t.event.name)for(var l in meshes[t.event.meshid].name=t.event.name,nodes)nodes[l].meshid==t.event.meshid&&(nodes[l].meshnamel=t.event.name.toLowerCase());if(meshes[t.event.meshid].desc=t.event.desc,meshes[t.event.meshid].links=t.event.links,null==meshes[t.event.meshid].links[userinfo._id]){20==xxcurrentView&&currentMesh==meshes[t.event.meshid]&&go(2),delete meshes[t.event.meshid];var u=[];for(var l in nodes)nodes[l].meshid!=t.event.meshid&&u.push(nodes[l]);nodes=u,10<=xxcurrentView&&xxcurrentView<20&&currentNode&&currentNode.meshid==t.event.meshid&&(setDialogMode(0),go(2))}}updateMeshes(),updateDevices(),meshserver.send({action:"files"}),20==xxcurrentView&&currentMesh._id==t.event.meshid&&p20updateMesh();break;case"deletemesh":meshes[t.event.meshid]&&(delete meshes[t.event.meshid],updateMeshes(),meshserver.send({action:"files"}));u=[];for(var l in nodes)nodes[l].meshid!=t.event.meshid&&u.push(nodes[l]);nodes=u,updateDevices(),20<=xxcurrentView&&xxcurrentView<30&&currentMesh._id==t.event.meshid&&(setDialogMode(0),go(2)),10<=xxcurrentView&&xxcurrentView<20&&currentNode&&currentNode.meshid==t.event.meshid&&(setDialogMode(0),go(2));break;case"addnode":var m=t.event.node;if(!meshes[m.meshid])break;if(null!=getNodeFromId(m._id))break;m.namel=m.name.toLowerCase(),m.rname?m.rnamel=m.rname.toLowerCase():m.rnamel=m.namel,m.meshnamel=meshes[m.meshid].name.toLowerCase(),m.state=0,m.icon||(m.icon=1),m.ident=++nodeShortIdent,nodes.push(m),updateDevices();break;case"removenode":var h=-1;for(var l in nodes)if(nodes[l]._id==t.event.nodeid){h=l;break}if(-1!=h){m=nodes[h];currentNode==m&&(10<=xxcurrentView&&xxcurrentView<20&&(setDialogMode(0),go(2)),currentNode=null),nodes.splice(h,1),updateDevices()}break;case"changenode":h=-1;for(var l in nodes)if(nodes[l]._id==t.event.nodeid){h=l;break}if(-1!=h)(m=nodes[h]).name=t.event.node.name,m.rname=t.event.node.rname,m.host=t.event.node.host,m.desc=t.event.node.desc,m.publicip=t.event.node.publicip,m.iploc=t.event.node.iploc,m.wifiloc=t.event.node.wifiloc,m.gpsloc=t.event.node.gpsloc,m.tags=t.event.node.tags,m.userloc=t.event.node.userloc,null!=t.event.node.agent&&(null==m.agent&&(m.agent={}),null!=t.event.node.agent.ver&&(m.agent.ver=t.event.node.agent.ver),null!=t.event.node.agent.id&&(m.agent.id=t.event.node.agent.id),null!=t.event.node.agent.caps&&(m.agent.caps=t.event.node.agent.caps),null!=t.event.node.agent.core?m.agent.core=t.event.node.agent.core:m.agent.core&&delete m.agent.core,m.agent.tag=t.event.node.agent.tag),null!=t.event.node.intelamt&&(null==m.intelamt&&(m.intelamt={}),null!=t.event.node.intelamt.state&&(m.intelamt.state=t.event.node.intelamt.state),null!=t.event.node.intelamt.host&&(m.intelamt.user=t.event.node.intelamt.host),null!=t.event.node.intelamt.user&&(m.intelamt.user=t.event.node.intelamt.user),null!=t.event.node.intelamt.tls&&(m.intelamt.tls=t.event.node.intelamt.tls),null!=t.event.node.intelamt.ver&&(m.intelamt.ver=t.event.node.intelamt.ver),null!=t.event.node.intelamt.tag&&(m.intelamt.tag=t.event.node.intelamt.tag),null!=t.event.node.intelamt.uuid&&(m.intelamt.uuid=t.event.node.intelamt.uuid),null!=t.event.node.intelamt.realm&&(m.intelamt.realm=t.event.node.intelamt.realm)),m.namel=m.name.toLowerCase(),m.rname?m.rnamel=m.rname.toLowerCase():m.rnamel=m.namel,t.event.node.icon&&(m.icon=t.event.node.icon),refreshDevice(m._id),updateDevices();break;case"nodemeshchange":h=-1;for(var l in nodes)if(nodes[l]._id==t.event.nodeid){h=l;break}if(-1!=h){m=nodes[h];null==meshes[t.event.newMeshId]?(currentNode==m&&(10<=xxcurrentView&&xxcurrentView<20&&(setDialogMode(0),go(2)),currentNode=null),nodes.splice(h,1)):(m.meshid=t.event.newMeshId,m.meshnamel=meshes[t.event.newMeshId].name.toLowerCase()),updateDevices(),refreshDevice(t.event.nodeid)}else{m=t.event.node;if(!meshes[m.meshid])break;m.namel=m.name.toLowerCase(),m.rname?m.rnamel=m.rname.toLowerCase():m.rnamel=m.namel,m.meshnamel=meshes[m.meshid].name.toLowerCase(),m.state=0,m.icon||(m.icon=1),m.ident=++nodeShortIdent,nodes.push(m),updateDevices()}break;case"nodeconnect":h=-1;for(var l in nodes)if(nodes[l]._id==t.event.nodeid){h=l;break}if(-1!=h)(m=nodes[h]).conn=t.event.conn,m.pwr=t.event.pwr,updateDevices();break;case"login":null!=users&&users["user/"+domain+"/"+t.event.username.toLowerCase()]&&(users["user/"+domain+"/"+t.event.username.toLowerCase()].login=t.event.time)}}}function topMenu(e){null!=xxdialogMode&&0!=xxdialogMode&&999!=xxdialogMode||(void 0===e?1==("none"==QS("topMenu").display)?0!=xxdialogMode&&null!=xxdialogMode||(QV("topMenu",!0),xxdialogMode=999):(QV("topMenu",!1),xxdialogMode=0):(QV("topMenu",!1),xxdialogMode=0,1==e&&3!=xxcurrentView&&goForward("account"),2==e&&5!=xxcurrentView&&goForward("files")))}var filetreelinkpath,backStack=[];function goBack(){xxdialogMode||(0<backStack.length&&backStack.pop(),goStack())}function goForward(e){xxdialogMode||(backStack.push(e),goStack())}function goStack(){if(0!=backStack.length){var e=backStack[backStack.length-1],t=e.split("/")[0];"node"==t&&(setupDeviceMenu(0),gotoDevice(e)),"mesh"==t&&gotoMesh(e),"account"==t&&go(3),"devices"==t&&go(2),"files"==t&&go(5)}else go(2)}function updateFooterMenu(e){for(;null!=e&&e.length<3;)e.push({n:""});var t="",o="";if(null!=e)for(var n in e)t+='<td style="cursor:pointer'+(""==o?"":";border-left:solid 1px white")+'" onclick="'+e[n].f+'">'+e[n].n,o=e[n].n;QH("footerMenu","<tr>"+t)}function account_manageAuthApp(){xxdialogMode||0==(4096&features)||(1==userinfo.otpsecret?account_removeOtp():account_addOtp())}function account_addOtp(){xxdialogMode||1==userinfo.otpsecret||0==(4096&features)||(setDialogMode(2,"Authenticator App",2,function(){meshserver.send({action:"otpauth-setup",secret:Q("d2optsecret").attributes.secret.value,token:Q("d2otpauthinput").value})},"<div id=d2optinfo>Loading...</div>","otpauth-request"),meshserver.send({action:"otpauth-request"}))}function account_addOtpCheck(e){var t=6==Q("d2otpauthinput").value.length;QE("idx_dlgOkButton",t),e&&13==e.keyCode&&t&&dialogclose(1)}function account_removeOtp(){xxdialogMode||1!=userinfo.otpsecret||0==(4096&features)||setDialogMode(2,"Authenticator App",3,function(){meshserver.send({action:"otpauth-clear"})},"Confirm removal of authenticator application 2-step login?")}function account_manageOtp(e){2==xxdialogMode&&"otpauth-manage"==xxdialogTag&&dialogclose(0),xxdialogMode||1!=userinfo.otpsecret||0==(4096&features)||meshserver.send({action:"otpauth-getpasswords",subaction:e})}function account_showVerifyEmail(){xxdialogMode||1==userinfo.emailVerified||1!=serverinfo.emailcheck||setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,"Click ok to send a verification mail to:<br /><div style=padding:8px><b>"+EscapeHtml(userinfo.email)+"</b></div>Please wait a few minute to receive the verification.")}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){xxdialogMode||(setDialogMode(2,"Email Address Change",3,account_changeEmail,addHtmlValue("Email","<input id=dp3email style=width:170px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />")),null!=userinfo.email&&(Q("dp3email").value=userinfo.email),account_validateEmail(),Q("dp3email").focus())}function account_validateEmail(e,t){QE("idx_dlgOkButton",validateEmail(Q("dp3email").value)&&Q("dp3email").value!=userinfo.email),null!=e&&13==e.keyCode&&dialogclose(1)}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp3email").value})}function account_showDeleteAccount(){if(!xxdialogMode){var e="<form method=post><table style=margin-left:10px><input type=hidden name=action value=deleteaccount /><input type=hidden name=authcookie value="+authCookie+" /><tr>";e+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>",e+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>",e+="</tr></table><div style=padding:10px;margin-bottom:4px>",e+='<input id=account_dlgCancelButton type=button value="Cancel" style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>',e+='<input id=account_dlgOkButton type=submit value="OK" style="float:right;width:80px" onclick=dialogclose(1)>',setDialogMode(2,"Delete Account",0,null,e+="</div><br /></form>"),account_validateDeleteAccount(),Q("apassword1").focus()}}function account_showChangePassword(){if(xxdialogMode)return!1;var e="<table style=margin-left:10px>";if(e+="<tr><td align=right>"+nobreak("Old password:")+"</td><td><input id=apassword0 type=password name=apassword0 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b></b></td></tr>",e+="<tr><td align=right>"+nobreak("New password:")+"</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td></tr>",e+="<tr><td align=right>"+nobreak("New password:")+"</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>",65536&features&&(e+="<tr><td align=right>Password hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>"),e+="</table>",passRequirements){var t=[],o=0;for(var n in passRequirements)"reset"!=n&&"hint"!=n&&(t.push(n+":"+passRequirements[n]),o++);0<o&&(e+="<br /><span style=font-size:x-small>"+format("Requirements: {0}.",t.join(", "))+"</span>")}return setDialogMode(2,"Change Password",3,account_showChangePasswordEx,e+="<br />"),Q("apassword0").focus(),account_validateNewPassword(),!1}function account_showChangePasswordEx(){if(Q("apassword1").value==Q("apassword2").value){var e={action:"changepassword",oldpass:Q("apassword0").value,newpass:Q("apassword1").value};65536&features&&(e.hint=Q("apasswordhint").value),meshserver.send(e)}}function account_createMesh(){if(!xxdialogMode)if(4294967295==userinfo.siteadmin||0==(64&userinfo.siteadmin))if(!0===userinfo.emailVerified||1!=serverinfo.emailcheck||4294967295==userinfo.siteadmin)if(!(262144&features)||1==userinfo.otpsecret||0<userinfo.otphkeys||0<userinfo.otpkeys){var e=addHtmlValue("Name","<input id=dp3meshname style=width:170px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />");e+=addHtmlValue("Type","<div style=width:170px;margin:0;padding:0><select id=dp3meshtype style=width:100% onchange=account_validateMeshCreate() ><option value=2>Software Agent Group</option><option value=1>Intel&reg; AMT only</option></select></div>"),setDialogMode(2,"Create Device Group",3,account_createMeshEx,e+=addHtmlValue("Description","<div style=width:170px;margin:0;padding:0><textarea id=dp3meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>")),account_validateMeshCreate(),Q("dp3meshname").focus()}else setDialogMode(2,"Account Security",1,null,'Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the "My Account" and look at the "Account Security" section.');else setDialogMode(2,"Account Security",1,null,'Unable to access a device until a email address is verified. This is required for password recovery. Go to the "My Account" to change and verify an email address.');else setDialogMode(2,"New Device Group",1,null,"This account does not have the rights to create a new device group.")}function account_validateMeshCreate(){QE("idx_dlgOkButton",0<Q("dp3meshname").value.length)}function account_createMeshEx(e,t){meshserver.send({action:"createmesh",meshname:Q("dp3meshname").value,meshtype:Q("dp3meshtype").value,desc:Q("dp3meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",0<Q("apassword1").value.length&&Q("apassword1").value==Q("apassword2").value)}function account_validateNewPassword(){var e="",t=0<Q("apassword0").value.length&&0<Q("apassword1").value.length&&Q("apassword1").value==Q("apassword2").value&&Q("apassword0").value!=Q("apassword1").value;if(65536&features&&Q("apasswordhint").value==Q("apassword1").value&&(t=!1),""!=Q("apassword1").value)if(null==passRequirements||""==passRequirements){var o=checkPasswordStrength(Q("apassword1").value);e=80<=o?"<span style=color:green>Strong<span>":60<=o?"<span style=color:blue>&#9679;<span>":"<span style=color:red>&#9679;<span>"}else{0==checkPasswordRequirements(Q("apassword1").value,passRequirements)&&(t=!1,e="<span style=color:red>Policy<span>")}QH("dxPassWarn",e),QE("idx_dlgOkButton",t)}function checkPasswordStrength(e){var t=0,o={},n=0,i={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e)return 0;for(var a=0;a<e.length;a++)o[e[a]]=(o[e[a]]||0)+1,t+=5/o[e[a]];for(var s in i)n+=1==i[s]?1:0;return parseInt(t+10*(n-1))}function checkPasswordRequirements(e,t){if(null==t||""==t||"object"!=typeof t)return!0;if(t.min&&e.length<t.min)return!1;if(t.max&&e.length>t.max)return!1;for(var o=0,n=0,i=0,a=0,s=0;s<e.length;s++)/\d/.test(e[s])&&o++,/[a-z]/.test(e[s])&&n++,/[A-Z]/.test(e[s])&&i++,/\W/.test(e[s])&&a++;return!(t.num&&o<t.num)&&(!(t.lower&&n<t.lower)&&(!(t.upper&&i<t.upper)&&!(t.nonalpha&&a<t.nonalpha)))}function updateMeshes(){var e="",t=0;for(i in meshes){t++;var o=meshes[i].links[userinfo._id].rights,n="Partial Rights";4294967295==o?n="Full Administrator":0==o&&(n="No Rights"),e+="<div style=cursor:pointer onclick=goForward('"+i+"')>",e+='<div style="float:left;margin-left:4px"><img src="/images/meshicon50.png" width=50 height=50 /></div>',e+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">',e+="<div><div style=padding-left:12px;padding-top:2px><b>"+EscapeHtml(meshes[i].name)+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+n+"</div></div>",e+="</div></div>"}QH("p3meshes",e),QV("p3noMeshFound",0==t)}function gotoMesh(e){null==(currentMesh=meshes[e])&&goBack(),p20updateMesh(),go(20)}var sortorder,filetreelocation=[];function p5refreshFiles(){meshserver.send({action:"files"})}function updateFiles(){if(QV("MainMenuMyFiles",0==(8&features)),0==(8&features)){for(var e,t="",o="",n="<a style=cursor:pointer onclick=p5folderup(0)>Root</a>",i="Root",a=filetree,s=1,l=[],r=filetreelinkpath,d=[],p=document.getElementsByName("fc"),c=0;c<p.length;c++)p[c].checked&&d.push(p[c].value);for(var c in filetreelinkpath="",filetreelocation){if(null==a.f||null==a.f[filetreelocation[c]])break;if(l.push(filetreelocation[c]),i+=" / "+filetreelocation[c],1==s){var u=filetreelocation[c].split("/");e=window.location+u[0]+"files/"+u[2],filetreelinkpath+=filetreelocation[c]}else""!=filetreelinkpath&&(filetreelinkpath+="/"+filetreelocation[c],2<s&&(e+="/"+filetreelocation[c]));n+=" / <a style=cursor:pointer onclick=p5folderup("+s+")>"+(null!=(a=a.f[filetreelocation[c]]).n?a.n:filetreelocation[c])+"</a>",s++}filetreelocation=l;var m=i.toLowerCase().startsWith("root / "+userinfo._id+" / public"),h=p5sort_files(a.f);for(var c in h){var f,g=h[c],v=g.n;f=40<(f=v).length?EscapeHtml(v.substring(0,40))+"...":EscapeHtml(v),v=EscapeHtml(v);var k="";null!=g.s&&(k=getFileSizeStr(g.s));var y="";if(g.t<3||4==g.t){y="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+v+"'>&nbsp;<span style=float:right;padding-right:4px>"+(1==g.t||4==g.t?p5getQuotabar(g):"")+"</span><span><div class=fileIcon"+g.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(g.nx)+'")>'+f+"</a></span></div>"}else{var w=f,x="";m&&(x=" (<a style=cursor:pointer onclick='p5showPublicLink(\""+e+"/"+g.nx+"\")'>Link</a>)"),0<g.s&&(w='<a rel="noreferrer noopener" target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+g.nx)+'">'+f+"</a>"+x),y="<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+g.nx+"'>&nbsp;<span style=float:right;padding-right:4px>"+k+"</span><span><div class=fileIcon"+g.t+"></div>"+w+"</span></div>"}g.t<3?t+=y:o+=y}if(QH("p5rightOfButtons",p5getQuotabar(a)),QH("p5files",t+o),QH("p5currentpath",n),QE("p5FolderUp",0!=filetreelocation.length),QV("p5PublicShare",m),r==filetreelinkpath){p=document.getElementsByName("fc");for(c=0;c<p.length;c++)p[c].checked=0<=d.indexOf(p[c].value)}p5setActions()}}function getNiceSize(e){return e<=0?"Storage exceed":e<2048?format("{0}b left",e):e<2097152?format("{0}k left",Math.round(e/1024)):e<2147483648?format("{0}m left",Math.round(e/1024/1024)):format("{0}g left",Math.round(e/1024/1024/1024))}function p5getQuotabar(e){for(;1<e.t&&4!=e.t;)e=e.parent;return 1!=e.t&&4!=e.t||null==e.maxbytes?"":getNiceSize(e.maxbytes-e.s)+" <progress style=height:10px;width:100px value="+e.s+" max="+e.maxbytes+" />"}function p5showPublicLink(e){setDialogMode(2,"Public Link",1,null,'<input type=text style=width:100% value="'+e+'" readonly />')}function p5sort_filename(e,t){return e.ln>t.ln?1*sortorder:e.ln<t.ln?-1*sortorder:0}function p5sort_timestamp(e,t){return e.d>t.d?1*sortorder:e.d<t.d?-1*sortorder:0}function p5sort_bysize(e,t){return e.s==t.s?p5sort_filename(e,t):(e.s-t.s)*sortorder}function p5sort_files(e){var t=[],o=Q("p5sortdropdown").value;for(var n in e)e[n].nx=n,null==e[n].n&&(e[n].n=n),e[n].ln=e[n].n.toLowerCase(),t.push(e[n]);return sortorder=1,3<o&&(sortorder=-1,o-=3),1==o?t.sort(p5sort_filename):2==o?t.sort(p5sort_bysize):3==o&&t.sort(p5sort_timestamp),t}function p5setActions(){var e=getFileSelCount(),t=getFileCount(),o=getFileSelCount(!1);QE("p5DeleteFileButton",0<e&&0<filetreelocation.length),QE("p5NewFolderButton",0<filetreelocation.length),QE("p5UploadButton",0<filetreelocation.length),QE("p5RenameFileButton",1==e&&0<filetreelocation.length),QE("p5SelectAllButton",0<t),Q("p5SelectAllButton").value=0<e?"None":"All",QE("p5CutButton",0<o&&e==o),QE("p5CopyButton",0<o&&e==o),QE("p5PasteButton",null!=p5clipboard&&0<p5clipboard.length&&0<filetreelocation.length)}function getFileSelCount(e){for(var t=0,o=document.getElementsByName("fc"),n=0;n<o.length;n++)!o[n].checked||0==e&&"3"!=o[n].attributes.file.value||t++;return t}function getFileSelDirCount(){for(var e=0,t=document.getElementsByName("fc"),o=0;o<t.length;o++)t[o].checked&&"999"==t[o].attributes.file.value&&e++;return e}function getFileCount(){return document.getElementsByName("fc").length}function p5selectallfile(){for(var e=0==getFileSelCount(),t=document.getElementsByName("fc"),o=0;o<t.length;o++)t[o].checked=e;p5setActions()}function setupBackPointers(e){if(null!=e.f){var t=0,o=0;for(var n in e.f)setupBackPointers(e.f[n]),(e.f[n].parent=e).f[n].s&&(t+=e.f[n].s),e.f[n].c&&(o+=e.f[n].c),3==e.f[n].t&&o++;e.s=t,e.c=o}return e}function getFileSizeStr(e){return 1==e?"1 byte":format("{0} bytes",e)}function p5folderup(e){if(null==e)filetreelocation.pop();else for(;filetreelocation.length>e;)filetreelocation.pop();return updateFiles(),!1}function p5folderset(e){return filetreelocation.push(decodeURIComponent(e)),updateFiles(),!1}function p5createfolder(){setDialogMode(2,"New Folder",3,p5createfolderEx,"<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% />"),focusTextBox("p5renameinput"),p5fileNameCheck()}function p5createfolderEx(){meshserver.send({action:"fileoperation",fileop:"createfolder",path:filetreelocation,newfolder:Q("p5renameinput").value})}function p5deletefile(){var e=getFileSelCount(),t=0<getFileSelDirCount()?"<br /><br /><label><input type=checkbox id=p5recdeleteinput>Recursive delete</label><br>":"<input type=checkbox id=p5recdeleteinput style='display:none'>";setDialogMode(2,"Delete",3,p5deletefileEx,1<e?format("Delete {0} selected items?",e)+t:"Delete selected item?"+t)}function p5deletefileEx(){for(var e=[],t=document.getElementsByName("fc"),o=0;o<t.length;o++)t[o].checked&&e.push(t[o].value);meshserver.send({action:"fileoperation",fileop:"delete",path:filetreelocation,delfiles:e,rec:Q("p5recdeleteinput").checked})}function p5renamefile(){for(var e,t=document.getElementsByName("fc"),o=0;o<t.length;o++)t[o].checked&&(e=t[o].value);setDialogMode(2,"Rename",3,p5renamefileEx,'<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="'+e+'" />',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:e}),focusTextBox("p5renameinput"),p5fileNameCheck()}function p5renamefileEx(e,t){t.newname=Q("p5renameinput").value,meshserver.send(t)}function p5fileNameCheck(e){var t=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",t),1==t&&e&&13==e.keyCode&&dialogclose(1)}var isFilenameValid=function(){var t=/^[^\\/:\*\?"<>\|]+$/,o=/^\./,n=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function(e){return t.test(e)&&!o.test(e)&&!n.test(e)&&"."!=e[0]}}();function p5uploadFile(){setDialogMode(2,"Upload File",3,p5uploadFileEx,'<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p5uploadpath value="'+encodeURIComponent(filetreelinkpath)+'" /><input type=file name=files id=p5uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p5uploadinput\')" /><input type=hidden name=authCookie value='+authCookie+" /><input type=submit id=p5loginSubmit style=display:none /></form>"),updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(e){QE("idx_dlgOkButton",""!=Q(e).value)}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(e){var t=document.getElementsByName("fc");p5clipboard=[],p5clipboardCut=e,p5clipboardFolder=Clone(filetreelocation);for(var o=0;o<t.length;o++)t[o].checked&&"3"==t[o].attributes.file.value&&p5clipboard.push(t[o].value);p5updateClipview()}function p5pasteFile(){var e="";null!=p5clipboard&&0<p5clipboard.length&&(e=format("Confim {0} of {1} entrie{2} to this location?",0==p5clipboardCut?"copy":"move",p5clipboard.length,1<p5clipboard.length?"s":"")),setDialogMode(2,"Paste",3,p5pasteFileEx,e)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:0==p5clipboardCut?"copy":"move",scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard}),p5folderup(999),1==p5clipboardCut&&(p5clipboardFolder=p5clipboard=null,p5clipboardCut=0,p5updateClipview())}function p5updateClipview(){var e="";null!=p5clipboard&&0<p5clipboard.length&&(e=format("Holding {0} entrie{1} for {2}",p5clipboard.length,1<p5clipboard.length?"s":"",0==p5clipboardCut?"copy":"move")+', <a href=# onclick="return p5clearClip()" style=cursor:pointer>Clear</a>.'),QH("p5bottomstatus",e),p5setActions()}function p5clearClip(){return p5clipboardFolder=p5clipboard=null,p5clipboardCut=0,p5updateClipview(),!1}function p5fileDragDrop(e){if(haltEvent(e),QV("bigfail",!1),QV("bigok",!1),null!=e.dataTransfer&&0!=e.dataTransfer.files.length&&0!=filetreelocation.length)for(var t=[],o=[],n=[],i=[],a=e.dataTransfer.files.length,s=0;s<e.dataTransfer.files.length;s++){var l=new FileReader,r=e.dataTransfer.files[s];t.push(r.name),o.push(r.size),n.push(r.type),l.onload=function(e){i.push(e.target.result),0==--a&&(Q("p5fileDragName").value=t.join("*"),Q("p5fileDragSize").value=o.join("*"),Q("p5fileDragType").value=n.join("*"),Q("p5fileDragData").value=i.join("*"),Q("p5fileDragLink").value=encodeURIComponent(filetreelinkpath),Q("p5loginSubmit2").click())},l.readAsDataURL(r)}}var p5dragtimer=null;function p5fileDragOver(e){haltEvent(e),null!=p5dragtimer&&(clearTimeout(p5dragtimer),p5dragtimer=null);var t=!0;0==filetreelocation.length&&(t=!1),QV("bigok",t),QV("bigfail",!t)}function p5fileDragLeave(e){haltEvent(e),"p5filetable"!=e.target.id?(QV("bigfail",!1),QV("bigok",!1)):p5dragtimer=setTimeout("QV('bigfail',false);QV('bigok',false);p5dragtimer=null;",200)}function ondeskkeypress(e){if(toggleSoftKeys(0),Q("DeskSoftInput").value="",setSessionActivity(),desktop&&!xxdialogMode&&10==xxcurrentView){if(null!=currentNode){var t=meshes[currentNode.meshid].links[userinfo._id].rights;if(0==(4294967295==t||0!=(8&t)&&0==(256&t)))return!1;if(1==(4294967295!=t&&0!=(8&t)&&0==(256&t)&&0!=(4096&t))&&(1==e.altKey||1==e.ctrlKey||e.keyCode<32&&8!=e.keyCode&&13!=e.keyCode||90<e.keyCode))return!1}return desktop.m.handleKeys(e)}}function ondeskkeydown(e){if(toggleSoftKeys(0),Q("DeskSoftInput").value="",setSessionActivity(),desktop&&!xxdialogMode&&10==xxcurrentView){if(null!=currentNode){var t=meshes[currentNode.meshid].links[userinfo._id].rights;if(0==(4294967295==t||0!=(8&t)&&0==(256&t)))return!1;if(1==(4294967295!=t&&0!=(8&t)&&0==(256&t)&&0!=(4096&t))&&(1==e.altKey||1==e.ctrlKey||e.keyCode<32&&8!=e.keyCode&&13!=e.keyCode||90<e.keyCode))return!1}return desktop.m.handleKeyDown(e)}}function ondeskkeyup(e){if(toggleSoftKeys(0),Q("DeskSoftInput").value="",setSessionActivity(),desktop&&!xxdialogMode&&10==xxcurrentView){if(null!=currentNode){var t=meshes[currentNode.meshid].links[userinfo._id].rights;if(0==(4294967295==t||0!=(8&t)&&0==(256&t)))return!1;if(1==(4294967295!=t&&0!=(8&t)&&0==(256&t)&&0!=(4096&t))&&(1==e.altKey||1==e.ctrlKey||e.keyCode<32&&8!=e.keyCode&&13!=e.keyCode||90<e.keyCode))return!1}return desktop.m.handleKeyUp(e)}}var updateDevicesTimer=null;function updateDevices(){null==updateDevicesTimer&&(updateDevicesTimer=setTimeout(updateDevicesEx,200))}var deviceHeaderCount,sort=0,deviceHeaderId=0,deviceHeaders={},showRealNames=!1,deviceHeaderTotal=0,deviceHeadersTitles=(deviceHeaders={},{});function updateDevicesEx(){null!=updateDevicesTimer&&(clearTimeout(updateDevicesTimer),updateDevicesTimer=null);var e="",t=0,o=null,n=0,i={};for(var a in deviceHeaderCount={},deviceHeaders={},deviceHeadersTitles={},(deviceHeaderTotal=deviceHeaderId=0)==sort?nodes.sort(meshSort):1==sort?nodes.sort(powerSort):2==sort&&(1==showRealNames?nodes.sort(deviceHostSort):nodes.sort(deviceSort)),nodes)if(0!=nodes[a].v){var s=meshes[nodes[a].meshid].links[userinfo._id];if(null!=s){s.rights;if(0==sort){if(nodes.sort(meshSort),nodes[a].meshid!=o){deviceHeaderSet();var l="";1==meshes[nodes[a].meshid].mtype&&(l="<span style=color:lightgray>, Intel&reg; AMT only</span>"),null!=o&&(2==t&&(e+="<td><div style=width:301px></div></td>"),""!=e&&(e+="</tr></table>")),e+="<div class=DevSt style=padding-top:4px><span style=float:right>",e+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+nodes[a].meshid+'")>'+EscapeHtml(meshes[nodes[a].meshid].name)+"</span>"+l+"<span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>",i[o=nodes[a].meshid]=1,t=0}}else 1==sort?nodes[a].pwr!==o&&(deviceHeaderSet(),null!==o&&(2==t&&(e+="<td><div style=width:301px></div></td>"),""!=e&&(e+="</tr></table>")),e+="<div class=DevSt style=width:100%;padding-top:4px><span>"+PowerStateStr2(nodes[a].pwr)+"</span><span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>",o=nodes[a].pwr,t=0):2==sort&&null==o&&(o="1");n++;var r=EscapeHtml(nodes[a].name);0==r.length&&(r="<i>None</i>"),null!=nodes[a].rname&&0<nodes[a].rname.length&&(r+=" / "+EscapeHtml(nodes[a].rname));var d=EscapeHtml(nodes[a].name);1==showRealNames&&null!=nodes[a].rname&&(d=EscapeHtml(nodes[a].rname)),0==d.length&&(d="<i>None</i>");var p=nodes[a].icon,c=NodeStateStr(nodes[a]);nodes[a].conn&&0!=nodes[a].conn||(p+=" gray"),e+="<div style=cursor:pointer onclick=goForward('"+nodes[a]._id+"')>",e+='<div class="i'+p+'" style="float:left;margin-left:4px"></div>',e+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">',e+="<div><div style=padding-left:12px;padding-top:2px><b>"+d+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+c+"</div></div>",e+="</div></div>",deviceHeaderTotal++,void 0===deviceHeaderCount[nodes[a].state]?deviceHeaderCount[nodes[a].state]=1:deviceHeaderCount[nodes[a].state]++}}if(0==sort)for(var a in meshes){var u=meshes[a],m=u.links[userinfo._id];if(null!=m){m.rights;null==i[u._id]&&(""!=o&&""!=e&&(e+="</tr></table>"),e+="<div><div colspan=3 class=DevSt><span style=float:right>",e+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+u._id+'")>'+EscapeHtml(u.name)+"</span></div>",1==u.mtype&&(e+="<div style=padding:10px><i>No Intel&reg; AMT devices in this group"),2==u.mtype&&(e+="<div style=padding:10px><i>No devices in this group"),e+=".</i></div></div>",o=u._id,n++)}}for(var a in 0==n?QH("xdevices",'<div style="margin-top:50px;text-align:center"><span style="font-size:30px">No devices</span><br /><br />Use the desktop version of this website to add devices.</div>'):QH("xdevices",e),deviceHeaderSet(),deviceHeaders)QH(a,deviceHeaders[a]);for(var a in deviceHeadersTitles)Q(a).title=deviceHeadersTitles[a]}var powerStatetable=["","Powered","Sleep","Sleep","Sleep","Hibernating","Power off","Present"],powerStateStrings=["","Powered","Sleeping","Sleeping","Deep Sleep","Hibernating","Soft-Off","Present"],powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"],powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(e){var t=[];return 0<e.state&&e.state<powerStatetable.length&&state.push(powerStatetable[e.state]),e.conn&&(0!=(1&e.conn)&&t.push("<span>Agent</span>"),0!=(2&e.conn)?t.push("<span>CIRA</span>"):0!=(4&e.conn)&&t.push("<span>Intel&reg; AMT</span>"),0!=(8&e.conn)&&t.push("<span>Relay</span>"),0!=(16&e.conn)&&t.push("<span>MQTT</span>")),null!=e.pwr&&0!=e.pwr&&t.push(powerStateStrings[e.pwr]),t.join(", ")}function PowerStateStr(e){return e<powerStatetable.length?powerStatetable[e]:""}function PowerStateStr2(e){return 0!=e&&e<powerStatetable.length?powerStatetable[e]:"Unknown"}function onSortSelectChange(e){sort=document.getElementById("sortselect").selectedIndex,e||putstore("sort",sort),updateDevicesEx()}function deviceHeaderSet(){if(0!=deviceHeaderId){deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+(1==deviceHeaderTotal?" node":" nodes");var e="";for(var t in deviceHeaderCount)0<e.length&&(e+=", "),e+=deviceHeaderCount[t]+" "+PowerStateStr2(t);deviceHeadersTitles["DevxHeader"+deviceHeaderId]=e,deviceHeaderId++,deviceHeaderCount={},deviceHeaderTotal=0}else deviceHeaderId=1}function meshSort(e,t){return e.meshnamel>t.meshnamel?1:e.meshnamel<t.meshnamel?-1:e.meshid==t.meshid?1==showRealNames?e.rnamel>t.rnamel?1:e.rnamel<t.rnamel?-1:0:e.namel>t.namel?1:e.namel<t.namel?-1:0:0}function powerSort(e,t){var o=e.pwr?e.pwr:0,n=t.pwr?t.pwr:0;return o==n?1==showRealNames?e.rnamel>t.rnamel?1:e.rnamel<t.rnamel?-1:0:e.namel>t.namel?1:e.namel<t.namel?-1:0:n<o?1:o<n?-1:0}function deviceSort(e,t){return e.namel>t.namel?1:e.namel<t.namel?-1:0}function deviceHostSort(e,t){return e.rnamel>t.rnamel?1:e.rnamel<t.rnamel?-1:0}function refreshDevice(e){currentNode&&currentNode._id==e&&gotoDevice(e,xxcurrentView,!0)}function getNodeRights(e){var t=getNodeFromId(e);return meshes[t.meshid].links[userinfo._id].rights}var currentNode,currentDevicePanel=0,powerTimelineNode=null,powerTimelineReq=null,powerTimelineUpdate=null,powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(e,t,o){if(!0===userinfo.emailVerified||1!=serverinfo.emailcheck||4294967295==userinfo.siteadmin)if(!(262144&features)||1==userinfo.otpsecret||0<userinfo.otphkeys||0<userinfo.otpkeys){var n=getNodeFromId(e);if(null!=n){var i=meshes[n.meshid];if(null!=i){var a=i.links[userinfo._id].rights;if(!currentNode||currentNode._id!=n._id||1==o){currentNode=n;var s=EscapeHtml(n.name);0==s.length&&(s="<i>None</i>"),0!=(4&a)&&(s="<span onclick=showEditNodeValueDialog(0) style=cursor:pointer>"+s+"</span>"),QH("p10deviceName",s);var l="<table style=width:100%>";l+=addDeviceAttribute("<span>Group</span>",'<a onclick=goForward("'+n.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[n.meshid].name)+"</a>"),null!=n.rname&&(l+=addDeviceAttribute("<span>Name</span>","<span>"+EscapeHtml(n.rname)+"</span>")),1!=i.mtype&&n.name==n.host||(0!=(4&a)?n.host?l+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(n.host)+"</span>"):l+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>"):l+=addDeviceAttribute("Hostname",EscapeHtml(n.host)));var r=n.desc?EscapeHtml(n.desc):"<i>None</i>";l+=addDeviceAttribute("Description",0!=(4&a)?"<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+r+"</span>":r);var d=["Unknown","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","MacOS 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","MacOS 64bit","ChromeOS","Linux Poky x86-64bit","Linux NoKVM x86-32bit","Linux NoKVM x86-64bit","Windows MinCore console","Windows MinCore service","NodeJS","ARM-Linaro","ARMv6l / ARMv7l","ARMv8 64bit","ARMv6l / ARMv7l / NoKVM","Unknown","Unknown","FreeBSD x86-64"];if(null!=n.agent&&null!=n.agent.id&&null!=n.agent.ver){var p="";p=n.agent.id<=d.length?d[n.agent.id]:d[0],0!=n.agent.ver&&(p+=" v"+n.agent.ver),l+=addDeviceAttribute("Agent",p)}if(null!=n.intelamt){p="";var c={0:nobreak("Not Activated (Pre)"),1:nobreak("Not Activated (In)"),2:nobreak("Activated")};null!=n.intelamt.ver&&null==n.intelamt.state?p+="<i>"+nobreak("Unknown State")+"</i>, v"+n.intelamt.ver:null==n.intelamt.ver&&2==n.intelamt.state?p+="<i>Activated</i>":null==n.intelamt.ver||null==n.intelamt.state?p+="<i>Unknown Version & State</i>":(p+=c[n.intelamt.state],n.intelamt.flags&&(2&n.intelamt.flags?p=" <span>CCM</span>":4&n.intelamt.flags&&(p=" <span>ACM</span>")),p+=", v"+n.intelamt.ver),1==n.intelamt.tls&&(p+=", <span>TLS</span>"),2==n.intelamt.state&&(null!=n.intelamt.user&&""!=n.intelamt.user||(p+=0!=(4&a)?', <i style=color:#FF0000;cursor:pointer onclick=editDeviceAmtSettings("'+n._id+'")>'+nobreak("No Credentials")+"</i>":", <i style=color:#FF0000>No Credentials</i>"),p+=" ",0!=(4&a)&&(p+='<img src=images/link4.png height=10 width=10 style=cursor:pointer onclick=editDeviceAmtSettings("'+n._id+'")>'));var u="Intel&reg; ME";"number"==typeof n.intelamt.sku&&(0!=(8&n.intelamt.sku)?u="Intel&reg; AMT":0!=(16&n.intelamt.sku)&&(u="Intel&reg; SM")),l+=addDeviceAttribute(u,p)}if(null!=n.agent&&null!=n.agent.tag&&"mailto:"!=n.agent.tag){var m=EscapeHtml(n.agent.tag);m.startsWith("mailto:")&&(m='<a href="'+m+'">'+m.substring(7)+"</a>"),l+=addDeviceAttribute("Agent Tag",m)}var h=n.conn;if(h&&1<h){var f=[];0!=(1&n.conn)&&f.push("<span>Agent</span>"),0!=(2&n.conn)?f.push("<span>Intel&reg; AMT CIRA</span>"):0!=(4&n.conn)&&f.push("<span>Intel&reg; AMT</span>"),0!=(8&n.conn)&&f.push("<span>Agent Relay</span>"),0!=(16&n.conn)&&f.push("<span>MQTT</span>"),l+=addDeviceAttribute("Connectivity",f.join(", "))}var g="<i>None</i>";if(null!=n.tags)for(var v in g="",n.tags)g+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+n.tags[v]+"</span>";l+=addDeviceAttribute("Tags",0!=(4&a)?"<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+g+"</span>":g),l+="</table><br />",0!=(76&a)&&(l+="<input type=button value=Actions onclick=deviceActionFunction() />"),QH("p10html",l),setupFiles(),l="<div style=float:right;font-size:x-small;margin-right:10px>",0!=(4&a)&&(l+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+n._id+'")>Delete Device</a>'),l+="</div><div style=font-size:x-small>",l+="</div><br>",QH("p10html3",l);var k=PowerStateStr(n.state);0!=(1&h)&&(0<k.length&&(k+=", "),k+="<span style=font-size:10px>Mesh Agent</span>"),0!=(2&h)?(0<k.length&&(k+=", "),k+="<span style=font-size:10px>Intel&reg; AMT connected</span>"):0!=(4&h)&&(0<k.length&&(k+=", "),k+="<span style=font-size:10px>Intel&reg; AMT detected</span>"),0!=(16&h)&&(0<k.length&&(k+="<br/>"),k+="<span style=font-size:12px>MQTT channel connected</span>"),QH("MainComputerState",k),QH("MainComputerImage",'<div class="i'+n.icon+'"></div>'),powerTimelineNode!=currentNode._id&&powerTimelineReq!=currentNode._id&&(QH("p10html2",""),powerTimelineReq=currentNode._id,meshserver.send({action:"powertimeline",nodeid:currentNode._id}))}setupDesktop(),go(t=t||10),setupDeviceMenu()}else goBack()}else goBack()}else setDialogMode(2,"Account Security",1,null,'Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the "My Account" and look at the "Account Security" section.');else setDialogMode(2,"Account Security",1,null,'Unable to access a device until a email address is verified. This is required for password recovery. Go to the "My Account" to change and verify an email address.')}function deviceToastFunction(){xxdialogMode||setDialogMode(2,"Device Toast",3,deviceToastFunctionEx,"<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function setupDeviceMenu(e,t){var o=0;currentNode&&(o=meshes[currentNode.meshid].links[userinfo._id].rights),null!=e&&(currentDevicePanel=e),QV("p10general",0==currentDevicePanel),QV("p10desktop",1==currentDevicePanel),QV("p10files",2==currentDevicePanel);var n=[];0!=currentDevicePanel&&n.push({n:"General",f:"setupDeviceMenu(0)"}),1!=currentDevicePanel&&null!=currentNode&&(8&o||256&o)&&(1==meshes[currentNode.meshid].mtype&&("number"!=typeof currentNode.intelamt.sku||0!=(8&currentNode.intelamt.sku))||currentNode.agent&&1&currentNode.agent.caps)&&n.push({n:"Desktop",f:"setupDeviceMenu(1)"}),2!=currentDevicePanel&&null!=currentNode&&8&o&&(4294967295==o||0==(1024&o))&&2==currentNode.mtype&&4&currentNode.agent.caps&&n.push({n:"Files",f:"setupDeviceMenu(2)"}),updateFooterMenu(n)}function deviceActionFunction(){if(!xxdialogMode){var e=meshes[currentNode.meshid].links[userinfo._id].rights,t="Select an operation to perform on this device.<br /><br />",o="<select id=d2deviceop style=float:right;width:170px>";0!=(64&e)&&(o+="<option value=100>Wake-up</option>"),0!=(8&e)&&(o+="<option value=4>Sleep</option><option value=3>Reset</option><option value=2>Power off</option>"),setDialogMode(2,"Device Action",3,deviceActionFunctionEx,t+=addHtmlValue("Operation",o+="</select>"))}}function deviceActionFunctionEx(){var e=Q("d2deviceop").value;100==e?meshserver.send({action:"wakedevices",nodeids:[currentNode._id]}):meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:e})}function updateDeviceTimeline(){2==meshserver.State&&null!=powerTimelineNode&&null!=powerTimelineUpdate&&null!=currentNode&&powerTimelineNode==powerTimelineReq&&currentNode._id==powerTimelineNode&&powerTimelineUpdate<Date.now()&&(powerTimelineUpdate=null,meshserver.send({action:"powertimeline",nodeid:currentNode._id}))}function drawDeviceTimeline(){var e=null,t=Date.now();currentNode._id==powerTimelineNode&&(e=powerTimeline);var o=new Date;o.setHours(0,0,0,0);(o=new Date(o.getTime()-5184e5)).getTime();var n=[];if(null!=e&&1<e.length){n.push([0,e[1],e[0]]);for(var i=e[1],a=2;a<e.length;a+=2){var s=e[a],l=t;e.length>a+1&&(l=e[a+1]),n.push([i,i+l,s]),i+=l}}var r="",d=1,p=new Date,c=Q("masthead").offsetWidth-122;p.setHours(0,0,0,0);for(a=0;a<7;a++){var u="",m=p.getTime(),h=m+864e5;for(var f in n){var g=n[f];if(1==isTimeBlockInside(m,h,g[0],g[1])){var v=Math.max(m,g[0]),k=Math.min(Math.min(h,g[1]),t),y=Math.round((k-v)*c/864e5);0<y&&(u+="<div style=display:table-cell;width:"+y+"px;background-color:"+powerColor(g[2])+";height:16px></div>")}}r+="<tr style="+(d%2==0?"background-color:#DDD":"")+"><td><div>&nbsp;"+printDate(p)+"<div></div></div></td><td><div>"+u+"</div></td></tr>",++d,p=new Date(p.getTime()-864e5)}QH("p10html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse;width:calc(100% - 18px);margin:9px" border=0 cellpadding=2 cellspacing=0><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:90px>Day</th><th scope=col style=text-align:center>Power State</th></tr>'+r+"</tbody></table>")}function powerColor(e){return e<powerColorTable.length?powerColorTable[e]:"yellow"}function isTimeBlockInside(e,t,o,n){return o<e&&t<n||(e<o&&o<t||e<n&&n<t)}function addDeviceAttribute(e,t){return"<tr><td style=width:100px;color:gray>"+e+"</td><td style=overflow:hidden>"+t+"</td></tr>"}function editDeviceAmtSettings(e,t){if(!xxdialogMode){var o="",n=getNodeFromId(e),i=3;0!=(4&getNodeRights(e))&&(o+=addHtmlValue("Username",'<input id=dp10username style=width:170px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />'),o+=addHtmlValue("Password","<input id=dp10password type=password style=width:170px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />"),o+=addHtmlValue("Security","<select id=dp10tls style=width:176px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>"),null!=n.intelamt.user&&""!=n.intelamt.user&&(i=7),setDialogMode(2,"Edit Intel&reg; AMT credentials",i,editDeviceAmtSettingsEx,o,{node:n,func:t}),null!=n.intelamt.user&&""!=n.intelamt.user?Q("dp10username").value=n.intelamt.user:Q("dp10username").value="admin",Q("dp10tls").value=n.intelamt.tls,validateDeviceAmtSettings())}}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(e,t){if(2==e)meshserver.send({action:"changedevice",nodeid:t.node._id,intelamt:{user:"",pass:""}});else{var o=Q("dp10username").value;""==o&&(o="admin");var n=Q("dp10password").value;""==n&&(o=""),meshserver.send({action:"changedevice",nodeid:t.node._id,intelamt:{user:o,pass:n,tls:Q("dp10tls").value}}),t.node.intelamt.user=o,t.node.intelamt.tls=Q("dp10tls").value,t.func&&setTimeout(t.func,300)}}function p10showDeleteNodeDialog(e){xxdialogMode||(setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,format("Delete {0}?",EscapeHtml(currentNode.name))+"<br /><br /><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm",e),p10validateDeleteNodeDialog())}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(e,t){meshserver.send({action:"removedevices",nodeids:[t]})}function p10showiconselector(){if(!xxdialogMode&&0!=(4&meshes[currentNode.meshid].links[userinfo._id].rights)){"<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>","<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>","<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div><br>","<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>","<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>","<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div></table>",setDialogMode(2,"Icon Selection",0,null,"<table align=center><td><div style=display:inline-block class=i1 onclick=p10setIcon(1)></div><div style=display:inline-block class=i2 onclick=p10setIcon(2)></div><div style=display:inline-block class=i3 onclick=p10setIcon(3)></div><br><div style=display:inline-block class=i4 onclick=p10setIcon(4)></div><div style=display:inline-block class=i5 onclick=p10setIcon(5)></div><div style=display:inline-block class=i6 onclick=p10setIcon(6)></div></table>"),QV("id_dialogclose",!0)}}function p10setIcon(e){setDialogMode(0),meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:e})}var desktop,desktopNode,showEditNodeValueDialog_modes=["Device Name","Hostname","Description","Tags"],showEditNodeValueDialog_modes2=["name","host","desc","tags"],showEditNodeValueDialog_modes3=["","","","Group1, Group2, Group3"];function showEditNodeValueDialog(e){if(!xxdialogMode){setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,addHtmlValue(showEditNodeValueDialog_modes[e],'<input id=dp10devicevalue style=width:170px maxlength=64 placeholder="'+showEditNodeValueDialog_modes3[e]+'" onchange=p10editdevicevalueValidate('+e+",event) onkeyup=p10editdevicevalueValidate("+e+",event) />"),e);var t=currentNode[showEditNodeValueDialog_modes2[e]];null==t&&(t=""),Array.isArray(t)&&(t=t.join(", ")),Q("dp10devicevalue").value=t,p10editdevicevalueValidate(),Q("dp10devicevalue").focus()}}function showEditNodeValueDialogEx(e,t){var o={action:"changedevice",nodeid:currentNode._id};o[showEditNodeValueDialog_modes2[t]]=Q("dp10devicevalue").value,meshserver.send(o)}function p10editdevicevalueValidate(e,t){var o=1<e||0<Q("dp10devicevalue").value.length;QE("idx_dlgOkButton",o),null!=t&&1==o&&13==t.keyCode&&dialogclose(1)}var desktopsettings={encoding:2,showfocus:!1,showmouse:!0,showcad:!0,quality:40,scaling:1024,framerate:50};function setupDesktop(){desktopNode!=currentNode&&null!=desktop&&(desktop.Stop(),desktop=desktopNode=null),desktopNode==currentNode&&null!=desktop||(QH("DeskParent",'<canvas id=Desk width=640 height=200 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>'),desktopNode=currentNode,Q("Desk").addEventListener("DOMMouseScroll",function(e){return dmousewheel(e)}),Q("Desk").addEventListener("mousewheel",function(e){return dmousewheel(e)})),desktopNode=currentNode,updateDesktopButtons(),Q("Desk").toBlob||QV("deskSaveBtn",!1)}function updateDesktopButtons(){var e=meshes[currentNode.meshid],t=0;null!=desktop&&(t=desktop.State);var o=e.links[userinfo._id].rights;QV("disconnectbutton1",0!=t),QV("connectbutton1",0==t&&2==e.mtype&&(8&o||256&o)),QV("connectbutton1h",0==t&&8&o&&(1==e.mtype||null!=currentNode.intelamt&&2==currentNode.intelamt.state&&null!=currentNode.intelamt.ver&&"number"==typeof currentNode.intelamt.sku&&0!=(8&currentNode.intelamt.sku))),QV("d7amtkvm",!(null==currentNode.intelamt||null==currentNode.intelamt.ver&&1!=e.mtype||0!=t&&2!=desktop.contype)),QV("d7meshkvm",2==e.mtype&&(0==t||1==desktop.contype));var n=0!=(1&currentNode.conn);QE("connectbutton1",n);var i=0!=(6&currentNode.conn);QE("connectbutton1h",i),QV("DeskToastButton",0!=(16384&o)&&currentNode.agent&&currentNode.agent.id<5&&8&o),QV("deskActionsBtn",8&o),Q("DeskControl").checked=0!=(8&o),0==n&&QV("DeskTools",!1)}function connectDesktop(e,t){if(setSessionActivity(),null==desktop)if(desktopNode=currentNode,2==t){if(null==desktopNode.intelamt.user||""==desktopNode.intelamt.user)return void editDeviceAmtSettings(desktopNode._id,connectDesktop);(desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"),authCookie)).debugmode=debugmode,desktop.onStateChanged=onDesktopStateChange,desktop.m.bpp=1==desktopsettings.encoding||3==desktopsettings.encoding?1:2,desktop.m.useZRLE=desktopsettings.encoding<3,desktop.m.showmouse=desktopsettings.showmouse,desktop.m.onScreenSizeChange=deskAdjust,desktop.Start(desktopNode._id,16994,"*","*",0),desktop.contype=2}else(desktop=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("Desk"),serverPublicNamePort,authCookie,authRelayCookie,domainUrl)).debugmode=debugmode,desktop.m.debugmode=debugmode,desktop.attemptWebRTC=attemptWebRTC,desktop.onStateChanged=onDesktopStateChange,desktop.m.CompressionLevel=desktopsettings.quality,desktop.m.ScalingLevel=desktopsettings.scaling,desktop.m.FrameRateTimer=desktopsettings.framerate,desktop.m.onDisplayinfo=deskDisplayInfo,desktop.m.onScreenSizeChange=deskAdjust,desktop.Start(desktopNode._id),desktop.contype=1;else desktop.Stop(),desktopNode=desktop=null}function onDesktopStateChange(e,t){var o=t;3==o&&2==e.contype&&o++;var n=StatusStrs[o];switch(null!=desktop&&1==desktop.webRtcActive&&(n+=", WebRTC"),QH("deskstatus",n),t){case 0:desktop.Stop(),desktopNode=desktop=null,QV("termdisplays",!1),1==fullscreen&&deskToggleFull()}updateDesktopButtons(),deskAdjust(),setTimeout(deskAdjust,50)}function showDesktopSettings(){xxdialogMode||(applyDesktopSettings(),updateDesktopButtons(),setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged))}function showDesktopSettingsChanged(){desktopsettings.encoding=d7desktopmode.value,desktopsettings.showfocus=d7showfocus.checked,desktopsettings.showmouse=d7showcursor.checked,desktopsettings.quality=d7bitmapquality.value,desktopsettings.scaling=d7bitmapscaling.value,desktopsettings.framerate=d7framelimiter.value,localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings)),applyDesktopSettings(),desktop&&(1==desktop.contype&&0!=desktop.State&&desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate),2==desktop.contype&&0!=desktop.State&&(desktop.Stop(),setTimeout(function(){connectDesktop(null,2)},50)))}function applyDesktopSettings(){var e="",t=512&features?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1];for(var o in t)e+="<option value="+t[o]+">"+t[o]+"%</option>";QH("d7bitmapquality",e),d7desktopmode.value=desktopsettings.encoding,d7showfocus.checked=desktopsettings.showfocus,d7showcursor.checked=desktopsettings.showmouse,d7bitmapquality.value=40,0<=t.indexOf(parseInt(desktopsettings.quality))&&(d7bitmapquality.value=desktopsettings.quality),d7bitmapscaling.value=desktopsettings.scaling,desktopsettings.framerate&&(d7framelimiter.value=desktopsettings.framerate)}var fullscreen=!1;function deskAdjust(){var e=(Q("DeskParent").clientHeight-Q("Desk").clientHeight)/2;if(e<0){var t=Q("DeskParent").clientHeight,o=9999;desktop&&(o=desktop.m.width/desktop.m.height*t),QS("Desk")["max-height"]=t+"px",QS("Desk")["max-width"]=o+"px",e=0}else QS("Desk")["max-height"]=null,QS("Desk")["max-width"]=null;QS("Desk")["margin-top"]=e+"px",QS("Desk")["margin-bottom"]=e+"px"}function deskSendKeys(){if(!xxdialogMode&&null!=desktop&&3==desktop.State){var e=Q("deskkeys").value;0==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[65364,1],[65364,0],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,91]]):1==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[65362,1],[65362,0],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,91]]):2==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[108,1],[108,0],[65511,0]]):desktop.sendCtrlMsg('{"action":"lock"}'):3==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[109,1],[109,0],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91]]):4==e?2==desktop.contype?desktop.m.sendkey([[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91],[desktop.m.KeyAction.UP,16]]):5==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.EXUP,91]]):6==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[114,1],[114,0],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,82],[desktop.m.KeyAction.UP,82],[desktop.m.KeyAction.EXUP,91]]):7==e?2==desktop.contype?desktop.m.sendkey([[65513,1],[65473,1],[65473,0],[65513,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,18],[desktop.m.KeyAction.DOWN,115],[desktop.m.KeyAction.UP,115],[desktop.m.KeyAction.EXUP,18]]):8==e?2==desktop.contype?desktop.m.sendkey([[65507,1],[119,1],[119,0],[65507,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,17],[desktop.m.KeyAction.DOWN,87],[desktop.m.KeyAction.UP,87],[desktop.m.KeyAction.EXUP,17]]):9==e?2==desktop.contype?desktop.m.sendkey([[65513,1],[65289,1],[65289,0],[65513,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,18],[desktop.m.KeyAction.DOWN,9],[desktop.m.KeyAction.UP,9],[desktop.m.KeyAction.EXUP,18]]):10==e?desktop.m.sendcad():11==e&&(2==desktop.contype?desktop.m.sendkey([[65289,1],[65289,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,9],[desktop.m.KeyAction.UP,9]]))}}function sendSpecialKeys(){xxdialogMode||null==desktop||3!=desktop.State||setDialogMode(3,"Special Keys",3,deskSendKeys)}function toggleSoftKeys(e){QV("DeskSoftInput",1==e),1==e&&Q("DeskSoftInput").focus()}function toggleDeskTools(){setSessionActivity(),xxdialogMode||("none"==QS("DeskTools").display?(QV("DeskTools",!0),Q("DeskTools").nodeid=currentNode._id,refreshDeskTools()):QV("DeskTools",!1))}function refreshDeskTools(){setSessionActivity(),QV("DeskToolsRefreshButton",!1),setTimeout(refreshDeskToolsEx,500),meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",!0)}var filesNode,deskTools={sort:1,msg:null};function sortProcess(e){deskTools.sort=e,showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(e,t){return e.p>t.p?1:e.p<t.p?-1:0}function sortProcessName(e,t){return e.d>t.d?1:e.d<t.d?-1:0}function showDeskToolsProcesses(e){if(null!=(deskTools.msg=e)){if(Q("DeskTools").nodeid==e.nodeid){var t=[],o=null;try{o=JSON.parse(e.value)}catch(e){}if(console.log(o),null!=o){for(var n in o)t.push({p:parseInt(n),c:o[n].cmd,d:o[n].cmd.toLowerCase(),u:o[n].user});0==deskTools.sort?t.sort(sortProcessPid):1==deskTools.sort&&t.sort(sortProcessName);var i="";for(var a in t)0!=t[a].p&&(i+="<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>"+t[a].p+"</div><a style=float:right;padding-right:5px;cursor:pointer onclick=stopProcess("+t[a].p+',"'+t[a].c+'")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>'+(t[a].u?t[a].u:"")+"</div><div>"+t[a].c+"</div></div>");QH("DeskToolsProcesses",i)}}}else QH("DeskToolsProcesses","")}function deskSaveImage(){if(setSessionActivity(),!xxdialogMode&&null!=desktop&&3==desktop.State){var e=new Date,t="Desktop-"+currentNode.name+"-"+e.getFullYear()+"-"+("0"+(e.getMonth()+1)).slice(-2)+"-"+("0"+e.getDate()).slice(-2)+"-"+("0"+e.getHours()).slice(-2)+"-"+("0"+e.getMinutes()).slice(-2);Q("Desk").toBlob(function(e){saveAs(e,t+".jpg")})}}function deskDisplayInfo(e,t,o,n){var i=Q("termdisplays").value;if(0<t.length){var a="";for(var s in t)a+="<option"+(i==t[s]?" selected":"")+">"+t[s]+"</option>";QH("termdisplays",a)}QV("termdisplays",0<t.length)}function deskGetDisplayNumbers(e){desktop.m.GetDisplayNumbers()}function deskSetDisplay(e){setSessionActivity();var t=0,o=Q("termdisplays").value;t="All Displays"==o?65535:parseInt(o.substring(8)),desktop.m.SetDisplay(t)}function dmousedown(e){setSessionActivity(),xxdialogMode||null==desktop||desktop.m.mousedown(e)}function dmouseup(e){setSessionActivity(),xxdialogMode||null==desktop||desktop.m.mouseup(e)}function dmousemove(e){setSessionActivity(),xxdialogMode||null==desktop||desktop.m.mousemove(e)}function dmousewheel(e){return setSessionActivity(),!(xxdialogMode||null==desktop||!desktop.m.mousewheel)&&(desktop.m.mousewheel(e),haltEvent(e),!0)}function drotate(e){xxdialogMode||null==desktop||(desktop.m.setRotation(desktop.m.rotation+e),deskAdjust(),deskAdjust())}function stopProcess(e,t){return setDialogMode(2,"Process Control",3,stopProcessEx,format('Stop process #{0} "{1}"?',e,t),e),!1}function stopProcessEx(e,t){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:t}),setTimeout(refreshDeskTools,300)}function setupFiles(){var e=filesNode==currentNode,t=0!=(1&(filesNode=currentNode).conn);QE("p13Connect",t),0!=e&&0!=t||!files||(files.Stop(),files=null)}function onFilesStateChange(e,t){setSessionActivity(),p13Connect.value=0==t?"Connect":"Disconnect";var o=StatusStrs[t];switch(1==files.webRtcActive&&(o+=", WebRTC"),Q("p13Status").textContent=o,t){case 0:QH("p13files",""),p13filetree=null,p13filetreelocation=[],QH("p13currentpath",""),QE("p13FolderUp",!1),p13setActions(),null!=files&&(files.Stop(),files=null);break;case 3:p13targetpath="",files.sendText({action:"ls",reqid:1,path:""})}}function CreateRemoteFiles(e){var t={protocol:5};return t.onFileUpdate=e,t.xxStateChange=function(e){},t.ProcessData=function(e){t.onFileUpdate(e)},t}var autoConnectFilesTimer=null;function autoConnectFiles(e){autoConnectFilesTimer=null==autoConnectFilesTimer?setInterval(connectFiles,100):(clearInterval(autoConnectFilesTimer),null)}function connectFiles(e){files?(files.Stop(),files=null):((files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort,authCookie,authRelayCookie,domainUrl)).attemptWebRTC=attemptWebRTC,files.onStateChanged=onFilesStateChange,files.Start(filesNode._id)),p13clipboard=p13clipboardFolder=null,p13clipboardCut=0,p13updateClipview()}var p13sortorder,p13filetree=null,p13targetpath=null,p13filetreelocation=[];function p13gotFiles(e){if(setSessionActivity(),0<e.length&&123!=e.charCodeAt(0))p13gotDownloadBinaryData(e);else if("download"!=(e=JSON.parse(decode_utf8(e))).action)if(e.path=e.path.replace(/\//g,"\\"),null!=p13filetree&&e.path==p13filetree.path){var t=p13getCheckedNames();p13filetree=e,p13updateFiles(t)}else{for(var o=e.path.replace(/\//g,"\\"),n=p13targetpath.replace(/\//g,"\\");0<o.length&&"\\"==o[0];)o=o.substring(1);for(;0<n.length&&"\\"==n[0];)n=n.substring(1);(o==n||"\\"==e.path&&""==p13targetpath)&&(p13filetree=e,p13updateFiles())}else p13gotDownloadCommand(e)}function p13getCheckedNames(){for(var e=[],t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked&&e.push(p13filetree.dir[t[o].value].n);return e}function p13updateFiles(e){var t="",o="",n="<a style=cursor:pointer onclick=p13folderup(0)>Root</a>",i=p13filetree.path.split("\\");for(var a in p13filetreelocation=[],i)""!=i[a]&&p13filetreelocation.push(i[a]);for(var a in p13filetreelocation)n+=" / <a style=cursor:pointer onclick=p13folderup("+(parseInt(a)+1)+")>"+p13filetreelocation[a]+"</a>";var s=p13filetreelocation.join("/"),l=p13sort_files(p13filetree.dir);for(var a in l){var r,d=l[a],p=d.n;r=70<(r=p).length?EscapeHtml(p.substring(0,70))+"...":EscapeHtml(p),p=EscapeHtml(p);var c="";null!=d.s&&(c=getFileSizeStr(d.s));var u="";if(d.t<3){u="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span style=float:right></span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p13folderset("'+encodeURIComponent(d.nx)+'")>'+r+"</a></span></div>"}else{var m=r;0<d.s&&(m='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick="p13downloadfile(\''+encodeURIComponent(s+"/"+p)+"','"+encodeURIComponent(p)+"',"+d.s+')">'+r+"</a>"),u="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span style=float:right;padding-right:4px>"+c+"</span><span><div class=fileIcon"+d.t+"></div>"+m+"</span></div>"}d.t<3?t+=u:o+=u}if(QH("p13files",t+o),QH("p13currentpath",n),QE("p13FolderUp",0!=p13filetreelocation.length),null!=e){var h=document.getElementsByName("fd");for(a=0;a<h.length;a++)0<=e.indexOf(p13filetree.dir[h[a].value].n)&&(h[a].checked=!0)}p13setActions()}function p13folderset(e){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[e].n).split("\\").join("/"),files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(e){if(null==e)p13filetreelocation.pop();else for(;p13filetreelocation.length>e;)p13filetreelocation.pop();p13targetpath=p13filetreelocation.join("/"),files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13sort_filename(e,t){return e.ln>t.ln?1*p13sortorder:e.ln<t.ln?-1*p13sortorder:0}function p13sort_timestamp(e,t){return e.d>t.d?1*p13sortorder:e.d<t.d?-1*p13sortorder:0}function p13sort_bysize(e,t){return e.s==t.s?p13sort_filename(e,t):(e.s-t.s)*p13sortorder}function p13sort_files(e){var t=[],o=Q("p13sortdropdown").value;for(var n in e)e[n].nx=n,null==e[n].s&&(e[n].s=0),null==e[n].n&&(e[n].n=n),e[n].ln=e[n].n.toLowerCase(),t.push(e[n]);return p13sortorder=1,3<o&&(p13sortorder=-1,o-=3),1==o?t.sort(p13sort_filename):2==o?t.sort(p13sort_bysize):3==o&&t.sort(p13sort_timestamp),t}function p13setActions(){if(null==p13filetree)QE("p13DeleteFileButton",!1),QE("p13NewFolderButton",!1),QE("p13UploadButton",!1),QE("p13RenameFileButton",!1),QE("p13SelectAllButton",!1),Q("p13SelectAllButton").value="All",QE("p13RefreshButton",!1),QE("p13CutButton",!1),QE("p13CopyButton",!1),QE("p13PasteButton",!1);else{var e=p13getFileSelCount(),t=p13getFileCount(),o=p13getFileSelCount(!1),n=0<currentNode.agent.id&&currentNode.agent.id<5;QE("p13DeleteFileButton",0<e&&(0<p13filetreelocation.length||0==n)),QE("p13NewFolderButton",0<p13filetreelocation.length||0==n),QE("p13UploadButton",0<p13filetreelocation.length||0==n),QE("p13RenameFileButton",1==e&&(0<p13filetreelocation.length||0==n)),QE("p13SelectAllButton",0<t),Q("p13SelectAllButton").value=0<e?"None":"All",QE("p13RefreshButton",!0),QE("p13CutButton",0<e&&e==o&&(0<p13filetreelocation.length||0==n)),QE("p13CopyButton",0<e&&e==o&&(0<p13filetreelocation.length||0==n)),QE("p13PasteButton",(0<p13filetreelocation.length||0==n)&&null!=p13clipboard&&0<p13clipboard.length)}}function p13getFileSelCount(e){for(var t=0,o=document.getElementsByName("fd"),n=0;n<o.length;n++)!o[n].checked||0==e&&"3"!=o[n].attributes.file.value||t++;return t}function p13getFileSelDirCount(){for(var e=0,t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked&&"999"==t[o].attributes.file.value&&e++;return e}function p13getFileCount(){return document.getElementsByName("fd").length}function p13selectallfile(){for(var e=0==p13getFileSelCount(),t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked=e;p13setActions()}function p13createfolder(){setDialogMode(2,"New Folder",3,p13createfolderEx,"<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />"),focusTextBox("p13renameinput"),p13fileNameCheck()}function p13createfolderEx(){files.sendText({action:"mkdir",reqid:1,path:p13filetreelocation.join("/")+"/"+Q("p13renameinput").value}),p13folderup(999)}function p13deletefile(){var e=p13getFileSelCount(),t=0<p13getFileSelDirCount()?"<br /><br /><label><input type=checkbox id=p13recdeleteinput>Recursive delete</label><br>":"<input type=checkbox id=p13recdeleteinput style='display:none'>";setDialogMode(2,"Delete",3,p13deletefileEx,1<e?format("Delete {0} selected items?",e)+t:"Delete selected item?"+t)}function p13deletefileEx(){for(var e=[],t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked&&e.push(p13filetree.dir[t[o].value].n);files.sendText({action:"rm",reqid:1,path:p13filetreelocation.join("/"),delfiles:e,rec:Q("p13recdeleteinput").checked}),p13folderup(999)}function p13renamefile(){for(var e,t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked&&(e=p13filetree.dir[t[o].value].n);setDialogMode(2,"Rename",3,p13renamefileEx,'<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="'+e+'" />',{action:"rename",path:p13filetreelocation.join("/"),oldname:e}),focusTextBox("p13renameinput"),p13fileNameCheck()}function p13renamefileEx(e,t){t.newname=Q("p13renameinput").value,files.sendText(t),p13folderup(999)}function p13fileNameCheck(e){var t=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",t),1==t&&null!=e&&13==e.keyCode&&dialogclose(1)}function p13uploadFile(){setDialogMode(2,"Upload File",3,p13uploadFileEx,"<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p13uploadinput')\" />"),updateUploadDialogOk("p13uploadinput")}function p13uploadFileEx(){p13doUploadFiles(Q("p13uploadinput").files)}function p13viewfile(){for(var e=document.getElementsByName("fd"),t=0;t<e.length;t++)if(e[t].checked){p13filetree.dir[e[t].value].s<=204800?p13downloadfile(encodeURIComponent(p13filetreelocation.join("/")+"/"+p13filetree.dir[e[t].value].n),encodeURIComponent(p13filetree.dir[e[t].value].n),p13filetree.dir[e[t].value].s,"viewer"):messagebox("File Editor","Only files less than 200k can be edited.");break}}var downloadFile,uploadFile,currentMesh,p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(e){var t=document.getElementsByName("fd");p13clipboard=[],p13clipboardCut=e,p13clipboardFolder=p13targetpath;for(var o=0;o<t.length;o++)t[o].checked&&"3"==t[o].attributes.file.value&&p13clipboard.push(p13filetree.dir[t[o].value].n);p13updateClipview()}function p13pasteFile(){var e="";null!=p13clipboard&&0<p13clipboard.length&&(e=0==p13clipboardCut?1<p13clipboard.length?format("Confirm copy of {0} entries's to this location?",p13clipboard.length):format("Confirm copy of 1 entrie to this location?"):1<p13clipboard.length?format("Confirm move of {0} entries's to this location?",p13clipboard.length):format("Confirm move of 1 entrie to this location?")),setDialogMode(2,"Paste",3,p13pasteFileEx,e)}function p13pasteFileEx(){files.sendText({action:0==p13clipboardCut?"copy":"move",reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard}),p13folderup(999),1==p13clipboardCut&&(p13clipboardFolder=p13clipboard=null,p13clipboardCut=0,p13updateClipview())}function p13updateClipview(){var e="";null!=p13clipboard&&0<p13clipboard.length&&(e=0==p13clipboardCut?1<p13clipboard.length?format('Holding {0} entries for copy, <a href=# onclick="return p13clearClip()" style=cursor:pointer>Clear</a>.',p13clipboard.length):format('Holding 1 entrie for copy, <a href=# onclick="return p13clearClip()" style=cursor:pointer>Clear</a>.'):1<p13clipboard.length?format('Holding {0} entries for move, <a href=# onclick="return p13clearClip()" style=cursor:pointer>Clear</a>.',p13clipboard.length):format('Holding 1 entrie for move, <a href=# onclick="return p13clearClip()" style=cursor:pointer>Clear</a>.')),QH("p13bottomstatus",e),p13setActions()}function p13clearClip(){return p13clipboardFolder=p13clipboard=null,p13clipboardCut=0,p13updateClipview(),!1}function updateUploadDialogOk(e){QE("idx_dlgOkButton",""!=Q(e).value)}function getFileSelCount(e){for(var t=0,o=document.getElementsByName("fc"),n=0;n<o.length;n++)!o[n].checked||0==e&&"3"!=o[n].attributes.file.value||t++;return t}function getFileCount(){return document.getElementsByName("fc").length}function p13downloadfile(e,t,o){xxdialogMode||downloadFile||!files||(downloadFile={path:decodeURIComponent(e),file:decodeURIComponent(t),size:o,tsize:0,data:"",state:0,id:Math.random()},files.sendText({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path}),setDialogMode(2,"Download File",10,p13downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+o+" />"))}function p13downloadFileCancel(){setDialogMode(0),files.sendText({action:"download",sub:"cancel",id:downloadFile.id}),downloadFile=null}function p13gotDownloadCommand(e){null!=downloadFile&&e.id==downloadFile.id&&("start"==e.sub?(downloadFile.state=1,files.sendText({action:"download",sub:"startack",id:downloadFile.id})):"cancel"==e.sub&&(downloadFile=null,setDialogMode(0)))}function p13gotDownloadBinaryData(e){downloadFile&&0!=downloadFile.state&&(4<e.length&&(downloadFile.tsize+=e.length-4,downloadFile.data+=e.substring(4),Q("d2progressBar").value=downloadFile.tsize),0!=(1&ReadInt(e,0))?(saveAs(data2blob(downloadFile.data),downloadFile.file),downloadFile=null,setDialogMode(0)):files.sendText({action:"download",sub:"ack",id:downloadFile.id}))}function p13doUploadFiles(e){xxdialogMode||((uploadFile={}).xpath=p13filetreelocation.join("/"),uploadFile.xfiles=e,uploadFile.xfilePtr=-1,setDialogMode(2,"Upload File",10,p13uploadFileCancel,"<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />"),p13uploadReconnect())}function onFileUploadStateChange(e,t){switch(t){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break;default:console.log("Unknown onFileUploadStateChange state",t)}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort,authCookie,authRelayCookie,domainUrl),uploadFile.ws.attemptWebRTC=!1,uploadFile.ws.ctrlMsgAllowed=!1,uploadFile.ws.onStateChanged=onFileUploadStateChange,uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){if(uploadFile.xfilePtr++,uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var e=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",e.name),Q("d2progressBar").max=e.size,Q("d2progressBar").value=0,uploadFile.xreader=new FileReader,uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result,uploadFile.ws.sendText({action:"upload",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:e.name,size:uploadFile.xdata.byteLength})},uploadFile.xreader.readAsArrayBuffer(e)}else p13uploadFileCancel()}function p13uploadFileCancel(e,t){null!=uploadFile&&(null!=uploadFile.ws&&(uploadFile.ws.Stop(),uploadFile.ws=null),uploadFile=null),setDialogMode(0)}function p13gotUploadData(e){var t=JSON.parse(e);if(null!=uploadFile&&parseInt(uploadFile.xfilePtr)==parseInt(t.reqid))if("uploadstart"==t.action){p13uploadNextPart(!1);for(var o=0;o<8;o++)p13uploadNextPart(!0)}else"uploadack"==t.action?p13uploadNextPart(!1):"uploaderror"==t.action&&p13uploadFileCancel()}function p13uploadNextPart(e){var t=uploadFile.xdata,o=uploadFile.xptr,n=uploadFile.xptr+4096;if(n>t.byteLength){if(1==e)return;n=t.byteLength}if(o==t.byteLength)null!=uploadFile.ws&&(uploadFile.ws.Stop(),uploadFile.ws=null),uploadFile.xfiles.length>uploadFile.xfilePtr+1?p13uploadReconnect():p13uploadFileCancel();else{var i=t.slice(o,n);uploadFile.ws.send(i),uploadFile.xptr=n,Q("d2progressBar").value=n}}function p20updateMesh(){if(null!=currentMesh){QH("p20meshName",EscapeHtml(currentMesh.name));var e=format("Unknown #{0}",currentMesh.mtype),t=currentMesh.links[userinfo._id].rights;1==currentMesh.mtype&&(e="Intel&reg; AMT only, no agent"),2==currentMesh.mtype&&(e="Managed using a software agent");var o="";o+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",0!=(1&t))),o+=addHtmlValue("Description",addLinkConditional(currentMesh.desc&&""!=currentMesh.desc?EscapeHtml(currentMesh.desc):"<i>None</i>","p20editmesh(2)",0!=(1&t))),o+=addHtmlValue("Type",e),o+="<br style=clear:both><br>";var n=currentMesh.links[userinfo._id];n&&0!=(2&n.rights)&&(o+="<div style=margin-bottom:6px><a onclick=p20showAddMeshUserDialog() style=cursor:pointer><img src=images/icon-addnew.png border=0 height=12 width=12> Add User</a></div>"),o+='<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>User Authorizations</th></tr>';var i=1,a=[];for(var s in currentMesh.links)a.push({id:s,name:s.split("/")[2],rights:currentMesh.links[s].rights});for(var s in a.sort(function(e,t){return e.name>t.name?1:e.name<t.name?-1:0}),a){var l="",r="Partial Rights",d=a[s].rights;4294967295==d?r="Full Administrator":0==d&&(r="No Rights"),s==userinfo._id||4294967295!=t&&0==(2&t)||(l='<a onclick=p20deleteUser(event,"'+encodeURIComponent(a[s].id)+'") style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'),o+='<tr onclick=p20viewuser("'+encodeURIComponent(a[s].id)+'") style=height:32px;cursor:pointer'+(i%2==0?";background-color:#DDD":"")+"><td>",o+="<div style=float:right>"+l+"</div><div style=float:right;padding-right:4px>"+r+"</div><div class=m2></div><div>&nbsp;"+EscapeHtml(decodeURIComponent(a[s].name))+"<div></div></div>",o+="</td></tr>",++i}o+="</tbody></table>",4294967295==t&&(o+="<div style=font-size:small;text-align:right;margin-top:6px><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Group</a></span></div>"),QH("p20info",o)}}function p20showDeleteMeshDialog(){if(xxdialogMode)return!1;var e=format("Are you sure you want to delete group {0}? Deleting the device group will also delete all information about devices within this group.",EscapeHtml(currentMesh.name))+"<br /><br />";return setDialogMode(2,"Delete Group",3,p20showDeleteMeshDialogEx,e+="<label><input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm</label>"),p20validateDeleteMeshDialog(),!1}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(e,t){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(e){if(!xxdialogMode){var t=addHtmlValue("Name","<input id=dp20meshname style=width:170px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />");setDialogMode(2,"Edit Device Group",3,p20editmeshEx,t+=addHtmlValue("Description","<input id=dp20meshdesc style=width:170px maxlength=1024 onkeyup=p20editmeshValidate() />")),Q("dp20meshname").value=currentMesh.name,currentMesh.desc&&(Q("dp20meshdesc").value=currentMesh.desc),p20editmeshValidate(),2==e?Q("dp20meshdesc").focus():Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",0<Q("dp20meshname").value.length)}function p20showAddMeshUserDialog(){if(!xxdialogMode){var e=addHtmlValue("User","<input id=dp20username style=width:170px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />");e+='<div style="border:2px groove gray;background-color:white;max-height:120px;overflow-y:scroll">',e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Device Group</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Device Group Users</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Device Group Computers</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remoteview style=margin-left:12px>Remote View Only</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotelimitedinput style=margin-left:12px>Limited Input Only</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20noterminal style=margin-left:12px>No Terminal Access</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20nofiles style=margin-left:12px>No File Access</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20noamt style=margin-left:12px>No Intel&reg; AMT</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Mesh Agent Console</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20limitevents>Show Only Own Events</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20chatnotify>Chat & Notify</label><br>",setDialogMode(2,"Add User to Mesh",3,p20showAddMeshUserDialogEx,e+="</div>"),p20validateAddMeshUserDialog(),Q("dp20username").focus()}}function p20validateAddMeshUserDialog(){var e=currentMesh.links[userinfo._id].rights;QE("idx_dlgOkButton",0<Q("dp20username").value.length),QE("p20fulladmin",4294967295==e),QE("p20editmesh",!Q("p20fulladmin").checked&&4294967295==e),QE("p20manageusers",!Q("p20fulladmin").checked),QE("p20managecomputers",!Q("p20fulladmin").checked),QE("p20remotecontrol",!Q("p20fulladmin").checked),QE("p20meshagentconsole",!Q("p20fulladmin").checked),QE("p20meshserverfiles",!Q("p20fulladmin").checked),QE("p20wakedevices",!Q("p20fulladmin").checked),QE("p20editnotes",!Q("p20fulladmin").checked),QE("p20remoteview",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked),QE("p20noterminal",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked),QE("p20nofiles",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked),QE("p20noamt",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked)}function p20showAddMeshUserDialogEx(){var e=0;1==Q("p20fulladmin").checked?e=4294967295:(1==Q("p20editmesh").checked&&(e+=1),1==Q("p20manageusers").checked&&(e+=2),1==Q("p20managecomputers").checked&&(e+=4),1==Q("p20remotecontrol").checked&&(e+=8),1==Q("p20meshagentconsole").checked&&(e+=16),1==Q("p20meshserverfiles").checked&&(e+=32),1==Q("p20wakedevices").checked&&(e+=64),1==Q("p20editnotes").checked&&(e+=128),1==Q("p20remoteview").checked&&(e+=256),1==Q("p20noterminal").checked&&(e+=512),1==Q("p20nofiles").checked&&(e+=1024),1==Q("p20noamt").checked&&(e+=2048)),meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,username:Q("dp20username").value,meshadmin:e})}function p20viewuser(e){if(!xxdialogMode){e=decodeURIComponent(e);var t=[],o=currentMesh.links[userinfo._id].rights,n=currentMesh.links[e].rights;4294967295==n?t.push("Full Administrator"):(0!=(1&n)&&t.push("Edit Device Group"),0!=(2&n)&&t.push("Manage Device Group Users"),0!=(4&n)&&t.push("Manage Device Group Computers"),0!=(8&n)&&t.push("Remote Control"),0!=(16&n)&&t.push("Agent Console"),0!=(32&n)&&t.push("Server Files"),0!=(64&n)&&t.push("Wake Devices"),0!=(128&n)&&t.push("Edit Notes"),0!=(256&n)&&t.push("Remote View Only"),0!=(512&n)&&t.push("No Terminal"),0!=(1024&n)&&t.push("No Files"),0!=(2048&n)&&t.push("No Intel&reg; AMT"),0!=(8&n)&&0!=(4096&n)&&0==(256&n)&&t.push("Limited Input"),0!=(8192&n)&&t.push("Self Events Only"),0!=(16384&n)&&t.push("Chat & Notify")),0==t.length&&t.push("No Rights");var i=1,a=addHtmlValue("User",EscapeHtml(decodeURIComponent(e.split("/")[2])));a+=addHtmlValue("Permissions",t.join(", ")),userinfo._id!=e&&(4294967295==o||0!=(2&o)&&4294967295!=n)&&(i+=4),setDialogMode(2,"Device Group User",i,p20viewuserEx,a,e)}}function p20viewuserEx(e,t){2==e&&setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,format("Confirm removal of user {0}?",t.split("/")[2]),t)}function p20deleteUser(e,t){haltEvent(e),p20viewuserEx(2,decodeURIComponent(t))}function p20viewuserEx2(e,t){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:t})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,xxcurrentView=-1;function go(e){if(setSessionActivity(),!xxdialogMode&&xxcurrentView!=e){updateFooterMenu(),setDialogMode(0);for(var t=0;t<32;t++)QV("p"+t,t==e);xxcurrentView=e}}function setDialogMode(e,t,o,n,i,a){setSessionActivity(),xxdialogMode=e,xxdialogFunc=n,xxdialogButtons=o,xxdialogTag=a,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&o),QV("idx_dlgCancelButton",2&o),QV("id_dialogclose",2&o||8&o),QV("idx_dlgButtonBar",7&o),t&&QH("id_dialogtitle",t);for(var s=1;s<24;s++)QV("dialog"+s,s==e);QV("dialog",e),i&&(2==e?QH("id_dialogOptions",i):QH("id_dialogMessage",i))}function dialogclose(e){setSessionActivity();var t=xxdialogFunc,o=xxdialogButtons,n=xxdialogTag;setDialogMode(),(8&o||e)&&t&&t(e,n)}function putstore(e,t){try{if("undefined"==typeof localStorage||localStorage.getItem(e)==t)return;null==t?localStorage.removeItem(e):localStorage.setItem(e,t)}catch(e){}if("_"!=e[0]){for(var o={},n=0,i=localStorage.length;n<i;++n){var a=localStorage.key(n);"_"!=a[0]&&(o[a]=localStorage.getItem(a))}meshserver.send({action:"userWebState",state:JSON.stringify(o)})}}function getstore(e,t){try{if("undefined"==typeof localStorage)return t;var o=localStorage.getItem(e);return null==o||null==o?t:o}catch(e){return t}}function center(){QS("dialog").left=(getDocWidth()-300)/2+"px",deskAdjust(),deskAdjust()}function messagebox(e,t){QH("id_dialogMessage",t),setDialogMode(1,e,1)}function statusbox(e,t){QH("id_dialogMessage",t),setDialogMode(1,e)}function getDocWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement.clientWidth:document.getElementsByTagName("body")[0].clientWidth}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function haltReturn(e){13==e.keyCode&&haltEvent(e)}function validateEmail(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}function reload(){window.location.href=window.location.href}function getNodeFromId(e){for(var t in nodes)if(nodes[t]._id==e)return nodes[t];return null}function addHtmlValue(e,t){return"<table><td style=width:120px>"+e+"<td><b>"+t+"</b></table>"}function addHtmlValue2(e,t){return"<div><div style=display:inline-block;float:right>"+t+"</div><div style=display:inline-block>"+e+"</div></div>"}function addLink(e,t){return"<a style=cursor:pointer;color:darkblue;text-decoration:none onclick='"+t+"'>&diams; "+e+"</a>"}function addLinkConditional(e,t,o){return o?addLink(e,t):e}function passwordcheck(e){return/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/.test(e)}function getFileSizeStr(e){return 1==e?"1 byte":format("{0} bytes",e)}function joinPaths(){var e=[];for(var t in arguments){var o=arguments[t];if(null!=o&&""!=o){for(;o.endsWith("/")||o.endsWith("\\");)o=o.substring(0,o.length-1);for(;o.startsWith("/")||o.startsWith("\\");)o=o.substring(1);e.push(o)}}return e.join("/")}function focusTextBox(e){setTimeout(function(){Q(e).selectionStart=Q(e).selectionEnd=65535,Q(e).focus()},0)}isFilenameValid=function(){var t=/^[^\\/:\*\?"<>\|]+$/,o=/^\./,n=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function(e){return t.test(e)&&!o.test(e)&&!n.test(e)&&"."!=e[0]}}();function parseUriArgs(){var e,t={},o=window.document.location.href.split(/[\?&|\=]/);for(n in o.splice(0,1),o)switch(n%2){case 0:e=decodeURIComponent(o[n]);break;case 1:t[e]=decodeURIComponent(o[n]);var n=parseInt(t[e]);n==t[e]&&(t[e]=n)}return t}function printDate(e){return e.toLocaleDateString(args.locale)}function printTime(e){return e.toLocaleTimeString(args.locale)}function printDateTime(e){return e.toLocaleString(args.locale)}function format(e){var o=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,t){return void 0!==o[t]?o[t]:e})}function nobreak(e){return e.split(" ").join("&nbsp;")}</script>
\ No newline at end of file
views/default-mobile.handlebars
+2 -2
@@ -568,8 +568,8 @@
568 </div>
569 <div style="height:60px">
570 <div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white">
571 - <label><input type="checkbox" id='d7showfocus'>Show Focus Tool<br></label>
572 - <label><input type="checkbox" id='d7showcursor'>Show Local Mouse Cursor<br</label>>
571 + <label><input type="checkbox" id='d7showfocus' />Show Focus Tool</label><br />
572 + <label><input type="checkbox" id='d7showcursor' />Show Local Mouse Cursor</label><br />
573 </div>
574 <div>Other</div>
575 </div>
views/download-min.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=/styles/style.css media=screen rel=stylesheet title=CSS><title>MeshCentral - Download</title><div id=container style=max-height:100vh><div id=mastheadx></div><div id=masthead style="background:url(logo.png) 0 0;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px><strong><font style=font-size:46px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px><strong><font style=font-size:14px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div></div><div id=page_content style=max-height:calc(100vh-138px)><div id=column_l><h1>Download</h1><p style=margin-left:20px>{{{message}}}</p><br></div><div id=footer><table cellpadding=0 cellspacing=10 style=width:100%><tr><td style=text-align:left><td style=text-align:right>{{{rootCertLink}}} &nbsp;<a href=terms>Terms &amp; Privacy</a></table></div></div></div>
\ No newline at end of file
views/error404-min.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><title>MeshCentral - Terms of use</title><body id=body onload='"undefined"!=typeof startup&&startup()'style=display:none;overflow:hidden><div id=container><div id=masthead class=noselect style="background:url(logo.png) 0 0;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px><strong><font style=font-size:46px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px><strong><font style=font-size:14px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div><p id=logoutControl style="color:#fff;font-size:11px;margin:10px 10px 0">{{{logoutControl}}}</div><div id=page_leftbar><div style=height:16px></div></div><div id=topbar class="noselect style3"style=height:24px;position:relative><div id=uiMenuButton title="User interface selection"onclick=showUserInterfaceSelectMenu()>&diams;<div id=uiMenu style=display:none><div id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"><div class=uiSelector1></div></div><div id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"><div class=uiSelector2></div></div><div id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"><div class=uiSelector3></div></div><div id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode"><div class=uiSelector4></div></div></div></div></div><div id=column_l style="max-height:calc(100vh - 135px);overflow-y:auto"><div style=text-align:center;padding-top:30px;font-size:200px;font-family:Arial;color:#bbb><b>404</b></div><div style=text-align:center;font-size:20px;font-family:Arial;color:#999>This page does not exist</div><div style=text-align:center;padding-top:20px;font-size:20px;font-family:Arial;color:#999><a href=/ style=text-decoration:none><b>Go to main site</b></a></div></div><div id=footer><table cellpadding=0 cellspacing=10 style=width:100%><tr><td style=text-align:left><td style=text-align:right><a href=/ >Back</a></table></div></div><script>"use strict";var uiMode=parseInt(getstore("uiMode",1)),webPageStackMenu=!1,webPageFullScreen=!0,nightMode="1"==getstore("_nightMode","0"),terms="{{{terms}}}";function showUserInterfaceSelectMenu(){Q("uiViewButton1").classList.remove("uiSelectorSel"),Q("uiViewButton2").classList.remove("uiSelectorSel"),Q("uiViewButton3").classList.remove("uiSelectorSel"),Q("uiViewButton4").classList.remove("uiSelectorSel");try{Q("uiViewButton"+uiMode).classList.add("uiSelectorSel")}catch(e){}QV("uiMenu","none"==QS("uiMenu").display),nightMode&&Q("uiViewButton4").classList.add("uiSelectorSel")}function userInterfaceSelectMenu(e){e&&putstore("uiMode",uiMode=e),webPageFullScreen=uiMode<3,webPageStackMenu=!0,toggleFullScreen(0),toggleStackMenu(0),QC("column_l").add("room4submenu")}function toggleNightMode(){(nightMode=!nightMode)?QC("body").add("night"):QC("body").remove("night"),putstore("_nightMode",nightMode?"1":"0")}function toggleFullScreen(e){1===e&&putstore("webPageFullScreen",webPageFullScreen=!webPageFullScreen);0==webPageFullScreen?(QC("body").remove("menu_stack"),QC("body").remove("fullscreen"),QC("body").remove("arg_hide")):QC("body").add("fullscreen"),QV("body",!0)}function toggleStackMenu(e){1==webPageFullScreen&&(1===e&&putstore("webPageStackMenu",webPageStackMenu=!webPageStackMenu),0==webPageStackMenu?QC("body").remove("menu_stack"):QC("body").add("menu_stack"))}function putstore(e,t){try{if("undefined"==typeof localStorage)return;localStorage.setItem(e,t)}catch(e){}}function getstore(e,t){try{if("undefined"==typeof localStorage)return t;var o=localStorage.getItem(e);return null==o||null==o?t:o}catch(e){return t}}""!=terms&&QH("column_l",decodeURIComponent(terms)),QV("column_l",!0),userInterfaceSelectMenu()</script>
\ No newline at end of file
views/error404-mobile-min.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><title>MeshCentral - Terms of use</title><style type=text/css>a{color:#036;text-decoration:underline}#footer a{color:#fff;text-decoration:underline}#footer a:hover{color:#fff;text-decoration:none}</style><body onload='"undefined"!=typeof startup&&startup()'style="overflow-y:hidden;max-width:100%;margin:0;padding:0;border:0;color:#000;font-size:13px;font-family:\'Trebuchet MS\',Arial,Helvetica,sans-serif"><div id=container><div id=masthead style="background:url(logo.png) 0 0;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:4px><strong><font style=font-size:36px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:7px><strong><font style=font-size:12px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div><p>{{{logoutControl}}}</div><div id=page_content style=overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%><div id=column_l style=padding-left:10px;padding-right:10px><div style=text-align:center;padding-top:30px;font-size:100px;font-family:Arial;color:#bbb><b>404</b></div><div style=text-align:center;font-size:16px;font-family:Arial;color:#999>This page does not exist</div><div style=text-align:center;padding-top:16px;font-size:20px;font-family:Arial;color:#999><a href=/ style=text-decoration:none><b>Go to main site</b></a></div></div></div><div id=footer style=height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0><table cellpadding=0 cellspacing=6 style=width:100%><tr><td style=text-align:left;color:#fff>{{{footer}}}<td style=text-align:right>{{{rootCertLink}}}&nbsp;<a href=/ >Back</a></table></div></div>
\ No newline at end of file
views/login-min.handlebars
+1 -1
@@ -1 +1 @@
1 -<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <link rel="shortcut icon" type="image/x-icon" href="{{{domainurl}}}favicon.ico"> <link keeplink="1" type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS"> <script type="text/javascript" src="scripts/u2f-api.js"></script> <title>{{{title}}} - Login</title> </head> <body id="body" onload="if (typeof(startup) !== 'undefined') startup();" class="arg_hide login"> <div id="container"> <div id="masthead"> <div class="title">{{{title}}}</div> <div class="title2">{{{title2}}}</div> </div> <div id="topbar" class="noselect style3" style="height:24px"> <div id="uiMenuButton" title="User interface selection" onclick="showUserInterfaceSelectMenu()"> &diams; <div id="uiMenu" style="display:none"> <div id="uiViewButton1" class="uiSelector" onclick="userInterfaceSelectMenu(1)" title="Left bar interface"><div class="uiSelector1"></div></div> <div id="uiViewButton2" class="uiSelector" onclick="userInterfaceSelectMenu(2)" title="Top bar interface"><div class="uiSelector2"></div></div> <div id="uiViewButton3" class="uiSelector" onclick="userInterfaceSelectMenu(3)" title="Fixed width interface"><div class="uiSelector3"></div></div> <div id="uiViewButton4" class="uiSelector" onclick="toggleNightMode()" title="Toggle night mode"><div class="uiSelector4"></div></div> </div> </div> </div> <div id="column_l"> <h1>Welcome</h1> <div id="welcomeText" style="display:none">Connect to your home or office devices from anywhere in the world using <a href="http://www.meshcommander.com/meshcentral2">MeshCentral</a>, the real time, open source remote monitoring and management web site. You will need to download and install a management agent on your computers. Once installed, computers will show up in the &quot;My Devices&quot; section of this web site and you will be able to monitor them and take control of them.</div> <table id="centralTable" style=""> <tr> <td id="welcomeimage"> <picture> <img alt="" src="welcome.jpg" style="border-radius:20px"> </picture> </td> <td id="logincell"> <div id="loginpanel" style="display:none"> <form method="post"> <input type="hidden" name="action" value="login"> <div id="message1"> {{{message}}} </div> <div> <b>Log In</b> </div> <table> <tr> <td id="loginusername" align="right" width="100">Username:</td> <td><input id="username" type="text" maxlength="64" name="username" onchange="validateLogin(1)" onkeyup="validateLogin(1,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="password" type="password" maxlength="256" name="password" autocomplete="off" onchange="validateLogin(2)" onkeyup="validateLogin(2,event)"></td> </tr> <tr> <td><div id="showPassHintLink" style="display:none"><a onclick="return showPassHint(event);" href="#" style="cursor:pointer">Show Hint</a></div></td> <td align="right"><input id="loginButton" type="submit" value="Log In" disabled="disabled"></td> </tr> </table> <div id="hrAccountDiv" style="display:none"><hr></div> <div id="resetAccountDiv" style="display:none;padding:2px"> <span id="resetAccountSpan">Forgot username/password?</span> <a onclick="return xgo(3,event);" href="#" style="cursor:pointer">Reset account</a>. </div> <div id="newAccountDiv" style="display:none;padding:2px"> Don&#39;t have an account? <a onclick="return xgo(2,event);" href="#" style="cursor:pointer">Create one</a>. </div> <input id="loginformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="createpanel" style="display:none;position:relative"> <form method="post"> <input type="hidden" name="action" value="createaccount"> <div id="message2"> {{{message}}} </div> <div> <b>Account Creation</b> </div> <div id="passwordPolicyCallout" style="display:none"></div> <table> <tr id="nuUserRow"> <td id="nuUser" align="right" width="100">Username:</td> <td><input id="ausername" type="text" name="username" onchange="validateCreate(1)" maxlength="64" onkeydown="haltReturn(event)" onkeyup="validateCreate(1,event)"></td> </tr> <tr> <td id="nuEmail" align="right" width="100">Email:</td> <td><input id="aemail" type="text" name="email" onchange="validateCreate(2)" maxlength="256" onkeydown="haltReturn(event)" onkeyup="validateCreate(2,event)"></td> </tr> <tr> <td id="nuPass1" align="right">Password:</td> <td><input id="apassword1" type="password" name="password1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(3,event)" onkeyup="validateCreate(3,event)"></td> </tr> <tr> <td id="nuPass2" align="right">Password:</td> <td><input id="apassword2" type="password" name="password2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(4,event)" onkeyup="validateCreate(4,event)"></td> </tr> <tr id="createPanelHint" style="display:none"> <td id="nuHint" align="right">Password Hint:</td> <td><input id="apasswordhint" type="text" name="apasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(5,event)" onkeyup="validateCreate(5,event)"></td> </tr> <tr id="newAccountPass" title="Enter the account creation token"> <td id="nuToken" align="right">Creation Token:</td> <td><input id="anewaccountpass" type="password" name="anewaccountpass" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(6,event)" onkeyup="validateCreate(6,event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="createButton" type="submit" value="Create Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="return xgo(1,event);" href="#" style="cursor:pointer">Back to login</a> <input id="createformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="resetpanel" style="display:none"> <form method="post"> <input type="hidden" name="action" value="resetaccount"> <div id="message3"> {{{message}}} </div> <div> <b>Account Reset</b> </div> <table> <tr> <td align="right" width="100">Email:</td> <td><input id="remail" type="text" name="email" maxlength="256" onchange="validateReset()" onkeyup="validateReset(event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="eresetButton" type="submit" value="Reset Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="return xgo(1,event);" href="#" style="cursor:pointer">Back to login</a> <input id="resetformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="tokenpanel" style="display:none"> <form method="post" autocomplete="off"> <input type="hidden" name="action" value="tokenlogin"> <input type="hidden" name="hwstate" value="{{{hwstate}}}"> <div id="message4"> {{{message}}} </div> <table> <tr> <td align="right" width="100">Login token:</td> <td> <input id="tokenInput" type="text" name="token" maxlength="50" onchange="checkToken(event)" onpaste="resetCheckToken(event)" onkeyup="checkToken(event)" onkeydown="checkToken(event)"> <input id="hwtokenInput" type="text" name="hwtoken" style="display:none"> </td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="tokenOkButton" type="submit" value="Login" disabled="disabled"></div> </td> </tr> </table> <hr><a onclick="return xgo(1,event);" href="#" style="cursor:pointer">Back to login</a> <input id="tokenformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="resettokenpanel" style="display:none"> <form method="post"> <input type="hidden" name="action" value="resetaccount"> <div id="message5"> {{{message}}} </div> <table> <tr> <td align="right" width="100">Login token:</td> <td> <input id="resetTokenInput" type="text" name="token" maxlength="50" onchange="resetCheckToken(event)" onkeyup="resetCheckToken(event)" onkeydown="resetCheckToken(event)"> <input id="resetHwtokenInput" type="text" name="hwtoken" style="display:none"> </td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="resetTokenOkButton" type="submit" value="Login" disabled="disabled"></div> </td> </tr> </table> <hr><a onclick="return xgo(1,event);" href="#" style="cursor:pointer">Back to login</a> <input id="resettokenformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="resetpasswordpanel" style="display:none;position:relative"> <form method="post"> <input type="hidden" name="action" value="resetpassword"> <div id="message6"> {{{message}}} </div> <div id="rpasswordPolicyCallout" style="display:none"></div> <table> <tr> <td id="rnuPass1" width="100" align="right">Password:</td> <td><input id="rapassword1" type="password" name="rpassword1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(3,event)" onkeyup="validatePassReset(3,event)"></td> </tr> <tr> <td id="rnuPass2" align="right">Password:</td> <td><input id="rapassword2" type="password" name="rpassword2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(4,event)" onkeyup="validatePassReset(4,event)"></td> </tr> <tr id="resetpasswordpanelHint" style="display:none"> <td id="rnuHint" align="right">Password Hint:</td> <td><input id="rapasswordhint" type="text" name="rpasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(5,event)" onkeyup="validatePassReset(5,event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="resetPassButton" type="submit" value="Reset Password" disabled="disabled"></div> <div id="rpassWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="return xgo(1,event);" href="#" style="cursor:pointer">Back to login</a> <input id="resetpasswordformargs" name="urlargs" type="hidden" value=""> </form> </div> </td> </tr> </table> <br> </div> <div id="footer"> <div class="footer1">{{{footer}}}</div> <div class="footer2"> {{{rootCertLink}}} &nbsp;<a href="terms">Terms &amp; Privacy</a> </div> </div> </div> <div id="dialog" style="display:none"> <div id="dialogHeader"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div id="dialogBody"> <div id="dialog1"> <div id="id_dialogMessage" style=""></div> </div> <div id="dialog2" style=""> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar" style=""> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="" onclick="dialogclose(1)"> </div> </div> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function QC(a){try{return Q(a).classList}catch(a){}}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}function zeroPad(b,a){if(a==null){a=2}var d="00000000"+b;return d.substr(d.length-a)}"use strict";var passhint="{{{passhint}}}";var newAccountPass=parseInt("{{{newAccountPass}}}");var emailCheck=("{{{emailcheck}}}"=="true");var passRequirements="{{{passRequirements}}}";var hardwareKeyChallenge=decodeURIComponent("{{{hkey}}}");if(passRequirements!=""){passRequirements=JSON.parse(decodeURIComponent(passRequirements))}else{passRequirements={}}var passRequirementsEx=((passRequirements.min!=null)||(passRequirements.max!=null)||(passRequirements.upper!=null)||(passRequirements.lower!=null)||(passRequirements.numeric!=null)||(passRequirements.nonalpha!=null));var features=parseInt("{{{features}}}");var welcomeText=decodeURIComponent("{{{welcometext}}}");var currentpanel=0;var uiMode=parseInt(getstore("uiMode","1"));var webPageFullScreen=true;var nightMode=(getstore("_nightMode","0")=="1");var publicKeyCredentialRequestOptions=null;if(window.location.href.indexOf("?")>0){var urlargs=window.location.href.substring(window.location.href.indexOf("?"));Q("loginformargs").value=urlargs;Q("createformargs").value=urlargs;Q("resetformargs").value=urlargs;Q("tokenformargs").value=urlargs;Q("resettokenformargs").value=urlargs;Q("resetpasswordformargs").value=urlargs}function startup(){if((features&32)==0){var d=null;try{d=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(d==null||top.active==false)){top.location=self.location;return}}if(features&2097152){QH("loginusername","Email:");QH("resetAccountSpan","Forgot password?");QV("nuUserRow",false)}if(nightMode){QC("body").add("night")}QV("createPanelHint",passRequirements.hint===true);QV("resetpasswordpanelHint",passRequirements.hint===true);if(welcomeText){QH("welcomeText",welcomeText)}QV("welcomeText",true);window.onresize=center;center();validateLogin();validateCreate();if("{{loginmode}}"!=""){go(parseInt("{{loginmode}}"))}else{go(1)}QV("newAccountDiv",("{{{newAccount}}}"==="1")||("{{{newAccount}}}"==="true"));if((passhint!=null)&&(passhint.length>0)){QV("showPassHintLink",true)}QV("newAccountPass",(newAccountPass==1));QV("resetAccountDiv",(emailCheck==true));QV("hrAccountDiv",(emailCheck==true)||(newAccountPass==1));if("{{loginmode}}"=="4"){try{if(hardwareKeyChallenge.length>0){hardwareKeyChallenge=JSON.parse(hardwareKeyChallenge)}else{hardwareKeyChallenge=null}}catch(b){hardwareKeyChallenge=null}if((hardwareKeyChallenge!=null)&&(hardwareKeyChallenge.type=="webAuthn")){hardwareKeyChallenge.challenge=Uint8Array.from(atob(hardwareKeyChallenge.challenge),function(e){return e.charCodeAt(0)}).buffer;publicKeyCredentialRequestOptions={challenge:hardwareKeyChallenge.challenge,allowCredentials:[],timeout:hardwareKeyChallenge.timeout};for(var c=0;c<hardwareKeyChallenge.keyIds.length;c++){publicKeyCredentialRequestOptions.allowCredentials.push({id:Uint8Array.from(atob(hardwareKeyChallenge.keyIds[c]),function(e){return e.charCodeAt(0)}),type:"public-key",transports:["usb","ble","nfc"],})}navigator.credentials.get({publicKey:publicKeyCredentialRequestOptions}).then(function(f){var e={id:btoa(String.fromCharCode.apply(null,new Uint8Array(f.rawId))),clientDataJSON:btoa(String.fromCharCode.apply(null,new Uint8Array(f.response.clientDataJSON))),userHandle:btoa(String.fromCharCode.apply(null,new Uint8Array(f.response.userHandle))),signature:btoa(String.fromCharCode.apply(null,new Uint8Array(f.response.signature))),authenticatorData:btoa(String.fromCharCode.apply(null,new Uint8Array(f.response.authenticatorData))),};Q("hwtokenInput").value=JSON.stringify(e);QE("tokenOkButton",true);Q("tokenOkButton").click()},function(e){console.log("credentials-get error",e)})}}if("{{loginmode}}"=="5"){try{if(hardwareKeyChallenge.length>0){hardwareKeyChallenge=JSON.parse(hardwareKeyChallenge)}else{hardwareKeyChallenge=null}}catch(b){hardwareKeyChallenge=null}if((hardwareKeyChallenge!=null)&&(hardwareKeyChallenge.type=="webAuthn")){hardwareKeyChallenge.challenge=Uint8Array.from(atob(hardwareKeyChallenge.challenge),function(e){return e.charCodeAt(0)}).buffer;publicKeyCredentialRequestOptions={challenge:hardwareKeyChallenge.challenge,allowCredentials:[],timeout:hardwareKeyChallenge.timeout};for(var c=0;c<hardwareKeyChallenge.keyIds.length;c++){publicKeyCredentialRequestOptions.allowCredentials.push({id:Uint8Array.from(atob(hardwareKeyChallenge.keyIds[c]),function(e){return e.charCodeAt(0)}),type:"public-key",transports:["usb","ble","nfc"],})}navigator.credentials.get({publicKey:publicKeyCredentialRequestOptions}).then(function(f){var e={id:btoa(String.fromCharCode.apply(null,new Uint8Array(f.rawId))),clientDataJSON:btoa(String.fromCharCode.apply(null,new Uint8Array(f.response.clientDataJSON))),userHandle:btoa(String.fromCharCode.apply(null,new Uint8Array(f.response.userHandle))),signature:btoa(String.fromCharCode.apply(null,new Uint8Array(f.response.signature))),authenticatorData:btoa(String.fromCharCode.apply(null,new Uint8Array(f.response.authenticatorData))),};Q("resetHwtokenInput").value=JSON.stringify(e);QE("resetTokenOkButton",true);Q("resetTokenOkButton").click()},function(e){console.log("credentials-get error",e)})}}userInterfaceSelectMenu()}function showPassHint(a){messagebox("Password Hint",passhint);haltEvent(a);return false}function xgo(b,a){QV("message1",false);QV("message2",false);QV("message3",false);QV("message4",false);QV("message5",false);QV("message6",false);go(b);haltEvent(a);return false}function go(a){currentpanel=a;setDialogMode(0);QV("showPassHintLink",false);QV("loginpanel",a==1);QV("createpanel",a==2);QV("resetpanel",a==3);QV("tokenpanel",a==4);QV("resettokenpanel",a==5);QV("resetpasswordpanel",a==6);if(a==1){Q("username").focus()}if(a==2){if(features&2097152){Q("aemail").focus()}else{Q("ausername").focus()}}if(a==3){Q("remail").focus()}if(a==4){Q("tokenInput").focus()}if(a==5){Q("resetTokenInput").focus()}if(a==6){Q("rapassword1").focus()}}function validateLogin(a,b){var c=((Q("username").value.length>0)&&(Q("username").value.indexOf(" ")==-1)&&(Q("password").value.length>0));QE("loginButton",c);setDialogMode(0);if((b!=null)&&(b.keyCode==13)){if((a==1)&&(Q("username").value!="")){Q("password").focus()}else{if((a==2)&&(Q("password").value!="")){Q("loginButton").click()}}}if(b!=null){haltEvent(b)}}function validateCreate(a,b){setDialogMode(0);var k=false;if(features&2097152){k=true}else{k=(Q("ausername").value.length>0)&&(Q("ausername").value.indexOf(" ")==-1)&&(Q("ausername").value.indexOf('"')==-1)&&(Q("ausername").value.indexOf(",")==-1)}var c=(validateEmail(Q("aemail").value)==true);var g=(Q("apassword1").value.length>0);var h=(Q("apassword2").value.length>0)&&(Q("apassword2").value==Q("apassword1").value);var d=(newAccountPass==0)||(Q("anewaccountpass").value.length>0);var f=(k&&c&&g&&h&&d);QS("nuUser").color=k?"black":"#7b241c";QS("nuEmail").color=c?"black":"#7b241c";QS("nuPass1").color=g?"black":"#7b241c";QS("nuPass2").color=h?"black":"#7b241c";QS("nuToken").color=d?"black":"#7b241c";if(Q("apassword1").value==""){QH("passWarning","");QV("passwordPolicyCallout",false)}else{if(!passRequirementsEx){var j=checkPasswordStrength(Q("apassword1").value);if(j>=80){QH("passWarning","<span style=color:green><b>Strong Password</b><span>")}else{if(j>=60){QH("passWarning","<span style=color:blue><b>Good Password</b><span>")}else{QH("passWarning","<span style=color:red><b>Weak Password</b><span>")}}}else{var i=checkPasswordRequirements(Q("apassword1").value,passRequirements);if(i==false){f=false;QS("nuPass1").color="#7b241c";QS("nuPass2").color="#7b241c";QH("passWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>");QV("passwordPolicyCallout",true);QH("passwordPolicyCallout",passwordPolicyText(Q("apassword1").value))}else{QH("passWarning","");QV("passwordPolicyCallout",false)}}}if((b!=null)&&(b.keyCode==13)){if((a==1)&&k){Q("aemail").focus()}if((a==2)&&c){Q("apassword1").focus()}if((a==3)&&g){Q("apassword2").focus()}if((a==4)&&h){if(passRequirements.hint===true){Q("apasswordhint").focus()}else{a=5}}if(a==5){if(newAccountPass==1){Q("anewaccountpass").focus()}else{a=6}}if(a==6){Q("createButton").click()}}if(b!=null){haltEvent(b)}QE("createButton",f)}function validatePassReset(a,b){setDialogMode(0);var d=(Q("rapassword1").value.length>0);var f=(Q("rapassword2").value.length>0)&&(Q("rapassword2").value==Q("rapassword1").value);var c=(d&&f);QS("rnuPass1").color=d?"black":"#7b241c";QS("rnuPass2").color=f?"black":"#7b241c";if(Q("rapassword1").value==""){QH("rpassWarning","");QV("rpasswordPolicyCallout",false)}else{if(!passRequirementsEx){var h=checkPasswordStrength(Q("rapassword1").value);if(h>=80){QH("rpassWarning","<span style=color:green><b>Strong Password</b><span>")}else{if(h>=60){QH("rpassWarning","<span style=color:blue><b>Good Password</b><span>")}else{QH("rpassWarning","<span style=color:red><b>Weak Password</b><span>")}}}else{var g=checkPasswordRequirements(Q("rapassword1").value,passRequirements);if(g==false){c=false;QS("rnuPass1").color="#7b241c";QS("rnuPass2").color="#7b241c";QH("rpassWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>");QV("rpasswordPolicyCallout",true);QH("rpasswordPolicyCallout",passwordPolicyText(Q("rapassword1").value))}else{QH("rpassWarning","");QV("rpasswordPolicyCallout",false)}}}if((b!=null)&&(b.keyCode==13)){if(a==2){Q("rapassword1").focus()}if(a==3){Q("rapassword2").focus()}if(a==4){Q("rapasswordhint").focus()}if(a==6){Q("resetPassButton").click()}}if(b!=null){haltEvent(b)}QE("resetPassButton",c)}function passwordPolicyText(b){var c="<div style=text-align:left>";var a=strCount(b);if(passRequirements.min&&((b==null)||(b.length<passRequirements.min))){c+="Minimum length of "+passRequirements.min+"<br />"}if(passRequirements.max&&((b==null)||(b.length>passRequirements.max))){c+="Maximum length of "+passRequirements.max+"<br />"}if(passRequirements.upper&&((b==null)||(a.upper<passRequirements.upper))){c+=""+passRequirements.upper+" upper case<br />"}if(passRequirements.lower&&((b==null)||(a.lower<passRequirements.lower))){c+=""+passRequirements.lower+" lower case<br />"}if(passRequirements.numeric&&((b==null)||(a.numeric<passRequirements.numeric))){c+=""+passRequirements.numeric+" numeric<br />"}if(passRequirements.nonalpha&&((b==null)||(a.nonalpha<passRequirements.nonalpha))){c+=passRequirements.nonalpha+" non-alphanumeric<br />"}c+="</div>";return c}function showPasswordPolicy(){messagebox("Password Policy",passwordPolicyText())}function validateReset(a){setDialogMode(0);var b=validateEmail(Q("remail").value);QE("eresetButton",b);if((a!=null)&&(a.keyCode==13)&&(b==true)){Q("eresetButton").click()}if(a!=null){haltEvent(a)}}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}function checkPasswordRequirements(b,c){if((c==null)||(c=="")||(typeof c!="object")){return true}if(c.min){if(b.length<c.min){return false}}if(c.max){if(b.length>c.max){return false}}var a=strCount(b);if(c.numeric&&(a.numeric<c.numeric)){return false}if(c.lower&&(a.lower<c.lower)){return false}if(c.upper&&(a.upper<c.upper)){return false}if(c.nonalpha&&(a.nonalpha<c.nonalpha)){return false}return true}function strCount(c){var a={numeric:0,lower:0,upper:0,nonalpha:0};if(typeof c!="string"){return a}for(var b=0;b<c.length;b++){if(/\d/.test(c[b])){a.numeric++}if(/[a-z]/.test(c[b])){a.lower++}if(/[A-Z]/.test(c[b])){a.upper++}if(/\W/.test(c[b])){a.nonalpha++}}return a}function checkToken(){var a=Q("tokenInput").value;var b=a.split(" ").join("");if(a!=b){Q("tokenInput").value=b}QE("tokenOkButton",(Q("tokenInput").value.length==6)||(Q("tokenInput").value.length==8)||(Q("tokenInput").value.length==44))}function resetCheckToken(){var a=Q("resetTokenInput").value;var b=a.split(" ").join("");if(a!=b){Q("resetTokenInput").value=b}QE("resetTokenOkButton",(Q("resetTokenInput").value.length==6)||(Q("resetTokenInput").value.length==8)||(Q("resetTokenInput").value.length==44))}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;var xxcurrentView=0;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function toggleFullScreen(a){if(webPageFullScreen==false){QC("body").remove("fullscreen")}else{QC("body").add("fullscreen")}QV("body",true);center()}function showUserInterfaceSelectMenu(){Q("uiViewButton1").classList.remove("uiSelectorSel");Q("uiViewButton2").classList.remove("uiSelectorSel");Q("uiViewButton3").classList.remove("uiSelectorSel");try{Q("uiViewButton"+uiMode).classList.add("uiSelectorSel")}catch(a){}QV("uiMenu",(QS("uiMenu").display=="none"));if(nightMode){Q("uiViewButton4").classList.add("uiSelectorSel")}}function userInterfaceSelectMenu(a){if(a){uiMode=a;putstore("uiMode",uiMode)}webPageFullScreen=(uiMode<3);toggleFullScreen(0)}function toggleNightMode(){nightMode=!nightMode;if(nightMode){QC("body").add("night")}else{QC("body").remove("night")}putstore("_nightMode",(nightMode?"1":"0"))}function center(){if(webPageFullScreen==false){QS("centralTable")["margin-top"]=""}else{var a=((Q("column_l").clientHeight)/2)-220;if(a<0){a=0}QS("centralTable")["margin-top"]=a+"px"}}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function haltReturn(a){if(a.keyCode==13){haltEvent(a)}}function validateEmail(b){var a=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return a.test(b)}function putstore(b,c){try{if(typeof(localStorage)==="undefined"){return}localStorage.setItem(b,c)}catch(a){}}function getstore(b,d){try{if(typeof(localStorage)==="undefined"){return d}var c=localStorage.getItem(b);if((c==null)||(c==null)){return d}return c}catch(a){return d}};</script></body></html>
\ No newline at end of file
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link rel="shortcut icon"type=image/x-icon href={{{domainurl}}}favicon.ico><link keeplink=1 type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><script keeplink=1 src=scripts/u2f-api.js></script><title>{{{title}}} - Login</title><body id=body onload='"undefined"!=typeof startup&&startup()'class="arg_hide login"><div id=container><div id=masthead><div class=title>{{{title}}}</div><div class=title2>{{{title2}}}</div></div><div id=topbar class="noselect style3"style=height:24px><div id=uiMenuButton title="User interface selection"onclick=showUserInterfaceSelectMenu()>&diams;<div id=uiMenu style=display:none><div id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"><div class=uiSelector1></div></div><div id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"><div class=uiSelector2></div></div><div id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"><div class=uiSelector3></div></div><div id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode"><div class=uiSelector4></div></div></div></div></div><div id=column_l><h1>Welcome</h1><div id=welcomeText style=display:none>Connect to your home or office devices from anywhere in the world using<a href=http://www.meshcommander.com/meshcentral2>MeshCentral</a>, the real time, open source remote monitoring and management web site. You will need to download and install a management agent on your computers. Once installed, computers will show up in the &quot;My Devices&quot; section of this web site and you will be able to monitor them and take control of them.</div><table id=centralTable><tr><td id=welcomeimage><picture><img alt=""src=welcome.jpg style=border-radius:20px></picture><td id=logincell><div id=loginpanel style=display:none><form method=post><input type=hidden name=action value=login><div id=message1>{{{message}}}</div><div><b>Log In</b></div><table><tr><td id=loginusername align=right width=100>Username:<td><input id=username maxlength=64 name=username onchange=validateLogin(1) onkeyup=validateLogin(1,event)><tr><td align=right>Password:<td><input id=password type=password maxlength=256 name=password autocomplete=off onchange=validateLogin(2) onkeyup=validateLogin(2,event)><tr><td><div id=showPassHintLink style=display:none><a onclick="return showPassHint(event)"href=# style=cursor:pointer>Show Hint</a></div><td align=right><input id=loginButton type=submit value="Log In"disabled></table><div id=hrAccountDiv style=display:none><hr></div><div id=resetAccountDiv style=display:none;padding:2px><span id=resetAccountSpan>Forgot username/password?</span><a onclick="return xgo(3,event)"href=# style=cursor:pointer>Reset account</a>.</div><div id=newAccountDiv style=display:none;padding:2px>Don&#39;t have an account?<a onclick="return xgo(2,event)"href=# style=cursor:pointer>Create one</a>.</div><input id=loginformargs name=urlargs type=hidden></form></div><div id=createpanel style=display:none;position:relative><form method=post><input type=hidden name=action value=createaccount><div id=message2>{{{message}}}</div><div><b>Account Creation</b></div><div id=passwordPolicyCallout style=display:none></div><table><tr id=nuUserRow><td id=nuUser align=right width=100>Username:<td><input id=ausername name=username onchange=validateCreate(1) maxlength=64 onkeydown=haltReturn(event) onkeyup=validateCreate(1,event)><tr><td id=nuEmail align=right width=100>Email:<td><input id=aemail name=email onchange=validateCreate(2) maxlength=256 onkeydown=haltReturn(event) onkeyup=validateCreate(2,event)><tr><td id=nuPass1 align=right>Password:<td><input id=apassword1 type=password name=password1 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(3,event) onkeyup=validateCreate(3,event)><tr><td id=nuPass2 align=right>Password:<td><input id=apassword2 type=password name=password2 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(4,event) onkeyup=validateCreate(4,event)><tr id=createPanelHint style=display:none><td id=nuHint align=right>Password Hint:<td><input id=apasswordhint name=apasswordhint autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(5,event) onkeyup=validateCreate(5,event)><tr id=newAccountPass title="Enter the account creation token"><td id=nuToken align=right>Creation Token:<td><input id=anewaccountpass type=password name=anewaccountpass autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(6,event) onkeyup=validateCreate(6,event)><tr><td colspan=2><div style=float:right><input id=createButton type=submit value="Create Account"disabled></div><div id=passWarning style=padding-top:6px></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a><input id=createformargs name=urlargs type=hidden></form></div><div id=resetpanel style=display:none><form method=post><input type=hidden name=action value=resetaccount><div id=message3>{{{message}}}</div><div><b>Account Reset</b></div><table><tr><td align=right width=100>Email:<td><input id=remail name=email maxlength=256 onchange=validateReset() onkeyup=validateReset(event)><tr><td colspan=2><div style=float:right><input id=eresetButton type=submit value="Reset Account"disabled></div><div id=passWarning style=padding-top:6px></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a><input id=resetformargs name=urlargs type=hidden></form></div><div id=tokenpanel style=display:none><form method=post autocomplete=off><input type=hidden name=action value=tokenlogin> <input type=hidden name=hwstate value={{{hwstate}}}><div id=message4>{{{message}}}</div><table><tr><td align=right width=100>Login token:<td><input id=tokenInput name=token maxlength=50 onchange=checkToken(event) onpaste=resetCheckToken(event) onkeyup=checkToken(event) onkeydown=checkToken(event)> <input id=hwtokenInput name=hwtoken style=display:none><tr><td colspan=2><div style=float:right><input id=tokenOkButton type=submit value=Login disabled></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a><input id=tokenformargs name=urlargs type=hidden></form></div><div id=resettokenpanel style=display:none><form method=post><input type=hidden name=action value=resetaccount><div id=message5>{{{message}}}</div><table><tr><td align=right width=100>Login token:<td><input id=resetTokenInput name=token maxlength=50 onchange=resetCheckToken(event) onkeyup=resetCheckToken(event) onkeydown=resetCheckToken(event)> <input id=resetHwtokenInput name=hwtoken style=display:none><tr><td colspan=2><div style=float:right><input id=resetTokenOkButton type=submit value=Login disabled></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a><input id=resettokenformargs name=urlargs type=hidden></form></div><div id=resetpasswordpanel style=display:none;position:relative><form method=post><input type=hidden name=action value=resetpassword><div id=message6>{{{message}}}</div><div id=rpasswordPolicyCallout style=display:none></div><table><tr><td id=rnuPass1 width=100 align=right>Password:<td><input id=rapassword1 type=password name=rpassword1 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(3,event) onkeyup=validatePassReset(3,event)><tr><td id=rnuPass2 align=right>Password:<td><input id=rapassword2 type=password name=rpassword2 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(4,event) onkeyup=validatePassReset(4,event)><tr id=resetpasswordpanelHint style=display:none><td id=rnuHint align=right>Password Hint:<td><input id=rapasswordhint name=rpasswordhint autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(5,event) onkeyup=validatePassReset(5,event)><tr><td colspan=2><div style=float:right><input id=resetPassButton type=submit value="Reset Password"disabled></div><div id=rpassWarning style=padding-top:6px></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a><input id=resetpasswordformargs name=urlargs type=hidden></form></div></table><br></div><div id=footer><div class=footer1>{{{footer}}}</div><div class=footer2>{{{rootCertLink}}} &nbsp;<a href=terms>Terms &amp; Privacy</a></div></div></div><div id=dialog style=display:none><div id=dialogHeader><div id=id_dialogclose style=float:right;padding:5px;cursor:pointer onclick=setDialogMode()><b>X</b></div><div id=id_dialogtitle style=padding:5px></div><div style=width:100%;margin:6px></div></div><div id=dialogBody><div id=dialog1><div id=id_dialogMessage></div></div><div id=dialog2><div id=id_dialogOptions></div></div></div><div id=idx_dlgButtonBar><input id=idx_dlgCancelButton type=button value=Cancel onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK onclick=dialogclose(1)></div></div><script>"use strict";var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,passhint="{{{passhint}}}",newAccountPass=parseInt("{{{newAccountPass}}}"),emailCheck=!1,passRequirements="{{{passRequirements}}}",hardwareKeyChallenge=decodeURIComponent("{{{hkey}}}"),passRequirementsEx=null!=(passRequirements=""!=passRequirements?JSON.parse(decodeURIComponent(passRequirements)):{}).min||null!=passRequirements.max||null!=passRequirements.upper||null!=passRequirements.lower||null!=passRequirements.numeric||null!=passRequirements.nonalpha,features=parseInt("{{{features}}}"),welcomeText=decodeURIComponent("{{{welcometext}}}"),currentpanel=0,uiMode=parseInt(getstore("uiMode","1")),webPageFullScreen=!0,nightMode="1"==getstore("_nightMode","0"),publicKeyCredentialRequestOptions=null;if(0<window.location.href.indexOf("?")){var urlargs=window.location.href.substring(window.location.href.indexOf("?"));Q("loginformargs").value=urlargs,Q("createformargs").value=urlargs,Q("resetformargs").value=urlargs,Q("tokenformargs").value=urlargs,Q("resettokenformargs").value=urlargs,Q("resetpasswordformargs").value=urlargs}function startup(){if(0==(32&features)){var e=null;try{e=top.location.toString().toLowerCase()}catch(e){}if(top!=self&&(null==e||0==top.active))return void(top.location=self.location)}2097152&features&&(QH("loginusername","Email:"),QH("resetAccountSpan","Forgot password?"),QV("nuUserRow",!1)),nightMode&&QC("body").add("night"),QV("createPanelHint",!0===passRequirements.hint),QV("resetpasswordpanelHint",!0===passRequirements.hint),welcomeText&&QH("welcomeText",welcomeText),QV("welcomeText",!0),(window.onresize=center)(),validateLogin(),validateCreate(),go(parseInt("{{loginmode}}")),QV("newAccountDiv",!1),null!=passhint&&0<passhint.length&&QV("showPassHintLink",!0),QV("newAccountPass",1==newAccountPass),QV("resetAccountDiv",1==emailCheck),QV("hrAccountDiv",1==emailCheck||1==newAccountPass),userInterfaceSelectMenu()}function showPassHint(e){return messagebox("Password Hint",passhint),haltEvent(e),!1}function xgo(e,n){return QV("message1",!1),QV("message2",!1),QV("message3",!1),QV("message4",!1),QV("message5",!1),QV("message6",!1),go(e),haltEvent(n),!1}function go(e){currentpanel=e,setDialogMode(0),QV("showPassHintLink",!1),QV("loginpanel",1==e),QV("createpanel",2==e),QV("resetpanel",3==e),QV("tokenpanel",4==e),QV("resettokenpanel",5==e),QV("resetpasswordpanel",6==e),1==e&&Q("username").focus(),2==e&&(2097152&features?Q("aemail").focus():Q("ausername").focus()),3==e&&Q("remail").focus(),4==e&&Q("tokenInput").focus(),5==e&&Q("resetTokenInput").focus(),6==e&&Q("rapassword1").focus()}function validateLogin(e,n){var s=0<Q("username").value.length&&-1==Q("username").value.indexOf(" ")&&0<Q("password").value.length;QE("loginButton",s),setDialogMode(0),null!=n&&13==n.keyCode&&(1==e&&""!=Q("username").value?Q("password").focus():2==e&&""!=Q("password").value&&Q("loginButton").click()),null!=n&&haltEvent(n)}function validateCreate(e,n){setDialogMode(0);var s=!1;s=!!(2097152&features)||0<Q("ausername").value.length&&-1==Q("ausername").value.indexOf(" ")&&-1==Q("ausername").value.indexOf('"')&&-1==Q("ausername").value.indexOf(",");var a=1==validateEmail(Q("aemail").value),t=0<Q("apassword1").value.length,o=0<Q("apassword2").value.length&&Q("apassword2").value==Q("apassword1").value,r=0==newAccountPass||0<Q("anewaccountpass").value.length,l=s&&a&&t&&o&&r;if(QS("nuUser").color=s?"black":"#7b241c",QS("nuEmail").color=a?"black":"#7b241c",QS("nuPass1").color=t?"black":"#7b241c",QS("nuPass2").color=o?"black":"#7b241c",QS("nuToken").color=r?"black":"#7b241c",""==Q("apassword1").value)QH("passWarning",""),QV("passwordPolicyCallout",!1);else if(passRequirementsEx){0==checkPasswordRequirements(Q("apassword1").value,passRequirements)?(l=!1,QS("nuPass1").color="#7b241c",QS("nuPass2").color="#7b241c",QH("passWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>"),QV("passwordPolicyCallout",!0),QH("passwordPolicyCallout",passwordPolicyText(Q("apassword1").value))):(QH("passWarning",""),QV("passwordPolicyCallout",!1))}else{var u=checkPasswordStrength(Q("apassword1").value);80<=u?QH("passWarning","<span style=color:green><b>Strong Password</b><span>"):60<=u?QH("passWarning","<span style=color:blue><b>Good Password</b><span>"):QH("passWarning","<span style=color:red><b>Weak Password</b><span>")}null!=n&&13==n.keyCode&&(1==e&&s&&Q("aemail").focus(),2==e&&a&&Q("apassword1").focus(),3==e&&t&&Q("apassword2").focus(),4==e&&o&&(!0===passRequirements.hint?Q("apasswordhint").focus():e=5),5==e&&(1==newAccountPass?Q("anewaccountpass").focus():e=6),6==e&&Q("createButton").click()),null!=n&&haltEvent(n),QE("createButton",l)}function validatePassReset(e,n){setDialogMode(0);var s=0<Q("rapassword1").value.length,a=0<Q("rapassword2").value.length&&Q("rapassword2").value==Q("rapassword1").value,t=s&&a;if(QS("rnuPass1").color=s?"black":"#7b241c",QS("rnuPass2").color=a?"black":"#7b241c",""==Q("rapassword1").value)QH("rpassWarning",""),QV("rpasswordPolicyCallout",!1);else if(passRequirementsEx){0==checkPasswordRequirements(Q("rapassword1").value,passRequirements)?(t=!1,QS("rnuPass1").color="#7b241c",QS("rnuPass2").color="#7b241c",QH("rpassWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>"),QV("rpasswordPolicyCallout",!0),QH("rpasswordPolicyCallout",passwordPolicyText(Q("rapassword1").value))):(QH("rpassWarning",""),QV("rpasswordPolicyCallout",!1))}else{var o=checkPasswordStrength(Q("rapassword1").value);80<=o?QH("rpassWarning","<span style=color:green><b>Strong Password</b><span>"):60<=o?QH("rpassWarning","<span style=color:blue><b>Good Password</b><span>"):QH("rpassWarning","<span style=color:red><b>Weak Password</b><span>")}null!=n&&13==n.keyCode&&(2==e&&Q("rapassword1").focus(),3==e&&Q("rapassword2").focus(),4==e&&Q("rapasswordhint").focus(),6==e&&Q("resetPassButton").click()),null!=n&&haltEvent(n),QE("resetPassButton",t)}function passwordPolicyText(e){var n="<div style=text-align:left>",s=strCount(e);return passRequirements.min&&(null==e||e.length<passRequirements.min)&&(n+=format("Minimum length of {0}",passRequirements.min)+"<br />"),passRequirements.max&&(null==e||e.length>passRequirements.max)&&(n+=format("Maximum length of {0}",passRequirements.max)+"<br />"),passRequirements.upper&&(null==e||s.upper<passRequirements.upper)&&(n+=format("{0} upper case",passRequirements.upper)+"<br />"),passRequirements.lower&&(null==e||s.lower<passRequirements.lower)&&(n+=format("{0} lower case",passRequirements.lower)+"<br />"),passRequirements.numeric&&(null==e||s.numeric<passRequirements.numeric)&&(n+=format("{0} numeric",passRequirements.numeric)+"<br />"),passRequirements.nonalpha&&(null==e||s.nonalpha<passRequirements.nonalpha)&&(n+=format("{0} non-alphanumeric",passRequirements.nonalpha)+"<br />"),n+="</div>"}function showPasswordPolicy(){messagebox("Password Policy",passwordPolicyText())}function validateReset(e){setDialogMode(0);var n=validateEmail(Q("remail").value);QE("eresetButton",n),null!=e&&13==e.keyCode&&1==n&&Q("eresetButton").click(),null!=e&&haltEvent(e)}function checkPasswordStrength(e){var n=0,s={},a=0,t={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e)return 0;for(var o=0;o<e.length;o++)s[e[o]]=(s[e[o]]||0)+1,n+=5/s[e[o]];for(var r in t)a+=1==t[r]?1:0;return parseInt(n+10*(a-1))}function checkPasswordRequirements(e,n){if(null==n||""==n||"object"!=typeof n)return!0;if(n.min&&e.length<n.min)return!1;if(n.max&&e.length>n.max)return!1;var s=strCount(e);return!(n.numeric&&s.numeric<n.numeric)&&(!(n.lower&&s.lower<n.lower)&&(!(n.upper&&s.upper<n.upper)&&!(n.nonalpha&&s.nonalpha<n.nonalpha)))}function strCount(e){var n={numeric:0,lower:0,upper:0,nonalpha:0};if("string"!=typeof e)return n;for(var s=0;s<e.length;s++)/\d/.test(e[s])&&n.numeric++,/[a-z]/.test(e[s])&&n.lower++,/[A-Z]/.test(e[s])&&n.upper++,/\W/.test(e[s])&&n.nonalpha++;return n}function checkToken(){var e=Q("tokenInput").value,n=e.split(" ").join("");e!=n&&(Q("tokenInput").value=n),QE("tokenOkButton",6==Q("tokenInput").value.length||8==Q("tokenInput").value.length||44==Q("tokenInput").value.length)}function resetCheckToken(){var e=Q("resetTokenInput").value,n=e.split(" ").join("");e!=n&&(Q("resetTokenInput").value=n),QE("resetTokenOkButton",6==Q("resetTokenInput").value.length||8==Q("resetTokenInput").value.length||44==Q("resetTokenInput").value.length)}var xxcurrentView=0;function setDialogMode(e,n,s,a,t,o){xxdialogMode=e,xxdialogFunc=a,xxdialogButtons=s,xxdialogTag=o,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&s),QV("idx_dlgCancelButton",2&s),QV("id_dialogclose",2&s||8&s),QV("idx_dlgButtonBar",7&s),n&&QH("id_dialogtitle",n);for(var r=1;r<24;r++)QV("dialog"+r,r==e);QV("dialog",e),t&&(2==e?QH("id_dialogOptions",t):QH("id_dialogMessage",t))}function dialogclose(e){var n=xxdialogFunc,s=xxdialogButtons,a=xxdialogTag;setDialogMode(),(8&s||e)&&n&&n(e,a)}function toggleFullScreen(e){0==webPageFullScreen?QC("body").remove("fullscreen"):QC("body").add("fullscreen"),QV("body",!0),center()}function showUserInterfaceSelectMenu(){Q("uiViewButton1").classList.remove("uiSelectorSel"),Q("uiViewButton2").classList.remove("uiSelectorSel"),Q("uiViewButton3").classList.remove("uiSelectorSel");try{Q("uiViewButton"+uiMode).classList.add("uiSelectorSel")}catch(e){}QV("uiMenu","none"==QS("uiMenu").display),nightMode&&Q("uiViewButton4").classList.add("uiSelectorSel")}function userInterfaceSelectMenu(e){e&&putstore("uiMode",uiMode=e),webPageFullScreen=uiMode<3,toggleFullScreen(0)}function toggleNightMode(){(nightMode=!nightMode)?QC("body").add("night"):QC("body").remove("night"),putstore("_nightMode",nightMode?"1":"0")}function center(){if(0==webPageFullScreen)QS("centralTable")["margin-top"]="";else{var e=Q("column_l").clientHeight/2-220;e<0&&(e=0),QS("centralTable")["margin-top"]=e+"px"}}function messagebox(e,n){QH("id_dialogMessage",n),setDialogMode(1,e,1)}function statusbox(e,n){QH("id_dialogMessage",n),setDialogMode(1,e)}function getDocWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement.clientWidth:document.getElementsByTagName("body")[0].clientWidth}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function haltReturn(e){13==e.keyCode&&haltEvent(e)}function validateEmail(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}function putstore(e,n){try{if("undefined"==typeof localStorage)return;localStorage.setItem(e,n)}catch(e){}}function getstore(e,n){try{if("undefined"==typeof localStorage)return n;var s=localStorage.getItem(e);return null==s||null==s?n:s}catch(e){return n}}function format(e){var s=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,n){return void 0!==s[n]?s[n]:e})}</script>
\ No newline at end of file
views/login-mobile-min.handlebars
+1 -1
@@ -1 +1 @@
1 -<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <link rel="shortcut icon" type="image/x-icon" href="{{{domainurl}}}favicon.ico"> <title>MeshCentral - Login</title> <style> a{color:#036;text-decoration:underline;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}</style> </head> <body onload="if (typeof(startup) !== 'undefined') startup();" style="overflow-y:hidden;margin:0;padding:0;border:0;color:black;font-size:13px;font-family:\'Trebuchet MS\', Arial, Helvetica, sans-serif"> <div id="container"> <div id="mastheadx"></div> <div id="masthead" style="background:url(logo.png) 0px 0px;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px"> <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px"> <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> </div> <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%;display:flex;align-items:center"> <div id="column_l" style="padding:10px;width:100%"> <table style="width:100%"> <tr> <td align="center"> <div id="loginpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;display:none"> <form method="post"> <input type="hidden" name="action" value="login"> <div id="message1"> {{{message}}} </div> <div> <b>Log In</b> </div> <table> <tr> <td id="loginusername" align="right" width="100">Username:</td> <td><input id="username" type="text" maxlength="64" name="username" onchange="validateLogin(1)" onkeyup="validateLogin(1,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="password" type="password" maxlength="256" name="password" autocomplete="off" onchange="validateLogin(2)" onkeyup="validateLogin(2,event)"></td> </tr> <tr> <td><div id="showPassHintLink" style="display:none"><a onclick="showPassHint()" style="cursor:pointer">Show Hint</a></div></td> <td align="right"><input id="loginButton" type="submit" value="Log In" disabled="disabled"></td> </tr> </table> <div id="hrAccountDiv" style="display:none"><hr></div> <div id="resetAccountDiv" style="display:none;padding:2px"> <span id="resetAccountSpan">Forgot user/password?</span> <a onclick="xgo(3)" style="cursor:pointer">Reset account</a>. </div> <div id="newAccountDiv" style="display:none;padding:2px"> Don&#39;t have an account? <a onclick="xgo(2)" style="cursor:pointer">Create one</a>. </div> <input id="loginformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="createpanel" style="display:none"> <div style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;position:relative"> <form method="post"> <input type="hidden" name="action" value="createaccount"> <div id="message2"> {{{message}}} </div> <div> <b>Account Creation</b> </div> <div id="passwordPolicyCallout" style="left:-5px;top:10px;width:100px;position:absolute;background-color:#FFC;border-radius:5px;padding:5px;box-shadow:0px 0px 15px #666;font-size:10px"></div> <table> <tr id="nuUserRow"> <td align="right" width="100">Username:</td> <td><input id="ausername" type="text" name="username" onchange="validateCreate(1)" maxlength="64" onkeydown="haltReturn(event)" onkeyup="validateCreate(1,event)"></td> </tr> <tr> <td align="right" width="100">Email:</td> <td><input id="aemail" type="text" name="email" onchange="validateCreate(2)" maxlength="256" onkeydown="haltReturn(event)" onkeyup="validateCreate(2,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="apassword1" type="password" name="password1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(3)" onkeyup="validateCreate(3,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="apassword2" type="password" name="password2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(4)" onkeyup="validateCreate(4,event)"></td> </tr> <tr id="createPanelHint" style="display:none"> <td align="right">Pass Hint:</td> <td><input id="apasswordhint" type="text" name="apasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(5)" onkeyup="validateCreate(5,event)"></td> </tr> <tr id="newAccountPass" title="Enter the account creation token"> <td align="right">Creation Token:</td> <td><input id="anewaccountpass" type="password" name="anewaccountpass" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(6)" onkeyup="validateCreate(6,event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="createButton" type="submit" value="Create Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> <input id="createformargs" name="urlargs" type="hidden" value=""> </form> </div> </div> <div id="resetpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both"> <form method="post"> <input type="hidden" name="action" value="resetaccount"> <div id="message3"> {{{message}}} </div> <div> <b>Account Reset</b> </div> <table> <tr> <td align="right" width="100">Email:</td> <td><input id="remail" type="text" name="email" maxlength="256" onchange="validateReset()" onkeyup="validateReset(event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="eresetButton" type="submit" value="Reset Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> <input id="resetformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="tokenpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both"> <form method="post" autocomplete="off"> <input type="hidden" name="action" value="tokenlogin"> <input type="hidden" name="hwstate" value="{{{hwstate}}}"> <div id="message4"> {{{message}}} </div> <table> <tr> <td align="right" width="100">Login token:</td> <td> <input id="tokenInput" type="text" name="token" maxlength="50" onchange="checkToken(event)" onkeyup="checkToken(event)" onkeydown="checkToken(event)" onfocus="checkTokenTimer(1)" onblur="checkTokenTimer(0)"> <input id="hwtokenInput" type="text" name="hwtoken" style="display:none"> </td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="tokenOkButton" type="submit" value="Login" disabled="disabled"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> <input id="tokenformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="resettokenpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both"> <form method="post" autocomplete="off"> <input type="hidden" name="action" value="resetaccount"> <div id="message5"> {{{message}}} </div> <table> <tr> <td align="right" width="100">Login token:</td> <td> <input id="resetTokenInput" type="text" name="token" maxlength="50" onchange="resetCheckToken(event)" onpaste="resetCheckToken(event)" onkeyup="resetCheckToken(event)" onkeydown="resetCheckToken(event)"> <input id="resetHwtokenInput" type="text" name="hwtoken" style="display:none"> </td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="resetTokenOkButton" type="submit" value="Login" disabled="disabled"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> <input id="resettokenformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="resetpasswordpanel" style="position:relative;background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;display:none"> <form method="post"> <input type="hidden" name="action" value="resetpassword"> <div id="message6"> {{{message}}} </div> <div id="rpasswordPolicyCallout" style="left:-10px;width:100px;display:none;position:absolute;background-color:#FFC;border-radius:5px;padding:5px;box-shadow:0px 0px 15px #666;font-size:10px"></div> <table> <tr> <td id="rnuPass1" width="100" align="right">Password:</td> <td><input id="rapassword1" type="password" name="rpassword1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(3,event)" onkeyup="validatePassReset(3,event)"></td> </tr> <tr> <td id="rnuPass2" align="right">Password:</td> <td><input id="rapassword2" type="password" name="rpassword2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(4,event)" onkeyup="validatePassReset(4,event)"></td> </tr> <tr id="resetpasswordpanelHint" style="display:none"> <td id="rnuHint" align="right">Password Hint:</td> <td><input id="rapasswordhint" type="text" name="rpasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(5,event)" onkeyup="validatePassReset(5,event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="resetPassButton" type="submit" value="Reset Password" disabled="disabled"></div> <div id="rpassWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> <input id="resetpasswordformargs" name="urlargs" type="hidden" value=""> </form> </div> </td> </tr> </table> </div> </div> <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px"> <table cellpadding="0" cellspacing="6" style="width:100%"> <tr> <td style="text-align:left;color:white">{{{footer}}}</td> <td style="text-align:right">{{{rootCertLink}}}&nbsp;<a href="terms">Terms &amp; Privacy</a></td> </tr> </table> </div> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:180px;width:400px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> </div> </div> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function QC(a){try{return Q(a).classList}catch(a){}}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}function zeroPad(b,a){if(a==null){a=2}var d="00000000"+b;return d.substr(d.length-a)}"use strict";if(!window.u2f){var u2f=u2f||{};var js_api_version;u2f.EXTENSION_ID="kmendfapggjehodndflmmgagdbamhnfd";u2f.MessageTypes={U2F_REGISTER_REQUEST:"u2f_register_request",U2F_REGISTER_RESPONSE:"u2f_register_response",U2F_SIGN_REQUEST:"u2f_sign_request",U2F_SIGN_RESPONSE:"u2f_sign_response",U2F_GET_API_VERSION_REQUEST:"u2f_get_api_version_request",U2F_GET_API_VERSION_RESPONSE:"u2f_get_api_version_response"};u2f.ErrorCodes={OK:0,OTHER_ERROR:1,BAD_REQUEST:2,CONFIGURATION_UNSUPPORTED:3,DEVICE_INELIGIBLE:4,TIMEOUT:5};u2f.U2fRequest;u2f.U2fResponse;u2f.Error;u2f.Transport;u2f.Transports;u2f.SignRequest;u2f.SignResponse;u2f.RegisterRequest;u2f.RegisterResponse;u2f.RegisteredKey;u2f.GetJsApiVersionResponse;u2f.getMessagePort=function(a){if(typeof chrome!="undefined"&&chrome.runtime){var b={type:u2f.MessageTypes.U2F_SIGN_REQUEST,signRequests:[]};chrome.runtime.sendMessage(u2f.EXTENSION_ID,b,function(){if(!chrome.runtime.lastError){u2f.getChromeRuntimePort_(a)}else{u2f.getIframePort_(a)}})}else{if(u2f.isAndroidChrome_()){u2f.getAuthenticatorPort_(a)}else{if(u2f.isIosChrome_()){u2f.getIosPort_(a)}else{u2f.getIframePort_(a)}}}};u2f.isAndroidChrome_=function(){var a=navigator.userAgent;return a.indexOf("Chrome")!=-1&&a.indexOf("Android")!=-1};u2f.isIosChrome_=function(){var b=["iPhone","iPad","iPod"];for(var a in b){if(navigator.platform==b[a]){return true}}return false};u2f.getChromeRuntimePort_=function(a){var b=chrome.runtime.connect(u2f.EXTENSION_ID,{includeTlsChannelId:true});setTimeout(function(){a(new u2f.WrappedChromeRuntimePort_(b))},0)};u2f.getAuthenticatorPort_=function(a){setTimeout(function(){a(new u2f.WrappedAuthenticatorPort_())},0)};u2f.getIosPort_=function(a){setTimeout(function(){a(new u2f.WrappedIosPort_())},0)};u2f.WrappedChromeRuntimePort_=function(a){this.port_=a};u2f.formatSignRequest_=function(a,b,d,g,e){if(js_api_version===undefined||js_api_version<1.1){var f=[];for(var c=0;c<d.length;c++){f[c]={version:d[c].version,challenge:b,keyHandle:d[c].keyHandle,appId:a}}return{type:u2f.MessageTypes.U2F_SIGN_REQUEST,signRequests:f,timeoutSeconds:g,requestId:e}}return{type:u2f.MessageTypes.U2F_SIGN_REQUEST,appId:a,challenge:b,registeredKeys:d,timeoutSeconds:g,requestId:e}};u2f.formatRegisterRequest_=function(a,c,d,g,e){if(js_api_version===undefined||js_api_version<1.1){for(var b=0;b<d.length;b++){d[b].appId=a}var f=[];for(var b=0;b<c.length;b++){f[b]={version:c[b].version,challenge:d[0],keyHandle:c[b].keyHandle,appId:a}}return{type:u2f.MessageTypes.U2F_REGISTER_REQUEST,signRequests:f,registerRequests:d,timeoutSeconds:g,requestId:e}}return{type:u2f.MessageTypes.U2F_REGISTER_REQUEST,appId:a,registerRequests:d,registeredKeys:c,timeoutSeconds:g,requestId:e}};u2f.WrappedChromeRuntimePort_.prototype.postMessage=function(a){this.port_.postMessage(a)};u2f.WrappedChromeRuntimePort_.prototype.addEventListener=function(a,b){var c=a.toLowerCase();if(c=="message"||c=="onmessage"){this.port_.onMessage.addListener(function(d){b({data:d})})}else{console.error("WrappedChromeRuntimePort only supports onMessage")}};u2f.WrappedAuthenticatorPort_=function(){this.requestId_=-1;this.requestObject_=null};u2f.WrappedAuthenticatorPort_.prototype.postMessage=function(b){var a=u2f.WrappedAuthenticatorPort_.INTENT_URL_BASE_+";S.request="+encodeURIComponent(JSON.stringify(b))+";end";document.location=a};u2f.WrappedAuthenticatorPort_.prototype.getPortType=function(){return"WrappedAuthenticatorPort_"};u2f.WrappedAuthenticatorPort_.prototype.addEventListener=function(a,b){var c=a.toLowerCase();if(c=="message"){var d=this;window.addEventListener("message",d.onRequestUpdate_.bind(d,b),false)}else{console.error("WrappedAuthenticatorPort only supports message")}};u2f.WrappedAuthenticatorPort_.prototype.onRequestUpdate_=function(a,d){var e=JSON.parse(d.data);var c=e.intentURL;var b=e.errorCode;var f=null;if(e.hasOwnProperty("data")){f=(JSON.parse(e.data))}a({data:f})};u2f.WrappedAuthenticatorPort_.INTENT_URL_BASE_="intent:#Intent;action=com.google.android.apps.authenticator.AUTHENTICATE";u2f.WrappedIosPort_=function(){};u2f.WrappedIosPort_.prototype.postMessage=function(a){var b=JSON.stringify(a);var c="u2f://auth?"+encodeURI(b);location.replace(c)};u2f.WrappedIosPort_.prototype.getPortType=function(){return"WrappedIosPort_"};u2f.WrappedIosPort_.prototype.addEventListener=function(a,b){var c=a.toLowerCase();if(c!=="message"){console.error("WrappedIosPort only supports message")}};u2f.getIframePort_=function(a){var d="chrome-extension://"+u2f.EXTENSION_ID;var c=document.createElement("iframe");c.src=d+"/u2f-comms.html";c.setAttribute("style","display:none");document.body.appendChild(c);var b=new MessageChannel();var e=function(f){if(f.data=="ready"){b.port1.removeEventListener("message",e);a(b.port1)}else{console.error('First event on iframe port was not "ready"')}};b.port1.addEventListener("message",e);b.port1.start();c.addEventListener("load",function(){c.contentWindow.postMessage("init",d,[b.port2])})};u2f.EXTENSION_TIMEOUT_SEC=30;u2f.port_=null;u2f.waitingForPort_=[];u2f.reqCounter_=0;u2f.callbackMap_={};u2f.getPortSingleton_=function(a){if(u2f.port_){a(u2f.port_)}else{if(u2f.waitingForPort_.length==0){u2f.getMessagePort(function(b){u2f.port_=b;u2f.port_.addEventListener("message",(u2f.responseHandler_));while(u2f.waitingForPort_.length){u2f.waitingForPort_.shift()(u2f.port_)}})}u2f.waitingForPort_.push(a)}};u2f.responseHandler_=function(b){var d=b.data;var c=d.requestId;if(!c||!u2f.callbackMap_[c]){console.error("Unknown or missing requestId in response.");return}var a=u2f.callbackMap_[c];delete u2f.callbackMap_[c];a(d.responseData)};u2f.sign=function(a,c,e,b,d){if(js_api_version===undefined){u2f.getApiVersion(function(f){js_api_version=f.js_api_version===undefined?0:f.js_api_version;u2f.sendSignRequest(a,c,e,b,d)})}else{u2f.sendSignRequest(a,c,e,b,d)}};u2f.sendSignRequest=function(a,c,e,b,d){u2f.getPortSingleton_(function(f){var h=++u2f.reqCounter_;u2f.callbackMap_[h]=b;var i=(typeof d!=="undefined"?d:u2f.EXTENSION_TIMEOUT_SEC);var g=u2f.formatSignRequest_(a,c,e,i,h);f.postMessage(g)})};u2f.register=function(a,e,d,b,c){if(js_api_version===undefined){u2f.getApiVersion(function(f){js_api_version=f.js_api_version===undefined?0:f.js_api_version;u2f.sendRegisterRequest(a,e,d,b,c)})}else{u2f.sendRegisterRequest(a,e,d,b,c)}};u2f.sendRegisterRequest=function(a,e,d,b,c){u2f.getPortSingleton_(function(f){var h=++u2f.reqCounter_;u2f.callbackMap_[h]=b;var i=(typeof c!=="undefined"?c:u2f.EXTENSION_TIMEOUT_SEC);var g=u2f.formatRegisterRequest_(a,d,e,i,h);f.postMessage(g)})};u2f.getApiVersion=function(a,b){u2f.getPortSingleton_(function(d){if(d.getPortType){var c;switch(d.getPortType()){case"WrappedIosPort_":case"WrappedAuthenticatorPort_":c=1.1;break;default:c=0;break}a({js_api_version:c});return}var f=++u2f.reqCounter_;u2f.callbackMap_[f]=a;var e={type:u2f.MessageTypes.U2F_GET_API_VERSION_REQUEST,timeoutSeconds:(typeof b!=="undefined"?b:u2f.EXTENSION_TIMEOUT_SEC),requestId:f};d.postMessage(e)})}}"use strict";var passhint="{{{passhint}}}";var newAccountPass=parseInt("{{{newAccountPass}}}");var emailCheck=("{{{emailcheck}}}"=="true");var features=parseInt("{{{features}}}");var passRequirements="{{{passRequirements}}}";if(passRequirements!=""){passRequirements=JSON.parse(decodeURIComponent(passRequirements))}else{passRequirements={}}var passRequirementsEx=((passRequirements.min!=null)||(passRequirements.max!=null)||(passRequirements.upper!=null)||(passRequirements.lower!=null)||(passRequirements.numeric!=null)||(passRequirements.nonalpha!=null));var hardwareKeyChallenge=decodeURIComponent("{{{hkey}}}");var currentpanel=0;if(window.location.href.indexOf("?")>0){var urlargs=window.location.href.substring(window.location.href.indexOf("?"));Q("loginformargs").value=urlargs;Q("createformargs").value=urlargs;Q("resetformargs").value=urlargs;Q("tokenformargs").value=urlargs;Q("resettokenformargs").value=urlargs;Q("resetpasswordformargs").value=urlargs}function startup(){if((features&32)==0){var d=null;try{d=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(d==null||top.active==false)){top.location=self.location;return}}if(features&2097152){QH("loginusername","Email:");QH("resetAccountSpan","Forgot password?");QV("nuUserRow",false)}QV("createPanelHint",passRequirements.hint===true);QV("resetpasswordpanelHint",passRequirements.hint===true);window.onresize=center;center();validateLogin();validateCreate();if("{{loginmode}}"!=""){go(parseInt("{{loginmode}}"))}else{go(1)}QV("newAccountDiv",("{{{newAccount}}}"==="1")||("{{{newAccount}}}"==="true"));if((passRequirements.hint===true)&&(passhint!=null)&&(passhint.length>0)){QV("showPassHintLink",true)}QV("newAccountPass",(newAccountPass==1));QV("resetAccountDiv",(emailCheck==true));QV("hrAccountDiv",(emailCheck==true)||(newAccountPass==1));if("{{loginmode}}"=="4"){try{if(hardwareKeyChallenge.length>0){hardwareKeyChallenge=JSON.parse(hardwareKeyChallenge)}else{hardwareKeyChallenge=null}}catch(b){hardwareKeyChallenge=null}if((hardwareKeyChallenge!=null)&&(hardwareKeyChallenge.type=="webAuthn")){hardwareKeyChallenge.challenge=Uint8Array.from(atob(hardwareKeyChallenge.challenge),function(e){return e.charCodeAt(0)}).buffer;var f={challenge:hardwareKeyChallenge.challenge,allowCredentials:[],timeout:hardwareKeyChallenge.timeout};for(var c=0;c<hardwareKeyChallenge.keyIds.length;c++){f.allowCredentials.push({id:Uint8Array.from(atob(hardwareKeyChallenge.keyIds[c]),function(e){return e.charCodeAt(0)}),type:"public-key",transports:["usb","ble","nfc"],})}navigator.credentials.get({publicKey:f}).then(function(g){var e={id:btoa(String.fromCharCode.apply(null,new Uint8Array(g.rawId))),clientDataJSON:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.clientDataJSON))),userHandle:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.userHandle))),signature:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.signature))),authenticatorData:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.authenticatorData))),};Q("hwtokenInput").value=JSON.stringify(e);QE("tokenOkButton",true);Q("tokenOkButton").click()},function(e){console.log("credentials-get error",e)})}}if("{{loginmode}}"=="5"){try{if(hardwareKeyChallenge.length>0){hardwareKeyChallenge=JSON.parse(hardwareKeyChallenge)}else{hardwareKeyChallenge=null}}catch(b){hardwareKeyChallenge=null}if((hardwareKeyChallenge!=null)&&(hardwareKeyChallenge.type=="webAuthn")){hardwareKeyChallenge.challenge=Uint8Array.from(atob(hardwareKeyChallenge.challenge),function(e){return e.charCodeAt(0)}).buffer;var f={challenge:hardwareKeyChallenge.challenge,allowCredentials:[],timeout:hardwareKeyChallenge.timeout};for(var c=0;c<hardwareKeyChallenge.keyIds.length;c++){f.allowCredentials.push({id:Uint8Array.from(atob(hardwareKeyChallenge.keyIds[c]),function(e){return e.charCodeAt(0)}),type:"public-key",transports:["usb","ble","nfc"],})}navigator.credentials.get({publicKey:f}).then(function(g){var e={id:btoa(String.fromCharCode.apply(null,new Uint8Array(g.rawId))),clientDataJSON:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.clientDataJSON))),userHandle:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.userHandle))),signature:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.signature))),authenticatorData:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.authenticatorData))),};Q("resetHwtokenInput").value=JSON.stringify(e);QE("resetTokenOkButton",true);Q("resetTokenOkButton").click()},function(e){console.log("credentials-get error",e)})}}}function showPassHint(){if(passRequirements.hint===true){messagebox("Password Hint",passhint)}}function xgo(a){QV("message1",false);QV("message2",false);QV("message3",false);QV("message4",false);QV("message5",false);QV("message6",false);go(a)}function go(a){currentpanel=a;setDialogMode(0);QV("showPassHintLink",false);QV("loginpanel",a==1);QV("createpanel",a==2);QV("resetpanel",a==3);QV("tokenpanel",a==4);QV("resettokenpanel",a==5);QV("resetpasswordpanel",a==6);if(a==1){Q("username").focus()}if(a==2){if(features&2097152){Q("aemail").focus()}else{Q("ausername").focus()}}if(a==3){Q("remail").focus()}if(a==4){Q("tokenInput").focus()}if(a==5){Q("resetTokenInput").focus()}if(a==6){Q("rapassword1").focus()}}function validateLogin(a,b){var c=((Q("username").value.length>0)&&(Q("username").value.indexOf(" ")==-1)&&(Q("password").value.length>0));QE("loginButton",c);setDialogMode(0);if((b!=null)&&(b.keyCode==13)){if(a==1){Q("password").focus()}else{if(a==2){Q("loginButton").click()}}}if(b!=null){haltEvent(b)}}function validateCreate(a,b){setDialogMode(0);var c=false;if(features&2097152){c=true}else{c=(Q("ausername").value.length>0)&&(Q("ausername").value.indexOf(" ")==-1)&&(Q("ausername").value.indexOf('"')==-1)&&(Q("ausername").value.indexOf(",")==-1)}c&=((validateEmail(Q("aemail").value)==true)&&(Q("apassword1").value.length>0)&&(Q("apassword2").value==Q("apassword1").value));if((newAccountPass==1)&&(Q("anewaccountpass").value.length==0)){c=false}if(Q("apassword1").value==""){QH("passWarning","");QV("passwordPolicyCallout",false)}else{if(!passRequirementsEx){var f=checkPasswordStrength(Q("apassword1").value);if(f>=80){QH("passWarning","<span style=color:green><b>Strong Password</b><span>")}else{if(f>=60){QH("passWarning","<span style=color:blue><b>Good Password</b><span>")}else{QH("passWarning","<span style=color:red><b>Weak Password</b><span>")}}}else{var d=checkPasswordRequirements(Q("apassword1").value,passRequirements);if(d==false){c=false;QH("passWarning","<span style=color:red><b>Password Policy</b><span>");QV("passwordPolicyCallout",true);QH("passwordPolicyCallout",passwordPolicyText(Q("apassword1").value))}else{QH("passWarning","");QV("passwordPolicyCallout",false)}}}QE("createButton",c);if((b!=null)&&(b.keyCode==13)){if(a==1){Q("aemail").focus()}if(a==2){Q("apassword1").focus()}if(a==3){Q("apassword2").focus()}if(a==4){Q("apasswordhint").focus()}if(a==5){if(newAccountPass==1){Q("anewaccountpass").focus()}else{Q("createButton").click()}}if(a==6){Q("createButton").click()}}if(b!=null){haltEvent(b)}}function validatePassReset(a,b){setDialogMode(0);var d=(Q("rapassword1").value.length>0);var f=(Q("rapassword2").value.length>0)&&(Q("rapassword2").value==Q("rapassword1").value);var c=(d&&f);QS("rnuPass1").color=d?"black":"#7b241c";QS("rnuPass2").color=f?"black":"#7b241c";if(Q("rapassword1").value==""){QH("rpassWarning","");QV("rpasswordPolicyCallout",false)}else{if(!passRequirementsEx){var h=checkPasswordStrength(Q("rapassword1").value);if(h>=80){QH("rpassWarning","<span style=color:green><b>Strong Password</b><span>")}else{if(h>=60){QH("rpassWarning","<span style=color:blue><b>Good Password</b><span>")}else{QH("rpassWarning","<span style=color:red><b>Weak Password</b><span>")}}}else{var g=checkPasswordRequirements(Q("rapassword1").value,passRequirements);if(g==false){c=false;QS("rnuPass1").color="#7b241c";QS("rnuPass2").color="#7b241c";QH("rpassWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>");QV("rpasswordPolicyCallout",true);QH("rpasswordPolicyCallout",passwordPolicyText(Q("rapassword1").value))}else{QH("rpassWarning","");QV("rpasswordPolicyCallout",false)}}}if((b!=null)&&(b.keyCode==13)){if(a==2){Q("rapassword1").focus()}if(a==3){Q("rapassword2").focus()}if(a==4){Q("rapasswordhint").focus()}if(a==6){Q("resetPassButton").click()}}if(b!=null){haltEvent(b)}QE("resetPassButton",c)}function validateReset(a){setDialogMode(0);var b=validateEmail(Q("remail").value);QE("eresetButton",b);if((a!=null)&&(a.keyCode==13)&&(b==true)){Q("eresetButton").click()}if(a!=null){haltEvent(a)}}function passwordPolicyText(b){var c="<div style=text-align:left>";var a=strCount(b);if(passRequirements.min&&((b==null)||(b.length<passRequirements.min))){c+="Minimum length of "+passRequirements.min+"<br />"}if(passRequirements.max&&((b==null)||(b.length>passRequirements.max))){c+="Maximum length of "+passRequirements.max+"<br />"}if(passRequirements.upper&&((b==null)||(a.upper<passRequirements.upper))){c+=""+passRequirements.upper+" upper case<br />"}if(passRequirements.lower&&((b==null)||(a.lower<passRequirements.lower))){c+=""+passRequirements.lower+" lower case<br />"}if(passRequirements.numeric&&((b==null)||(a.numeric<passRequirements.numeric))){c+=""+passRequirements.numeric+" numeric<br />"}if(passRequirements.nonalpha&&((b==null)||(a.nonalpha<passRequirements.nonalpha))){c+=passRequirements.nonalpha+" non-alphanumeric<br />"}c+="</div>";return c}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}function checkPasswordRequirements(b,c){if((c==null)||(c=="")||(typeof c!="object")){return true}if(c.min){if(b.length<c.min){return false}}if(c.max){if(b.length>c.max){return false}}var a=strCount(b);if(c.numeric&&(a.numeric<c.numeric)){return false}if(c.lower&&(a.lower<c.lower)){return false}if(c.upper&&(a.upper<c.upper)){return false}if(c.nonalpha&&(a.nonalpha<c.nonalpha)){return false}return true}function strCount(c){var a={numeric:0,lower:0,upper:0,nonalpha:0};if(typeof c!="string"){return a}for(var b=0;b<c.length;b++){if(/\d/.test(c[b])){a.numeric++}if(/[a-z]/.test(c[b])){a.lower++}if(/[A-Z]/.test(c[b])){a.upper++}if(/\W/.test(c[b])){a.nonalpha++}}return a}var xcheckTokenTimer=null;function checkTokenTimer(a){if((a==0)&&(xcheckTokenTimer!=null)){clearInterval(xcheckTokenTimer);xcheckTokenTimer=null}if((a==1)&&(xcheckTokenTimer==null)){xcheckTokenTimer=setInterval(checkToken,200)}}function checkToken(){var a=Q("tokenInput").value,b=a.split(" ").join("");if(a!=b){Q("tokenInput").value=b}QE("tokenOkButton",(Q("tokenInput").value.length==6)||(Q("tokenInput").value.length==8)||(Q("tokenInput").value.length==44))}function resetCheckToken(){var a=Q("resetTokenInput").value,b=a.split(" ").join("");if(a!=b){Q("resetTokenInput").value=b}QE("resetTokenOkButton",(Q("resetTokenInput").value.length==6)||(Q("resetTokenInput").value.length==8)||(Q("resetTokenInput").value.length==44))}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;var xxcurrentView=0;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){QS("dialog").left=((((getDocWidth()-400)/2))+"px")}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function haltReturn(a){if(a.keyCode==13){haltEvent(a)}}function validateEmail(b){var a=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return a.test(b)};</script></body></html>
\ No newline at end of file
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link rel="shortcut icon"type=image/x-icon href={{{domainurl}}}favicon.ico><script src=scripts/common-0.0.1.js></script><script src=scripts/u2f-api.js></script><title>MeshCentral - Login</title><style>a{color:#036;text-decoration:underline}#footer a{color:#fff;text-decoration:underline}#footer a:hover{color:#fff;text-decoration:none}</style><body onload='"undefined"!=typeof startup&&startup()'style="overflow-y:hidden;margin:0;padding:0;border:0;color:#000;font-size:13px;font-family:\'Trebuchet MS\',Arial,Helvetica,sans-serif"><div id=container><div id=mastheadx></div><div id=masthead style="background:url(logo.png) 0 0;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px><strong><font style=font-size:36px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px><strong><font style=font-size:12px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div></div><div id=page_content style=overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%;display:flex;align-items:center><div id=column_l style=padding:10px;width:100%><table style=width:100%><tr><td align=center><div id=loginpanel style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;display:none><form method=post><input type=hidden name=action value=login><div id=message1>{{{message}}}</div><div><b>Log In</b></div><table><tr><td id=loginusername align=right width=100>Username:<td><input id=username maxlength=64 name=username onchange=validateLogin(1) onkeyup=validateLogin(1,event)><tr><td align=right>Password:<td><input id=password type=password maxlength=256 name=password autocomplete=off onchange=validateLogin(2) onkeyup=validateLogin(2,event)><tr><td><div id=showPassHintLink style=display:none><a onclick=showPassHint() style=cursor:pointer>Show Hint</a></div><td align=right><input id=loginButton type=submit value="Log In"disabled></table><div id=hrAccountDiv style=display:none><hr></div><div id=resetAccountDiv style=display:none;padding:2px><span id=resetAccountSpan>Forgot user/password?</span><a onclick=xgo(3) style=cursor:pointer>Reset account</a>.</div><div id=newAccountDiv style=display:none;padding:2px>Don&#39;t have an account?<a onclick=xgo(2) style=cursor:pointer>Create one</a>.</div><input id=loginformargs name=urlargs type=hidden></form></div><div id=createpanel style=display:none><div style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;position:relative><form method=post><input type=hidden name=action value=createaccount><div id=message2>{{{message}}}</div><div><b>Account Creation</b></div><div id=passwordPolicyCallout style="left:-5px;top:10px;width:100px;position:absolute;background-color:#ffc;border-radius:5px;padding:5px;box-shadow:0 0 15px #666;font-size:10px"></div><table><tr id=nuUserRow><td align=right width=100>Username:<td><input id=ausername name=username onchange=validateCreate(1) maxlength=64 onkeydown=haltReturn(event) onkeyup=validateCreate(1,event)><tr><td align=right width=100>Email:<td><input id=aemail name=email onchange=validateCreate(2) maxlength=256 onkeydown=haltReturn(event) onkeyup=validateCreate(2,event)><tr><td align=right>Password:<td><input id=apassword1 type=password name=password1 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(3) onkeyup=validateCreate(3,event)><tr><td align=right>Password:<td><input id=apassword2 type=password name=password2 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(4) onkeyup=validateCreate(4,event)><tr id=createPanelHint style=display:none><td align=right>Pass Hint:<td><input id=apasswordhint name=apasswordhint autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(5) onkeyup=validateCreate(5,event)><tr id=newAccountPass title="Enter the account creation token"><td align=right>Creation Token:<td><input id=anewaccountpass type=password name=anewaccountpass autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(6) onkeyup=validateCreate(6,event)><tr><td colspan=2><div style=float:right><input id=createButton type=submit value="Create Account"disabled></div><div id=passWarning style=padding-top:6px></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a><input id=createformargs name=urlargs type=hidden></form></div></div><div id=resetpanel style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both><form method=post><input type=hidden name=action value=resetaccount><div id=message3>{{{message}}}</div><div><b>Account Reset</b></div><table><tr><td align=right width=100>Email:<td><input id=remail name=email maxlength=256 onchange=validateReset() onkeyup=validateReset(event)><tr><td colspan=2><div style=float:right><input id=eresetButton type=submit value="Reset Account"disabled></div><div id=passWarning style=padding-top:6px></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a><input id=resetformargs name=urlargs type=hidden></form></div><div id=tokenpanel style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both><form method=post autocomplete=off><input type=hidden name=action value=tokenlogin> <input type=hidden name=hwstate value={{{hwstate}}}><div id=message4>{{{message}}}</div><table><tr><td align=right width=100>Login token:<td><input id=tokenInput name=token maxlength=50 onchange=checkToken(event) onkeyup=checkToken(event) onkeydown=checkToken(event) onfocus=checkTokenTimer(1) onblur=checkTokenTimer(0)> <input id=hwtokenInput name=hwtoken style=display:none><tr><td colspan=2><div style=float:right><input id=tokenOkButton type=submit value=Login disabled></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a><input id=tokenformargs name=urlargs type=hidden></form></div><div id=resettokenpanel style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both><form method=post autocomplete=off><input type=hidden name=action value=resetaccount><div id=message5>{{{message}}}</div><table><tr><td align=right width=100>Login token:<td><input id=resetTokenInput name=token maxlength=50 onchange=resetCheckToken(event) onpaste=resetCheckToken(event) onkeyup=resetCheckToken(event) onkeydown=resetCheckToken(event)> <input id=resetHwtokenInput name=hwtoken style=display:none><tr><td colspan=2><div style=float:right><input id=resetTokenOkButton type=submit value=Login disabled></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a><input id=resettokenformargs name=urlargs type=hidden></form></div><div id=resetpasswordpanel style=position:relative;background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;display:none><form method=post><input type=hidden name=action value=resetpassword><div id=message6>{{{message}}}</div><div id=rpasswordPolicyCallout style="left:-10px;width:100px;display:none;position:absolute;background-color:#ffc;border-radius:5px;padding:5px;box-shadow:0 0 15px #666;font-size:10px"></div><table><tr><td id=rnuPass1 width=100 align=right>Password:<td><input id=rapassword1 type=password name=rpassword1 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(3,event) onkeyup=validatePassReset(3,event)><tr><td id=rnuPass2 align=right>Password:<td><input id=rapassword2 type=password name=rpassword2 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(4,event) onkeyup=validatePassReset(4,event)><tr id=resetpasswordpanelHint style=display:none><td id=rnuHint align=right>Password Hint:<td><input id=rapasswordhint name=rpasswordhint autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(5,event) onkeyup=validatePassReset(5,event)><tr><td colspan=2><div style=float:right><input id=resetPassButton type=submit value="Reset Password"disabled></div><div id=rpassWarning style=padding-top:6px></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a><input id=resetpasswordformargs name=urlargs type=hidden></form></div></table></div></div><div id=footer style=height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0><table cellpadding=0 cellspacing=6 style=width:100%><tr><td style=text-align:left;color:#fff>{{{footer}}}<td style=text-align:right>{{{rootCertLink}}}&nbsp;<a href=terms>Terms &amp; Privacy</a></table></div></div><div id=dialog style="z-index:1000;background-color:#eee;box-shadow:0 0 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:180px;width:400px;display:none"><div style="width:100%;background-color:#036;color:#fff;border-radius:5px 5px 0 0"><div id=id_dialogclose style=float:right;padding:5px;cursor:pointer onclick=setDialogMode()><b>X</b></div><div id=id_dialogtitle style=padding:5px></div><div style=width:100%;margin:6px></div></div><div style=margin-right:16px;margin-left:8px><div id=dialog1 style=margin:auto;text-align:center;margin:3px><div id=id_dialogMessage style=padding:10px></div></div><div id=dialog2 style=margin:auto;margin:3px><div id=id_dialogOptions></div></div></div><div id=idx_dlgButtonBar style=padding:10px;margin-bottom:20px><input id=idx_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK style=float:right;width:80px onclick=dialogclose(1)></div></div><script>"use strict";var passhint="{{{passhint}}}",newAccountPass=parseInt("{{{newAccountPass}}}"),emailCheck=!1,features=parseInt("{{{features}}}"),passRequirements="{{{passRequirements}}}",passRequirementsEx=null!=(passRequirements=""!=passRequirements?JSON.parse(decodeURIComponent(passRequirements)):{}).min||null!=passRequirements.max||null!=passRequirements.upper||null!=passRequirements.lower||null!=passRequirements.numeric||null!=passRequirements.nonalpha,hardwareKeyChallenge=decodeURIComponent("{{{hkey}}}"),currentpanel=0;if(0<window.location.href.indexOf("?")){var urlargs=window.location.href.substring(window.location.href.indexOf("?"));Q("loginformargs").value=urlargs,Q("createformargs").value=urlargs,Q("resetformargs").value=urlargs,Q("tokenformargs").value=urlargs,Q("resettokenformargs").value=urlargs,Q("resetpasswordformargs").value=urlargs}function startup(){if(0==(32&features)){var e=null;try{e=top.location.toString().toLowerCase()}catch(e){}if(top!=self&&(null==e||0==top.active))return void(top.location=self.location)}2097152&features&&(QH("loginusername","Email:"),QH("resetAccountSpan","Forgot password?"),QV("nuUserRow",!1)),QV("createPanelHint",!0===passRequirements.hint),QV("resetpasswordpanelHint",!0===passRequirements.hint),(window.onresize=center)(),validateLogin(),validateCreate(),go(parseInt("{{loginmode}}")),QV("newAccountDiv",!1),!0===passRequirements.hint&&null!=passhint&&0<passhint.length&&QV("showPassHintLink",!0),QV("newAccountPass",1==newAccountPass),QV("resetAccountDiv",1==emailCheck),QV("hrAccountDiv",1==emailCheck||1==newAccountPass)}function showPassHint(){!0===passRequirements.hint&&messagebox("Password Hint",passhint)}function xgo(e){QV("message1",!1),QV("message2",!1),QV("message3",!1),QV("message4",!1),QV("message5",!1),QV("message6",!1),go(e)}function go(e){currentpanel=e,setDialogMode(0),QV("showPassHintLink",!1),QV("loginpanel",1==e),QV("createpanel",2==e),QV("resetpanel",3==e),QV("tokenpanel",4==e),QV("resettokenpanel",5==e),QV("resetpasswordpanel",6==e),1==e&&Q("username").focus(),2==e&&(2097152&features?Q("aemail").focus():Q("ausername").focus()),3==e&&Q("remail").focus(),4==e&&Q("tokenInput").focus(),5==e&&Q("resetTokenInput").focus(),6==e&&Q("rapassword1").focus()}function validateLogin(e,s){var a=0<Q("username").value.length&&-1==Q("username").value.indexOf(" ")&&0<Q("password").value.length;QE("loginButton",a),setDialogMode(0),null!=s&&13==s.keyCode&&(1==e?Q("password").focus():2==e&&Q("loginButton").click()),null!=s&&haltEvent(s)}function validateCreate(e,s){setDialogMode(0);var a=!1;if(a=!!(2097152&features)||0<Q("ausername").value.length&&-1==Q("ausername").value.indexOf(" ")&&-1==Q("ausername").value.indexOf('"')&&-1==Q("ausername").value.indexOf(","),a&=1==validateEmail(Q("aemail").value)&&0<Q("apassword1").value.length&&Q("apassword2").value==Q("apassword1").value,1==newAccountPass&&0==Q("anewaccountpass").value.length&&(a=!1),""==Q("apassword1").value)QH("passWarning",""),QV("passwordPolicyCallout",!1);else if(passRequirementsEx){0==checkPasswordRequirements(Q("apassword1").value,passRequirements)?(a=!1,QH("passWarning","<span style=color:red><b>Password Policy</b><span>"),QV("passwordPolicyCallout",!0),QH("passwordPolicyCallout",passwordPolicyText(Q("apassword1").value))):(QH("passWarning",""),QV("passwordPolicyCallout",!1))}else{var n=checkPasswordStrength(Q("apassword1").value);80<=n?QH("passWarning","<span style=color:green><b>Strong Password</b><span>"):60<=n?QH("passWarning","<span style=color:blue><b>Good Password</b><span>"):QH("passWarning","<span style=color:red><b>Weak Password</b><span>")}QE("createButton",a),null!=s&&13==s.keyCode&&(1==e&&Q("aemail").focus(),2==e&&Q("apassword1").focus(),3==e&&Q("apassword2").focus(),4==e&&Q("apasswordhint").focus(),5==e&&(1==newAccountPass?Q("anewaccountpass").focus():Q("createButton").click()),6==e&&Q("createButton").click()),null!=s&&haltEvent(s)}function validatePassReset(e,s){setDialogMode(0);var a=0<Q("rapassword1").value.length,n=0<Q("rapassword2").value.length&&Q("rapassword2").value==Q("rapassword1").value,t=a&&n;if(QS("rnuPass1").color=a?"black":"#7b241c",QS("rnuPass2").color=n?"black":"#7b241c",""==Q("rapassword1").value)QH("rpassWarning",""),QV("rpasswordPolicyCallout",!1);else if(passRequirementsEx){0==checkPasswordRequirements(Q("rapassword1").value,passRequirements)?(t=!1,QS("rnuPass1").color="#7b241c",QS("rnuPass2").color="#7b241c",QH("rpassWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>"),QV("rpasswordPolicyCallout",!0),QH("rpasswordPolicyCallout",passwordPolicyText(Q("rapassword1").value))):(QH("rpassWarning",""),QV("rpasswordPolicyCallout",!1))}else{var r=checkPasswordStrength(Q("rapassword1").value);80<=r?QH("rpassWarning","<span style=color:green><b>Strong Password</b><span>"):60<=r?QH("rpassWarning","<span style=color:blue><b>Good Password</b><span>"):QH("rpassWarning","<span style=color:red><b>Weak Password</b><span>")}null!=s&&13==s.keyCode&&(2==e&&Q("rapassword1").focus(),3==e&&Q("rapassword2").focus(),4==e&&Q("rapasswordhint").focus(),6==e&&Q("resetPassButton").click()),null!=s&&haltEvent(s),QE("resetPassButton",t)}function validateReset(e){setDialogMode(0);var s=validateEmail(Q("remail").value);QE("eresetButton",s),null!=e&&13==e.keyCode&&1==s&&Q("eresetButton").click(),null!=e&&haltEvent(e)}function passwordPolicyText(e){var s="<div style=text-align:left>",a=strCount(e);return passRequirements.min&&(null==e||e.length<passRequirements.min)&&(s+=format("Minimum length of {0}",passRequirements.min)+"<br />"),passRequirements.max&&(null==e||e.length>passRequirements.max)&&(s+=format("Maximum length of {0}",passRequirements.max)+"<br />"),passRequirements.upper&&(null==e||a.upper<passRequirements.upper)&&(s+=format("{0} upper case",passRequirements.upper)+"<br />"),passRequirements.lower&&(null==e||a.lower<passRequirements.lower)&&(s+=format("{0} lower case",passRequirements.lower)+"<br />"),passRequirements.numeric&&(null==e||a.numeric<passRequirements.numeric)&&(s+=format("{0} numeric",passRequirements.numeric)+"<br />"),passRequirements.nonalpha&&(null==e||a.nonalpha<passRequirements.nonalpha)&&(s+=format("{0} non-alphanumeric",passRequirements.nonalpha)+"<br />"),s+="</div>"}function checkPasswordStrength(e){var s=0,a={},n=0,t={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e)return 0;for(var r=0;r<e.length;r++)a[e[r]]=(a[e[r]]||0)+1,s+=5/a[e[r]];for(var o in t)n+=1==t[o]?1:0;return parseInt(s+10*(n-1))}function checkPasswordRequirements(e,s){if(null==s||""==s||"object"!=typeof s)return!0;if(s.min&&e.length<s.min)return!1;if(s.max&&e.length>s.max)return!1;var a=strCount(e);return!(s.numeric&&a.numeric<s.numeric)&&(!(s.lower&&a.lower<s.lower)&&(!(s.upper&&a.upper<s.upper)&&!(s.nonalpha&&a.nonalpha<s.nonalpha)))}function strCount(e){var s={numeric:0,lower:0,upper:0,nonalpha:0};if("string"!=typeof e)return s;for(var a=0;a<e.length;a++)/\d/.test(e[a])&&s.numeric++,/[a-z]/.test(e[a])&&s.lower++,/[A-Z]/.test(e[a])&&s.upper++,/\W/.test(e[a])&&s.nonalpha++;return s}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,xcheckTokenTimer=null;function checkTokenTimer(e){0==e&&null!=xcheckTokenTimer&&(clearInterval(xcheckTokenTimer),xcheckTokenTimer=null),1==e&&null==xcheckTokenTimer&&(xcheckTokenTimer=setInterval(checkToken,200))}function checkToken(){var e=Q("tokenInput").value,s=e.split(" ").join("");e!=s&&(Q("tokenInput").value=s),QE("tokenOkButton",6==Q("tokenInput").value.length||8==Q("tokenInput").value.length||44==Q("tokenInput").value.length)}function resetCheckToken(){var e=Q("resetTokenInput").value,s=e.split(" ").join("");e!=s&&(Q("resetTokenInput").value=s),QE("resetTokenOkButton",6==Q("resetTokenInput").value.length||8==Q("resetTokenInput").value.length||44==Q("resetTokenInput").value.length)}var xxcurrentView=0;function setDialogMode(e,s,a,n,t,r){xxdialogMode=e,xxdialogFunc=n,xxdialogButtons=a,xxdialogTag=r,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&a),QV("idx_dlgCancelButton",2&a),QV("id_dialogclose",2&a||8&a),QV("idx_dlgButtonBar",7&a),s&&QH("id_dialogtitle",s);for(var o=1;o<24;o++)QV("dialog"+o,o==e);QV("dialog",e),t&&(2==e?QH("id_dialogOptions",t):QH("id_dialogMessage",t))}function dialogclose(e){var s=xxdialogFunc,a=xxdialogButtons,n=xxdialogTag;setDialogMode(),(8&a||e)&&s&&s(e,n)}function center(){QS("dialog").left=(getDocWidth()-400)/2+"px"}function messagebox(e,s){QH("id_dialogMessage",s),setDialogMode(1,e,1)}function statusbox(e,s){QH("id_dialogMessage",s),setDialogMode(1,e)}function getDocWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement.clientWidth:document.getElementsByTagName("body")[0].clientWidth}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function haltReturn(e){13==e.keyCode&&haltEvent(e)}function validateEmail(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}function format(e){var a=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,s){return void 0!==a[s]?a[s]:e})}</script>
\ No newline at end of file
views/message-min.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=/styles/style.css media=screen rel=stylesheet title=CSS><title>MeshCentral - {{{title3}}}</title><div id=container style=max-height:100vh><div id=mastheadx></div><div id=masthead style="background:url(logo.png) 0 0;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px><strong><font style=font-size:46px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px><strong><font style=font-size:14px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div></div><div id=page_content style=max-height:calc(100vh-138px)><div id=column_l><h1>{{{title3}}}</h1><p style=margin-left:20px>{{{message}}}</p><br></div><div id=footer><table cellpadding=0 cellspacing=10 style=width:100%><tr><td style=text-align:left><td style=text-align:right><a href=terms>Terms &amp; Privacy</a></table></div></div></div>
\ No newline at end of file
views/messenger-min.handlebars
+1 -1
@@ -1 +1 @@
1 -<!DOCTYPE html> <html style="height:100%"> <head> <title>MeshMessenger</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="format-detection" content="telephone=no"> <style> html, body{width:100%;height:100%;}body{margin:0;padding:0;border:0;color:black;font-size:13px;font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;background-color:#d3d9d6; }#container{background-color:#fff;width:960px;min-width:960px;max-height:100vh;margin:0 auto;border-top:0;border-right:1px solid #b7b7b7;border-bottom:0;border-left:1px solid #b7b7b7;padding:0;}.night #container{color:#bbb;background-color:#000;}.fullscreen.login #container{-ms-grid-rows:66px 24px 1fr 45px;grid-template-rows:66px 24px auto 45px;-ms-grid-columns:90px 1fr; grid-template-areas:"header header" "nav nav" "content content" "footer footer";}.fullscreen.arg_hide #container{-ms-grid-rows:66px 24px 1fr 45px;grid-template-rows:66px 24px auto 45px;-ms-grid-columns:90px 1fr; grid-template-areas:"header header" "nav nav" "content content" "footer footer";}.fullscreen.menu_stack #container{-ms-grid-rows:66px minmax(24px, max-content) 1fr 45px;grid-template-rows:66px minmax(24px, max-content) auto 45px;-ms-grid-columns:90px 1fr; grid-template-areas:"header header" "nav nav" "content content" "footer footer";}.fullscreen #container{width:100%;min-width:100%;min-height:0px;border-right:0px none #b7b7b7;border-left:0px none #b7b7b7;height:calc(100% - 0px);position:relative;display:-ms-grid;display:grid;grid-gap:0px;grid-template-areas:"header header" "sidebar nav" "sidebar content" "sidebar footer";-ms-grid-columns:90px 1fr;grid-template-columns:90px auto;-ms-grid-rows:66px 24px 1fr 45px;grid-template-rows:66px 24px auto 45px;}.fulldesk #container{width:100%;height:100%;min-width:700px;min-height:0px;border-right:0px none #b7b7b7;border-left:0px none #b7b7b7;position:unset;position:relative;display:-ms-grid !important;display:grid !important;grid-gap:0px;grid-template-areas:"content" !important;-ms-grid-columns:1fr;grid-template-columns:repeat(auto-fit, minmax(100px, 1fr)) !important;-ms-grid-rows:1fr;grid-template-rows:repeat(auto-fit, minmax(100px, 1fr)) !important;}#masthead{width:auto;margin:0;padding:0;overflow:hidden;text-align:right;background-color:#036;background-image:url(../logo.png);background-position-x:0px;background-position-y:0px;background-attachment:initial;background-repeat:no-repeat; height:66px;}.fullscreen #masthead{width:100%;grid-area:header;-ms-grid-column:1;-ms-grid-column-span:2;-ms-grid-row:1;}.fulldesk #masthead{display:none;}.fulldesk #mastheadx{display:none;}.fulldesk #p11deviceNameHeader{display:none;}#masthead .title{float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px;font-size:46px;font-family:Arial,Helvetica,sans-serif;font-weight:bold;}#masthead .title2{float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px;font-size:14px;font-family:Arial,Helvetica,sans-serif;font-weight:bold;}#page_leftbar{-ms-grid-column:1;-ms-grid-row:2;-ms-grid-row-span:3;height:100%; width:90px;z-index:1000;background:#113962;background:linear-gradient(to bottom, #104893 0%,#113962 100%);color:white;overflow-y:hidden;display:none;}.fullscreen #page_leftbar{grid-area:sidebar;display:block;}.menu_stack #page_leftbar{display:none;}.arg_hide #page_leftbar{display:none;}.fulldesk #page_leftbar{display:none;}#topbar{position:relative;grid-area:nav;-ms-grid-column:2;-ms-grid-row:2;}.fulldesk #topbar{display:none;}.menu_stack #topbar, .login #topbar, .arg_hide #topbar{-ms-grid-column:1;-ms-grid-column-span:2;-ms-grid-row:2;}.topbar_td{width:100px;height:24px;cursor:pointer;}.topbar_td_end{text-align:right;height:24px;}#uiMenuButton{cursor:pointer;color:white;position:absolute;top:3px;right:6px;}#uiMenu{position:absolute;top:17px;right:0;background-color:#eee;z-index:10;border-radius:5px;box-shadow:1px 0px 10px 5px #333;padding:5px;} #MainSubMenuSpan, #MeshSubMenuSpan, #UserSubMenuSpan, #ServerSubMenuSpan, #MainMenuSpan, #MainSubMenu, #MeshSubMenu, #UserSubMenu, #ServerSubMenu, #UserDummyMenu{width:100%;height:24px;color:white;background-color:#808080;}.menu_stack #UserDummyMenu{display:none;}#MainMenuSpan{display:table;}.fullscreen #MainMenuSpan{display:none;}.fulldesk #MainMenuSpan{display:none;}.menu_stack #MainMenuSpan{display:block;}#column_l{position:relative; width:100%;box-sizing:border-box;margin:0;padding:0 15px;background-color:#fff; min-width:unset;}.night #column_l{background-color:#000;}.menu_stack.fullscreen.fulldesk #column_l{-ms-grid-column:1;-ms-grid-row:1;-ms-grid-column-span:2;-ms-grid-row-span:4;}.fullscreen #column_l{-ms-grid-column:2;-ms-grid-row:3;grid-area:content;width:unset; overflow-y:auto;}.menu_stack.fullscreen #column_l, .login #column_l, .arg_hide #column_l{-ms-grid-column:1;-ms-grid-column-span:2;-ms-grid-row:3;}.fulldesk #column_l{height:100%;width:100%;height:unset;margin-left:unset;overflow-y:hidden;padding:0;max-height:none;-ms-grid-column:1;-ms-grid-row:1;background-color:rgb(0, 51, 102);}.fulldesk #column_l_bottomgap{display:none;}.room4submenu{ min-height:calc(100vh - 184px);}#centralTable{width:100%;}#welcomeimage{text-align:center;width:50%;}@media (max-width:800px){.fullscreen #welcomeimage{display:none;}}#welcomeimage img{height:310px;width:359px;}#logincell{text-align:center;width:50%;}.night #logincell a{color:blue;}#loginpanel, #createpanel, #resetpanel, #tokenpanel, #resettokenpanel, #resetpasswordpanel, #resetpasswordpanel{display:inline-block;margin:0;background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;color:black;}#passwordPolicyCallout, #rpasswordPolicyCallout{left:-10px;width:100px;position:absolute;background-color:#FFC;border-radius:5px;padding:5px;box-shadow:0px 0px 15px #666;font-size:10px;}#passWarning{padding-top:6px;}#footer{-ms-grid-column:2;-ms-grid-row:4;grid-area:footer;clear:both;overflow:auto;width:100%;text-align:center;background-color:#113962;padding-top:5px;padding-bottom:5px;}.fulldesk #footer{display:none;}.menu_stack.fullscreen #footer, .login #footer, .arg_hide #footer{-ms-grid-column:1;-ms-grid-column-span:2;-ms-grid-row:4;} #footer table{width:100%;border-spacing:10px;border-collapse:separate;}#footer td:first-child{text-align:left;color:white;}#footer td{padding:0px;text-align:right;color:white;} .footer1{text-align:left;float:left;padding:10px;color:white;}.footer2{padding:10px;text-align:right;color:white;}#masthead img{float:left;}#masthead p{font-size:11px;color:#fff;margin:10px 10px 0;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}#verifyEmailId2{color:yellow;margin-left:3px;cursor:pointer;}#dialog{z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:180px;left:calc((100% / 2) - 200px);width:400px;color:black;}#dialogHeader{width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0;margin-bottom:6px;}#id_dialogclose{float:right;padding:3px;margin-right:3px;cursor:pointer;}#id_dialogtitle{padding:5px;}#dialogBody{margin-right:16px;margin-left:8px;}.dialogText{width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%;}.dialogTextLog{font-size:10px;}#dialog1{margin:auto;text-align:center;margin:3px;}#id_dialogMessage{padding:10px;}#dialog2, #dialog3, #dialog7{margin:3px;}#d3uploadMode, #d3localFile{float:right;width:260px;}#d3serveraction{width:100%;background-color:#d3d9d6;text-align:left;padding:3px;}#d3serverfiles{width:100%;height:150px;background-color:white;padding:2px;border:1px solid gray;overflow-y:scroll;}#d7bitmapquality, #d7bitmapquality, #d7bitmapscaling, #d7framelimiter, #d7desktopmode{float:right;width:200px;height:20px;}#dialog7 h4{width:100%;border-bottom:1px solid gray;}#d7meshkvm div, #d7amtkvm div, #d3upload, #d3localmode{margin:3px 0 3px 0;display:flex;justify-content:space-between;}#d7otherset{border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white;}#idx_dlgButtonBar{padding:10px;margin-bottom:5px;margin-right:10px;overflow:auto;}#idx_dlgCancelButton{float:right;width:80px;margin-left:5px;}#idx_dlgOkButton{float:right;width:80px;margin-left:5px;}#idx_dlgDeleteButton{float:left;width:80px;margin-left:5px;}#ua_fileaccessquota{width:80px;text-align:right;}#broadcastMessage{width:370px;height:100px;resize:none;}#idx_deskFullBtn2{float:left;font-size:16px;cursor:pointer;display:none;}.fulldesk #idx_deskFullBtn2{display:block;}.fulldesk #deskFullBtn{display:none;}#p0message{margin:50px;text-align:center;}.deviceBarCheckbox{width:22px;float:left;background-color:white;}.night .deviceBarCheckbox{background-color:black;}#devs{color:black;}.deviceBarIcon{float:left;height:18px;width:18px;background-color:white }.night .deviceBarIcon{background-color:black;}#devListToolbarViewIcons{float:right;}#devListToolbarSpan{width:100%;height:24px;background-color:#d3d9d6;vertical-align:middle;border-spacing:0;}.night #devListToolbarSpan{color:black;background-color:#d3d9d6;}#SearchInput{width:120px;}#devListToolbarView, #devListToolbarSort, #devListToolbarSize{float:right;}#refreshmap{margin-left:5px;} #NoMeshesPanel a{cursor:pointer;}#NoMeshesPanel table{width:100%;padding:20px;}NoMeshesPanel img{height:48px;width:47px;}#xdevices{max-height:calc(100vh - 242px);overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;}#xdevicesmap{height:calc(100vh - 239px);width:100%;overflow:hidden;position:relative;}#xmapSearchResultsDlg{position:absolute;max-height:280px;left:5px;top:5px;max-width:250px;z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;}#xmapSearchResultsBck{width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0;}#xmapSearchClose{float:right;padding:5px;cursor:pointer;}.xmapItem{overflow-y:auto;width:100%;max-height:240px;}.xmapItemSel1{cursor:pointer;padding:5px;background-color:#F5F5F5;}.xmapItemSel1{cursor:pointer;padding:5px;background-color:#EBEBEB;}#xmap-info-window{text-shadow:0px 0px 15px #FFF;}#p2 a, #p6 a, #p10 a{cursor:pointer;}#p2AccountImage{width:128px;height:128px;margin-bottom:10px;margin-right:20px;float:right;}.p2AccountActions{width:15px;display:inline-block;}.p2AccountActions span{color:green;font-size:10px;}#p2AccountActions .mL{margin-left:40px;}#p2ServerActions .mL{margin-left:40px;}.newMeshBtn{background:url(../images/icon-addnew.png) no-repeat 0px 0px;height:12px;width:12px;cursor:pointer;border:none;padding-left:15px;}#p2noMeshFound, #serverStats{margin-left:40px;}#p2ServerActionsBackup, #p2ServerActionsRestore, #p2ServerActionsVersion, #p2ServerActionsErrors{margin-left:0px;}.pTable{width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px;vertical-align:middle;border-spacing:0;}#p3users{max-height:calc(100vh - 244px);overflow-y:auto;}.p3usersTable{width:100%;border-spacing:0;padding:0;}.p3usersTable th{color:gray;}#p3events, #p16events, #p31events, #p41events{height:calc(100vh - 245px);overflow-y:scroll;}.p3eventsTable{width:100%;border-spacing:0;padding:0;}#p4name, #p4email, #p4pass1, #p4pass2{width:230px;}#p5toolbar{width:100%;}#p5filehead{width:100%;background-color:#d3d9d6;text-align:left;padding:4px;}#p5filesubhead{background-color:#E4E9E7;height:28px;}#p5rightOfButtons{float:right;margin-top:3px;}#p5filetable{width:100%;height:calc(100vh - 295px);overflow:auto;-webkit-user-select:none;position:relative;}#p5PublicShare{display:none;width:100%;overflow:auto;-webkit-user-select:none;background-color:lightsteelblue;}#p5PublicShare div{padding:4px;}#bigok{width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;}#bigfail{width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;}.chartViewCanvas{width:80px;display:inline-block;}.chartViewText{width:160px;display:inline-block;}#serverCpuChart, #serverMemoryChart{width:60px;height:60px;}#serverMainStats{height:calc(100vh - 251px);max-height:calc(100vh - 251px);width:100%;}#p10BackButton, #p11BackButton{float:left;}#p10html2 table{color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse;width:100%;}#p10html2 thead{background-color:#AAA;font-weight:bold;}#p10html2 thead tr{background-color:#AAA;font-weight:bold;}#p10html2 thead img{float:right;cursor:pointer;padding:3px;}#p10html2 .altBack{background-color:#DDD;}.pwState{display:table-cell;height:16px;}.pwsYellow{background-color:yellow;}.pwsTransparent{background-color:#00000000;}.pwsBlack{background-color:black;}.pwsBlue{background-color:blue;}.pwsBlue2{background-color:blue;}.pwsLightblue{background-color:lightblue;}.pwsBlueviolet{background-color:blueviolet;}.pwsDarkgreen{background-color:darkgreen;}.pwsLightseagreen{background-color:lightseagreen;}.pwsLightseagreen2{background-color:lightseagreen;}.p10html3right{float:right;font-size:x-small;}.p10html3left{font-size:x-small;}#dp10devicevalue{width:230px;}.fulldesk #p11{height:100%;}#MainComputerImage{border-width:0px;height:200px;width:200px;}#MainComputerState{font-size:12px;font-weight:bold;width:100%;text-align:center;}#d2groupop{float:right;width:250px;}#p12warning, #p12warning2, #p11warning, #p11warning2{max-width:100%;display:none;cursor:pointer;margin-bottom:5px;}#MainMeshImage{border-width:0px;height:200px;width:200px;float:right;}#DeskTools{position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;}#DeskToolsRefreshButton{float:right;padding:3px;cursor:pointer;}a{color:#036;text-decoration:underline;cursor:pointer;}.night a{color:#69B;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;cursor:pointer;border:none;}.j1{background:url(../images/icons16.png) 0px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j2{background:url(../images/icons16.png) -16px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j3{background:url(../images/icons16.png) -32px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j4{background:url(../images/icons16.png) -48px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j5{background:url(../images/icons16.png) -64px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j6{background:url(../images/icons16.png) -80px 0px;height:16px;width:16px;cursor:pointer;border:none;}.relayIcon16{background:url(../images/icon-relay.png);height:16px;width:16px;cursor:pointer;border:none;}.lbbutton{width:74px;height:74px;border-radius:5px;background-color:white;margin-left:8px;margin-top:8px;position:relative;cursor:pointer;opacity:0.5;}.night .lbbutton{background-color:black;}.lbbutton:hover{opacity:1;}.lbbuttonsel{opacity:0.9;}.lbbuttonsel2{width:82px;border-radius:5px 0px 0px 5px;opacity:1;}.lb1{background:url(../images/leftbar-64.png) -1px -2px;height:62px;width:62px;cursor:pointer;border:none;position:absolute;top:6px;left:6px;}.lb2{background:url(../images/leftbar-64.png) -66px -2px;height:62px;width:62px;cursor:pointer;border:none;position:absolute;top:6px;left:6px;}.lb3{background:url(../images/leftbar-64.png) -130px -2px;height:62px;width:62px;cursor:pointer;border:none;position:absolute;top:6px;left:6px;}.lb4{background:url(../images/leftbar-64.png) -194px -2px;height:62px;width:62px;cursor:pointer;border:none;position:absolute;top:6px;left:6px;}.lb5{background:url(../images/leftbar-64.png) -257px -2px;height:62px;width:62px;cursor:pointer;border:none;position:absolute;top:6px;left:6px;}.lb6{background:url(../images/leftbar-64.png) -318px -2px;height:62px;width:62px;cursor:pointer;border:none;position:absolute;top:6px;left:6px;}.m0{background:url(../images/images16.png) -32px 0px;height:16px;width:16px;border:none;float:left;}.m1{background:url(../images/images16.png) -16px 0px;height:16px;width:16px;border:none;float:left;}.m2{background:url(../images/images16.png) -96px 0px;height:16px;width:16px;border:none;float:left;}.m3{background:url(../images/images16.png) -112px 0px;height:16px;width:16px;border:none;float:left;}.si0{background:url(../images/icons16.png) 0px 0px;height:16px;width:16px;border:none;float:left;}.si1{background:url(../images/icons16.png) -16px 0px;height:16px;width:16px;border:none;float:left;}.si2{background:url(../images/icons16.png) -32px 0px;height:16px;width:16px;border:none;float:left;}.si3{background:url(../images/icons16.png) -48px 0px;height:16px;width:16px;border:none;float:left;}.si4{background:url(../images/icons16.png) -64px 0px;height:16px;width:16px;border:none;float:left;}.si5{background:url(../images/icons16.png) -80px 0px;height:16px;width:16px;border:none;float:left;}.mi{background:url(../images/meshicon50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none;}#floatframe{position:fixed;top:200px;height:300px;z-index:200;display:none;}.style1{text-align:center;}.style2{text-align:center;background-color:#808080;font-weight:bold;}.style3{text-align:center;color:white;background-color:#808080;font-weight:bold;}.style3x{text-align:center;color:white;background-color:#808080;font-weight:bold;}.style3x:hover{background-color:#606060;}.style3x.fullselect{background-color:#003366;}.style3x.semiselect{background-color:#606060;}.style3sel{text-align:center;color:white;background-color:#003366;font-weight:bold;}.style4{color:white;text-decoration:none;}.style5{text-align:center;background-color:#808080;font-weight:normal;}.style6{text-align:left;background-color:#D3D9D6;padding:3px;}.style7{font-size:large;width:180px;}.style9{max-width:400px;overflow:hidden;}.style10{background-color:#C9C9C9;}.night .style10{color:#333;}.style11{font-size:large;background-color:#C9C9C9;}.style14{height:100%;text-align:left;background-color:#D3D9D6;}.auto-style1{text-align:right;}#pTable .auto-style1{height:100%;float:right;}.night .auto-style1{color:black;}.night #pTable{color:black;}.icon2{float:left;margin:7px;}.warningbox{width:auto;border-radius:8px;padding:8px;background-color:lightsalmon;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;clear:both;}.filelist:hover{background:#EEE;border-radius:3px;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.selecttext{-webkit-touch-callout:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;}.fsize{float:right;text-align:right;width:180px;}.g1{background-position:0% 0%;width:14px;height:100%;float:left; background-image:linear-gradient(to right, #fff 0%, #c9c9c9 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.night .g1{background-image:linear-gradient(to right, #000 0%, #c9c9c9 100%);}#p3events .g1{float:none;}#p16events .g1{float:none;}#p31events .g1{float:none;}#p3users .g1{height:24px;float:left;}.g1s{background-image:linear-gradient(to right, #fff 0%, #b9b9b9 100%);}.night .g1s{background-image:linear-gradient(to right, #000 0%, #b9b9b9 100%);}.g2{background-position:0% 0%;width:14px;height:100%;float:right; background-image:linear-gradient(to right, #c9c9c9 0%, #fff 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.night .g2{background-image:linear-gradient(to right, #c9c9c9 0%, #000 100%);}#p3events .g2{float:none;}#p16events .g2{float:none;}#p31events .g2{float:none;}#p3users .g2{height:24px;float:right;}.g2s{background-image:linear-gradient(to right, #b9b9b9 0%, #fff 100%);}.night .g2s{background-image:linear-gradient(to right, #b9b9b9 0%, #000 100%);}.h1pre{width:16px;height:100%;float:left;font-size:large;background-color:#FFFFFF;}.h1{background-position:0% 0%;width:14px;height:24px; background-image:linear-gradient(to right, #fff 0%, #d3d9d6 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.night .h1{background-image:linear-gradient(to right, #000 0%, #d3d9d6 100%);}.h2end{height:100%;width:20px;float:right;background-color:#ffffff;}.h2{background-position:0% 0%;width:14px;height:24px; background-image:linear-gradient(to right, #d3d9d6 0%, #fff 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.night .h2{background-image:linear-gradient(to right, #d3d9d6 0%, #000 100%);}.e1{font-size:large;margin-top:4px;margin-bottom:3px;overflow:hidden;word-wrap:hyphenate;white-space:nowrap;text-overflow:ellipsis;}.e2{float:left;height:100%;background-color:#c9c9c9;}.night .e2{color:black;}.e2s{background-color:#b9b9b9;}.bar{font-size:large;background-color:#C9C9C9;height:24px;float:left;margin-bottom:2px;}.night .bar{color:black;}#p3users .bar{width:100%;font-size:medium;}.baricon{float:left;height:24px;width:24px;background-color:white;}.night .baricon{background-color:black;}.baricon div{width:16px;margin-top:4px;margin-left:2px;height:16px;}.bar2{font-size:large;height:24px;float:left;margin-bottom:2px;}.bar18{font-size:large;background-color:#C9C9C9;height:18px;float:left;margin-bottom:2px;color:black;}.bar182{font-size:large;height:18px;float:left;margin-bottom:2px;}.devHeaderx{color:lightgray;}.DevSt{border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.night .DevSt{color:white;}.contextMenu{background:#F9F9F9;box-shadow:0 0 12px rgba( 0, 0, 0, .3 );border:1px solid #ccc; display:none;position:absolute;top:0;left:0;list-style:none;margin:0;padding:5px;min-width:100px;max-width:150px;z-index:500;}.cmtext{color:#444;display:inline-block;padding-left:8px;padding-right:8px;padding-top:5px;padding-bottom:5px;text-decoration:none;width:85%;cursor:default;overflow:hidden;position:relative;}.cmtext:hover{color:#f9f9f9;background:#444;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";-moz-opacity:0.60;opacity:.60;filter:alpha(opacity=60);}.unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.notifiyBox{position:absolute;z-index:1000;top:50px;right:26px;width:300px;text-align:left;background-color:#F0ECCD;border:4px solid #666;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;-webkit-box-shadow:2px 2px 4px #888;-moz-box-shadow:2px 2px 4px #888;box-shadow:2px 2px 4px #888;max-height:200px;}.night .notifiyBox{color:black;}.notifiyBox:before{content:' ';position:absolute;width:0;height:0;right:5px;top:-30px;border:15px solid;border-color:transparent #666 #666 transparent;}.notifiyBox:after{content:' ';position:absolute;width:0;height:0;right:7px;top:-24px;border:12px solid;border-color:transparent #F0ECCD #F0ECCD transparent;}.notification{width:100%;min-height:30px;}.notification:hover{background-color:#EFE8B6;}#notificationCount{min-width:28px;font-size:20px;border-radius:5px;background-color:lightblue;text-align:center;margin:8px;cursor:pointer;padding:4px;}.night #notificationCount{color:black;}.deskareaicon{cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px;}.areaHead{padding-left:4px;padding-top:2px;padding-bottom:2px;background:#C0C0C0;}.areaProgress{background-color:gray;}.areaProgress div{height:2px;width:0%;background-color:red;}.areaFoot{padding-top:2px;padding-bottom:2px;background:#C0C0C0;}.toright2{float:right;text-align:right;padding-right:4px;}#deskarea0{width:100%;padding:0px;margin-top:0px;}.night #deskarea0{color:black;}.fulldesk #deskarea0{min-width:100%;min-height:0px;height:100%;position:relative;display:-ms-grid;display:grid;grid-gap:0px;grid-template-areas:"deskarea1" "deskarea2" "deskarea3" "deskarea4"; grid-template-rows:24px max-content auto max-content;-ms-grid-columns:1fr;-ms-grid-rows:24px max-content 1fr max-content;}#deskarea0 .mR{margin-right:3px;}#deskarea1{grid-area:deskarea1;-ms-grid-column:1;-ms-grid-row:1;}#deskarea2{grid-area:deskarea2;background-color:gray;-ms-grid-column:1;-ms-grid-row:2;}#progressbar{height:2px;width:0%;background-color:red;}#deskarea3x{background:black;text-align:center;position:relative;overflow:hidden;width:100%;max-height:calc(100vh - 270px); height:calc(100vh - 270px);}.room4submenu #deskarea3x{max-height:calc(100vh - 296px);height:calc(100vh - 296px);}.fulldesk #deskarea3x{grid-area:deskarea3;max-height:100%;height:100%;-ms-grid-column:1;-ms-grid-row:3;}#DeskFocus{overflow:hidden;color:transparent;border:3px dotted rgba(255,0,0,.2);position:absolute;border-radius:5px;}#DeskParent{margin:0;overflow:hidden;height:100%;width:100%;position:absolute;right:0;top:0;}#Desk{overflow:hidden;width:100%;-ms-touch-action:none;position:absolute;top:0px;bottom:0px;left:0px;right:0px;margin:auto;}.deskToolsTopTab{position:absolute;background-color:lightgray;padding:2px;top:2px;left:0px;width:80px;bottom:2px;border-top-left-radius:4px;border-top-right-radius:4px;cursor:pointer;}#deskToolsAreaTop{position:absolute; top:0px;left:4px;right:4px;height:26px;background-color:gray;}#deskToolsArea{position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left;}#deskToolsHeader{border-bottom:1px solid darkgray;padding:3px;}#deskToolsHeader .colmn1{width:50px;padding-right:5px;float:left;}#deskToolsServiceHeader{border-bottom:1px solid darkgray;padding:3px;}#deskToolsServiceHeader .colmn1{width:50px;padding-right:5px;float:left;}#DeskToolsProcesses{overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%;color:black;}#DeskToolsServices{overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%;color:black;}.deskToolsBar{padding:3px;}.deskToolsBar:hover{background-color:#EFE8B6;}#deskarea4{grid-area:deskarea4;-ms-grid-column:1;-ms-grid-row:4;}#DeskChatButton, #DeskNotifyButton, #DeskOpenWebButton{float:right;margin-top:1px;margin-right:4px;cursor:pointer;}#DeskClip, #DeskControlSpan, #specialkeylist{margin-left:6px;}.serverStateTableCell{width:300px;height:24px;background-color:#d3d9d6;margin-bottom:4px;vertical-align:middle;border-spacing:0;}.night .serverStateTableCell{color:black;}.userTableHeader{border-bottom:1pt solid lightgray;padding-top:4px;padding-bottom:4px;}#deskkeys{margin-left:6px;}#p12BackButton{float:left;}#termTable{width:100%;padding:0px;padding:0px;margin-top:0px;}#termarea3x{background:black;text-align:center;height:500px;position:relative;}#Term{background:black;margin:0;padding:0;}#p13toolbar{width:100%;}#p13toolbar .areaHead{border-bottom:2px solid black;}#p13toolbar .areaHead2{width:100%;background-color:#d3d9d6;text-align:left;padding:4px;}#p13toolbar .areaHead3{background-color:#E4E9E7;height:28px;}#p13filetable{width:100%;height:calc(100vh - 323px);overflow:auto;-webkit-user-select:none;}.room4submenu #p13filetable{height:calc(100vh - 349px);}#p13bigok{width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAA;}#p13bigfail{width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAA;}.fulldesk #p14title{margin-left:16px;margin-right:16px;color:#CCC;}#p14iframe{width:100%;height:calc(100vh - 218px);border:0;overflow:hidden;}.menu_stack #p14iframe{height:calc(100vh - 246px);}.fulldesk #p14iframe{height:calc(100vh - 65px);}#p13toolbarBottom, #p13toolbar{width:100%;}#consoleTable{width:100%;padding:0px;padding:0px;margin-top:0px;}.night #consoleTable{color:black;}#p15statetext{padding:4px;height:15px;}#p15agentConsole{background:black;margin:0;padding:0;color:lightgray;width:100%;height:calc(100vh - 276px);max-height:calc(100vh - 276px);position:relative;}.menu_stack.fullscreen #p15agentConsole{height:calc(100vh - 305px);max-height:calc(100vh - 305px);}#p15coreName{padding:4px;display:inline-block;}#p15agentConsoleText{margin:0;padding:0;top:0;bottom:0;overflow-y:scroll;overflow-x:auto;height:calc(100vh - 279px);max-height:calc(100vh - 279px);width:930px;}.menu_stack.fullscreen #p15agentConsoleText{width:calc(100vw - 30px);height:calc(100vh - 305px);max-height:calc(100vh - 305px);}.fullscreen #p15agentConsoleText{width:calc(100vw - 120px);} .night #p16events, #p31events{color:#222;}#p40{height:calc(100vh - 191px);}.viewSelector{width:32px;height:32px;background-color:#DDD;border-radius:3px;float:left;margin-left:5px;cursor:pointer;opacity:0.3;}.viewSelectorSel{background-color:#BBB;opacity:0.8;}.viewSelector:hover{opacity:0.5;background-color:#AAA;}.viewSelector1{margin-left:2px;margin-top:2px;background:url(../images/views.png) -0px 0px;height:28px;width:28px;}.viewSelector2{margin-left:2px;margin-top:2px;background:url(../images/views.png) -28px 0px;height:28px;width:28px;}.viewSelector3{margin-left:2px;margin-top:2px;background:url(../images/views.png) -56px 0px;height:28px;width:28px;}.viewSelector4{margin-left:2px;margin-top:2px;background:url(../images/views.png) -84px 0px;height:28px;width:28px;}.viewSelector5{margin-left:2px;margin-top:2px;background:url(../images/views.png) -112px 0px;height:28px;width:28px;}.fulldesk .viewSelector5{background:url(../images/views.png) -252px 0px;}.backButtonEx{margin-left:2px;margin-top:2px;background:url(../images/views.png) -140px 0px;height:28px;width:28px;}.uiSelector{width:32px;height:32px;background-color:#BBB;border-radius:3px;float:left;margin:3px;cursor:pointer;opacity:0.3;}.uiSelector:hover{opacity:0.5;background-color:#AAA;}.uiSelectorSel{background-color:#BBB;opacity:0.8;}.uiSelector1{margin:2px;background:url(../images/views.png) -168px 0px;height:28px;width:28px;}.uiSelector2{margin:2px;background:url(../images/views.png) -196px 0px;height:28px;width:28px;}.uiSelector3{margin:2px;background:url(../images/views.png) -224px 0px;height:28px;width:28px;}.uiSelector4{margin:2px;background:url(../images/views.png) -280px 0px;height:28px;width:28px;}.backButton{width:32px;height:32px;background-color:#DDD;border-radius:3px;float:left;margin-right:5px;cursor:pointer;opacity:0.3;}.backButton:hover{opacity:0.5;background-color:#AAA;}.hoverButton{opacity:0.5;width:10px;height:10px;}.hoverButton:hover{opacity:1;}.tagSpan{background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px;}.night .tagSpan{color:black;}.suggestionBox{position:absolute;background-color:#6CC;border-radius:4px;padding:6px;box-shadow:0px 0px 15px #666;}.traceEvent{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:3px 3px 3px 0;padding:3px;border-radius:3px;background-color:#DDD;}</style> <style>.topButton{cursor:pointer;border:none;margin:2px;margin-top:3px;float:right;border-radius:3px;height:32px;width:32px;}.topButton:hover{background-color:lightgray;}.topRedButton{cursor:pointer;border:none;margin:2px;float:right;border-radius:3px;height:32px;width:32px;}.topRedButton:hover{background-color:orangered;}.remoteBubble{background-color:#00cc99;color:black;border-radius:5px;padding:5px;float:left;margin-bottom:5px;margin-right:20px;box-shadow:3px 3px 10px gray;}.localBubble{background-color:#0099ff;color:black;border-radius:5px;padding:5px;float:right;margin-bottom:5px;margin-left:20px;box-shadow:3px 3px 10px gray;}.icon1{background:url(../images/messenger32.png) 0px 0px;background-color:gray;}.icon2{background:url(../images/messenger32.png) -32px 0px;background-color:gray;}.icon3{background:url(../images/messenger32.png) -64px 0px;background-color:gray;}.icon4{background:url(../images/messenger32.png) -96px 0px;background-color:gray;}.icon5{background:url(../images/messenger32.png) -128px 0px;background-color:gray;}.icon6{background:url(../images/messenger32.png) -160px 0px;background-color:gray;}.icon7{background:url(../images/messenger32.png) -192px 0px;background-color:gray;}.icon8{background:url(../images/messenger32.png) -224px 0px;background-color:gray;}.icon9{background:url(images/messenger32.png) -256px 0px;background-color:gray;}.icon10{background:url(../images/messenger32.png) -288px 0px;background-color:gray;}.icon11{background:url(../images/messenger32.png) -320px 0px;background-color:orange;}.icon12{background:url(../images/messenger32.png) -352px 0px;background-color:gray;}.icon13{background:url(../images/messenger32.png) -384px 0px;background-color:gray;}.icon14{background:url(../images/messenger32.png) -416px 0px;background-color:gray;}.fileicon{background:url(../images/messenger32.png) -96px 0px;height:32px;width:32px;}.fileiconx{background:url(../images/messenger32.png) -352px 0px;height:32px;width:32px;}.fileicontransfer{background:url(../images/messenger32.png) -288px 0px;height:32px;width:32px;}.fileicondone{background:url(../images/messenger32.png) -256px 0px;height:32px;width:32px;}</style> </head> <body style="font-family:Arial,Helvetica,sans-serif"> <div id="xtop" style="position:absolute;left:0;right:0;top:0;height:38px;background-color:#036;color:#c8c8c8;box-shadow:3px 3px 10px gray"> <div id="notifyButton" class="icon13 topButton" style="margin-right:4px;display:none" title="Enable browser notification" onclick="enableNotificationsButtonClick()"></div> <div id="fileButton" class="icon4 topButton" title="Share a file" style="display:none" onclick="fileButtonClick()"></div> <div id="camButton" class="icon2 topButton" title="Activate camera & microphone" style="display:none" onclick="camButtonClick()"></div> <div id="micButton" class="icon6 topButton" title="Activate microphone" style="display:none" onclick="micButtonClick()"></div> <div id="hangupButton" class="icon11 topRedButton" title="Hang up" style="display:none" onclick="hangUpButtonClick(1)"></div> <div style="display:inline-block;width:2px"></div> <div style="padding-top:9px;padding-left:6px;font-size:20px;display:inline-block"><b>MeshMessenger<span id="xtitle"></span></b></div> </div> <div id="xmiddle" style="position:absolute;left:0;right:0;top:38px;bottom:30px"> <div style="position:absolute;left:0;right:0;top:0;bottom:0;overflow-y:scroll"> <div id="xmsg" style="position:absolute;left:0;right:0;bottom:0;padding:5px"></div> </div> </div> <div id="xbottom" style="position:absolute;left:0;right:0;bottom:0px;height:30px;background-color:#036"> <div style="position:absolute;left:5px;right:215px;bottom:4px;top:4px;background-color:aliceblue"><input id="xouttext" type="text" style="width:calc(100% - 5px)" onfocus="onUserInputFocus(1)" onblur="onUserInputFocus(0)"></div> <input type="button" id="sendButton" value="Send" style="position:absolute;right:110px;width:100px;top:4px;" onclick="xsend(event)"> <input type="button" id="clearButton" value="Clear" style="position:absolute;right:5px;width:100px;top:4px;" onclick="displayClear()"> </div> <div id="remoteVideo" style="position:absolute;right:24px;top:45px;width:320px;height:calc(240px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"> <div style="position:absolute;right:0;left:0;top:2.5px;text-align:center">Remote</div> <video id="remoteVideoCanvas" autoplay="" style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:black"></video> </div> <div id="localVideo" style="position:absolute;right:24px;top:320px;width:160px;height:calc(120px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"> <div style="position:absolute;right:0;left:0;top:2.5px;text-align:center">Local</div> <video id="localVideoCanvas" autoplay="" muted="" style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:black"></video> </div> <input id="uploadFileInput" type="file" multiple="" style="display:none"> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function QC(a){try{return Q(a).classList}catch(a){}}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}function zeroPad(b,a){if(a==null){a=2}var d="00000000"+b;return d.substr(d.length-a)}(function(b,a){if(typeof define==="function"&&define.amd){define([],a)}else{if(typeof exports!=="undefined"){a()}else{var c={exports:{}};a();b.FileSaver=c.exports}}})(this,function(){var a=typeof window==="object"&&window.window===window?window:typeof self==="object"&&self.self===self?self:typeof global==="object"&&global.global===global?global:void 0;function b(g,h){if(typeof h==="undefined"){h={autoBom:false}}else{if(typeof h!=="object"){console.warn("Deprecated: Expected third argument to be a object");h={autoBom:!h}}}if(h.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(g.type)){return new Blob([String.fromCharCode(65279),g],{type:g.type})}return g}function e(i,g,h){var j=new XMLHttpRequest();j.open("GET",i);j.responseType="blob";j.onload=function(){f(j.response,g,h)};j.onerror=function(){console.error("could not download file")};j.send()}function d(h){var i=new XMLHttpRequest();i.open("HEAD",h,false);try{i.send()}catch(g){}return i.status>=200&&i.status<=299}function c(i){try{i.dispatchEvent(new MouseEvent("click"))}catch(g){var h=document.createEvent("MouseEvents");h.initMouseEvent("click",true,true,window,0,0,0,80,20,false,false,false,false,0,null);i.dispatchEvent(h)}}var f=a.saveAs||(typeof window!=="object"||window!==a?function f(){}:"download" in HTMLAnchorElement.prototype?function f(h,i,j){var k=a.URL||a.webkitURL;var g=document.createElement("a");i=i||h.name||"download";g.download=i;g.rel="noopener";if(typeof h==="string"){g.href=h;if(g.origin!==location.origin){d(g.href)?e(h,i,j):c(g,g.target="_blank")}else{c(g)}}else{g.href=k.createObjectURL(h);setTimeout(function(){k.revokeObjectURL(g.href)},40000);setTimeout(function(){c(g)},0)}}:"msSaveOrOpenBlob" in navigator?function f(h,i,j){i=i||h.name||"download";if(typeof h==="string"){if(d(h)){e(h,i,j)}else{var g=document.createElement("a");g.href=h;g.target="_blank";setTimeout(function(){c(g)})}}else{navigator.msSaveOrOpenBlob(b(h,j),i)}}:function f(g,k,l,m){m=m||open("","_blank");if(m){m.document.title=m.document.body.innerText="downloading..."}if(typeof g==="string"){return e(g,k,l)}var h=g.type==="application/octet-stream";var j=/constructor/i.test(a.HTMLElement)||a.safari;var i=/CriOS\/[\d]+/.test(navigator.userAgent);if((i||h&&j)&&typeof FileReader==="object"){var n=new FileReader();n.onloadend=function(){var q=n.result;q=i?q:q.replace(/^data:[^;]*;/,"data:attachment/file;");if(m){m.location.href=q}else{location=q}m=null};n.readAsDataURL(g)}else{var p=a.URL||a.webkitURL;var o=p.createObjectURL(g);if(m){m.location=o}else{location.href=o}m=null;setTimeout(function(){p.revokeObjectURL(o)},40000)}});a.saveAs=f.saveAs=f;if(typeof module!=="undefined"){module.exports=f}});var userInputFocus=0;var args=parseUriArgs();var socket=null;var state=0;var random=Math.random();var webrtcSessions={};var webchannel=null;var localStream=null;var remoteStream=null;var multiWebRtc=true;var userMediaSupport=0;var notification=null;getUserMediaSupport(function(a){userMediaSupport=a});var webrtcconfiguration="{{{webrtconfig}}}";if(webrtcconfiguration==""){webrtcconfiguration=null}else{try{webrtcconfiguration=JSON.parse(decodeURIComponent(webrtcconfiguration))}catch(ex){console.log('Invalid WebRTC config: "'+webrtcconfiguration+'".');webrtcconfiguration=null}}var fileUploads=[];var fileDownloads={};var currentFileUpload=null;var currentFileDownload=null;if(args.title){QH("xtitle"," - "+args.title);document.title=document.title+" - "+args.title}if(Notification){QV("notifyButton",Notification.permission!="granted")}document.addEventListener("dragover",haltEvent,false);document.addEventListener("dragleave",haltEvent,false);document.addEventListener("drop",fileDrop,false);document.onclick=function(a){if(Notification){QV("notifyButton",Notification.permission!="granted")}if(notification!=null){notification.close();notification=null}};document.onkeyup=function ondockeypress(a){if(Notification){QV("notifyButton",Notification.permission!="granted")}if(notification!=null){notification.close();notification=null}if(state==2){if((a.keyCode==8)&&(userInputFocus==0)){var b=Q("xouttext").value;if(b.length>0){Q("xouttext").value=b.substring(0,b.length-1)}}}if(userInputFocus==0){haltEvent(a);return false}};document.onkeypress=function ondockeypress(a){if(Notification){QV("notifyButton",Notification.permission!="granted")}if(notification!=null){notification.close();notification=null}if(state==2){if(a.keyCode==13){xsend(a)}else{if((userInputFocus==0)&&(a.key.length==1)){Q("xouttext").value=Q("xouttext").value+a.key}}}if(userInputFocus==0){haltEvent(a);return false}};function onUserInputFocus(a){userInputFocus=a}function displayClear(){QH("xmsg","");cancelAllFileTransfers();fileUploads=[],fileDownloads={}}if(!FileReader.prototype.readAsBinaryString){FileReader.prototype.readAsBinaryString=function(b){var a="",d=this,c=new FileReader();c.onload=function(g){var f=new Uint8Array(c.result);for(var h=0;h<f.byteLength;h++){a+=String.fromCharCode(f[h])}d.onload({target:{result:a}})};c.readAsArrayBuffer(b)}}function getUserMediaSupport(b){try{navigator.mediaDevices.enumerateDevices().then(function(d){try{var f=0,c=0;d.forEach(function(g){if(g.kind==="audioinput"){f=1}if(g.kind==="videoinput"){c=1}});if(f==0){b(0)}b(f+c)}catch(e){}})}catch(a){}}function displayControl(a){QA("xmsg",'<div style="clear:both"><div style="color:gray;float:left;margin-bottom:2px">'+a+"</div><div></div></div>");Q("xmsg").scrollTop=Q("xmsg").scrollHeight}function displayLocalVideo(a){QV("localVideo",a);adjustVideoWindows()}function displayRemoteVideo(a){QV("remoteVideo",a);adjustVideoWindows()}function adjustVideoWindows(){var a=(QS("remoteVideo")["display"]!="none");QS("localVideo")["top"]=a?"320px":"45px"}function displayRemote(a){QA("xmsg",'<div style="clear:both"><div class="remoteBubble">'+a+"</div><div></div></div>");Q("xmsg").scrollTop=Q("xmsg").scrollHeight;if(Notification){QV("notifyButton",Notification.permission!="granted")}if(Notification&&(Notification.permission=="granted")){if(notification!=null){notification.close();notification=null}if(args.title){notification=new Notification("MeshMessenger - "+args.title,{body:a})}else{notification=new Notification("MeshMessenger",{body:a})}}}function xsend(a){if(notification!=null){notification.close();notification=null}if(Notification){QV("notifyButton",Notification.permission!="granted")}var b=Q("xouttext").value;if(b.length>0){Q("xouttext").value="";QA("xmsg",'<div style="clear:both"><div class="localBubble">'+b+"</div><div></div></div>");Q("xmsg").scrollTop=Q("xmsg").scrollHeight;send({action:"chat",msg:b})}}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function parseUriArgs(){var a,c={},b=window.document.location.href.split(/[\?&|\=]/);b.splice(0,1);for(d in b){switch(d%2){case 0:a=decodeURIComponent(b[d]);break;case 1:c[a]=decodeURIComponent(b[d]);var d=parseInt(c[a]);if(d==c[a]){c[a]=d}break;default:break}}return c}function updateControls(){QE("sendButton",state==2);QE("clearButton",state==2);QE("xouttext",state==2);QV("fileButton",state==2);QV("camButton",webchannel&&webchannel.ok&&!localStream&&(userMediaSupport==2));QV("micButton",webchannel&&webchannel.ok&&!localStream&&(userMediaSupport>0));QV("hangupButton",webchannel&&webchannel.ok&&localStream)}function startWebRTC(a,b){if((webrtcSessions[0]!=null)&&(multiWebRtc==false)){return webrtcSessions[0]}var c=null;if(typeof RTCPeerConnection!=="undefined"){c=new RTCPeerConnection(webrtcconfiguration)}else{if(typeof webkitRTCPeerConnection!=="undefined"){c=new webkitRTCPeerConnection(webrtcconfiguration)}}if(c==null){return null}c.id=a;c.onicecandidate=function(d){try{if(d.candidate!=null){sendws({action:"webRtcIce",ice:d.candidate,id:this.id})}}catch(f){}};c.oniceconnectionstatechange=function(){if(c&&c.iceConnectionState=="failed"){c.close();if(webrtcSessions[c.id]){delete webrtcSessions[c.id]}}};c.ondatachannel=function(d){webchannel=d.channel;webchannel.onmessage=function(e){processMessage(e.data,2)};webchannel.onopen=function(){webchannel.ok=true;updateControls();sendws({action:"rtcSwitch",v:0})};webchannel.onclose=function(e){if(webchannel&&webchannel.ok){disconnect()}else{hangUpButtonClick(0)}}};c.onnegotiationneeded=function(d){if(c.holdTimer!=null){return}c.holdTimer=setTimeout(function(){c.holdTimer=null;c.createOffer(function(e){c.setLocalDescription(e,function(){sendws({action:"webRtcSdp",sdp:e,id:a})},function(){hangUpButtonClick(a)})},function(){hangUpButtonClick(a)})},20)};c.ontrack=function(d){var e=Q("remoteVideoCanvas");e.srcObject=remoteStream=d.streams[0];e.onloadedmetadata=function(f){e.play()};displayRemoteVideo(true)};if(b==true){webchannel=c.createDataChannel("DataChannel",{});webchannel.onmessage=function(d){processMessage(d.data,2)};webchannel.onopen=function(){webchannel.ok=true;updateControls();sendws({action:"rtcSwitch",v:0})};webchannel.onclose=function(d){if(webchannel&&webchannel.ok){disconnect()}else{hangUpButtonClick(0)}}}webrtcSessions[a]=c;return c}function webRtcHandleOffer(b,a){var c=webrtcSessions[b];if(c){c.setRemoteDescription(new RTCSessionDescription(a),function(){if(a.type=="offer"){c.createAnswer(function(d){c.setLocalDescription(d,function(e,f){try{sendws({action:"webRtcSdp",sdp:d,id:b})}catch(g){}},function(){hangUpButtonClick(b)})},function(){hangUpButtonClick(b)})}},function(){hangUpButtonClick(b)})}}function performWebRtcSwitch(){if(webchannel&&webchannel.ok){sendws({action:"rtcSwitch",v:1});webchannel.xoutBuffer=[]}}function disconnect(){if(state>0){displayControl("Connection closed.")}if(state>1){setTimeout(start,500)}cancelAllFileTransfers();hangUpButtonClick(0,true);hangUpButtonClick(1,true);hangUpButtonClick(2,true);if(socket!=null){socket.close();socket=null}updateControls();state=0}function send(a){if(state!=2){return}if(typeof a=="object"){a=JSON.stringify(a)}if(webchannel&&webchannel.ok){if(webchannel.xoutBuffer!=null){webchannel.xoutBuffer.push(a)}else{webchannel.send(a)}}else{if(socket!=null){try{socket.send(a)}catch(b){}}}}function sendws(a){if(state!=2){return}if(typeof a=="object"){a=JSON.stringify(a)}if(socket!=null){socket.send(a)}}function webRtcIdSwitch(a){if(a==0){return 0}return 3-a}function processMessage(a,d){if(typeof a=="string"){try{a=JSON.parse(a)}catch(b){console.log("Unable to parse",a);return}switch(a.action){case"chat":displayRemote(a.msg);break;case"random":if(random>a.random){startWebRTC(0,true)}break;case"webRtcSdp":if(!webrtcSessions[webRtcIdSwitch(a.id)]){startWebRTC(webRtcIdSwitch(a.id),false)}webRtcHandleOffer(webRtcIdSwitch(a.id),a.sdp);break;case"webRtcIce":var e=webrtcSessions[webRtcIdSwitch(a.id)];if(e){try{e.addIceCandidate(new RTCIceCandidate(a.ice))}catch(b){}}break;case"videoStop":hangUpButtonClick(webRtcIdSwitch(a.id),true);break;case"rtcSwitch":switch(a.v){case 0:performWebRtcSwitch();break;case 1:sendws({action:"rtcSwitch",v:2});break;case 2:for(var c in webchannel.xoutBuffer){webchannel.send(webchannel.xoutBuffer[c])}delete webchannel.xoutBuffer;break;default:console.log("Unknown rtcSwitch value: "+a.action);break}break;case"file":startFileDownload(a);break;case"fileUploadCancel":cancelFileTransfer(a.id);break;case"fileUploadStart":if(fileDownloads[a.id]){currentFileDownload=fileDownloads[a.id];currentFileDownload.data="";changeFileInfo(a.id,2,0);continueFileDownload(a);send({action:"fileUploadAck",id:a.id})}break;case"fileUploadEnd":if(currentFileDownload&&(currentFileDownload.id==a.id)){changeFileInfo(a.id,3,200);currentFileDownload.done=1;currentFileDownload=null;send({action:"fileUploadAck",id:a.id})}currentFileDownload=null;break;case"fileUploadAck":continueFileUpload();break;case"fileData":if(currentFileDownload&&(currentFileDownload.id==a.id)){currentFileDownload.data+=a.data;changeFileInfo(a.id,2,(currentFileDownload.data.length*200/currentFileDownload.size));send({action:"fileUploadAck",id:a.id})}break;default:console.log("Unhandled object data",a);break}}else{console.log("Unhandled data",typeof a,a)}}function fileButtonClick(){var a=Q("uploadFileInput");if(a.getAttribute("eventset")!=1){a.setAttribute("eventset","1");a.addEventListener("change",fileSelect,false)}a.value=null;a.click()}function fileSelect(){if(state!=2){return}var c=Q("uploadFileInput");if(c.files.length>10){displayControl("Limit of 10 file uploads at the same time.")}else{for(var a=0;a<c.files.length;a++){if(c.files[a].size>0){var b=new FileReader();b.onload=function(d){this.xfile.data=d.target.result;startFileUpload(this.xfile)};b.xfile=c.files[a];b.readAsBinaryString(c.files[a])}}}}function fileDrop(a){haltEvent(a);if((state!=2)||(a.dataTransfer==null)){return}if(a.dataTransfer.files.length>10){displayControl("Limit of 10 file uploads at the same time.")}else{for(var b=0;b<a.dataTransfer.files.length;b++){if(a.dataTransfer.files[b].size>0){var c=new FileReader();c.onload=function(d){this.xfile.data=d.target.result;startFileUpload(this.xfile)};c.xfile=a.dataTransfer.files[b];c.readAsBinaryString(a.dataTransfer.files[b])}}}}function startFileUpload(a){if(state!=2){return}a.id=Math.random();fileUploads.push(a);QA("xmsg",'<div style="clear:both"></div><div id="FILEUP-'+a.id+'" class="localBubble" style="width:240px;cursor:pointer" onclick="cancelFileTransfer(\''+a.id+'\')"><div id="FILEUP-ICON-'+a.id+'" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-'+a.id+'" style="height:16px;overflow:hidden;white-space:nowrap;" title="'+a.name+'">'+a.name+'</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-'+a.id+'" style="width:0px;background-color:green;border-radius:3px;height:11px">&nbsp;</div></div></div></div>');Q("xmsg").scrollTop=Q("xmsg").scrollHeight;send({action:"file",size:a.size,id:a.id,type:a.type,name:a.name});if(currentFileUpload==null){continueFileUpload()}}function startFileDownload(a){if(state!=2){return}fileDownloads[a.id]=a;QA("xmsg",'<div style="clear:both"></div><div id="FILEUP-'+a.id+'" class="remoteBubble" style="width:240px;cursor:pointer" onclick="saveFileTransfer(\''+a.id+'\')"><div id="FILEUP-ICON-'+a.id+'" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-'+a.id+'" style="height:16px;overflow:hidden;white-space:nowrap;" title="'+a.name+'">'+a.name+'</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-'+a.id+'" style="width:0px;background-color:green;border-radius:3px;height:11px">&nbsp;</div></div></div></div>');Q("xmsg").scrollTop=Q("xmsg").scrollHeight}function changeFileInfo(b,a,c,d){if(a){Q("FILEUP-ICON-"+b).classList.remove("fileicon");Q("FILEUP-ICON-"+b).classList.remove("fileiconx");Q("FILEUP-ICON-"+b).classList.remove("fileicontransfer");Q("FILEUP-ICON-"+b).classList.remove("fileicondone");Q("FILEUP-ICON-"+b).classList.add(["fileicon","fileiconx","fileicontransfer","fileicondone"][a])}if(c){QS("FILEUP-PROGRESS-"+b)["width"]=c+"px"}if(d){QS("FILEUP-PROGRESS-"+b)["background-color"]=d}}function data2blob(b){var a=new Array(b.length);for(var c=0;c<b.length;c++){a[c]=b.charCodeAt(c)}return new Blob([new Uint8Array(a)])}function saveFileTransfer(b){var a=fileDownloads[b];if(a&&a.done==1){saveAs(data2blob(a.data),a.name)}}function cancelFileTransfer(c){if((currentFileUpload!=null)&&(currentFileUpload.id==c)){currentFileUpload=null}if((currentFileDownload!=null)&&(currentFileDownload.id==c)){currentFileDownload=null}var a=false;if(fileDownloads[c]&&(fileDownloads[c].done!=1)){delete fileDownloads[c];a=true}else{for(var b in fileUploads){if(fileUploads[b].id==c){send({action:"fileUploadCancel",id:c});fileUploads.splice(b,1);a=true;break}}}if(a){changeFileInfo(c,1,200,"gray")}}function cancelAllFileTransfers(){for(var a in fileDownloads){cancelFileTransfer(fileDownloads[a].id)}for(var a in fileUploads){cancelFileTransfer(fileUploads[a].id)}}function continueFileUpload(){if(currentFileUpload==null){if(fileUploads.length==0){return}currentFileUpload=fileUploads[0];currentFileUpload.ptr=0;send({action:"fileUploadStart",size:currentFileUpload.size,id:currentFileUpload.id,type:currentFileUpload.type,name:currentFileUpload.name})}else{if(currentFileUpload.size<=currentFileUpload.ptr){send({action:"fileUploadEnd",size:currentFileUpload.size,id:currentFileUpload.id,type:currentFileUpload.type,name:currentFileUpload.name});changeFileInfo(currentFileUpload.id,3,200);fileUploads.splice(0,1);currentFileUpload=null;continueFileUpload()}else{var b=Math.min(4000,currentFileUpload.data.length-currentFileUpload.ptr);var a=currentFileUpload.data.substring(currentFileUpload.ptr,currentFileUpload.ptr+b);send({action:"fileData",id:currentFileUpload.id,data:a});currentFileUpload.ptr+=b;changeFileInfo(currentFileUpload.id,0,(currentFileUpload.ptr*200/currentFileUpload.size))}}}function continueFileDownload(a){send({action:"fileUploadAck",id:a.id})}function enableNotificationsButtonClick(){if(Notification){Notification.requestPermission().then(function(a){QV("notifyButton",a!="granted")})}return false}function camButtonClick(){if(localStream==null){startLocalStream({video:true,audio:true})}}function micButtonClick(){if(localStream==null){startLocalStream({video:false,audio:true})}}function hangUpButtonClick(d,b){var f=Q("localVideoCanvas");var g=Q("remoteVideoCanvas");var j=webrtcSessions[(multiWebRtc==true)?d:0];if((d==0)&&(webchannel!=null)){try{webchannel.close()}catch(a){}webchannel=null}if(j){if((multiWebRtc==true)||(d==0)){j.ontrack=null;j.onremovetrack=null;j.onremovestream=null;j.onnicecandidate=null;j.oniceconnectionstatechange=null;j.onsignalingstatechange=null;j.onicegatheringstatechange=null;j.onnotificationneeded=null}if((d==1)&&localStream){var h=localStream.getTracks();for(var c in h){h[c].stop()}localStream=null}if((d==2)&&remoteStream){var h=remoteStream.getTracks();for(var c in h){h[c].stop()}remoteStream=null}if((multiWebRtc==true)||(d==0)){j.close();delete webrtcSessions[d]}}if(d==1){f.removeAttribute("src");f.removeAttribute("srcObject");if(localStream!=null){localStream=null}displayLocalVideo(false)}else{if(d==2){g.removeAttribute("src");g.removeAttribute("srcObject");displayRemoteVideo(false)}}if(b!=true){send({action:"videoStop",id:d})}updateControls()}function startLocalStream(b){var a=(multiWebRtc==true)?1:0;if(localStream!=null){return}if((multiWebRtc==true)&&(webrtcSessions[1]!=null)){return}if(navigator.mediaDevices.getUserMedia){localStream=1;updateControls();navigator.mediaDevices.getUserMedia(b).then(function(d){localStream=d;var e=localStream.getTracks();var g=startWebRTC(a);if(b.video==true){var f=Q("localVideoCanvas");f.srcObject=d;f.onloadedmetadata=function(h){f.play()};displayLocalVideo(true)}for(var c in e){g.addTrack(e[c],localStream)}},function(c){displayControl(c.message+".");hangUpButtonClick(1)})}}function start(){updateControls();if((typeof args.id=="string")&&(args.id.length>0)){var a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+args.id;if((args.auth!=null)&&(args.auth!="")){a+="&auth="+args.auth}socket=new WebSocket(a);socket.onopen=function(){state=1;displayControl("Waiting for other user...")};socket.onerror=function(b){};socket.onclose=function(){disconnect()};socket.onmessage=function(b){if((state<2)&&(typeof b.data=="string")&&((b.data=="c")||(b.data=="cr"))){hangUpButtonClick(0,true);hangUpButtonClick(1,true);hangUpButtonClick(2,true);displayControl("Connected.");state=2;updateControls();sendws({action:"random",random:random});return}if(state==2){processMessage(b.data,1)}}}else{displayControl("Error: No connection key specified.")}}start();function onUnLoad(){for(var b=0;b<3;b++){if(webrtcSessions[b]){webrtcSessions[b].close();delete webrtcSessions[b]}}if(webchannel!=null){try{webchannel.close()}catch(a){}webchannel=null}if(socket!=null){try{socket.close()}catch(a){}socket=null}};</script></body></html>
\ No newline at end of file
1 +<!doctypehtml><html style=height:100%><title>MeshMessenger</title><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8"http-equiv=Content-Type><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><link type=text/css href=styles/messenger.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><script src=scripts/filesaver.js></script><body style=font-family:Arial,Helvetica,sans-serif><div id=xtop style="position:absolute;left:0;right:0;top:0;height:38px;background-color:#036;color:#c8c8c8;box-shadow:3px 3px 10px gray"><div id=notifyButton class="icon13 topButton"style=margin-right:4px;display:none title="Enable browser notification"onclick=enableNotificationsButtonClick()></div><div id=fileButton class="icon4 topButton"title="Share a file"style=display:none onclick=fileButtonClick()></div><div id=camButton class="icon2 topButton"title="Activate camera & microphone"style=display:none onclick=camButtonClick()></div><div id=micButton class="icon6 topButton"title="Activate microphone"style=display:none onclick=micButtonClick()></div><div id=hangupButton class="icon11 topRedButton"title="Hang up"style=display:none onclick=hangUpButtonClick(1)></div><div style=display:inline-block;width:2px></div><div style=padding-top:9px;padding-left:6px;font-size:20px;display:inline-block><b>MeshMessenger<span id=xtitle></span></b></div></div><div id=xmiddle style=position:absolute;left:0;right:0;top:38px;bottom:30px><div style=position:absolute;left:0;right:0;top:0;bottom:0;overflow-y:scroll><div id=xmsg style=position:absolute;left:0;right:0;bottom:0;padding:5px></div></div></div><div id=xbottom style=position:absolute;left:0;right:0;bottom:0;height:30px;background-color:#036><div style=position:absolute;left:5px;right:215px;bottom:4px;top:4px;background-color:#f0f8ff><input id=xouttext style="width:calc(100% - 5px)"onfocus=onUserInputFocus(1) onblur=onUserInputFocus(0)></div><input type=button id=sendButton value=Send style=position:absolute;right:110px;width:100px;top:4px onclick=xsend(event)> <input type=button id=clearButton value=Clear style=position:absolute;right:5px;width:100px;top:4px onclick=displayClear()></div><div id=remoteVideo style="position:absolute;right:24px;top:45px;width:320px;height:calc(240px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"><div style=position:absolute;right:0;left:0;top:2.5px;text-align:center>Remote</div><video id=remoteVideoCanvas autoplay style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:#000"></video></div><div id=localVideo style="position:absolute;right:24px;top:320px;width:160px;height:calc(120px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"><div style=position:absolute;right:0;left:0;top:2.5px;text-align:center>Local</div><video id=localVideoCanvas autoplay muted style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:#000"></video></div><input id=uploadFileInput type=file multiple style=display:none><script onunload=onUnLoad()>var userInputFocus=0,args=parseUriArgs(),socket=null,state=0,random=Math.random(),webrtcSessions={},webchannel=null,localStream=null,remoteStream=null,multiWebRtc=!0,userMediaSupport=0,notification=null;getUserMediaSupport(function(e){userMediaSupport=e});var webrtcconfiguration="{{{webrtconfig}}}";if(""==webrtcconfiguration)webrtcconfiguration=null;else try{webrtcconfiguration=JSON.parse(decodeURIComponent(webrtcconfiguration))}catch(e){console.log('Invalid WebRTC config: "'+webrtcconfiguration+'".'),webrtcconfiguration=null}var fileUploads=[],fileDownloads={},currentFileUpload=null,currentFileDownload=null;function onUserInputFocus(e){userInputFocus=e}function displayClear(){QH("xmsg",""),cancelAllFileTransfers(),fileUploads=[],fileDownloads={}}function getUserMediaSupport(i){try{navigator.mediaDevices.enumerateDevices().then(function(e){try{var t=0,n=0;e.forEach(function(e){"audioinput"===e.kind&&(t=1),"videoinput"===e.kind&&(n=1)}),0==t&&i(0),i(t+n)}catch(e){}})}catch(e){}}function displayControl(e){QA("xmsg",'<div style="clear:both"><div style="color:gray;float:left;margin-bottom:2px">'+e+"</div><div></div></div>"),Q("xmsg").scrollTop=Q("xmsg").scrollHeight}function displayLocalVideo(e){QV("localVideo",e),adjustVideoWindows()}function displayRemoteVideo(e){QV("remoteVideo",e),adjustVideoWindows()}function adjustVideoWindows(){var e="none"!=QS("remoteVideo").display;QS("localVideo").top=e?"320px":"45px"}function displayRemote(e){QA("xmsg",'<div style="clear:both"><div class="remoteBubble">'+e+"</div><div></div></div>"),Q("xmsg").scrollTop=Q("xmsg").scrollHeight,Notification&&QV("notifyButton","granted"!=Notification.permission),Notification&&"granted"==Notification.permission&&(null!=notification&&(notification.close(),notification=null),notification=args.title?new Notification("MeshMessenger - "+args.title,{body:e}):new Notification("MeshMessenger",{body:e}))}function xsend(e){null!=notification&&(notification.close(),notification=null),Notification&&QV("notifyButton","granted"!=Notification.permission);var t=Q("xouttext").value;0<t.length&&(Q("xouttext").value="",QA("xmsg",'<div style="clear:both"><div class="localBubble">'+t+"</div><div></div></div>"),Q("xmsg").scrollTop=Q("xmsg").scrollHeight,send({action:"chat",msg:t}))}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function parseUriArgs(){var e,t={},n=window.document.location.href.split(/[\?&|\=]/);for(i in n.splice(0,1),n)switch(i%2){case 0:e=decodeURIComponent(n[i]);break;case 1:t[e]=decodeURIComponent(n[i]);var i=parseInt(t[e]);i==t[e]&&(t[e]=i)}return t}function updateControls(){QE("sendButton",2==state),QE("clearButton",2==state),QE("xouttext",2==state),QV("fileButton",2==state),QV("camButton",webchannel&&webchannel.ok&&!localStream&&2==userMediaSupport),QV("micButton",webchannel&&webchannel.ok&&!localStream&&0<userMediaSupport),QV("hangupButton",webchannel&&webchannel.ok&&localStream)}function startWebRTC(t,e){if(null!=webrtcSessions[0]&&0==multiWebRtc)return webrtcSessions[0];var n=null;return"undefined"!=typeof RTCPeerConnection?n=new RTCPeerConnection(webrtcconfiguration):"undefined"!=typeof webkitRTCPeerConnection&&(n=new webkitRTCPeerConnection(webrtcconfiguration)),null==n?null:(n.id=t,n.onicecandidate=function(e){try{null!=e.candidate&&sendws({action:"webRtcIce",ice:e.candidate,id:this.id})}catch(e){}},n.oniceconnectionstatechange=function(){n&&"failed"==n.iceConnectionState&&(n.close(),webrtcSessions[n.id]&&delete webrtcSessions[n.id])},n.ondatachannel=function(e){(webchannel=e.channel).onmessage=function(e){processMessage(e.data,2)},webchannel.onopen=function(){webchannel.ok=!0,updateControls(),sendws({action:"rtcSwitch",v:0})},webchannel.onclose=function(e){webchannel&&webchannel.ok?disconnect():hangUpButtonClick(0)}},n.onnegotiationneeded=function(e){null==n.holdTimer&&(n.holdTimer=setTimeout(function(){n.holdTimer=null,n.createOffer(function(e){n.setLocalDescription(e,function(){sendws({action:"webRtcSdp",sdp:e,id:t})},function(){hangUpButtonClick(t)})},function(){hangUpButtonClick(t)})},20))},n.ontrack=function(e){var t=Q("remoteVideoCanvas");t.srcObject=remoteStream=e.streams[0],t.onloadedmetadata=function(e){t.play()},displayRemoteVideo(!0)},1==e&&((webchannel=n.createDataChannel("DataChannel",{})).onmessage=function(e){processMessage(e.data,2)},webchannel.onopen=function(){webchannel.ok=!0,updateControls(),sendws({action:"rtcSwitch",v:0})},webchannel.onclose=function(e){webchannel&&webchannel.ok?disconnect():hangUpButtonClick(0)}),webrtcSessions[t]=n)}function webRtcHandleOffer(i,e){var t=webrtcSessions[i];t&&t.setRemoteDescription(new RTCSessionDescription(e),function(){"offer"==e.type&&t.createAnswer(function(n){t.setLocalDescription(n,function(e,t){try{sendws({action:"webRtcSdp",sdp:n,id:i})}catch(e){}},function(){hangUpButtonClick(i)})},function(){hangUpButtonClick(i)})},function(){hangUpButtonClick(i)})}function performWebRtcSwitch(){webchannel&&webchannel.ok&&(sendws({action:"rtcSwitch",v:1}),webchannel.xoutBuffer=[])}function disconnect(){0<state&&displayControl("Connection closed."),1<state&&setTimeout(start,500),cancelAllFileTransfers(),hangUpButtonClick(0,!0),hangUpButtonClick(1,!0),hangUpButtonClick(2,!0),null!=socket&&(socket.close(),socket=null),updateControls(),state=0}function send(e){if(2==state)if("object"==typeof e&&(e=JSON.stringify(e)),webchannel&&webchannel.ok)null!=webchannel.xoutBuffer?webchannel.xoutBuffer.push(e):webchannel.send(e);else if(null!=socket)try{socket.send(e)}catch(e){}}function sendws(e){2==state&&("object"==typeof e&&(e=JSON.stringify(e)),null!=socket&&socket.send(e))}function webRtcIdSwitch(e){return 0==e?0:3-e}function processMessage(t,e){if("string"==typeof t){try{t=JSON.parse(t)}catch(e){return void console.log("Unable to parse",t)}switch(t.action){case"chat":displayRemote(t.msg);break;case"random":random>t.random&&startWebRTC(0,!0);break;case"webRtcSdp":webrtcSessions[webRtcIdSwitch(t.id)]||startWebRTC(webRtcIdSwitch(t.id),!1),webRtcHandleOffer(webRtcIdSwitch(t.id),t.sdp);break;case"webRtcIce":var n=webrtcSessions[webRtcIdSwitch(t.id)];if(n)try{n.addIceCandidate(new RTCIceCandidate(t.ice))}catch(e){}break;case"videoStop":hangUpButtonClick(webRtcIdSwitch(t.id),!0);break;case"rtcSwitch":switch(t.v){case 0:performWebRtcSwitch();break;case 1:sendws({action:"rtcSwitch",v:2});break;case 2:for(var i in webchannel.xoutBuffer)webchannel.send(webchannel.xoutBuffer[i]);delete webchannel.xoutBuffer;break;default:console.log("Unknown rtcSwitch value: "+t.action)}break;case"file":startFileDownload(t);break;case"fileUploadCancel":cancelFileTransfer(t.id);break;case"fileUploadStart":fileDownloads[t.id]&&((currentFileDownload=fileDownloads[t.id]).data="",changeFileInfo(t.id,2,0),continueFileDownload(t),send({action:"fileUploadAck",id:t.id}));break;case"fileUploadEnd":currentFileDownload&&currentFileDownload.id==t.id&&(changeFileInfo(t.id,3,200),currentFileDownload.done=1,currentFileDownload=null,send({action:"fileUploadAck",id:t.id})),currentFileDownload=null;break;case"fileUploadAck":continueFileUpload();break;case"fileData":currentFileDownload&&currentFileDownload.id==t.id&&(currentFileDownload.data+=t.data,changeFileInfo(t.id,2,200*currentFileDownload.data.length/currentFileDownload.size),send({action:"fileUploadAck",id:t.id}));break;default:console.log("Unhandled object data",t)}}else console.log("Unhandled data",typeof t,t)}function fileButtonClick(){var e=Q("uploadFileInput");1!=e.getAttribute("eventset")&&(e.setAttribute("eventset","1"),e.addEventListener("change",fileSelect,!1)),e.value=null,e.click()}function fileSelect(){if(2==state){var e=Q("uploadFileInput");if(10<e.files.length)displayControl("Limit of 10 file uploads at the same time.");else for(var t=0;t<e.files.length;t++)if(0<e.files[t].size){var n=new FileReader;n.onload=function(e){this.xfile.data=e.target.result,startFileUpload(this.xfile)},n.xfile=e.files[t],n.readAsBinaryString(e.files[t])}}}function fileDrop(e){if(haltEvent(e),2==state&&null!=e.dataTransfer)if(10<e.dataTransfer.files.length)displayControl("Limit of 10 file uploads at the same time.");else for(var t=0;t<e.dataTransfer.files.length;t++)if(0<e.dataTransfer.files[t].size){var n=new FileReader;n.onload=function(e){this.xfile.data=e.target.result,startFileUpload(this.xfile)},n.xfile=e.dataTransfer.files[t],n.readAsBinaryString(e.dataTransfer.files[t])}}function startFileUpload(e){2==state&&(e.id=Math.random(),fileUploads.push(e),QA("xmsg",'<div style="clear:both"></div><div id="FILEUP-'+e.id+'" class="localBubble" style="width:240px;cursor:pointer" onclick="cancelFileTransfer(\''+e.id+'\')"><div id="FILEUP-ICON-'+e.id+'" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-'+e.id+'" style="height:16px;overflow:hidden;white-space:nowrap;" title="'+e.name+'">'+e.name+'</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-'+e.id+'" style="width:0px;background-color:green;border-radius:3px;height:11px">&nbsp;</div></div></div></div>'),Q("xmsg").scrollTop=Q("xmsg").scrollHeight,send({action:"file",size:e.size,id:e.id,type:e.type,name:e.name}),null==currentFileUpload&&continueFileUpload())}function startFileDownload(e){2==state&&(fileDownloads[e.id]=e,QA("xmsg",'<div style="clear:both"></div><div id="FILEUP-'+e.id+'" class="remoteBubble" style="width:240px;cursor:pointer" onclick="saveFileTransfer(\''+e.id+'\')"><div id="FILEUP-ICON-'+e.id+'" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-'+e.id+'" style="height:16px;overflow:hidden;white-space:nowrap;" title="'+e.name+'">'+e.name+'</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-'+e.id+'" style="width:0px;background-color:green;border-radius:3px;height:11px">&nbsp;</div></div></div></div>'),Q("xmsg").scrollTop=Q("xmsg").scrollHeight)}function changeFileInfo(e,t,n,i){t&&(Q("FILEUP-ICON-"+e).classList.remove("fileicon"),Q("FILEUP-ICON-"+e).classList.remove("fileiconx"),Q("FILEUP-ICON-"+e).classList.remove("fileicontransfer"),Q("FILEUP-ICON-"+e).classList.remove("fileicondone"),Q("FILEUP-ICON-"+e).classList.add(["fileicon","fileiconx","fileicontransfer","fileicondone"][t])),n&&(QS("FILEUP-PROGRESS-"+e).width=n+"px"),i&&(QS("FILEUP-PROGRESS-"+e)["background-color"]=i)}function data2blob(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return new Blob([new Uint8Array(t)])}function saveFileTransfer(e){var t=fileDownloads[e];t&&1==t.done&&saveAs(data2blob(t.data),t.name)}function cancelFileTransfer(e){null!=currentFileUpload&&currentFileUpload.id==e&&(currentFileUpload=null),null!=currentFileDownload&&currentFileDownload.id==e&&(currentFileDownload=null);var t=!1;if(fileDownloads[e]&&1!=fileDownloads[e].done)delete fileDownloads[e],t=!0;else for(var n in fileUploads)if(fileUploads[n].id==e){send({action:"fileUploadCancel",id:e}),fileUploads.splice(n,1),t=!0;break}t&&changeFileInfo(e,1,200,"gray")}function cancelAllFileTransfers(){for(var e in fileDownloads)cancelFileTransfer(fileDownloads[e].id);for(var e in fileUploads)cancelFileTransfer(fileUploads[e].id)}function continueFileUpload(){if(null==currentFileUpload){if(0==fileUploads.length)return;(currentFileUpload=fileUploads[0]).ptr=0,send({action:"fileUploadStart",size:currentFileUpload.size,id:currentFileUpload.id,type:currentFileUpload.type,name:currentFileUpload.name})}else if(currentFileUpload.size<=currentFileUpload.ptr)send({action:"fileUploadEnd",size:currentFileUpload.size,id:currentFileUpload.id,type:currentFileUpload.type,name:currentFileUpload.name}),changeFileInfo(currentFileUpload.id,3,200),fileUploads.splice(0,1),currentFileUpload=null,continueFileUpload();else{var e=Math.min(4e3,currentFileUpload.data.length-currentFileUpload.ptr),t=currentFileUpload.data.substring(currentFileUpload.ptr,currentFileUpload.ptr+e);send({action:"fileData",id:currentFileUpload.id,data:t}),currentFileUpload.ptr+=e,changeFileInfo(currentFileUpload.id,0,200*currentFileUpload.ptr/currentFileUpload.size)}}function continueFileDownload(e){send({action:"fileUploadAck",id:e.id})}function enableNotificationsButtonClick(){return Notification&&Notification.requestPermission().then(function(e){QV("notifyButton","granted"!=e)}),!1}function camButtonClick(){null==localStream&&startLocalStream({video:!0,audio:!0})}function micButtonClick(){null==localStream&&startLocalStream({video:!1,audio:!0})}function hangUpButtonClick(e,t){var n=Q("localVideoCanvas"),i=Q("remoteVideoCanvas"),o=webrtcSessions[1==multiWebRtc?e:0];if(0==e&&null!=webchannel){try{webchannel.close()}catch(e){}webchannel=null}if(o){if(1!=multiWebRtc&&0!=e||(o.ontrack=null,o.onremovetrack=null,o.onremovestream=null,o.onnicecandidate=null,o.oniceconnectionstatechange=null,o.onsignalingstatechange=null,o.onicegatheringstatechange=null,o.onnotificationneeded=null),1==e&&localStream){var a=localStream.getTracks();for(var l in a)a[l].stop();localStream=null}if(2==e&&remoteStream){a=remoteStream.getTracks();for(var l in a)a[l].stop();remoteStream=null}1!=multiWebRtc&&0!=e||(o.close(),delete webrtcSessions[e])}1==e?(n.removeAttribute("src"),n.removeAttribute("srcObject"),null!=localStream&&(localStream=null),displayLocalVideo(!1)):2==e&&(i.removeAttribute("src"),i.removeAttribute("srcObject"),displayRemoteVideo(!1)),1!=t&&send({action:"videoStop",id:e}),updateControls()}function startLocalStream(a){var l=1==multiWebRtc?1:0;null==localStream&&(1==multiWebRtc&&null!=webrtcSessions[1]||navigator.mediaDevices.getUserMedia&&(localStream=1,updateControls(),navigator.mediaDevices.getUserMedia(a).then(function(e){var t=(localStream=e).getTracks(),n=startWebRTC(l);if(1==a.video){var i=Q("localVideoCanvas");i.srcObject=e,i.onloadedmetadata=function(e){i.play()},displayLocalVideo(!0)}for(var o in t)n.addTrack(t[o],localStream)},function(e){displayControl(e.message+"."),hangUpButtonClick(1)})))}function start(){if(updateControls(),"string"==typeof args.id&&0<args.id.length){var e=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+args.id;null!=args.auth&&""!=args.auth&&(e+="&auth="+args.auth),(socket=new WebSocket(e)).onopen=function(){state=1,displayControl("Waiting for other user...")},socket.onerror=function(e){},socket.onclose=function(){disconnect()},socket.onmessage=function(e){if(state<2&&"string"==typeof e.data&&("c"==e.data||"cr"==e.data))return hangUpButtonClick(0,!0),hangUpButtonClick(1,!0),hangUpButtonClick(2,!0),displayControl("Connected."),state=2,updateControls(),void sendws({action:"random",random:random});2==state&&processMessage(e.data,1)}}else displayControl("Error: No connection key specified.")}function onUnLoad(){for(var e=0;e<3;e++)webrtcSessions[e]&&(webrtcSessions[e].close(),delete webrtcSessions[e]);if(null!=webchannel){try{webchannel.close()}catch(e){}webchannel=null}if(null!=socket){try{socket.close()}catch(e){}socket=null}}args.title&&(QH("xtitle"," - "+args.title),document.title=document.title+" - "+args.title),Notification&&QV("notifyButton","granted"!=Notification.permission),document.addEventListener("dragover",haltEvent,!1),document.addEventListener("dragleave",haltEvent,!1),document.addEventListener("drop",fileDrop,!1),document.onclick=function(e){Notification&&QV("notifyButton","granted"!=Notification.permission),null!=notification&&(notification.close(),notification=null)},document.onkeyup=function(e){if(Notification&&QV("notifyButton","granted"!=Notification.permission),null!=notification&&(notification.close(),notification=null),2==state&&8==e.keyCode&&0==userInputFocus){var t=Q("xouttext").value;0<t.length&&(Q("xouttext").value=t.substring(0,t.length-1))}if(0==userInputFocus)return haltEvent(e),!1},document.onkeypress=function(e){if(Notification&&QV("notifyButton","granted"!=Notification.permission),null!=notification&&(notification.close(),notification=null),2==state&&(13==e.keyCode?xsend(e):0==userInputFocus&&1==e.key.length&&(Q("xouttext").value=Q("xouttext").value+e.key)),0==userInputFocus)return haltEvent(e),!1},FileReader.prototype.readAsBinaryString||(FileReader.prototype.readAsBinaryString=function(e){var i="",o=this,a=new FileReader;a.onload=function(e){for(var t=new Uint8Array(a.result),n=0;n<t.byteLength;n++)i+=String.fromCharCode(t[n]);o.onload({target:{result:i}})},a.readAsArrayBuffer(e)}),start()</script>
\ No newline at end of file
views/translations/agentinvite-min_fr.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><title>MeshCentral - Agent Installation</title><style>.tab{overflow:hidden;border:1px solid #ccc;background-color:#f1f1f1}.tab button{background-color:inherit;float:left;border:none;outline:0;cursor:pointer;padding:14px 16px;transition:.3s}.tab button:hover{background-color:#ddd}.tab button.active{background-color:#8f8}.tabcontent{display:none;padding:6px 12px;border:1px solid #ccc;border-top:none}</style><body id=body onload='"undefined"!=typeof startup&&startup()'style=display:none;overflow:hidden><div id=container><div id=masthead class=noselect style="background:url(logo.png) 0 0;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px><strong><font style=font-size:46px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px><strong><font style=font-size:14px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div><p id=logoutControl style="color:#fff;font-size:11px;margin:10px 10px 0">{{{logoutControl}}}</div><div id=page_leftbar><div style=height:16px></div></div><div id=topbar class="noselect style3"style=height:24px;position:relative><div id=uiMenuButton title="User interface selection"onclick=showUserInterfaceSelectMenu()>♦<div id=uiMenu style=display:none><div id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"><div class=uiSelector1></div></div><div id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"><div class=uiSelector2></div></div><div id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"><div class=uiSelector3></div></div><div id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Basculer mode nuit"><div class=uiSelector4></div></div></div></div></div><div id=column_l style="max-height:calc(100vh - 135px);overflow-y:auto"><h1>Remote Agent Installation<span id=groupname></span></h1><p>You have been invited to install a software that will allow a remote operator to fully access your computer remotely including the desktop and files. Only follow the instructions below if this invitation was expected and you know who will be accessing your computer. Selecting your operation system and follow the instructions below.<div><div class=tab><button id=twintab64 class=tablinks onclick='openTab(event,"wintab64")'>Windows 64bit</button><button id=twintab32 class=tablinks onclick='openTab(event,"wintab32")'>Windows 32bit</button><button id=tlinuxtab class=tablinks onclick='openTab(event,"linuxtab")'>Linux</button><button id=tmacostab class=tablinks onclick='openTab(event,"macostab")'>MacOS</button></div><div id=wintab64 class=tabcontent style=background-color:#fff;color:#000><h3>Microsoft™ Windows 64bit</h3><p><a id=win64url>Download the software here</a>, run it and press "Install" or "Connect".<div style=text-align:center><img class=winagent-img src=images/winagent.png></div></div><div id=wintab32 class=tabcontent style=background-color:#fff;color:#000><h3>Microsoft™ Windows 32bit</h3><p><a id=win32url>Download the software here</a>, run it and press "Install" or "Connect".<div style=text-align:center><img class=winagent-img src=images/winagent.png></div></div><div id=linuxtab class=tabcontent style=background-color:#fff;color:#000><h3>Linux</h3><p>To install, cut and paste the following command in a root terminal.<div id=linuxinstall style="font-family:courier,'courier new',monospace;margin-left:30px"></div><input type=button value="Copy to clipboard"style=margin-left:30px;margin-top:4px onclick=copyToClipLinuxInstall()><p>To uninstall, cut and paste the following command as root.<div id=unlinuxinstall style="font-family:courier,'courier new',monospace;margin-left:30px"></div><input type=button value="Copy to clipboard"style=margin-left:30px;margin-top:4px onclick=copyToClipLinuxUnInstall()><br><br></div><div id=macostab class=tabcontent style=background-color:#fff;color:#000><h3>Apple™ MacOS</h3><p><a id=macosurl>Download the installer here</a>, right click on it or press "control" and click on the file. Then select "Open" and follow the instructions.<div style=text-align:center><img src=images/macosagent.png></div></div></div></div><div id=footer><table cellpadding=0 cellspacing=10 style=width:100%><tr><td style=text-align:left><td style=text-align:right></table></div></div><script>"use strict";var linuxInstall,linuxUnInstall,uiMode=parseInt(getstore("uiMode",1)),webPageStackMenu=!1,webPageFullScreen=!0,nightMode="1"==getstore("_nightMode","0"),domain="{{{domain}}}",domainUrl="{{{domainurl}}}",meshid="{{{meshid}}}",serverPort="{{{serverport}}}",serverHttps="{{{serverhttps}}}",serverNoProxy="{{{servernoproxy}}}",installFlags="{{{installflags}}}",groupName=decodeURIComponent("{{{meshname}}}");function showUserInterfaceSelectMenu(){Q("uiViewButton1").classList.remove("uiSelectorSel"),Q("uiViewButton2").classList.remove("uiSelectorSel"),Q("uiViewButton3").classList.remove("uiSelectorSel"),Q("uiViewButton4").classList.remove("uiSelectorSel");try{Q("uiViewButton"+uiMode).classList.add("uiSelectorSel")}catch(e){}QV("uiMenu","none"==QS("uiMenu").display),nightMode&&Q("uiViewButton4").classList.add("uiSelectorSel")}function userInterfaceSelectMenu(e){e&&putstore("uiMode",uiMode=e),webPageFullScreen=uiMode<3,webPageStackMenu=!0,toggleFullScreen(0),toggleStackMenu(0),QC("column_l").add("room4submenu")}function toggleNightMode(){(nightMode=!nightMode)?QC("body").add("night"):QC("body").remove("night"),putstore("_nightMode",nightMode?"1":"0")}function toggleFullScreen(e){1===e&&putstore("webPageFullScreen",webPageFullScreen=!webPageFullScreen);0==webPageFullScreen?(QC("body").remove("menu_stack"),QC("body").remove("fullscreen"),QC("body").remove("arg_hide")):QC("body").add("fullscreen"),QV("body",!0)}function toggleStackMenu(e){1==webPageFullScreen&&(1===e&&putstore("webPageStackMenu",webPageStackMenu=!webPageStackMenu),0==webPageStackMenu?QC("body").remove("menu_stack"):QC("body").add("menu_stack"))}function putstore(e,t){try{if("undefined"==typeof localStorage)return;localStorage.setItem(e,t)}catch(e){}}function getstore(e,t){try{if("undefined"==typeof localStorage)return t;var n=localStorage.getItem(e);return null==n||null==n?t:n}catch(e){return t}}function openTab(e,t){var n,s,l;for(s=document.getElementsByClassName("tabcontent"),n=0;n<s.length;n++)s[n].style.display="none";for(l=document.getElementsByClassName("tablinks"),n=0;n<l.length;n++)l[n].className=l[n].className.replace("actif","");document.getElementById(t).style.display="block",null!=e?e.currentTarget.className+="actif":document.getElementById("t"+t).className+="actif"}function setup(){var e=window.location.hostname,t=domainUrl.substring(0,domainUrl.length-1),n="meshagents?id=4&meshid="+meshid;if(0!=installFlags&&(n+="&installflags="+installFlags),Q("win64url").href=n,n="meshagents?id=3&meshid="+meshid,0!=installFlags&&(n+="&installflags="+installFlags),Q("win32url").href=n,n="meshosxagent?id=16&meshid="+meshid,Q("macosurl").href=n,1==serverHttps){var s=443==serverPort?"":":"+serverPort;linuxUnInstall=0==serverNoProxy?(linuxInstall="(wget https://"+e+s+domainUrl+"meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://"+e+s+domainUrl+"meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://"+e+s+t+" '"+meshid+"'\r\n","(wget https://"+e+s+domainUrl+"meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://"+e+s+domainUrl+"meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"):(linuxInstall="wget https://"+e+s+domainUrl+"meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://"+e+s+t+" '"+meshid+"'\r\n","wget https://"+e+s+domainUrl+"meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n")}else{s=80==serverPort?"":":"+serverPort;linuxUnInstall=0==serverNoProxy?(linuxInstall="(wget http://"+e+s+domainUrl+"meshagents?script=1 -O ./meshinstall.sh || wget http://"+e+s+domainUrl+"meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://"+e+s+t+" '"+meshid+"'\r\n","(wget http://"+e+s+domainUrl+"meshagents?script=1 -O ./meshinstall.sh || wget http://"+e+s+domainUrl+"meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"):(linuxInstall="wget http://"+e+s+domainUrl+"meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://"+e+s+t+" '"+meshid+"'\r\n","wget http://"+e+s+domainUrl+"meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n")}QH("linuxinstall",linuxInstall),QH("unlinuxinstall",linuxUnInstall),0<=navigator.userAgent.indexOf("Win64")?openTab(null,"wintab64"):0<=navigator.userAgent.indexOf("Windows")?openTab(null,"wintab32"):0<=navigator.userAgent.indexOf("Linux")?openTab(null,"linuxtab"):0<=navigator.userAgent.indexOf("Macintosh")?openTab(null,"macostab"):openTab(null,"wintab64")}function copyToClipLinuxInstall(){copyTextToClip(linuxInstall)}function copyToClipLinuxUnInstall(){copyTextToClip(linuxUnInstall)}function copyTextToClip(e){var t=document.createElement("DIV");t.textContent=e,document.body.appendChild(t),function(e){if(document.selection)(t=document.body.createTextRange()).moveToElementText(e),t.select();else if(window.getSelection){var t;(t=document.createRange()).selectNode(e),window.getSelection().removeAllRanges(),window.getSelection().addRange(t)}}(t),document.execCommand("copy"),t.remove()}""!=groupName&&QH("groupname"," for "+groupName),userInterfaceSelectMenu(),setup()</script>
\ No newline at end of file
views/translations/default-min_fr.handlebars new
+8339
@@ -0,0 +1,8339 @@
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link rel="shortcut icon"type=image/x-icon href={{{domainurl}}}favicon.ico><link keeplink=1 type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><link type=text/css href=styles/ol.css media=screen rel=stylesheet title=CSS><link type=text/css href=styles/ol3-contextmenu.min.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><script src=scripts/meshcentral.js></script><script src=scripts/amt-0.2.0.js></script><script src=scripts/amt-wsman-0.2.0.js></script><script src=scripts/amt-desktop-0.0.2.js></script><script src=scripts/amt-terminal-0.0.2.js></script><script src=scripts/zlib.js></script><script src=scripts/zlib-inflate.js></script><script src=scripts/zlib-adler32.js></script><script src=scripts/zlib-crc32.js></script><script src=scripts/amt-redir-ws-0.1.0.js></script><script src=scripts/amt-wsman-ws-0.2.0.js></script><script src=scripts/agent-redir-ws-0.1.1.js></script><script src=scripts/agent-redir-rtc-0.1.0.js></script><script src=scripts/agent-desktop-0.0.2.js></script><script src=scripts/qrcode.min.js></script><script keeplink=1 src=scripts/u2f-api.js></script><script keeplink=1 src=scripts/charts.js></script><script keeplink=1 src=scripts/filesaver.js></script><script keeplink=1 src=scripts/ol.js></script><script keeplink=1 src=scripts/ol3-contextmenu.js></script><title>{{{title}}}</title><body id=body onload='"undefined"!=typeof startup&&startup()'oncontextmenu=handleContextMenu(event) style=display:none;min-width:495px><div id=contextMenu class="contextMenu noselect"style=display:none><div id=cxinfo class=cmtext onclick=cmaction(1,event)><b>Information</b></div><div id=cxdesktop class=cmtext onclick=cmaction(3,event)>Desktop</div><div id=cxterminal class=cmtext onclick=cmaction(2,event)>Terminal</div><div id=cxfiles class=cmtext onclick=cmaction(4,event)>Files</div><div id=cxevents class=cmtext onclick=cmaction(5,event)>Events</div><div id=cxconsole class=cmtext onclick=cmaction(6,event)>Console</div><hr id=cxmgroupsplit><div id=cxmdesktop class=cmtext onclick=cmaction(7,event) style=display:none>Multi-Desktop</div></div><div id=meshContextMenu class="contextMenu noselect"style=display:none;min-width:0><div id=cxselectall class=cmtext onclick=cmmeshaction(1,event)>Tout Sélectionner</div><div id=cxselectnone class=cmtext onclick=cmmeshaction(2,event)>Rien sélectionner</div></div><div id=termShellContextMenu class="contextMenu noselect"style=display:none;min-width:0><div id=cxtermnorm class=cmtext onclick=cmtermaction(1,event)>Normal Connect</div><div id=cxtermps class=cmtext onclick=cmtermaction(2,event)>PowerShell Connect</div></div><div id=container><div id=notifiyBox class=notifiyBox style=display:none></div><div id=masthead class=noselect><div class=title>{{{title}}}</div><div class=title2>{{{title2}}}</div><div style=float:right><div id=notificationCount onclick=clickNotificationIcon() class=unselectable style=display:none title="Click to view current notifications">0</div></div><p id=logoutControl>{{{logoutControl}}}<span id=idleTimeoutNotify style=color:#ff0></span></div><div id=page_leftbar><div style=height:16px></div><div id=LeftMenuMyDevices tabindex=0 class="lbbutton lbbuttonsel"title="Mes Appareils"onclick=go(1,event) onkeypress='"Enter"==event.key&&go(1)'><div class=lb2></div></div><div id=LeftMenuMyAccount tabindex=0 class=lbbutton title="Mon Compte"onclick=go(2,event) onkeypress='"Enter"==event.key&&go(2)'><div class=lb1></div></div><div id=LeftMenuMyEvents tabindex=0 class=lbbutton title="Mes Événements"onclick=go(3,event) onkeypress='"Enter"==event.key&&go(3)'><div class=lb3></div></div><div id=LeftMenuMyFiles tabindex=0 class=lbbutton style=display:none title="Mes Dossiers"onclick=go(5,event) onkeypress='"Enter"==event.key&&go(5)'><div class=lb4></div></div><div id=LeftMenuMyUsers tabindex=0 class=lbbutton style=display:none title="Mes Utilisateurs"onclick=go(4,event) onkeypress='"Enter"==event.key&&go(4)'><div class=lb5></div></div><div id=LeftMenuMyServer tabindex=0 class=lbbutton style=display:none title="Mon Serveur"onclick=go(6,event) onkeypress='"Enter"==event.key&&go(6)'><div class=lb6></div></div></div><div id=topbar class=noselect><div><div style=position:relative><div tabindex=0 id=uiMenuButton title="User interface selection"onclick=showUserInterfaceSelectMenu() onkeypress='"Enter"==event.key&&showUserInterfaceSelectMenu()'>♦<div id=uiMenu style=display:none><div tabindex=0 id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"onkeypress='"Enter"==event.key&&userInterfaceSelectMenu(1)'><div class=uiSelector1></div></div><div tabindex=0 id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"onkeypress='"Enter"==event.key&&userInterfaceSelectMenu(2)'><div class=uiSelector2></div></div><div tabindex=0 id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"onkeypress='"Enter"==event.key&&userInterfaceSelectMenu(3)'><div class=uiSelector3></div></div><div tabindex=0 id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Basculer mode nuit"onkeypress='"Enter"==event.key&&toggleNightMode()'><div class=uiSelector4></div></div></div></div><table id=MainMenuSpan cellpadding=0 cellspacing=0 class=style1><tr><td tabindex=0 id=MainMenuMyDevices class="topbar_td style3x"onclick=go(1,event) onkeypress='"Enter"==event.key&&go(1)'>Mes Appareils<td tabindex=0 id=MainMenuMyAccount class="topbar_td style3x"onclick=go(2,event) onkeypress='"Enter"==event.key&&go(2)'>Mon Compte<td tabindex=0 id=MainMenuMyEvents class="topbar_td style3x"onclick=go(3,event) onkeypress='"Enter"==event.key&&go(3)'>Mes Événements<td tabindex=0 id=MainMenuMyFiles class="topbar_td style3x"onclick=go(5,event) onkeypress='"Enter"==event.key&&go(5)'>Mes Dossiers<td tabindex=0 id=MainMenuMyUsers class="topbar_td style3x"onclick=go(4,event) onkeypress='"Enter"==event.key&&go(4)'>Mes Utilisateurs<td tabindex=0 id=MainMenuMyServer class="topbar_td style3x"onclick=go(6,event) onkeypress='"Enter"==event.key&&go(6)'>Mon Serveur<td class="topbar_td_end style3">&nbsp;</table><div id=MainSubMenuSpan style=display:none><table id=MainSubMenu cellpadding=0 cellspacing=0 class=style1><tr><td tabindex=0 id=MainDev class="topbar_td style3x"onclick=go(10,event) onkeypress='"Enter"==event.key&&go(10)'>General<td tabindex=0 id=MainDevDesktop class="topbar_td style3x"onclick=go(11,event) onkeypress='"Enter"==event.key&&go(11)'>Desktop<td tabindex=0 id=MainDevTerminal class="topbar_td style3x"onclick=go(12,event) onkeypress='"Enter"==event.key&&go(12)'>Terminal<td tabindex=0 id=MainDevFiles class="topbar_td style3x"onclick=go(13,event) onkeypress='"Enter"==event.key&&go(13)'>Files<td tabindex=0 id=MainDevEvents class="topbar_td style3x"onclick=go(16,event) onkeypress='"Enter"==event.key&&go(16)'>Events<td tabindex=0 id=MainDevInfo class="topbar_td style3x"onclick=go(17,event) onkeypress='"Enter"==event.key&&go(17)'>Details<td tabindex=0 id=MainDevAmt class="topbar_td style3x"onclick=go(14,event) onkeypress='"Enter"==event.key&&go(14)'>Intel® AMT<td tabindex=0 id=MainDevConsole class="topbar_td style3x"onclick=go(15,event) onkeypress='"Enter"==event.key&&go(15)'>Console<td tabindex=0 id=MainDevPlugins class="topbar_td style3x"onclick=go(19,event) onkeypress='"Enter"==event.key&&go(19)'>Plugins<td class="topbar_td_end style3">&nbsp;</table></div><div id=MeshSubMenuSpan style=display:none><table id=MeshSubMenu cellpadding=0 cellspacing=0 class=style1><tr><td tabindex=0 id=MeshGeneral class="topbar_td style3x"onclick=go(20,event) onkeypress='"Enter"==event.key&&go(20)'>General<td class="topbar_td_end style3">&nbsp;</table></div><div id=UserSubMenuSpan style=display:none><table id=UserSubMenu cellpadding=0 cellspacing=0 class=style1><tr><td tabindex=0 id=UserGeneral class="topbar_td style3x"onclick=go(30,event) onkeypress='"Enter"==event.key&&go(30)'>General<td tabindex=0 id=UserEvents class="topbar_td style3x"onclick=go(31,event) onkeypress='"Enter"==event.key&&go(31)'>Events<td class="topbar_td_end style3">&nbsp;</table></div><div id=ServerSubMenuSpan style=display:none><table id=ServerSubMenu cellpadding=0 cellspacing=0 class=style1><tr><td tabindex=0 id=ServerGeneral class="topbar_td style3x"onclick=go(6,event) onkeypress='"Enter"==event.key&&go(6)'>General<td tabindex=0 id=ServerStats class="topbar_td style3x"onclick=go(40,event) onkeypress='"Enter"==event.key&&go(40)'>Stats<td tabindex=0 id=ServerConsole class="topbar_td style3x"onclick=go(115,event) onkeypress='"Enter"==event.key&&go(115)'>Console<td tabindex=0 id=ServerTrace class="topbar_td style3x"onclick=go(41,event) onkeypress='"Enter"==event.key&&go(41)'>Trace<td class="topbar_td_end style3">&nbsp;</table></div><div id=UserDummyMenuSpan><table id=UserDummyMenu cellpadding=0 cellspacing=0 class=style1><tr><td class=style3>&nbsp;</table></div></div></div></div><div id=column_l><div id=p0 style=display:none><div id=p0message><span id=p0span>Server disconnected</span>,<href onclick=reload() style=cursor:pointer><u>click to reconnect</u></href>.</div></div><div id=p1 style=display:none><div style=display:none id=devListToolbarViewIcons><div tabindex=0 id=devViewButton1 class=viewSelector onclick=onDeviceViewChange(1) onkeypress='"Enter"==event.key&&onDeviceViewChange(1)'title=Columns><div class=viewSelector2></div></div><div tabindex=0 id=devViewButton2 class=viewSelector onclick=onDeviceViewChange(2) onkeypress='"Enter"==event.key&&onDeviceViewChange(2)'title=List><div class=viewSelector1></div></div><div tabindex=0 id=devViewButton3 class=viewSelector onclick=onDeviceViewChange(3) onkeypress='"Enter"==event.key&&onDeviceViewChange(3)'title=Desktops><div class=viewSelector3></div></div><div tabindex=0 id=devViewButton4 class=viewSelector onclick=onDeviceViewChange(4) onkeypress='"Enter"==event.key&&onDeviceViewChange(4)'title=Carte><div class=viewSelector4></div></div></div><div><h1>Mes Appareils</h1></div><table id=devListToolbarSpan class=noselect><tr><td class=h1><td id=devListToolbar class=style14 style=display:none>&nbsp;&nbsp;<input type=button id=SelectAllButton onclick=selectallButtonFunction() value="Tout Sélectionner">&nbsp; <input type=button id=GroupActionButton disabled value="Action de groupe"onclick=groupActionFunction()>&nbsp; <input id=SearchInput placeholder=Filter onchange=masterUpdate(5) onkeyup=masterUpdate(5) autocomplete=off onfocus=onSearchFocus(1) onblur=onSearchFocus(0)>&nbsp;<label><input type=checkbox id=RealNameCheckBox onclick=onRealNameCheckBox()><span title="Show devices operating system name">Nom du système</span></label><td id=kvmListToolbar class=style14 style=display:none>&nbsp;&nbsp;<span id=kvmMultiConnectButtonSpan><input type=button onclick=connectAllKvmFunction() value="Connect All">&nbsp;</span><input type=button onclick=disconnectAllKvmFunction() value="Disconnect All">&nbsp;<span id=kvmAutoConnectButtonSpan><label><input type=checkbox id=autoConnectDesktopCheckbox onclick=autoConnectDesktops(event) title="Connexion automatique">Automatique&nbsp;</label></span><input type=button onclick=showMultiDesktopSettings() value=Settings>&nbsp;<td id=devMapToolbar class=style14 style=display:none>&nbsp;&nbsp;<input id=mapSearchLocation placeholder="Recherche de lieu"onfocus=onMapSearchFocus(1) onblur=onMapSearchFocus(0)> <input type=button value=Chercher title="Recherche de lieu"onclick=getSearchLocation()> <input type=button id=refreshmap title="Reset map view"value=Réinitialiser onclick=refreshMap(!1,!0)><td class=auto-style1 style=height:100%><div style=display:none id=devListToolbarView>View<select id=viewselect onchange=onDeviceViewChange()><option value=1>Columns<option value=2>List<option value=3>Desktops<option id=viewselectmapoption value=4>Carte</select></div><div style=display:none id=devListToolbarSort>Trier<select id=sortselect onchange=masterUpdate(6)><option>Groupe<option>Power<option>Device<option>Tags</select>&nbsp;</div><div style=display:none id=devListToolbarSize>Taille<select id=sizeselect onchange=onDeviceViewChange()><option value=0>Petit<option value=1>Medium<option value=2>Grand</select>&nbsp;</div><td class=h2></table><div id=NoMeshesPanel style=display:none><table><tr><td valign=top style=width:50px><img src=images/info.png><td><div id=getStarted1>To get started,<a href=# onclick="return account_createMesh()"><strong>click here to create a device group</strong></a>.</div><div id=getStarted2>Aucun groupe d'appareils.</div></table></div><div id=xdevices class=noselect style=display:none></div><div id=xdevicesmap style=display:none><div id=xmapSearchResultsDlg style=display:none><div id=xmapSearchResultsBck><div id=xmapSearchClose onclick=mapCloseSearchWindow()><b>X</b></div><div style=padding:5px>Location Results</div><div style=width:100%;margin:6px></div></div><div id=xmapSearchResults style=margin:6px></div></div></div><div id=xmap-info-window></div></div><div id=p2 style=display:none><h1>Mon Compte</h1><img id=p2AccountImage alt=""src=images/clipboard-128.png><div id=p2AccountSecurity style=display:none><p><strong>Account security</strong><div style=margin-left:25px><div id=manageAuthApp><div class=p2AccountActions><span id=authAppSetupCheck><strong>✓</strong></span></div><span><a href=# onclick="return account_manageAuthApp()">Manage authenticator app</a><br></span></div><div id=manageHardwareOtp><div class=p2AccountActions><span id=authKeySetupCheck><strong>✓</strong></span></div><span><a href=# onclick="return account_manageHardwareOtp(0)">Manage security keys</a><br></span></div><div id=manageOtp><div class=p2AccountActions><span id=authCodesSetupCheck><strong>✓</strong></span></div><span><a href=# onclick="return account_manageOtp(0)">Manage backup codes</a><br></span></div></div></div><div id=p2AccountActions><p><strong>Account actions</strong><p class=mL><span id=verifyEmailId style=display:none><a href=# onclick="return account_showVerifyEmail()">Verify email</a><br></span><span id=accountEnableNotificationsSpan style=display:none><a href=# onclick="return account_enableNotifications()">Enable web notifications</a><br></span><a href=# onclick="return account_showLocalizationSettings()">Localization Settings</a><br><a href=# onclick="return account_showAccountNotifySettings()">Notification Settings</a><br><span id=accountChangeEmailAddressSpan style=display:none><a href=# onclick="return account_showChangeEmail()">Change email address</a><br></span><a href=# onclick="return account_showChangePassword()">Change password</a><span id=p2nextPasswordUpdateTime></span><br><a href=# onclick="return account_showDeleteAccount()">Delete account</a><br></p><br style=clear:both></div><strong>Device Groups</strong><span id=p2createMeshLink1>(<a href=# onclick="return account_createMesh()"class=newMeshBtn>Nouveau</a>)</span><br><br><div id=p2meshes></div><div id=p2noMeshFound style=display:none>Aucun groupe d'appareils.<span id=p2createMeshLink2><a href=# onclick="return account_createMesh()"><strong>Get started here!</strong></a></span></div><br style=clear:both></div><div id=p3 style=display:none><h1>Mes Événements</h1><table class=pTable><tr><td class=h1><td class=auto-style1>Show<select id=p3limitdropdown onchange=refreshEvents()><option value=60>60 dernières<option value=120>120 dernières<option value=250>250 dernières<option value=500>500 dernières<option value=1000>1000 derniers</select>&nbsp;<a href=# onclick=p3showDownloadEventsDialog(2)><img src=images/link4.png height=10 width=10 title="Download Events"style=cursor:pointer></a>&nbsp;<td class=h2></table><div id=p3events></div></div><div id=p4 style=display:none><h1>Mes Utilisateurs</h1><table class=pTable><tr><td class=h1><td class=style14><div style=float:right><input type=button onclick=showUserBroadcastDialog() style=margin-right:6px value=Diffuser><a href=# onclick=p4downloadUserInfo()><img style=cursor:pointer title="Download user information"src=images/link4.png></a><a href=# onclick=p4batchAccountCreate()><img id=p4UserBatchCreate style=cursor:pointer;display:none title="Batch create many user accounts"src=images/link6.png></a></div><div><input id=UserNewAccountButton type=button style=margin-left:6px onclick=showCreateNewAccountDialog() value="Nouveau Compte..."> <input id=UserSearchInput style=width:120px;margin-left:6px placeholder=Filter onchange=onUserSearchInputChanged() onkeyup=onUserSearchInputChanged() autocomplete=off onfocus=onUserSearchFocus(1) onblur=onUserSearchFocus(0)></div><td class=h2></table><div id=p3users></div></div><div id=p5 style=display:none><h1>Mes Dossiers</h1><table id=p5toolbar cellpadding=0 cellspacing=0><tr><td id=p5filehead valign=bottom><div id=p5rightOfButtons></div><div><input type=button id=p5FolderUp disabled onclick="return p5folderup()"value=Up>&nbsp; <input type=button id=p5SelectAllButton disabled onclick=p5selectallfile() value="Tout Sélectionner">&nbsp; <input type=button id=p5RenameFileButton disabled value=Renommer onclick=p5renamefile()>&nbsp; <input type=button id=p5DeleteFileButton disabled value=Delete onclick=p5deletefile()>&nbsp; <input type=button id=p5NewFolderButton disabled value="Nouveau Dossier"onclick=p5createfolder()>&nbsp; <input type=button id=p5UploadButton disabled value=Télécharger onclick=p5uploadFile()>&nbsp; <input type=button id=p5CutButton disabled value=Cut onclick=p5copyFile(1)>&nbsp; <input type=button id=p5CopyButton disabled value=Copy onclick=p5copyFile(0)>&nbsp; <input type=button id=p5PasteButton disabled value=Paste onclick=p5pasteFile()>&nbsp;</div><tr><td id=p5filesubhead><div style=float:right><select id=p5sortdropdown onchange=updateFiles()><option value=1 selected>Trier par nom<option value=2>Trier par taille<option value=3>Trier par date<option value=4>Descend by name<option value=5>Descend by size<option value=6>Descend by date</select></div><div>&nbsp;&nbsp;<span id=p5currentpath></span></div></table><div id=p5filetable><div id=p5PublicShare><div>Ces fichiers sont partagés publiquement, cliquez sur "lien" pour obtenir une URL publique.</div></div><div id=bigok style=display:none><b>✓</b></div><div id=bigfail style=display:none><b>✗</b></div><span id=p5files></span></div><table id=p5toolbarBottom style=width:100% cellpadding=0 cellspacing=0><tr><td class=style6>&nbsp;<span id=p5bottomstatus></span></table></div><div id=p6 style=display:none><img id=MainMeshImage src=serverpic.ashx><h1>Mon Serveur</h1><div id=p2ServerActions><p><strong>Server actions</strong><div class=mL><div id=p2ServerActionsBackup><a href={{{domainurl}}}backup.zip rel="noreferrer noopener"target=_blank>Download server backup</a></div><div id=p2ServerActionsRestore><a href=# onclick="return server_showRestoreDlg()">Restaurer le serveur avec sauvegarde</a></div><div id=p2ServerActionsVersion><a href=# onclick="return server_showVersionDlg()">Check server version</a></div><div id=p2ServerActionsErrors><a href=# onclick="return server_showErrorsDlg()">Afficher le journal des erreurs du serveur</a></div></div></div><br><strong>Server Statistics</strong><br><br><div id=serverStats><div id=serverCpuChartView style=display:none><div class=chartViewCanvas><canvas id=serverCpuChart></canvas></div><div class=chartViewText id=serverCpuChartText></div></div><div id=serverMemoryChartView style=display:none><div class=chartViewCanvas><canvas id=serverMemoryChart></canvas></div><div class=chartViewText id=serverMemoryChartText></div></div><br><br><div id=serverStatsTable></div></div></div><div id=p10 style=display:none><table style=width:100% cellpadding=0 cellspacing=0><tr><td style=width:auto valign=top><div id=p10title><div id=p10BackButton><div class=backButton tabindex=0 onclick=goBack() title=Retour onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>General -<span id=p10deviceName></span></h1></div><div id=p10html></div><td style=width:20px><td style=width:200px><a href=# onclick=p10showiconselector()><img id=MainComputerImage></a><div id=MainComputerState></div></table><br><div id=p10html2></div><div id=p10html3></div></div><div id=p11 class=noselect style=display:none><div id=p11title><div id=p11deviceNameHeader><div id=p11BackButton><div class=backButton tabindex=0 onclick=goBack() title=Retour onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><div id=devListToolbarViewIcons><div class=viewSelector onclick=deskToggleFull(event) title="Full Screen. Hold shift to browser full screen."><div class=viewSelector5></div></div></div><h1>Desktop -<span id=p11deviceName></span></h1></div></div><div id=p11warning onclick=showFeaturesDlg()><div class=icon2></div><div class=warningbox>Intel® AMT Redirection port or KVM feature is disabled<span id=p11warninga>, click here to enable it.</span></div></div><div id=p11warning2 onclick=showPowerActionDlg()><div class=icon2></div><div class=warningbox>Remote computer is not powered on, click here to issue a power command.</div></div><div id=deskarea0 cellpadding=0 cellspacing=0><div id=deskarea1 class=areaHead><div class=toright2><span id=p11power></span>&nbsp;<div class=deskareaicon title="Toggle View Mode"onclick=toggleAspectRatio(1)>⇲</div><div class=deskareaicon title="Tourne à gauche"onclick=drotate(-1)>↺</div><div class=deskareaicon title="Tourner à droite"onclick=drotate(1)>↻</div><div id=deskRecordIcon class=deskareaicon title="Server is recording this session"style=display:none;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px></div><input id=deskFocusBtn type=button title="Toggle focus mode, when active only the region around the mouse is updated"onkeypress=return!1 onkeydown=return!1 value="Focus All"onclick=deskToggleFocus() style=margin-right:3px;display:none> <input id=deskSaveBtn type=button title="Enregistrer une capture d'écran du bureau distant"onkeypress=return!1 onkeydown=return!1 value=Sauver... onclick=deskSaveImage() class=mR> <input id=deskActionsBtn type=button title="Effectuer des actions d'alimentation sur le périphérique"onkeypress=return!1 onkeydown=return!1 value=Actions onclick=deviceActionFunction() class=mR> <input id=deskActionsSettings type=button value=Paramètres... title="Edit remote desktop settings"onkeypress=return!1 onkeydown=return!1 onclick=showDesktopSettings() class=mR> <input type=button title="Change the power state of the remote machine"onkeypress=return!1 onkeydown=return!1 value="Power Actions..."onclick=showPowerActionDlg() style=display:none></div><div><div id=idx_deskFullBtn2 onclick=deskToggleFull(event)>&nbsp;✖</div><input type=button id=autoconnectbutton1 value=AutoConnect onclick=autoConnectDesktop(event) onkeypress=return!1 onkeydown=return!1 style=display:none><span id=connectbutton1span><input type=button id=connectbutton1 value=Connect onclick=connectDesktop(event,1) onkeypress=return!1 onkeydown=return!1 disabled></span><span id=connectbutton1hspan>&nbsp;<input type=button id=connectbutton1h value="HW Connect"onclick=connectDesktop(event,2) onkeypress=return!1 onkeydown=return!1 disabled></span><span id=disconnectbutton1span>&nbsp;<input type=button id=disconnectbutton1 value=Disconnect onclick=connectDesktop(event,0) onkeypress=return!1 onkeydown=return!1></span>&nbsp;<span id=deskstatus>Disconnected</span></div></div><div id=deskarea2><div class=areaProgress><div id=progressbar></div></div></div><div id=deskarea3x><div id=DeskFocus oncontextmenu=return!1 onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></div><div id=DeskParent><canvas id=Desk width=640 height=480 oncontextmenu=return!1 onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event) onmousewheel=dmousewheel(event)></canvas></div><div id=DeskTools><div id=deskToolsAreaTop><a id=DeskToolsRefreshButton style=right:2px onclick=refreshDeskTools()>Rafraîchir</a><div id=deskToolsTopTabProcess class=deskToolsTopTab onclick=changeDeskToolTab(0) style=left:0;bottom:0>Processes</div><div id=deskToolsTopTabService class=deskToolsTopTab onclick=changeDeskToolTab(1) style=display:none;left:90px;color:gray>Services</div></div><div id=deskToolsArea><div id=DeskToolsProcessTab><div id=deskToolsHeader><a class=colmn1 title="Trier par identifiant de processus"onclick=sortProcess(0)>PID</a><a class=colmn2 title="Trier par nom"onclick=sortProcess(1)>Nom</a></div><div id=DeskToolsProcesses></div></div><div id=DeskToolsServiceTab style=display:none><div id=deskToolsServiceHeader><a class=colmn1 style=width:70px title="Trier par état"onclick=sortService(0)>State</a><a class=colmn2 title="Trier par nom"onclick=sortService(1)>Nom</a></div><div id=DeskToolsServices></div></div></div></div><div id=p11DeskConsoleMsg style=display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:#ff0;background-color:rgba(0,0,0,.6);padding:10px;border-radius:5px onclick=p11clearConsoleMsg()></div></div><div id=deskarea4 class=areaFoot><div class=toright2><span id=DeskTimer title="Session time"></span>&nbsp;<select id=termdisplays style=display:none onchange=deskSetDisplay(event) onkeypress=return!1 onkeydown=return!1></select>&nbsp; <input id=DeskToolsButton type=button value=Outils title="Toggle tools view"onkeypress=return!1 onkeydown=return!1 onclick=toggleDeskTools()>&nbsp;<span id=DeskChatButton class=deskarea title="Ouvrir la fenêtre de discussion sur cet ordinateur"><img src=images/icon-chat.png onclick=deviceChat() height=16 width=16 style=padding-top:2px></span><span id=DeskNotifyButton title="Display a notification on the remote computer"><img src=images/icon-notify.png onclick=deviceToastFunction() height=16 width=16 style=padding-top:2px></span><span id=DeskOpenWebButton title="Open a web address on remote computer"><img src=images/icon-url2.png onclick=deviceUrlFunction() height=16 width=16 style=padding-top:2px></span></div><div><select id=deskkeys><option value=10>Ctrl+Alt+Del<option value=5>Win<option value=0>Win+Down<option value=1>Win+Up<option value=2>Win+L<option value=3>Win+M<option value=4>Shift+Win+M<option value=6>Win+R<option value=7>Alt-F4<option value=8>Ctrl-W<option value=9>Alt-Tab<option value=11>Win+Left<option value=12>Win+Right</select><input id=DeskWD type=button value=Envoyer onkeypress=return!1 onkeydown=return!1 onclick=deskSendKeys()> <input id=DeskClip type=button value=Clipboard onkeypress=return!1 onkeydown=return!1 onclick=showDeskClip()> <input id=DeskType type=button value=Type onkeypress=return!1 onkeydown=return!1 onclick=showDeskType()><label><span id=DeskControlSpan title="Basculer la souris et le clavier"><input id=DeskControl type=checkbox onkeypress=return!1 onkeydown=return!1 onclick=toggleKvmControl()>Input</span></label>&nbsp;</div></div></div></div><div id=p12 style=display:none><div id=p12title><div id=p12BackButton><div class=backButton tabindex=0 onclick=goBack() title=Retour onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Terminal -<span id=p12deviceName></span></h1></div><div id=p12warning onclick=showFeaturesDlg()><div class=icon2></div><div class=warningbox>Intel® AMT Redirection port or KVM feature is disabled<span id=p12warninga>, click here to enable it.</span></div></div><div id=p12warning2 onclick=showPowerActionDlg()><div class=icon2></div><div class=warningbox>Remote computer is not powered on, click here to issue a power command.</div></div><div id=termTable style=position:relative><table style=width:100% cellpadding=0 cellspacing=0><tr><td class=areaHead><div class=toright2><div id=termRecordIcon class=deskareaicon title="Server is recording this session"style=display:none;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-left:5px></div><input id=termActionsBtn type=button title="Effectuer des actions d'alimentation sur le périphérique"onkeypress=return!1 onkeydown=return!1 value=Actions onclick=deviceActionFunction()></div><div><input type=button id=autoconnectbutton2 value=AutoConnect onclick=autoConnectTerminal(event) onkeypress=return!1 onkeydown=return!1 style=display:none><span id=connectbutton2span><input type=button id=connectbutton2 value=Connect onclick=connectTerminal(event,1) onkeypress=return!1 onkeydown=return!1 disabled></span><span id=connectbutton2hspan>&nbsp;<input type=button id=connectbutton2h value="HW Connect"onclick=connectTerminal(event,2) onkeypress=return!1 onkeydown=return!1 disabled></span><span id=disconnectbutton2span>&nbsp;<input type=button id=disconnectbutton2 value=Disconnect onclick=connectTerminal(event,0) onkeypress=return!1 onkeydown=return!1></span>&nbsp;<span id=termstatus>Disconnected</span><span id=termtitle></span></div><tr><td><div class=areaProgress><div id=termprogressbar></div></div><tr><td id=termarea3x><pre id=Term></pre><tr><td class=areaFoot><div class=toright2><span id=TermTimer title="Session time"></span>&nbsp;<span id=terminalSettingsButtons style=display:none><input id=id_tcrbutton type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton value=CR+LF title="Toggle what the return key will send"onclick=termToggleCr()> <input id=id_tfxkeysbutton type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton value="Intel (F10 = ESC+[OM)"title="Toggle F1 to F10 keys emulation type"onclick=termToggleFx()> <input id=id_ttypebutton type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton value="Extended Ascii"title="Basculer le type d'émulation de terminal"onclick=termToggleType()></span><span id=terminalSizeDropDown><select id=termSizeList onkeypress=return!1><option value=1>80x25<option value=2>100x30<option value=3 selected>Automatique</select></span><select id=specialkeylist onkeypress=return!1></select><input id=specialkeylistinput type=button onkeypress=return!1 class=bottombutton value=Envoyer title="Send the selected special key"onclick=sendSpecialKey()></div><div>&nbsp; <input type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton id=ctrlcbutton value=Ctl-C onclick='termSendKey(3,"ctrlcbutton")'> <input type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton id=ctrlxbutton value=Ctl-X onclick='termSendKey(24,"ctrlxbutton")'> <input type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton id=escbutton value=ESC onclick='termSendKey(27,"escbutton")'> <input type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton id=bsbutton value="Retour arrière"onclick='termSendKey(8,"bsbutton")'> <input type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton id=pastebutton value=Paste title="Paste text into the terminal"onclick=showTermPasteDialog()></div></table><div id=p12TermConsoleMsg style=display:none;cursor:pointer;position:absolute;left:30px;top:45px;color:#ff0;background-color:rgba(0,0,0,.6);padding:10px;border-radius:5px onclick=p12clearConsoleMsg()></div></div></div><div id=p13 style=display:none><div id=p13title><div id=p13BackButton style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Retour onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Files -<span id=p13deviceName></span></h1></div><table id=p13toolbar cellpadding=0 cellspacing=0><tr><td class=areaHead><div class=toright2><input id=filesActionsBtn type=button title="Effectuer des actions d'alimentation sur le périphérique"value=Actions onclick=deviceActionFunction()><div id=filesRecordIcon class=deskareaicon title="Server is recording this session"style=display:none;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-left:5px></div></div><div><input id=p13AutoConnect value=AutoConnect onclick=autoConnectFiles(event) type=button style=display:none> <input id=p13Connect value=Connect onclick=connectFiles(event) type=button><span id=p13Status>Disconnected</span></div><tr><td class=areaHead2 valign=bottom><div id=p13rightOfButtons class=toright2></div><div><input type=button id=p13FolderUp disabled onclick=p13folderup() value=Up>&nbsp; <input type=button id=p13SelectAllButton disabled onclick=p13selectallfile() value="Tout Sélectionner">&nbsp; <input type=button id=p13RenameFileButton disabled value=Renommer onclick=p13renamefile()>&nbsp; <input type=button id=p13DeleteFileButton disabled value=Delete onclick=p13deletefile()>&nbsp; <input type=button id=p13ViewFileButton disabled value=Edit onclick=p13viewfile()>&nbsp; <input type=button id=p13NewFolderButton disabled value="Nouveau Dossier"onclick=p13createfolder()>&nbsp; <input type=button id=p13UploadButton disabled value=Télécharger onclick=p13uploadFile()>&nbsp; <input type=button id=p13CutButton disabled value=Cut onclick=p13copyFile(1)>&nbsp; <input type=button id=p13CopyButton disabled value=Copy onclick=p13copyFile(0)>&nbsp; <input type=button id=p13PasteButton disabled value=Paste onclick=p13pasteFile()>&nbsp; <input type=button id=p13RefreshButton disabled value=Rafraîchir onclick=p13folderup(9999)>&nbsp;</div><tr><td class=areaHead3><div class=toright2><select id=p13sortdropdown onchange=p13updateFiles()><option value=1 selected>Trier par nom<option value=2>Trier par taille<option value=3>Trier par date<option value=4>Descend by name<option value=5>Descend by size<option value=6>Descend by date</select></div><div>&nbsp;&nbsp;<span id=p13currentpath></span></div></table><div id=p13FilesConsoleMsg style=display:none;cursor:pointer;position:absolute;left:30px;top:165px;color:#ff0;background-color:rgba(0,0,0,.6);padding:10px;border-radius:5px onclick=p13clearConsoleMsg()></div><div id=p13filetable><div id=p13bigok style=display:none><b>✓</b></div><div id=p13bigfail style=display:none><b>✗</b></div><span id=p13files></span></div><table id=p13toolbarBottom cellpadding=0 cellspacing=0><tr><td class=style6>&nbsp;<span id=p13bottomstatus></span></table></div><div id=p14 style=display:none><div id=p14title><div id=p14BackButton style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Retour onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><div id=devListToolbarViewIcons><div class=viewSelector onclick=deskToggleFull(event) title="Full Screen. Hold shift to browser full screen."><div class=viewSelector5></div></div></div><h1>Intel® AMT -<span id=p14deviceName></span></h1></div><iframe id=p14iframe src={{{domainurl}}}commander.htm></iframe></div><div id=p15 style=display:none><div id=p15title><div id=p15BackButton style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Retour onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1><span id=p15deviceName></span></h1></div><table id=consoleTable cellpadding=0 cellspacing=0><tr><td class=areaHead><div class=toright2><div id=p15coreName title="Information about current core running on this agent"></div><input type=button id=p15uploadCore value="Agent Action"onclick=p15uploadCore(event) title="Change the agent Java Script code module"> <img onclick=p15downloadConsoleText() style=cursor:pointer;margin-top:6px title="Download console text"src=images/link4.png></div><div id=p15statetext></div><tr><td><div class=areaProgress><div id=consoleprogressbar></div></div><tr><td id=p15agentConsole><pre id=p15agentConsoleText></pre><tr><td class=areaFoot><table style=width:100%><tr><td style=width:99%><input id=p15consoleText style=width:100% onkeyup=p15consoleSend(event) onfocus=onConsoleFocus(1) onblur=onConsoleFocus(0)><td>&nbsp;<td id=p15outputselecttd><select id=p15outputselect><option value=1>Agent<option value=2>MQTT</select><td style=width:1%><input id=id_p15consoleClear type=button class=bottombutton value=Clear onclick=p15consoleClear()></table></table></div><div id=p16 style=display:none><div id=p16title><div id=p16BackButton style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Retour onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Events -<span id=p16deviceName></span></h1></div><table class=pTable><tr><td class=h1><td class=auto-style1>Show<select id=p16limitdropdown onchange=refreshDeviceEvents()><option value=60>60 dernières<option value=120>120 dernières<option value=250>250 dernières<option value=500>500 dernières<option value=1000>1000 derniers</select><a href=# onclick=p3showDownloadEventsDialog(1)><img src=images/link4.png height=10 width=10 title="Download Events"style=cursor:pointer></a>&nbsp;<td class=h2></table><div id=p16events></div></div><div id=p17 style=display:none><div id=p17title><div id=p17BackButton style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Retour onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Details -<span id=p17deviceName></span></h1></div><div id=p17info></div></div><div id=p20 style=display:none><picture id=MainMeshImage style=border-width:0;height:200px;width:200px;float:right><source type=image/webp width=200 height=200 srcset=images/webp/mesh-256.webp><img alt=""width=200 height=200 src=images/mesh-256.png></picture><div style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Retour onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>General -<span id=p20meshName></span></h1><p id=p20info></div><div id=p30 style=display:none><table style=width:100% cellpadding=0 cellspacing=0><tr><td style=width:auto valign=top><div id=p30title><div style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Retour onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>General -<span id=p30userName></span></h1></div><div id=p30html></div><td style=width:20px><td style=width:200px><picture id=MainUserImage style=border-width:0;height:200px;width:200px;float:right><source type=image/webp width=200 height=200 srcset=images/webp/user-256.webp><img alt=""width=200 height=200 src=images/user-256.png></picture><div style=width:100%;text-align:center><strong><span id=MainUserState></span></strong></div></table><br><div id=p30html2></div><div id=p30html3></div></div><div id=p31 style=display:none><div style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Retour onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Events -<span id=p31userName></span></h1><table class=pTable><tr><td class=h1><td class=auto-style1>Show<select id=p31limitdropdown onchange=refreshUsersEvents()><option value=60>60 dernières<option value=120>120 dernières<option value=250>250 dernières<option value=500>500 dernières<option value=1000>1000 derniers</select><a href=# onclick=p3showDownloadEventsDialog(3)><img src=images/link4.png height=10 width=10 title="Download Events"style=cursor:pointer></a>&nbsp;<td class=h2></table><div id=p31events></div></div><div id=p40 style=display:none><h1>My Server Stats</h1><div class=areaHead><div class=toright2><select id=p40type onchange=updateServerTimelineStats()><option value=0>Connections<option value=1>Mémoire</select>&nbsp;<select id=p40time onchange=updateServerTimelineHours()><option value=3>3 dernières heures<option value=8>8 dernières heures<option value=24>Dernier jour<option value=168>Dernière semaine<option value=720>30 derniers jours</select>&nbsp; <img src=images/link4.png height=10 width=10 title="Download data points (.csv)"style=cursor:pointer onclick=p40downloadEvents()>&nbsp;</div><div><input value=Rafraîchir type=button onclick=refreshServerTimelineStats()> &nbsp;<label><input id=p40log type=checkbox onclick=updateServerTimelineHours()>Log-X</label></div></div><canvas id=serverMainStats></canvas></div><div id=p41 style=display:none><h1>My Server Tracing</h1><div class=areaHead><div class=toright2>Show<select id=p41limitdropdown onchange=displayServerTrace()><option value=100>100 dernières<option value=250>250 dernières<option value=500>500 dernières<option value=1000>1000 derniers</select><input value=Clear type=button onclick=clearServerTracing()> <img src=images/link4.png height=10 width=10 title="Download trace (.csv)"style=cursor:pointer onclick=p41downloadServerTrace()>&nbsp;</div><div><input value=Tracing type=button onclick=setServerTracing()><span id=p41traceStatus>None</span></div></div><div id=p41events></div></div><div id=p19 style=display:none><h1>Plugins -<span id=p19deviceName></span></h1><style>#p19headers{padding-right:7px;padding-bottom:10px;font-weight:700;border-bottom:1px dotted #00f}#p19headers>span:nth-child(n+2){border-left:1px solid #000}#p19headers>span{padding-left:4px;padding-right:4px}</style><div id=p19headers></div><div id=p19pages></div></div><br id=column_l_bottomgap></div><div id=footer><div class=footer1>{{{footer}}}</div><div class=footer2><a id=verifyEmailId2 style=display:none href=# onclick=account_showVerifyEmail()>Verify Email</a>&nbsp;<a href=terms>Terms &amp; Privacy</a></div></div><div id=dialog class=noselect style=display:none><div id=dialogHeader><div tabindex=0 id=id_dialogclose onclick=setDialogMode() onkeypress='"Enter"==event.key&&setDialogMode()'>✖</div><div id=id_dialogtitle></div></div><div id=dialogBody><div id=dialog1><div id=id_dialogMessage></div></div><div id=dialog2><div id=id_dialogOptions></div></div><div id=dialog3><div id=d3upload><div>File Selection</div><select id=d3uploadMode onchange=d3modechange()><option value=1>Local file upload<option value=2>Server file selection</select></div><div id=d3localmode style=display:none><div>Upload File</div><form id=d3localmodeform method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input id=d3auth name=auth style=display:none> <input id=d3attrib name=attrib style=display:none> <input type=file id=d3localFile name=files onchange=d3setActions()> <input type=submit id=d3submit style=display:none></form></div><div id=d3servermode><div id=d3serveraction valign=bottom><input type=button id=p3FolderUp disabled onclick=d3folderup() value=Up>&nbsp;</div><div id=d3serverfiles></div></div></div><div id=dialog7><div id=d7meshkvm><h4>Agent Remote Desktop</h4><div><div>Qualité</div><select id=d7bitmapquality dir=rtl></select></div><div><div>Mise à l'échelle</div><select id=d7bitmapscaling dir=rtl><option selected value=1024>100%<option value=896>87.5%<option value=768>75%<option value=640>62.5%<option value=512>50%<option value=384>37.5%<option value=256>25%<option value=128>12.5%</select></div><div><div>Frame rate</div><select id=d7framelimiter dir=rtl><option selected value=50>Fast<option value=100>Medium<option value=400>Lent<option value=1000>Very slow</select></div></div><div id=d7amtkvm><h4>Intel® AMT Hardware KVM</h4><div><div>Image Encoding</div><select id=d7desktopmode><option value=1>RLE8, le plus rapide<option value=2>RLE16, recommandé<option value=3>RAW8, Slow<option value=4>RAW16, Very Slow</select></div><div><div>Other Settings</div><div id=d7otherset style=display:block><label style=display:block><input type=checkbox id=d7showfocus>Show Focus Tool</label><label style=display:block><input type=checkbox id=d7showcursor>Show Local Mouse Cursor</label><label style=display:block><input type=checkbox id=d7localKeyMap>Local Keyboard Map</label></div></div></div></div></div><div id=idx_dlgButtonBar><input id=idx_dlgCancelButton type=button value=Annuler onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK onclick=dialogclose(1)><div><input id=idx_dlgDeleteButton type=button value=Delete style=display:none onclick=dialogclose(2)></div></div></div><iframe name=fileUploadFrame style=display:none></iframe><form style=display:none method=post action=uploadfile.ashx enctype=multipart/form-data target=fileUploadFrame><input id=p5fileDragName name=name><input id=p5fileDragAuthCookie name=auth><input id=p5fileDragSize name=size><input id=p5fileDragType name=type><input id=p5fileDragData name=data><input id=p5fileDragLink name=link><input type=submit id=p5loginSubmit2 style=display:none></form><form style=display:none method=post action=uploadnodefile.ashx enctype=multipart/form-data target=fileUploadFrame><input id=p13fileDragName name=name><input id=p13fileDragSize name=size><input id=p13fileDragType name=type><input id=p13fileDragData name=data><input id=p13fileDragLink name=link><input type=submit id=p13loginSubmit2 style=display:none></form><audio id=chimes><source src=sounds/chimes.mp3 type=audio/mp3></audio></div><script>'use strict';
2 +
3 + // Process server-side web state
4 + var webState = '{{{webstate}}}';
5 + if (webState != '') { webState = JSON.parse(decodeURIComponent(webState)); }
6 + for (var i in webState) { localStorage.setItem(i, webState[i]); }
7 + if (!webState.loctag) { delete localStorage.removeItem('loctag'); }
8 +
9 + var args;
10 + var autoReconnect = true;
11 + var powerStatetable = ['', "Alimenté", "Dormir", "Dormir", "Dormir", "Hibernating", "Éteindre", "Présent"];
12 + var StatusStrs = ["Disconnected", "Connecting...", "Setup...", "Connected", "Intel&reg; AMT Connected"];
13 + var sort = 0;
14 + var searchFocus = 0;
15 + var mapSearchFocus = 0;
16 + var userSearchFocus = 0;
17 + var consoleFocus = 0;
18 + var showRealNames = false;
19 + var meshserver = null;
20 + var meshes = {};
21 + var meshcount = 0;
22 + var nodes = null;
23 + var filetree = {};
24 + var userinfo = null;
25 + var serverinfo = null;
26 + var events = [];
27 + var users = null;
28 + var wssessions = null;
29 + var nodeShortIdent = 0;
30 + var desktop;
31 + var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true, quality: 40, scaling: 1024, framerate: 50, localkeymap: false };
32 + var multidesktopsettings = { quality: 20, scaling: 128, framerate: 1000 };
33 + var terminal;
34 + var files;
35 + var debugLevel = parseInt('{{{debuglevel}}}');
36 + var features = parseInt('{{{features}}}');
37 + var sessionTime = parseInt('{{{sessiontime}}}');
38 + var domain = '{{{domain}}}';
39 + var domainUrl = '{{{domainurl}}}';
40 + var authCookie = '{{{authCookie}}}';
41 + var authRelayCookie = '{{{authRelayCookie}}}';
42 + var authCookieRenewTimer = null;
43 + var multiDesktop = {};
44 + var multiDesktopFilter = null;
45 + var serverPublicNamePort = '{{{serverDnsName}}}:{{{serverPublicPort}}}';
46 + var amtScanResults = null;
47 + var debugmode = 0;
48 + var clickOnce = (((features & 256) != 0) && detectClickOnce());
49 + var attemptWebRTC = ((features & 128) != 0);
50 + var passRequirements = '{{{passRequirements}}}';
51 + if (passRequirements != '') { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); }
52 + var deskAspectRatio = 0;
53 + try { deskAspectRatio = parseInt(getstore('deskAspectRatio', '0')); } catch (ex) { }
54 + var uiMode = parseInt(getstore('uiMode', 1));
55 + var webPageStackMenu = false;
56 + var webPageFullScreen = true;
57 + var nightMode = (getstore('_nightMode', '0') == '1');
58 + var sessionActivity = Date.now();
59 + var updateSessionTimer = null;
60 + var pluginHandlerBuilder = {{{pluginHandler}}};
61 + var pluginHandler = null;
62 + if (pluginHandlerBuilder != null) { pluginHandler = new pluginHandlerBuilder(); }
63 +
64 + // Console Message Display Timers
65 + var p11DeskConsoleMsgTimer = null;
66 + var p12TermConsoleMsgTimer = null;
67 + var p13FilesConsoleMsgTimer = null;
68 +
69 + function startup() {
70 + if ((features & 32) == 0) {
71 + // Guard against other site's top frames (web bugs).
72 + var loc = null;
73 + try { loc = top.location.toString().toLowerCase(); } catch (e) { }
74 + if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; }
75 + }
76 +
77 + // Check if we are in debug mode
78 + args = parseUriArgs();
79 + if (!args.locale) { var x = getstore('loctag', 0); if ((x != null) && (x != '*')) { args.locale = x; } }
80 + debugmode = args.debug;
81 + if (args.webrtc != null) { attemptWebRTC = (args.webrtc == 1); }
82 + QV('p13AutoConnect', debugmode); // Files
83 + QV('autoconnectbutton2', debugmode); // Terminal
84 + QV('autoconnectbutton1', debugmode); // Desktop
85 + //QV('DeskClip', debugmode); // Clipboard feature, not completed so show in in debug mode only.
86 +
87 + if (nightMode) { QC('body').add('night'); }
88 + toggleFullScreen();
89 +
90 + // Setup page visuals
91 + if (args.hide) {
92 + var hide = parseInt(args.hide);
93 + QV('masthead', !(hide & 1));
94 + QV('topbar', !(hide & 2));
95 + QV('footer', !(hide & 4));
96 + QV('p10title', !(hide & 8));
97 + QV('p11title', !(hide & 8));
98 + QV('p12title', !(hide & 8));
99 + QV('p13title', !(hide & 8));
100 + QV('p14title', !(hide & 8));
101 + QV('p15title', !(hide & 8));
102 + QV('p16title', !(hide & 8));
103 + //if (hide & 16) {
104 + // QV('page_leftbar', false);
105 + // QS('page_content').left = '0px';
106 + //}
107 +
108 + // Fix the main grid to zero-height elements we want to hide.
109 + QS('container')['grid-template-rows'] = ((hide & 1) ? '0' : '66') + 'px ' + ((hide & 2) ? '0' : '24') + 'px auto ' + ((hide & 4) ? '0' : '45') + 'px';
110 + QS('container')['-ms-grid-rows'] = ((hide & 1) ? '0' : '66') + 'px ' + ((hide & 2) ? '0' : '24') + 'px auto ' + ((hide & 4) ? '0' : '45') + 'px';
111 +
112 + // Adjust height of remote desktop, files and Intel AMT
113 + var xh = (((hide & 1) ? 0 : 66) + ((hide & 2) ? 0 : 24) + ((hide & 4) ? 0 : 45) + ((hide & 8) ? 0 : 60)); // 0 to 195
114 + QS('p3users')['max-height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
115 + QS('p3events')['height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
116 + QS('deskarea3x')['height'] = 'calc(100vh - ' + (75 + xh) + 'px)';
117 + QS('deskarea3x')['max-height'] = 'calc(100vh - ' + (75 + xh) + 'px)';
118 + QS('p5filetable')['height'] = 'calc(100vh - ' + (160 + xh) + 'px)';
119 + QS('p13filetable')['height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
120 + QS('serverMainStats')['height'] = 'calc(100vh - ' + (110 + xh) + 'px)';
121 + QS('serverMainStats')['max-height'] = 'calc(100vh - ' + (110 + xh) + 'px)';
122 + QS('xdevices')['max-height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
123 + QS('xdevicesmap')['max-height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
124 + QS('p15agentConsole')['height'] = 'calc(100vh - ' + (84 + xh) + 'px)';
125 + QS('p15agentConsole')['max-height'] = 'calc(100vh - ' + (84 + xh) + 'px)';
126 + QS('p15agentConsoleText')['height'] = 'calc(100vh - ' + (81 + xh) + 'px)';
127 + QS('p15agentConsoleText')['max-height'] = 'calc(100vh - ' + (81 + xh) + 'px)';
128 + }
129 +
130 + // We are looking at a single device, remove all the back buttons
131 + if ('{{currentNode}}' != '') {
132 + QV('p10BackButton', false);
133 + QV('p11BackButton', false);
134 + QV('p12BackButton', false);
135 + QV('p13BackButton', false);
136 + QV('p14BackButton', false);
137 + QV('p15BackButton', false);
138 + QV('p16BackButton', false);
139 + }
140 + p1updateInfo();
141 +
142 + // Setup the context menu
143 + document.onclick = function (e) { hideContextMenu(); }
144 + document.onkeypress = ondockeypress;
145 + document.onkeydown = ondockeydown;
146 + document.onkeyup = ondockeyup;
147 + //window.addEventListener('focus', ondocfocus, false);
148 + window.addEventListener('blur', ondocblur, false);
149 + window.onresize = function () { masterUpdate(512); }
150 + setTimeout(function() { masterUpdate(512); }, 200);
151 +
152 + // Connect to the mesh server
153 + meshserver = MeshServerCreateControl(domainUrl, authCookie);
154 + meshserver.onStateChanged = onStateChanged;
155 + meshserver.onMessage = onMessage;
156 + meshserver.trace = (args.trace == 1);
157 + meshserver.Start();
158 +
159 + // Setup page controls
160 + Q('sortselect').selectedIndex = sort = getstore('sort', 0);
161 + Q('sizeselect').selectedIndex = getstore('_viewsize', 1);
162 + Q('SearchInput').value = getstore('_search', '');
163 + showRealNames = (getstore('showRealNames', 0) == 1);
164 + Q('RealNameCheckBox').checked = showRealNames;
165 + Q('viewselect').value = getstore('_deviceView', 1);
166 + Q('DeskControl').checked = (getstore('DeskControl', 1) == 1);
167 + QV('accountChangeEmailAddressSpan', (features & 0x200000) == 0);
168 +
169 + // Display the page devices
170 + masterUpdate(3)
171 + for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); }
172 + Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel');
173 +
174 + // Setup upload drag & drop
175 + Q('p5filetable').addEventListener('drop', p5fileDragDrop, false);
176 + Q('p5filetable').addEventListener('dragover', p5fileDragOver, false);
177 + Q('p5filetable').addEventListener('dragleave', p5fileDragLeave, false);
178 + //Q('p5fileCatchAllInput').addEventListener('drop', p5fileDragDrop, false);
179 + //Q('p5fileCatchAllInput').addEventListener('dragover', p5fileDragOver, false);
180 + //Q('p5fileCatchAllInput').addEventListener('dragleave', p5fileDragLeave, false);
181 +
182 + // Setup upload drag & drop
183 + Q('p13filetable').addEventListener('drop', p13fileDragDrop, false);
184 + Q('p13filetable').addEventListener('dragover', p13fileDragOver, false);
185 + Q('p13filetable').addEventListener('dragleave', p13fileDragLeave, false);
186 +
187 + // Timeline update interval
188 + setInterval(updateDeviceTimeline, 120000); // Check every 2 minutes
189 +
190 + // Load desktop settings
191 + var t = localStorage.getItem('desktopsettings');
192 + if (t != null) { desktopsettings = JSON.parse(t); }
193 + t = localStorage.getItem('multidesktopsettings');
194 + if (t != null) { multidesktopsettings = JSON.parse(t); }
195 + applyDesktopSettings();
196 +
197 + // Terminal special keys
198 + var x = '';
199 + for (var c = 1; c < 27; c++) x += '<option value=\'' + c + '\'>' + "Ctrl" + '-' + String.fromCharCode(64 + c) + ' (' + c + ')</option>';
200 + QH('specialkeylist', x);
201 +
202 + // Setup server stats panels
203 + setupGeneralServerStats();
204 + setupServerTimelineStats();
205 +
206 + // Setup the user interface in the right mode
207 + userInterfaceSelectMenu();
208 +
209 + // If SSPI or LDAP authentication not used, allow batch account creation.
210 + QV('p4UserBatchCreate', (features & 0x00080000) == 0);
211 + }
212 +
213 + // Toggle the web page to full screen
214 + function toggleAspectRatio(toggle) {
215 + if (toggle === 1) { deskAspectRatio = ((deskAspectRatio + 1) % 3); putstore('deskAspectRatio', deskAspectRatio); }
216 + deskAdjust();
217 + }
218 +
219 + // If FullScreen, toggle menu to be horisontal or vertical
220 + function toggleStackMenu(toggle) {
221 + if (webPageFullScreen == true) {
222 + if (toggle === 1) {
223 + webPageStackMenu = !webPageStackMenu;
224 + putstore('webPageStackMenu', webPageStackMenu);
225 + }
226 + if (webPageStackMenu == false) {
227 + QC('body').remove('menu_stack');
228 + } else {
229 + QC('body').add('menu_stack');
230 + if (xxcurrentView >= 10) QC('column_l').remove('room4submenu');
231 + }
232 + deskAdjust();
233 + }
234 + }
235 +
236 + // Toggle user interface menu
237 + function showUserInterfaceSelectMenu() {
238 + Q('uiViewButton1').classList.remove('uiSelectorSel');
239 + Q('uiViewButton2').classList.remove('uiSelectorSel');
240 + Q('uiViewButton3').classList.remove('uiSelectorSel');
241 + Q('uiViewButton4').classList.remove('uiSelectorSel');
242 + try { Q('uiViewButton' + uiMode).classList.add('uiSelectorSel'); } catch (ex) { }
243 + QV('uiMenu', (QS('uiMenu').display == 'none'));
244 + //Q('uiViewButton1').focus();
245 + if (nightMode) { Q('uiViewButton4').classList.add('uiSelectorSel'); }
246 + }
247 +
248 + function userInterfaceSelectMenu(s) {
249 + if (s) { uiMode = s; putstore('uiMode', uiMode); }
250 + webPageFullScreen = (uiMode < 3);
251 + webPageStackMenu = (uiMode > 1);
252 + toggleFullScreen(0);
253 + toggleStackMenu(0);
254 + if (webPageStackMenu && (xxcurrentView >= 10)) { QC('column_l').add('room4submenu'); } else { QC('column_l').remove('room4submenu'); }
255 + }
256 +
257 + function toggleNightMode() {
258 + nightMode = !nightMode;
259 + if (nightMode) { QC('body').add('night'); } else { QC('body').remove('night'); }
260 + putstore('_nightMode', nightMode?'1':'0');
261 + }
262 +
263 + // Toggle the web page to full screen
264 + function toggleFullScreen(toggle) {
265 + if (toggle === 1) { webPageFullScreen = !webPageFullScreen; putstore('webPageFullScreen', webPageFullScreen); }
266 + var hide = 0;
267 + if (args.hide) { hide = parseInt(args.hide); }
268 + if (webPageFullScreen == false) {
269 + QC('body').remove('menu_stack');
270 + QC('body').remove('fullscreen');
271 + QC('body').remove('arg_hide');
272 + if (xxcurrentView >= 10) QC('column_l').add('room4submenu');
273 + QV('UserDummyMenuSpan', false);
274 + //QV('page_leftbar', false);
275 + } else {
276 + QC('body').add('fullscreen');
277 + if (hide & 16) QC('body').add('arg_hide'); // This is replacement for QV('page_leftbar', !(hide & 16));
278 + QV('page_leftbar', !(hide & 16));
279 + QV('MainMenuSpan', !(hide & 16));
280 + if (xxcurrentView >= 10) QC('column_l').remove('room4submenu');
281 + QV('UserDummyMenuSpan', (xxcurrentView < 10) && webPageFullScreen);
282 + }
283 + masterUpdate(512);
284 + QV('body', true);
285 + }
286 +
287 + function getNodeFromId(id) { if (nodes != null) { for (var i in nodes) { if (nodes[i]._id == id) return nodes[i]; } } return null; }
288 + function reload() {
289 + var x = window.location.href;
290 + if (x.endsWith('/#')) { x = x.substring(0, x.length - 2); }
291 + window.location.href = x;
292 + }
293 +
294 + function onStateChanged(server, state, prevState, errorCode) {
295 + if (state == 0) {
296 + // Control web socket disconnected
297 + setDialogMode(0); // Close any dialog boxes if present
298 + go(0); // Go to disconnection panel
299 +
300 + // Clean up
301 + powerTimeline = null;
302 + powerTimelineReq = null;
303 + powerTimelineNode = null;
304 + powerTimelineUpdate = null;
305 + deleteAllNotifications(); // Close and clear notifications if present
306 + hideContextMenu(); // Hide the context menu if present
307 + QV('verifyEmailId2', false);
308 + QV('logoutControl', false);
309 + if (errorCode == 'noauth') { QH('p0span', "Unable to perform authentication"); return; }
310 + if (prevState == 2) { if (autoReconnect) { setTimeout(serverPoll, 5000); } } else { QH('p0span', "Unable to connect web socket"); }
311 + if (authCookieRenewTimer != null) { clearInterval(authCookieRenewTimer); authCookieRenewTimer = null; }
312 + } else if (state == 2) {
313 + // Fetch list of meshes, nodes, files
314 + meshserver.send({ action: 'meshes' });
315 + meshserver.send({ action: 'nodes', id: '{{currentNode}}' });
316 + if ('{{currentNode}}' == '') { meshserver.send({ action: 'files' }); }
317 + if ('{{viewmode}}' == '') { go(1); }
318 + authCookieRenewTimer = setInterval(function () { meshserver.send({ action: 'authcookie' }); }, 1800000); // Request a cookie refresh every 30 minutes.
319 + }
320 + }
321 +
322 + // Poll the server, if it responds, refresh the page.
323 + function serverPoll() {
324 + var xdr = null;
325 + try { xdr = new XDomainRequest(); } catch (e) { }
326 + if (!xdr) xdr = new XMLHttpRequest();
327 + xdr.open('HEAD', window.location.href);
328 + xdr.timeout = 15000;
329 + xdr.onload = function () { reload(); };
330 + xdr.onerror = xdr.ontimeout = function () { setTimeout(serverPoll, 10000); };
331 + xdr.send();
332 + }
333 +
334 + // Return true if this browser supports clickonce
335 + function detectClickOnce() {
336 + for (var i in window.navigator.mimeTypes) { if (window.navigator.mimeTypes[i].type == 'application/x-ms-application') { return true; } }
337 + var userAgent = window.navigator.userAgent.toUpperCase();
338 + return (userAgent.indexOf('.NET CLR 3.5') >= 0) || (userAgent.indexOf('(WINDOWS NT ') >= 0);
339 + }
340 +
341 + function updateSiteAdmin() {
342 + var noServerBackup = '{{{noServerBackup}}}';
343 + var siteRights = userinfo.siteadmin;
344 + if (noServerBackup == 1) { siteRights &= 0xFFFFFFFA; } // If not server backups allowed, remove server backup and restore permissions
345 +
346 + // Update account actions
347 + QV('p2AccountSecurity', ((features & 4) == 0) && (serverinfo.domainauth == false) && ((features & 4096) != 0)); // Hide Account Security if in single user mode, domain authentication to 2 factor auth not supported.
348 + QV('p2AccountActions', ((features & 4) == 0) && (serverinfo.domainauth == false)); // Hide Account Actions if in single user mode or domain authentication
349 + QV('p2AccountImage', ((features & 4) == 0) && (serverinfo.domainauth == false)); // If account actions are not visible, also remove the image on that panel
350 + QV('p2ServerActions', siteRights & 21);
351 + QV('LeftMenuMyServer', siteRights & 21); // 16 + 4 + 1
352 + QV('MainMenuMyServer', siteRights & 21);
353 + QV('p2ServerActionsBackup', siteRights & 1);
354 + QV('p2ServerActionsRestore', siteRights & 4);
355 + QV('p2ServerActionsVersion', siteRights & 16);
356 + QV('MainMenuMyFiles', siteRights & 8);
357 + QV('LeftMenuMyFiles', siteRights & 8);
358 + if (((siteRights & 8) == 0) && (xxcurrentView == 5)) { setDialogMode(0); go(1); }
359 + if (currentNode != null) { gotoDevice(currentNode._id, xxcurrentView, true); }
360 +
361 + // Update user management state
362 + if ((userinfo.siteadmin & 2) != 0)
363 + {
364 + // We are user administrator
365 + if (users == null) { meshserver.send({ action: 'users' }); }
366 + if (wssessions == null) { meshserver.send({ action: 'wssessioncount' }); }
367 + } else {
368 + // We are not user administrator
369 + users = null;
370 + wssessions = null;
371 + updateUsers();
372 + if (xxcurrentView == 4 || ((xxcurrentView >= 30) && (xxcurrentView < 40))) { setDialogMode(0); go(1); currentUser = null; }
373 + }
374 + meshserver.send({ action: 'events', limit: parseInt(p3limitdropdown.value) });
375 + QV('ServerConsole', userinfo.siteadmin === 0xFFFFFFFF);
376 + QV('ServerTrace', userinfo.siteadmin === 0xFFFFFFFF);
377 + if ((xxcurrentView == 115) && (userinfo.siteadmin != 0xFFFFFFFF)) { go(6); }
378 + if ((xxcurrentView == 6) && ((userinfo.siteadmin & 21) == 0)) { go(1); }
379 +
380 + // If we are site administrator, register to get server statistics
381 + if ((siteRights & 21) != 0) { meshserver.send({ action: 'serverstats', interval: 10000 }); }
382 + }
383 +
384 + // To boost the speed of the web page when even floods occur, this method perform a delayed update on the web page.
385 + var updateNaggleTimer = null;
386 + var updateNaggleFlags = 0;
387 + function masterUpdate(flags) {
388 + updateNaggleFlags |= flags;
389 + if (updateNaggleTimer == null) {
390 + updateNaggleTimer = setTimeout(function () {
391 + if (updateNaggleFlags & 512) { center(); }
392 + if (updateNaggleFlags & 1) { onSearchInputChanged(); }
393 + if (updateNaggleFlags & 2) { onSortSelectChange(false); }
394 + if (updateNaggleFlags & 128) { updateMeshes(); }
395 + if (updateNaggleFlags & 4) { updateDevices(); }
396 + if (updateNaggleFlags & 8) { drawNotifications(); }
397 + if (updateNaggleFlags & 16) { updateMapMarkers(); }
398 + if (updateNaggleFlags & 32) { eventsUpdate(); }
399 + if (updateNaggleFlags & 64) { refreshMap(false, true); }
400 + if (updateNaggleFlags & 256) { drawDeviceTimeline(); }
401 + if (updateNaggleFlags & 1024) { deviceEventsUpdate(); }
402 + if (updateNaggleFlags & 2048) { userEventsUpdate(); }
403 + if (updateNaggleFlags & 4096) { p20updateMesh(); }
404 + updateNaggleTimer = null;
405 + updateNaggleFlags = 0;
406 + }, 150);
407 + }
408 + }
409 +
410 + var backupCodesWarningDone = false;
411 + function updateSelf() {
412 + QV('verifyEmailId', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
413 + QV('verifyEmailId2', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
414 + QV('manageOtp', (userinfo.otpsecret == 1) || (userinfo.otphkeys > 0));
415 + QV('authAppSetupCheck', userinfo.otpsecret == 1);
416 + QV('authKeySetupCheck', userinfo.otphkeys > 0);
417 + QV('authCodesSetupCheck', userinfo.otpkeys > 0);
418 + masterUpdate(4 + 128 + 4096);
419 +
420 + // Check if backup codes should really be enabled
421 + if ((backupCodesWarningDone == false) && !(userinfo.otpkeys > 0) && (((userinfo.otpsecret == 1) && !(userinfo.otphkeys > 0)) || ((userinfo.otpsecret != 1) && (userinfo.otphkeys == 1)))) {
422 + var n = { text: "Please add two-factor backup codes. If the current factor is lost, there is not way to recover this account.", title: "Two factor authentication" };
423 + addNotification(n);
424 + backupCodesWarningDone = true;
425 + }
426 +
427 + // If we can't create new groups, hide all links that can do that.
428 + var newGroupsAllowed = ((userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.siteadmin & 64) == 0));
429 + QV('p2createMeshLink1', newGroupsAllowed);
430 + QV('p2createMeshLink2', newGroupsAllowed);
431 + QV('getStarted1', newGroupsAllowed);
432 + QV('getStarted2', !newGroupsAllowed);
433 +
434 + if (typeof userinfo.passchange == 'number') {
435 + if (userinfo.passchange == -1) { QH('p2nextPasswordUpdateTime', "- Réinitialiser à la prochaine connexion."); }
436 + else if ((passRequirements != null) && (typeof passRequirements.reset == 'number')) {
437 + var seconds = (userinfo.passchange) + (passRequirements.reset * 86400) - Math.floor(Date.now() / 1000);
438 + if (seconds < 0) { QH('p2nextPasswordUpdateTime', "- Réinitialiser à la prochaine connexion."); }
439 + else if (seconds < 3600) { QH('p2nextPasswordUpdateTime', format("- Réinitialisation en {0} minute {1}.", Math.floor(seconds / 60), addLetterS(Math.floor(seconds / 60)))); }
440 + else if (seconds < 86400) { QH('p2nextPasswordUpdateTime', format("- Réinitialisation dans {0} heure {1}.", Math.floor(seconds / 3600), addLetterS(Math.floor(seconds / 3600)))); }
441 + else { QH('p2nextPasswordUpdateTime', format("- Réinitialiser dans le {0} jour {1}."), Math.floor(seconds / 86400), addLetterS(Math.floor(seconds / 86400))); }
442 + }
443 + }
444 + }
445 +
446 + function addLetterS(x) { return (x > 1) ? 's' : ''; }
447 + function setSessionActivity() { sessionActivity = Date.now(); QH('idleTimeoutNotify', ''); }
448 + function checkIdleSessionTimeout() {
449 + var delta = (Date.now() - sessionActivity);
450 + if (delta > serverinfo.timeout) { window.location.href = 'logout'; } else {
451 + var ds = Math.round((serverinfo.timeout - delta) / 1000);
452 + if (ds <= 60) {
453 + QH('idleTimeoutNotify', '<br />' + format("{0} second{1} until disconnect", ds, addLetterS(ds)));
454 + } else {
455 + ds = Math.round(ds / 60);
456 + if (ds <= 5) { QH('idleTimeoutNotify', '<br />' + format("{0} minute{1} until disconnect", ds, addLetterS(ds))); }
457 + }
458 + }
459 + }
460 +
461 + function onMessage(server, message) {
462 + switch (message.action) {
463 + case 'trace': {
464 + serverTrace.unshift(message);
465 + displayServerTrace();
466 + break;
467 + }
468 + case 'traceinfo': {
469 + if (typeof message.traceSources == 'object') {
470 + if ((message.traceSources != null) && (message.traceSources.length > 0)) {
471 + serverTraceSources = message.traceSources;
472 + QH('p41traceStatus', EscapeHtml(message.traceSources.join(', ')));
473 + } else {
474 + serverTraceSources = [];
475 + QH('p41traceStatus', "None");
476 + }
477 + }
478 + break;
479 + }
480 + case 'serverstats': {
481 + updateGeneralServerStats(message);
482 + break;
483 + }
484 + case 'servertimelinestats': {
485 + setServerTimelineStats(message.events);
486 + break;
487 + }
488 + case 'authcookie': {
489 + // Got an authentication cookie refresh
490 + authCookie = message.cookie;
491 + authRelayCookie = message.rcookie;
492 + break;
493 + }
494 + case 'serverinfo': {
495 + serverinfo = message.serverinfo;
496 + if (serverinfo.timeout) { setInterval(checkIdleSessionTimeout, 10000); checkIdleSessionTimeout(); }
497 + if (debugmode == 1) { console.log('Server time: ', printDateTime(new Date(serverinfo.serverTime))); }
498 + break;
499 + }
500 + case 'userinfo': {
501 + userinfo = message.userinfo;
502 + updateSiteAdmin();
503 + updateSelf();
504 + break;
505 + }
506 + case 'users': {
507 + users = {};
508 + for (var m in message.users) { users[message.users[m]._id] = message.users[m]; }
509 + updateUsers();
510 + break;
511 + }
512 + case 'wssessioncount': {
513 + wssessions = message.wssessions;
514 + updateUsers();
515 + break;
516 + }
517 + case 'meshes': {
518 + meshes = {};
519 + for (var m in message.meshes) { meshes[message.meshes[m]._id] = message.meshes[m]; }
520 + masterUpdate(4 + 128);
521 + break;
522 + }
523 + case 'files': {
524 + filetree = setupBackPointers(message.filetree);
525 + updateFiles();
526 + d3updatefiles();
527 + break;
528 + }
529 + case 'nodes': {
530 + nodes = [];
531 + for (var m in message.nodes) {
532 + if (!meshes[m]) { console.log('Invalid mesh (1): ' + m); continue; }
533 + for (var n in message.nodes[m]) {
534 + if (message.nodes[m][n]._id == null) { console.log('Invalid node (' + n + '): ' + JSON.stringify(message.nodes)); continue; }
535 + message.nodes[m][n].namel = message.nodes[m][n].name.toLowerCase();
536 + if (message.nodes[m][n].rname) { message.nodes[m][n].rnamel = message.nodes[m][n].rname.toLowerCase(); } else { message.nodes[m][n].rnamel = message.nodes[m][n].namel; }
537 + message.nodes[m][n].meshnamel = meshes[m].name.toLowerCase();
538 + message.nodes[m][n].meshid = m;
539 + message.nodes[m][n].state = (message.nodes[m][n].state)?(message.nodes[m][n].state):0;
540 + message.nodes[m][n].desc = message.nodes[m][n].desc;
541 + message.nodes[m][n].ip = message.nodes[m][n].ip;
542 + if (!message.nodes[m][n].icon) message.nodes[m][n].icon = 1;
543 + message.nodes[m][n].ident = ++nodeShortIdent;
544 + nodes.push(message.nodes[m][n]);
545 + }
546 + }
547 + masterUpdate(1 | 2 | 4 | 64);
548 +
549 + if (xxcurrentView == -1) { if ('{{viewmode}}' != '') { go(parseInt('{{viewmode}}')); } else { setDialogMode(0); go(1); } }
550 + if ('{{currentNode}}' != '') { gotoDevice('{{currentNode}}',parseInt('{{viewmode}}'));}
551 + break;
552 + }
553 + case 'powertimeline': {
554 + if (message.nodeid != powerTimelineReq) break;
555 + powerTimelineNode = message.nodeid;
556 + powerTimeline = message.timeline;
557 + powerTimelineUpdate = Date.now() + 300000; // Update every 5 minutes
558 + for (var i in powerTimeline) { if (i % 2 == 1) { powerTimeline[i] = powerTimeline[i] * 1000; } } // Decompress time
559 + if (currentNode._id == message.nodeid) { masterUpdate(256); }
560 + break;
561 + }
562 + case 'getsysinfo': {
563 + if (message.nodeid != powerTimelineReq) break;
564 + //console.log('getsysinfo', message); // ***********************
565 + if (message.noinfo === true) {
566 + QH('p17info', "No information for this device.");
567 + } else {
568 + var x = '', s = {};
569 + if (message.hardware) {
570 + if (message.hardware.identifiers) {
571 + var ident = message.hardware.identifiers;
572 + // BIOS
573 + x += '<div class=DevSt style=margin-bottom:3px><b>' + "BIOS" + '</b></div>';
574 + if (ident.bios_vendor) { x += addDetailItem("Vendor", ident.bios_vendor, s); }
575 + if (ident.bios_version) { x += addDetailItem("Version", ident.bios_version, s); }
576 + x += '<br />';
577 +
578 + // Motherboard
579 + x += '<div class=DevSt style=margin-bottom:3px><b>' + "Carte mère" + '</b></div>';
580 + if (ident.board_vendor) { x += addDetailItem("Vendor", ident.board_vendor, s); }
581 + if (ident.board_name) { x += addDetailItem("Nom", ident.board_name, s); }
582 + if (ident.board_serial && (ident.board_serial != '')) { x += addDetailItem("Serial", ident.board_serial, s); }
583 + if (ident.board_version) { x += addDetailItem("Version", ident.board_version, s); }
584 + if (ident.product_uuid) { x += addDetailItem("Identifier", ident.product_uuid, s); }
585 + x += '<br />';
586 + }
587 +
588 + if (message.hardware.windows) {
589 + if (message.hardware.windows.memory) {
590 + // Memory
591 + x += '<div class=DevSt style=margin-bottom:3px><b>' + "Mémoire" + '</b></div>';
592 +
593 + // Sort Memory
594 + function memorySort(a, b) { if (a.BankLabel > b.BankLabel) return 1; if (a.BankLabel < b.BankLabel) return -1; return 0; }
595 + message.hardware.windows.memory.sort(memorySort);
596 +
597 + x += '<table style=width:100%>';
598 + for (var i in message.hardware.windows.memory) {
599 + var m = message.hardware.windows.memory[i];
600 + x += '<tr><td VALIGN=Top style=width:38px><img src="images/ram2.png" />'
601 + x += '<td><div style=background-color:lightgray;border-radius:5px;padding:8px>';
602 + x += '<div><b>' + m.BankLabel + '</b></div>';
603 + if (m.Capacity) { x += addDetailItem("Capacity / Speed", format("{0} Mb, {1} Mhz", (m.Capacity / 1024 / 1024), m.Speed), s); }
604 + if (m.PartNumber) { x += addDetailItem("Numéro d'article", ((m.Manufacturer && m.Manufacturer != 'Undefined')?(m.Manufacturer + ', '):'') + m.PartNumber, s); }
605 + x += '</div>';
606 + }
607 + x += '</table><br />';
608 + }
609 +
610 + if (message.hardware.windows.osinfo) {
611 + // Operating System
612 + var m = message.hardware.windows.osinfo;
613 + x += '<div class=DevSt style=margin-bottom:3px><b>' + "Système opérateur" + '</b></div>';
614 + if (m.Caption) { x += addDetailItem("Nom", m.Caption, s); }
615 + if (m.Version) { x += addDetailItem("Version", m.Version, s); }
616 + if (m.OSArchitecture) { x += addDetailItem("Architecture", m.OSArchitecture, s); }
617 + x += '<br />';
618 + }
619 +
620 + // Disks
621 + //x += '<div class=DevSt style=margin-bottom:3px><b>Disks</b></div>';
622 + //x += '<br />';
623 + }
624 + }
625 +
626 + QH('p17info', x);
627 + }
628 + break;
629 + }
630 + case 'lastconnect': {
631 + var node = getNodeFromId(message.nodeid);
632 + if (node != null) {
633 + node.lastconnect = message.time;
634 + node.lastaddr = message.addr;
635 + if ((currentNode._id == node._id) && (Q('MainComputerState').innerHTML == '')) {
636 + QH('MainComputerState', '<span>' + "Last seen:" + '<br />' + printDateTime(new Date(node.lastconnect)) + '</span>');
637 + }
638 + }
639 + break;
640 + }
641 + case 'msg': {
642 + // Check if this is a message from a node
643 + if (message.nodeid != null) {
644 + var index = -1;
645 + if (nodes != null) { for (var i in nodes) { if (nodes[i]._id == message.nodeid) { index = i; break; } } }
646 + if (index != -1) {
647 + // Node was found, dispatch the message
648 + if (message.type == 'console') { p15consoleReceive(nodes[index], message.value, message.source); } // This is a console message.
649 + else if (message.type == 'notify') { // This is a notification message.
650 + var n = getstore('notifications', 0);
651 + if (((n & 8) == 0) && (message.amtMessage != null)) { break; } // Intel AMT desktop & terminal messages should be ignored.
652 + var n = { text: message.value, title: message.title, icon: message.icon };
653 + if (message.nodeid != null) { n.nodeid = message.nodeid; }
654 + if (message.tag != null) { n.tag = message.tag; }
655 + if (message.username != null) { n.username = message.username; }
656 + addNotification(n);
657 + } else if (message.type == 'ps') {
658 + showDeskToolsProcesses(message);
659 + } else if (message.type == 'services') {
660 + showDeskToolsServices(message);
661 + } else if ((message.type == 'getclip') && (xxdialogTag == 'clipboard') && (currentNode != null) && (currentNode._id == message.nodeid)) {
662 + Q('d2clipText').value = message.data;
663 + } else if ((message.type == 'setclip') && (xxdialogTag == 'clipboard') && (currentNode != null) && (currentNode._id == message.nodeid)) {
664 + // Display success/fail on the clipboard dialog box.
665 + QH('dlgClipStatus', message.success ? '<span style=color:green>' + "Succès" + '</span>' : '<span style=color:red>' + "Failed" + '</span>')
666 + setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000);
667 + }
668 + }
669 + } else {
670 + if (message.type == 'notify') { // This is a notification message.
671 + var n = { text: message.value, title: message.title, icon: message.icon };
672 + if (message.tag != null) { n.tag = message.tag; }
673 + if (message.username != null) { n.username = message.username; }
674 + addNotification(n);
675 + }
676 + }
677 + break;
678 + }
679 + case 'getnetworkinfo': {
680 + if ((currentNode._id == message.nodeid) && (xxdialogMode == 2) && (xxdialogTag == 'if' + message.nodeid)) {
681 + if (message.netif == null) {
682 + QH('d2netinfo', "No network interface information available for this device.");
683 + } else {
684 + var x = '<div class=dialogText>';
685 +
686 + if (currentNode.lastconnect) { x += addHtmlValue2("Last agent connection", printDateTime(new Date(currentNode.lastconnect))); }
687 + if (currentNode.lastaddr) {
688 + var splitip = currentNode.lastaddr.split(':');
689 + if (splitip.length > 2) {
690 + // IPv6
691 + x += addHtmlValue2("Last agent address", currentNode.lastaddr + ' <img src="images/link4.png" title="Copy address to clipboard" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(currentNode.lastaddr) + '\") width=10 height=10>');
692 + } else {
693 + // IPv4
694 + if (isPrivateIP(currentNode.lastaddr)) {
695 + x += addHtmlValue2("Last agent address", splitip[0] + ' <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(splitip[0]) + '\") width=10 height=10>');
696 + } else {
697 + x += addHtmlValue2("Last agent address", '<a href="https://iplocation.com/?ip=' + splitip[0] + '" rel="noreferrer noopener" target="MeshIPLoopup">' + splitip[0] + '</a> <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(splitip[0]) + '\") width=10 height=10>');
698 + }
699 + }
700 + }
701 +
702 + x += addHtmlValue2("Dernière mise à jour des interfaces", printDateTime(new Date(message.updateTime)));
703 + for (var i in message.netif) {
704 + var net = message.netif[i];
705 + x += '<hr />'
706 + if (net.name) { x += addHtmlValue2("Nom", '<b>' + EscapeHtml(net.name) + '</b>'); }
707 + if (net.desc) { x += addHtmlValue2("Description", EscapeHtml(net.desc).replace('(R)', '&reg;').replace('(r)', '&reg;')); }
708 + if (net.dnssuffix) { x += addHtmlValue2("DNS suffix", EscapeHtml(net.dnssuffix) + ' <img src="images/link4.png" title="' + "Copy name to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.dnssuffix) + '\") width=10 height=10>'); }
709 + if (net.mac) { x += addHtmlValue2("MAC address", '<a href="https://dnslytics.com/mac-address-lookup/' + net.mac.substring(0, 6) + '" rel="noreferrer noopener" target="MeshMACLoopup">' + EscapeHtml(net.mac.toLowerCase()) + '</a> <img src="images/link4.png" title="' + "Copy MAC address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.mac.toLowerCase()) + '\") width=10 height=10>'); }
710 + if (net.v4addr) { x += addHtmlValue2("IPv4 address", EscapeHtml(net.v4addr) + ' <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.v4addr) + '\") width=10 height=10>'); }
711 + if (net.v4mask) { x += addHtmlValue2("IPv4 mask", EscapeHtml(net.v4mask) + ' <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.v4mask) + '\") width=10 height=10>'); }
712 + if (net.v4gateway) { x += addHtmlValue2("IPv4 gateway", EscapeHtml(net.v4gateway) + ' <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.v4gateway) + '\") width=10 height=10>'); }
713 + if (net.gatewaymac) { x += addHtmlValue2("Gateway MAC", '<a href="https://dnslytics.com/mac-address-lookup/' + net.gatewaymac.substring(0, 6) + '" rel="noreferrer noopener" target="MeshMACLoopup">' + EscapeHtml(net.gatewaymac.toLowerCase()) + '</a> <img src="images/link4.png" title="' + "Copy MAC address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.gatewaymac.toLowerCase()) + '\") width=10 height=10>'); }
714 + }
715 + x += '</div>';
716 + QH('d2netinfo', x);
717 + }
718 + }
719 + break;
720 + }
721 + case 'serverversion': {
722 + if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerUpdate')) {
723 + var x = '<div class=dialogText>';
724 + if (!message.current) { message.current = "Inconnue"; }
725 + if (!message.latest) { message.latest = "Inconnue"; }
726 + x += addHtmlValue2("Current Version", '<b>' + EscapeHtml(message.current) + '</b>');
727 + x += addHtmlValue2("Latest Version", '<b>' + EscapeHtml(message.latest) + '</b>');
728 + x += '</div>';
729 + if ((message.latest.indexOf('.') == -1) || (message.current == message.latest) || ((features & 2048) == 0)) {
730 + setDialogMode(2, "MeshCentral Version", 1, null, x);
731 + } else {
732 + setDialogMode(2, "MeshCentral Version", 3, server_showVersionDlgEx, x + '<br /><label><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> ' + "Check and click OK to start server self-update." + '</label>');
733 + server_showVersionDlgUpdate();
734 + }
735 + }
736 + break;
737 + }
738 + case 'servererrors': {
739 + if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerErrors')) {
740 + if (message.data == null) {
741 + setDialogMode(2, "MeshCentral Server Errors", 1, null, "Server has no error log.");
742 + } else {
743 + var x = '<div class="dialogText dialogTextLog"><pre id=d2ServerErrorsLogPre>' + message.data + '<pre></div>';
744 + setDialogMode(2, "MeshCentral Server Errors", 3, server_showErrorsDlgEx, x + '<br /><div style=float:right><img src=images/link4.png height=10 width=10 title="' + "Download error log" + '" style=cursor:pointer onclick=d2CopyServerErrorsToClip()></div><div><label><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> ' + "Check and click OK to clear error log." + '</label></div>');
745 + server_showVersionDlgUpdate();
746 + }
747 + }
748 + break;
749 + }
750 + case 'serverconsole': {
751 + p15consoleReceive('serverconsole', message.value);
752 + break;
753 + }
754 + case 'events': {
755 + if ((message.nodeid != null) && (message.nodeid == currentNode._id)) {
756 + currentDeviceEvents = message.events;
757 + masterUpdate(1024);
758 + } else if ((message.user != null) && (message.user == currentUser.name)) {
759 + currentUserEvents = message.events;
760 + masterUpdate(2048);
761 + } else {
762 + events = message.events;
763 + masterUpdate(32);
764 + }
765 + break;
766 + }
767 + case 'getcookie': {
768 + if (message.tag == 'clickonce') {
769 + var basicPort = '{{{serverRedirPort}}}' == '' ? '{{{serverPublicPort}}}' : '{{{serverRedirPort}}}';
770 + var rdpurl = 'http://' + window.location.hostname + ':' + basicPort + '/clickonce/minirouter/MeshMiniRouter.application?WS=wss%3A%2F%2F' + window.location.hostname + '%2Fmeshrelay.ashx%3Fauth=' + message.cookie + '&CH={{{webcerthash}}}&AP=' + message.protocol + ((debugmode == 1) ? '' : '&HOL=1');
771 + var newWindow = window.open(rdpurl, '_blank');
772 + newWindow.opener = null;
773 + }
774 + break;
775 + }
776 + case 'getNotes': {
777 + var n = Q('d2devNotes');
778 + if (n && (message.id == decodeURIComponent(n.attributes['noteid'].value))) {
779 + if (message.notes) { QH('d2devNotes', decodeURIComponent(message.notes)); } else { QH('d2devNotes', ''); }
780 + var ro = (n.attributes['ro'].value == 'true');
781 + if (ro == false) { // If we have permissions, set read/write on this note.
782 + n.removeAttribute('readonly');
783 + QE('idx_dlgOkButton', true);
784 + QV('idx_dlgOkButton', true);
785 + focusTextBox('d2devNotes');
786 + }
787 + }
788 + break;
789 + }
790 + case 'otpauth-request': {
791 + if ((xxdialogMode == 2) && (xxdialogTag == 'otpauth-request')) {
792 + var secret = message.secret;
793 + if (secret.length == 52) { secret = secret.split(/(.............)/).filter(Boolean).join(' '); }
794 + else if (secret.length == 32) { secret = secret.split(/(....)/).filter(Boolean).join(' '); secret = secret.substring(0, 20) + '<br/>' + secret.substring(20) }
795 + QH('d2optinfo', '<table style=width:380px><tr><td style=vertical-align:top>' + "Install <a href=\"https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2\" rel=\"noreferrer noopener\" target=_blank>Google Authenticator</a> or a compatible application and scan the barcode, use <a href=\"' + message.url + '\" rel=\"noreferrer noopener\" target=_blank> this link</a> or enter the secret. Then, enter the current 6 digit token below to activate 2-Step login." + '<br /><br />Secret<br /><tt id=d2optsecret secret=\"' + message.secret + '\" style=font-size:12px>' + secret + '</tt><br /><br /></td><td style=width:1px;vertical-align:top><a href=\"' + message.url + '\" rel=\"noreferrer noopener\" target=_blank><div id="qrcode"></div></a></td><tr><td colspan=2 style="text-align:center;border-top:1px solid black"><br />' + "Enter the token here for 2-step login:" + ' <input type=text onkeypress=\"return (event.keyCode == 8) || (event.charCode >= 48 && event.charCode <= 57)\" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text></td></table>');
796 + new QRCode(Q('qrcode'), { text: message.url, width: 128, height: 128, colorDark: '#000000', colorLight: '#EEE', correctLevel: QRCode.CorrectLevel.H });
797 + QV('idx_dlgOkButton', true);
798 + QE('idx_dlgOkButton', false);
799 + Q('d2otpauthinput').focus();
800 + }
801 + break;
802 + }
803 + case 'otpauth-setup': {
804 + if (xxdialogMode) return;
805 + setDialogMode(2, "Authenticator App", 1, null, message.success ? ('<b style=color:green>' + "Authenticator app activation successful." + '</b> ' + "You will now need a valid token to login again.") : ('<b style=color:red>' + "2-step login activation failed." + '</b> ' + "Clear the secret from the application and try again. You only have a few minutes to enter the proper code."));
806 + break;
807 + }
808 + case 'otpauth-clear': {
809 + if (xxdialogMode) return;
810 + setDialogMode(2, "Authenticator App", 1, null, message.success ? ('<b>' + "Authenticator application removed." + '</b> ' + "You can reactivate this feature at any time.") : ('<b style=color:red>' + "2-step login activation removal failed." + '</b> ' + "Try again."));
811 + break;
812 + }
813 + case 'otpauth-getpasswords': {
814 + if (xxdialogMode) return;
815 + var x = "One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place.";
816 + x += '<div style="border-radius:6px;border: 2px dashed #888;width:100%;margin-top:8px"><div style="padding:8px;font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold"><table class=selecttext style=width:100%;text-align:center>';
817 + if (message.passwords) {
818 + var j = 0, clipb = '';
819 + for (var i in message.passwords) {
820 + if (++j % 2) { x += '<tr>'; }
821 + var p = '' + message.passwords[i].p;
822 + while (p.length < 8) { p = '0' + p; }
823 + if (message.passwords[i].u === true) {
824 + x += '<td>' + p.substring(0, 4) + '&nbsp;' + p.substring(4);
825 + if (clipb != '') { clipb += ' '; }
826 + clipb += p;
827 + } else {
828 + x += '<td><strike style=color:#BBB>' + p.substring(0, 4) + '&nbsp;' + p.substring(4); + '</strike>';
829 + }
830 + }
831 + } else {
832 + x += '<tr><td>' + "No Active Tokens";
833 + }
834 + x += '</table></div></div><br />';
835 + x += '<div><input type=button value=' + "Close" + ' onclick=setDialogMode(0) style=float:right></input>';
836 + x += '<input type=button value="' + "Generate New Tokens" + '" onclick="account_manageOtp(1);"></input>';
837 + if (message.passwords != null) {
838 + x += '<input type=button value="' + "Clear Tokens" + '" onclick="account_manageOtp(2);"></input>';
839 + x += '&nbsp;<img src=images/link4.png height=10 width=10 title="' + "Copy valid codes to clipboard" + '" style=cursor:pointer onclick=copyTextToClip2("' + encodeURIComponent(clipb) + '")>';
840 + }
841 + x += '</div><br />';
842 + setDialogMode(2, "Manage Backup Codes", 8, null, x, 'otpauth-manage');
843 + break;
844 + }
845 + case 'otp-hkey-get': {
846 + if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) return;
847 + var start = '<div style="border-radius:6px;border:2px solid #CCC;background-color:#BBB;width:100%;box-sizing:border-box;margin-bottom:6px"><div style="margin:3px;font-family:Arial, Helvetica, sans-serif;font-size:16px;font-weight:bold"><table style=width:100%;text-align:left>';
848 + var end = '</table></div></div>';
849 + var x = "<a href=\"https://www.yubico.com/\" rel=\"noreferrer noopener\" target=\"_blank\">Hardware keys</a> are used as secondary login authentication.";
850 + x += '<div style="max-height:150px;overflow-y:auto;overflow-x:hidden;margin-top:6px;margin-bottom:6px">';
851 + if (message.keys && message.keys.length > 0) {
852 + for (var i in message.keys) {
853 + var key = message.keys[i], type = (key.type == 2)?'OTP':'WebAuthn';
854 + x += start + '<tr style=margin:5px><td style=width:30px><img width=24 height=18 src="images/hardware-key-' + type + '-24.png" style=margin-top:4px><td style=width:250px>' + key.name + '<td><input type=button value="' + "Retirer" + '" onclick=account_removehkey(" + key.i + ")></input>' + end;
855 + }
856 + } else {
857 + x += start + '<tr style=text-align:center><td>' + "No Keys Configured" + end;
858 + }
859 + x += '</div>';
860 + x += '<div><input type=button value="' + "Close" + '" onclick=setDialogMode(0) style=float:right></input>';
861 + if ((features & 0x00020000) != 0) { x += '<input id=d2addkey3 type=button value="' + "Add Key" + '" onclick="account_addhkey(3);"></input>'; }
862 + if ((features & 0x00004000) != 0) { x += '<input id=d2addkey2 type=button value="' + "Add YubiKey&reg; OTP" + '" onclick="account_addhkey(2);"></input>'; }
863 + x += '</div><br />';
864 + setDialogMode(2, "Manage Security Keys", 8, null, x, 'otpauth-hardware-manage');
865 + if (u2fSupported() == false) { QE('d2addkey1', false); }
866 + break;
867 + }
868 + case 'otp-hkey-yubikey-add': {
869 + if (message.result) {
870 + meshserver.send({ action: 'otp-hkey-get' }); // Success, ask for the full list of keys.
871 + } else {
872 + setDialogMode(2, "Ajouter une clé de sécurité", 1, null, '<br />' + "Error, Unable to add key." + '<br /><br />');
873 + }
874 + break;
875 + }
876 + case 'otp-hkey-setup-response': {
877 + if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) return;
878 + if (message.result == true) {
879 + meshserver.send({ action: 'otp-hkey-get' }); // Success, ask for the full list of keys.
880 + } else {
881 + setDialogMode(2, "Ajouter une clé de sécurité", 1, null, '<br />' + "ERROR: Unable to add key." + '<br /><br />', 'otpauth-hardware-manage');
882 + }
883 + break;
884 + }
885 + case 'webauthn-startregister': {
886 + if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) return;
887 + var x = "Press the key button now." + '<br /><br /><div style=width:100%;text-align:center><img width=120 height=117 src="images/hardware-keypress-120.png" /></div><input id=dp1keyname style=display:none value=' + message.name + ' />';
888 + setDialogMode(2, "Ajouter une clé de sécurité", 2, null, x);
889 +
890 + var publicKey = message.request;
891 + message.request.challenge = Uint8Array.from(atob(message.request.challenge), function (c) { return c.charCodeAt(0) })
892 + message.request.user.id = Uint8Array.from(atob(message.request.user.id), function (c) { return c.charCodeAt(0) })
893 + navigator.credentials.create({ publicKey: publicKey })
894 + .then(function(newCredentialInfo) {
895 + // Public key credential
896 + var r = { rawId: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.rawId))), response: { attestationObject: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.response.attestationObject))), clientDataJSON: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.response.clientDataJSON))) }, type: newCredentialInfo.type };
897 + meshserver.send({ action: 'webauthn-endregister', response: r });
898 + setDialogMode(0);
899 + }, function(error) {
900 + // Error
901 + setDialogMode(2, "Ajouter une clé de sécurité", 1, null, "ERROR: " + error);
902 + });
903 + break;
904 + }
905 + case 'event': {
906 + if (!message.event.nolog) {
907 + if (currentNode && (message.event.nodeid == currentNode._id)) {
908 + // If this event has a nodeid and we are looking at this node, update the log in real time.
909 + currentDeviceEvents.unshift(message.event);
910 + var eventLimit = parseInt(p16limitdropdown.value);
911 + while (currentDeviceEvents.length > eventLimit) { currentDeviceEvents.pop(); } // Remove element(s) at the end
912 + masterUpdate(1024);
913 + }
914 +
915 + if (currentUser && (message.event.userid == currentUser._id)) {
916 + // If this event has a userid and we are looking at this user, update the log in real time.
917 + currentUserEvents.unshift(message.event);
918 + var eventLimit = parseInt(p31limitdropdown.value);
919 + while (currentUserEvents.length > eventLimit) { currentUserEvents.pop(); } // Remove element(s) at the end
920 + masterUpdate(2048);
921 + }
922 +
923 + // Add this event to the master events log.
924 + events.unshift(message.event);
925 + var eventLimit = parseInt(p3limitdropdown.value);
926 + while (events.length > eventLimit) { events.pop(); } // Remove element(s) at the end
927 + masterUpdate(32);
928 + }
929 + if (message.event.noact) break; // Take no action on this event
930 + switch (message.event.action) {
931 + case 'userWebState': {
932 + // New user web state, update the web page as needed
933 + if (localStorage != null) {
934 + var oldShowRealNames = localStorage.getItem('showRealNames');
935 + var oldUiMode = localStorage.getItem('uiMode');
936 + var oldSort = localStorage.getItem('sort');
937 + var oldLoctag = localStorage.getItem('loctag');
938 +
939 + var webstate = JSON.parse(message.event.state);
940 + for (var i in webstate) { localStorage.setItem(i, webstate[i]); }
941 +
942 + // Update the web page
943 + if ((webstate.deskAspectRatio != null) && (webstate.deskAspectRatio != deskAspectRatio)) { deskAspectRatio = webstate.deskAspectRatio; deskAdjust(); }
944 + if ((webstate.showRealNames != null) && (webstate.showRealNames != oldShowRealNames)) { showRealNames = Q('RealNameCheckBox').checked = (webstate.showRealNames == '1'); masterUpdate(6); }
945 + if ((webstate.uiMode != null) && (webstate.uiMode != oldUiMode)) { userInterfaceSelectMenu(parseInt(webstate.uiMode)); }
946 + if ((webstate.sort != null) && (webstate.sort != oldSort)) { document.getElementById('sortselect').selectedIndex = sort = parseInt(webstate.sort); masterUpdate(6); }
947 + if ((webstate.loctag != null) && (webstate.loctag != oldLoctag)) { if (webstate.loctag != null) { args.locale = webstate.loctag; } else { delete args.locale; } masterUpdate(0xFFFFFFFF); }
948 + }
949 + break;
950 + }
951 + case 'servertimelinestats': { addServerTimelineStats(message.event.data); break; }
952 + case 'accountcreate':
953 + case 'accountchange': {
954 + // An account was created or changed
955 + if (userinfo.name == message.event.account.name) {
956 + var newsiteadmin = message.event.account.siteadmin?message.event.account.siteadmin:0;
957 + var oldsiteadmin = userinfo.siteadmin?userinfo.siteadmin:0;
958 + if ((message.event.account.quota != userinfo.quota) || (((userinfo.siteadmin & 8) == 0) && ((message.event.account.siteadmin & 8) != 0))) { meshserver.send({ action: 'files' }); }
959 + var oldgroups = userinfo.groups;
960 + userinfo = message.event.account;
961 + if (oldsiteadmin != newsiteadmin) updateSiteAdmin();
962 + updateSelf();
963 +
964 + if ((userinfo.siteadmin & 2) != 0) {
965 + // Compare our groups
966 + var og = oldgroups ? oldgroups : [];
967 + var ng = userinfo.groups ? userinfo.groups : [];
968 + if (og.join(',') != ng.join(',')) {
969 + // Our groups have changed, re-ask for a list of users.
970 + users = wssessions = null;
971 + meshserver.send({ action: 'users' });
972 + meshserver.send({ action: 'wssessioncount' });
973 + }
974 + }
975 + }
976 + if (users == null) break;
977 +
978 + // Check if the account is part of our user group
979 + if ((userinfo.groups == null) || (userinfo.groups.length == 0) || (findOne(message.event.account.groups, userinfo.groups) == true)) {
980 + users[message.event.account._id] = message.event.account; // Part of our groups, update this user.
981 + } else {
982 + delete users[message.event.account._id]; // No longer part of our groups, remove this user.
983 + }
984 +
985 + updateUsers();
986 + break;
987 + }
988 + case 'accountremove': {
989 + // An account was removed
990 + if (users == null) break;
991 + delete users['user/' + domain + '/' + message.event.username.toLowerCase()];
992 + updateUsers();
993 + break;
994 + }
995 + case 'createmesh': {
996 + // A new mesh was created
997 + if ((meshes[message.event.meshid] == null) && (message.event.links[userinfo._id] != null)) { // Check if this is a mesh create for a mesh we own. If site administrator, we get all messages so need to ignore some.
998 + meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
999 + masterUpdate(4 + 128);
1000 + meshserver.send({ action: 'files' });
1001 + }
1002 + break;
1003 + }
1004 + case 'meshchange': {
1005 + // Update mesh information
1006 + if (meshes[message.event.meshid] == null) {
1007 + // This is a new mesh for us
1008 + meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
1009 + meshserver.send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
1010 + } else {
1011 + // This is an existing mesh
1012 + if (message.event.name != null) {
1013 + meshes[message.event.meshid].name = message.event.name;
1014 + for (var i in nodes) { if (nodes[i].meshid == message.event.meshid) { nodes[i].meshnamel = message.event.name.toLowerCase(); } }
1015 + }
1016 + if (message.event.desc != null) { meshes[message.event.meshid].desc = message.event.desc; }
1017 + if (message.event.flags != null) { meshes[message.event.meshid].flags = message.event.flags; }
1018 + if (message.event.consent != null) { meshes[message.event.meshid].consent = message.event.consent; }
1019 + if (message.event.links) { meshes[message.event.meshid].links = message.event.links; }
1020 + if (message.event.amt) { meshes[message.event.meshid].amt = message.event.amt; }
1021 +
1022 + // Check if we lost rights to this mesh in this change.
1023 + if (meshes[message.event.meshid].links[userinfo._id] == null) {
1024 + if ((xxcurrentView == 20) && (currentMesh == meshes[message.event.meshid])) go(2);
1025 + delete meshes[message.event.meshid];
1026 +
1027 + // Delete all nodes in that mesh
1028 + var newnodes = [];
1029 + for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } }
1030 + nodes = newnodes;
1031 +
1032 + // If we are looking at a node in the deleted mesh, move back to "My Devices"
1033 + if (xxcurrentView >= 10 && xxcurrentView < 20 && currentNode && currentNode.meshid == message.event.meshid) { setDialogMode(0); go(1); }
1034 + }
1035 + }
1036 + masterUpdate(4 + 128);
1037 + if (currentNode && (currentNode.meshid == message.event.meshid)) { currentNode = null; if ((xxcurrentView >= 10) && (xxcurrentView < 20)) { go(1); } }
1038 + //meshserver.send({ action: 'files' }); // TODO: Why do we need to do this??
1039 +
1040 + // If we are looking at a mesh that is now deleted, move back to "My Account"
1041 + if (xxcurrentView == 20 && currentMesh._id == message.event.meshid) { masterUpdate(4096); }
1042 + break;
1043 + }
1044 + case 'deletemesh': {
1045 + // Delete the mesh
1046 + if (meshes[message.event.meshid]) {
1047 + delete meshes[message.event.meshid];
1048 + masterUpdate(128);
1049 + meshserver.send({ action: 'files' });
1050 + }
1051 +
1052 + // Delete all nodes in that mesh
1053 + var newnodes = [];
1054 + if (nodes != null) { for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } } }
1055 + nodes = newnodes;
1056 + masterUpdate(4);
1057 +
1058 + // If we are looking at a mesh that is now deleted, move back to "My Account"
1059 + if (xxcurrentView >= 20 && xxcurrentView < 30 && currentMesh._id == message.event.meshid) { setDialogMode(0); go(2); }
1060 + // If we are looking at a node in the deleted mesh, move back to "My Devices"
1061 + if (xxcurrentView >= 10 && xxcurrentView < 20 && currentNode && currentNode.meshid == message.event.meshid) { setDialogMode(0); go(1); }
1062 +
1063 + break;
1064 + }
1065 + case 'addnode': {
1066 + var node = message.event.node;
1067 + if (!meshes[node.meshid]) break; // This is a node for a mesh we don't know. Happens when we are site administrator, we get all messages.
1068 + if (getNodeFromId(node._id) != null) break; // This node is already known.
1069 + node.namel = node.name.toLowerCase();
1070 + if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
1071 + node.meshnamel = meshes[node.meshid].name.toLowerCase();
1072 + node.state = 0;
1073 + if (!node.icon) node.icon = 1;
1074 + node.ident = ++nodeShortIdent;
1075 + if (nodes == null) { }
1076 + nodes.push(node);
1077 +
1078 + // Web page update
1079 + masterUpdate(1 | 2 | 4 | 16);
1080 +
1081 + break;
1082 + }
1083 + case 'removenode': {
1084 + var index = -1;
1085 + for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1086 + if (index != -1) {
1087 + var node = nodes[index];
1088 + if (currentNode == node) {
1089 + if (xxcurrentView >= 10 && xxcurrentView < 20) { setDialogMode(0); go(1); }
1090 + currentNode = null;
1091 + // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
1092 + }
1093 + nodes.splice(index, 1);
1094 +
1095 + // Web page update
1096 + masterUpdate(4 | 16);
1097 + }
1098 + break;
1099 + }
1100 + case 'changenode': {
1101 + var index = -1;
1102 + for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1103 + if (index != -1) {
1104 + var node = nodes[index];
1105 +
1106 + // Change the node
1107 + node.name = message.event.node.name;
1108 + node.rname = message.event.node.rname;
1109 + node.users = message.event.node.users;
1110 + node.host = message.event.node.host;
1111 + node.desc = message.event.node.desc;
1112 + node.ip = message.event.node.ip;
1113 + node.osdesc = message.event.node.osdesc;
1114 + node.publicip = message.event.node.publicip;
1115 + node.iploc = message.event.node.iploc;
1116 + node.wifiloc = message.event.node.wifiloc;
1117 + node.gpsloc = message.event.node.gpsloc;
1118 + node.tags = message.event.node.tags;
1119 + node.userloc = message.event.node.userloc;
1120 + if (message.event.node.agent != null) {
1121 + if (node.agent == null) node.agent = {};
1122 + if (message.event.node.agent.ver != null) { node.agent.ver = message.event.node.agent.ver; }
1123 + if (message.event.node.agent.id != null) { node.agent.id = message.event.node.agent.id; }
1124 + if (message.event.node.agent.caps != null) { node.agent.caps = message.event.node.agent.caps; }
1125 + if (message.event.node.agent.core != null) { node.agent.core = message.event.node.agent.core; } else { if (node.agent.core) { delete node.agent.core; } }
1126 + node.agent.tag = message.event.node.agent.tag;
1127 + }
1128 + if (message.event.node.intelamt != null) {
1129 + if (node.intelamt == null) node.intelamt = {};
1130 + if (message.event.node.intelamt.state != null) { node.intelamt.state = message.event.node.intelamt.state; }
1131 + if (message.event.node.intelamt.host != null) { node.intelamt.user = message.event.node.intelamt.host; }
1132 + if (message.event.node.intelamt.user != null) { node.intelamt.user = message.event.node.intelamt.user; }
1133 + if (message.event.node.intelamt.tls != null) { node.intelamt.tls = message.event.node.intelamt.tls; }
1134 + if (message.event.node.intelamt.ver != null) { node.intelamt.ver = message.event.node.intelamt.ver; }
1135 + if (message.event.node.intelamt.tag != null) { node.intelamt.tag = message.event.node.intelamt.tag; }
1136 + if (message.event.node.intelamt.uuid != null) { node.intelamt.uuid = message.event.node.intelamt.uuid; }
1137 + if (message.event.node.intelamt.realm != null) { node.intelamt.realm = message.event.node.intelamt.realm; }
1138 + }
1139 + if (message.event.node.av != null) { node.av = message.event.node.av; }
1140 + node.namel = node.name.toLowerCase();
1141 + if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
1142 + if (message.event.node.icon) { node.icon = message.event.node.icon; }
1143 +
1144 + // Web page update
1145 + masterUpdate(2 | 4 | 8 | 16);
1146 + refreshDevice(node._id);
1147 +
1148 + if ((currentNode == node) && (xxdialogMode != null) && (xxdialogTag == '@xxmap')) { p10showNodeLocationDialog(); }
1149 + }
1150 + break;
1151 + }
1152 + case 'nodemeshchange': {
1153 + var index = -1;
1154 + for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1155 + if (index != -1) {
1156 + var node = nodes[index];
1157 + if (meshes[message.event.newMeshId] == null) {
1158 + // We don't see the new mesh, remove this device
1159 +
1160 + // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
1161 + if (currentNode == node) { if (xxcurrentView >= 10 && xxcurrentView < 20) { setDialogMode(0); go(1); } currentNode = null; }
1162 + nodes.splice(index, 1);
1163 + masterUpdate(4 | 16);
1164 + } else {
1165 + // We see the new mesh, move this device
1166 + node.meshid = message.event.newMeshId;
1167 + node.meshnamel = meshes[message.event.newMeshId].name.toLowerCase();
1168 + masterUpdate(1 | 2 | 4);
1169 + }
1170 + refreshDevice(message.event.nodeid);
1171 + } else {
1172 + // This is a new device, add it.
1173 + var node = message.event.node;
1174 + if (!meshes[node.meshid]) break; // This is a node for a mesh we don't know. Happens when we are site administrator, we get all messages.
1175 + node.namel = node.name.toLowerCase();
1176 + if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
1177 + node.meshnamel = meshes[node.meshid].name.toLowerCase();
1178 + node.state = 0;
1179 + if (!node.icon) node.icon = 1;
1180 + node.ident = ++nodeShortIdent;
1181 + if (nodes == null) { }
1182 + nodes.push(node);
1183 +
1184 + // Web page update
1185 + masterUpdate(1 | 2 | 4 | 16);
1186 + }
1187 + break;
1188 + }
1189 + case 'nodeconnect': {
1190 + // Indicated a node has changed connectivity state
1191 + var index = -1;
1192 + for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1193 + if (index != -1) {
1194 + var node = nodes[index];
1195 +
1196 + // Event the connection change if needed
1197 + var n = getstore('notifications', 0); // Account notification settings
1198 +
1199 + // Per-group notification settings
1200 + if (message.event.meshid && userinfo.links && userinfo.links[message.event.meshid] && userinfo.links[message.event.meshid].notify) {
1201 + n &= userinfo.links[message.event.meshid].notify;
1202 + } else {
1203 + n = 0;
1204 + }
1205 +
1206 + // Show the notification
1207 + if (n & 2) {
1208 + if (((node.conn & 1) == 0) && ((message.event.conn & 1) != 0)) { addNotification({ text: "Agent connected", title: node.name, icon: node.icon, nodeid: node._id }); }
1209 + if (((node.conn & 2) == 0) && ((message.event.conn & 2) != 0)) { addNotification({ text: "Intel AMT detected", title: node.name, icon: node.icon, nodeid: node._id }); }
1210 + if (((node.conn & 4) == 0) && ((message.event.conn & 4) != 0)) { addNotification({ text: "Intel AMT CIRA connected", title: node.name, icon: node.icon, nodeid: node._id }); }
1211 + if (((node.conn & 16) == 0) && ((message.event.conn & 16) != 0)) { addNotification({ text: "MQTT connected", title: node.name, icon: node.icon, nodeid: node._id }); }
1212 + }
1213 + if (n & 4) {
1214 + if (((node.conn & 1) != 0) && ((message.event.conn & 1) == 0)) { addNotification({ text: "Agent disconnected", title: node.name, icon: node.icon, nodeid: node._id }); }
1215 + if (((node.conn & 2) != 0) && ((message.event.conn & 2) == 0)) { addNotification({ text: "Intel AMT not detected", title: node.name, icon: node.icon, nodeid: node._id }); }
1216 + if (((node.conn & 4) != 0) && ((message.event.conn & 4) == 0)) { addNotification({ text: "Intel AMT CIRA disconnected", title: node.name, icon: node.icon, nodeid: node._id }); }
1217 + if (((node.conn & 16) != 0) && ((message.event.conn & 16) == 0)) { addNotification({ text: "MQTT disconnected", title: node.name, icon: node.icon, nodeid: node._id }); }
1218 + }
1219 +
1220 + // Change the node connection state
1221 + node.conn = message.event.conn;
1222 + node.pwr = message.event.pwr;
1223 +
1224 + // Web page update
1225 + masterUpdate(4 | 16);
1226 + refreshDevice(node._id);
1227 + }
1228 + break;
1229 + }
1230 + case 'wssessioncount': {
1231 + // Update the active web socket session count for a user
1232 + if (wssessions != null) {
1233 + if (message.event.count == 0 && wssessions['user/' + domain + '/' + message.event.username.toLowerCase()]) {
1234 + delete wssessions['user/' + domain + '/' + message.event.username.toLowerCase()];
1235 + } else {
1236 + wssessions['user/' + domain + '/' + message.event.username.toLowerCase()] = message.event.count;
1237 + }
1238 + updateUsers();
1239 + }
1240 + break;
1241 + }
1242 + case 'login': {
1243 + // Update the last login time
1244 + if (users != null && users['user/' + domain + '/' + message.event.username.toLowerCase()]) {
1245 + users['user/' + domain + '/' + message.event.username.toLowerCase()].login = Math.floor(new Date(message.event.time).getTime() / 1000);
1246 + }
1247 + break;
1248 + }
1249 + case 'scanamtdevice': {
1250 + // Populate the Intel AMT scan dialog box with the result of the RMCP scan
1251 + if ((xxdialogMode == null) || (!Q('dp1range')) || (Q('dp1range').value != message.event.range)) return;
1252 + var x = '';
1253 + if (message.event.results == null) {
1254 + // The scan could not occur because of an error. Likely the user range was invalid.
1255 + x = '<div style=width:100%;text-align:center;margin-top:12px>' + "Unable to scan this address range." + '</div><div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>' + "Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100" + '</div>';
1256 + } else {
1257 + // Go thru all the results and populate the dialog box
1258 + amtScanResults = message.event.results;
1259 + for (var i in message.event.results) {
1260 + var r = message.event.results[i], shortname = r.hostname;
1261 + if (shortname.length > 20) { shortname = shortname.substring(0, 20) + '...'; }
1262 + var str = '<b title="' + EscapeHtml(r.hostname) + '">' + EscapeHtml(shortname) + '</b> - v' + r.ver;
1263 + if (r.state == 2) { if (r.tls == 1) { str += "avec TLS."; } else { str += "sans TLS."; } } else { str += ' not activated.'; }
1264 + x += '<div style=width:100%;margin-bottom:2px;background-color:lightgray><div style=padding:4px><div style=display:inline-block;margin-right:5px><input class=DevScanCheckbox name=dp1checkbox tag="' + EscapeHtml(i) + '" type=checkbox onclick=addAmtScanToMeshCheckbox() /></div><div class=j1 style=display:inline-block></div><div style=display:inline-block;margin-left:5px;overflow-x:auto;white-space:nowrap>' + str + '</div></div></div>';
1265 + }
1266 + // If no results where found, display a nice message
1267 + if (x == '') { x = '<div style=width:100%;text-align:center;margin-top:12px>Scan returned no results.</div><div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>'; }
1268 + }
1269 + // Set the html in the dialog box and re-enable the scan button
1270 + QH('dp1results', x);
1271 + QE('dp1range', true);
1272 + QE('dp1rangebutton', true);
1273 + break;
1274 + }
1275 + case 'notify': {
1276 + var n = { text: message.event.value, title: message.event.title, icon: message.event.icon };
1277 + if (message.event.tag != null) { n.tag = message.event.tag; }
1278 + addNotification(n);
1279 + break;
1280 + }
1281 + case 'traceinfo': {
1282 + if (typeof message.event.traceSources == 'object') {
1283 + if ((message.event.traceSources != null) && (message.event.traceSources.length > 0)) {
1284 + serverTraceSources = message.event.traceSources;
1285 + QH('p41traceStatus', EscapeHtml(message.event.traceSources.join(', ')));
1286 + } else {
1287 + serverTraceSources = [];
1288 + QH('p41traceStatus', "None");
1289 + }
1290 + }
1291 + break;
1292 + }
1293 + case 'sysinfohash': {
1294 + // If the sysinfo document has changed and we are looking at it, request an update.
1295 + if ((currentNode != null) && (message.event.nodeid == powerTimelineReq)) {
1296 + meshserver.send({ action: 'getsysinfo', nodeid: message.event.nodeid });
1297 + }
1298 + break;
1299 + }
1300 + case 'stopped': { // Server is stopping.
1301 + // Disconnect
1302 + //console.log(message.msg);
1303 + break;
1304 + }
1305 + default:
1306 + //console.log('Unknown message.event.action', message.event.action);
1307 + break;
1308 + }
1309 + break;
1310 + }
1311 + case 'createInviteLink': { // Agent installation invitation link
1312 + if (xxdialogTag != message.meshid) break;
1313 + var servername = serverinfo.name;
1314 + if ((servername.indexOf('.') == -1) || ((features & 2) != 0)) { servername = window.location.hostname; } // If the server name is not set or it's in LAN-only mode, use the URL hostname as server name.
1315 + var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
1316 + var url;
1317 + if (serverinfo.https == true) {
1318 + var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
1319 + url = 'https://' + servername + portStr + domainUrl + 'agentinvite?c=' + message.cookie;
1320 + } else {
1321 + var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port);
1322 + url = 'http://' + servername + portStr + domainUrl + 'agentinvite?c=' + message.cookie;
1323 + }
1324 + Q('agentInvitationLink').href = url;
1325 + var t = format("{0} hour{1}", message.expire, addLetterS(message.expire));
1326 + if (message.expire == 24) { t = "1 jour"; }
1327 + if (message.expire == 168) { t = "1 semaine"; }
1328 + if (message.expire == 5040) { t = "1 mois"; }
1329 + if (message.expire == 0) { t = "Illimité"; }
1330 + QH('agentInvitationLink', format("Invitation Link ({0})", t));
1331 + QV('agentInvitationLinkDiv', true);
1332 + break;
1333 + }
1334 + case 'getmqttlogin': {
1335 + if ((currentNode == null) || (currentNode._id != message.nodeid) || (xxdialogMode != null)) return;
1336 + var x = "These settings can be used to connect MQTT for this device." + '<br /><br />';
1337 + delete message.action;
1338 + delete message.nodeid;
1339 + x += '<textarea readonly=readonly style=width:100%;resize:none;height:100px;overflow:auto;font-size:12px readonly>' + JSON.stringify(message) + '</textarea>';
1340 + /*
1341 + x += addHtmlValue('Username', '<input style=width:230px readonly value="' + message.user + '" />');
1342 + x += addHtmlValue('Password', '<input style=width:230px readonly value="' + message.pass + '" />');
1343 + x += addHtmlValue('WS URL', '<input style=width:230px readonly value="' + message.wsUrl + '" />');
1344 + if (message.mpsUrl && message.mpsCertHash) {
1345 + x += addHtmlValue('MPS URL', '<input style=width:230px readonly value="' + message.mpsUrl + '" />');
1346 + x += addHtmlValue('MPS Cert Hash', '<input style=width:230px readonly value="' + message.mpsCertHash + '" />');
1347 + }
1348 + */
1349 + setDialogMode(2, "MQTT Credentials", 1, null, x);
1350 + break;
1351 + }
1352 + case 'stopped': { // Server is stopping.
1353 + // Disconnect
1354 + autoReconnect = false;
1355 + QH('p0span', message.msg);
1356 + break;
1357 + }
1358 + case 'plugin': {
1359 + if ((pluginHandler == null) || (typeof message.plugin != 'string')) break;
1360 + try { pluginHandler[message.plugin][message.method](server, message); } catch (e) { console.log('Error loading plugin handler ('+ e + ')'); }
1361 + break;
1362 + }
1363 + default:
1364 + //console.log('Unknown message.action', message.action);
1365 + break;
1366 + }
1367 + }
1368 +
1369 + //
1370 + // MY DEVICES
1371 + //
1372 +
1373 + function onRealNameCheckBox() {
1374 + showRealNames = Q('RealNameCheckBox').checked;
1375 + putstore('showRealNames', showRealNames ? 1 : 0);
1376 + masterUpdate(6);
1377 + return;
1378 + }
1379 +
1380 + function onDeviceViewChange(i) {
1381 + if (i != null) { Q('viewselect').value = i; }
1382 + for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); }
1383 + Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel');
1384 + putstore('_deviceView', Q('viewselect').value);
1385 + putstore('_viewsize', Q('sizeselect').value);
1386 + masterUpdate(4);
1387 + setTimeout(function () { masterUpdate(512); }, 200);
1388 + }
1389 +
1390 + function ondockeypress(e) {
1391 + setSessionActivity();
1392 + if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked) {
1393 + // Check what keys we are allows to send
1394 + if (currentNode != null) {
1395 + var mesh = meshes[currentNode.meshid];
1396 + var meshrights = mesh.links[userinfo._id].rights;
1397 + var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
1398 + if (inputAllowed == false) return false;
1399 + var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
1400 + if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
1401 + }
1402 + return desktop.m.handleKeys(e);
1403 + }
1404 + if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) { return terminal.m.TermHandleKeys(e); }
1405 + if (!xxdialogMode && ((xxcurrentView == 15) || (xxcurrentView == 115))) return agentConsoleHandleKeys(e);
1406 + if (!xxdialogMode && xxcurrentView == 4) {
1407 + if (e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
1408 + var processed = 0;
1409 + if (e.key) {
1410 + if (e.key.length === 1 && userSearchFocus == 0) { Q('UserSearchInput').value = ((Q('UserSearchInput').value + e.key)); processed = 1; }
1411 + if (e.keyCode == 8 && userSearchFocus == 0) { var x = Q('UserSearchInput').value; Q('UserSearchInput').value = x.substring(0, x.length - 1); processed = 1; }
1412 + if (e.keyCode == 27) { Q('UserSearchInput').value = ''; processed = 1; }
1413 + } else {
1414 + if (e.charCode != 0 && userSearchFocus == 0) { Q('UserSearchInput').value = ((Q('UserSearchInput').value + String.fromCharCode(e.charCode))); processed = 1; }
1415 + }
1416 + if (processed > 0) { if (processed == 1) { onUserSearchInputChanged(); } return haltEvent(e); }
1417 + }
1418 + if (xxdialogMode || xxcurrentView != 1) return;
1419 + if (e.ctrlKey == true && e.charCode == 96) {
1420 + showRealNames = !showRealNames;
1421 + Q('RealNameCheckBox').value = showRealNames;
1422 + putstore('showRealNames', showRealNames ? 1 : 0);
1423 + masterUpdate(6)
1424 + return;
1425 + }
1426 + if (e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
1427 + if (Q('viewselect').value < 3) {
1428 + var processed = 0;
1429 + if (e.key) {
1430 + if (e.key.length === 1 && searchFocus == 0) { Q('SearchInput').value = ((Q('SearchInput').value + e.key)); processed = 1; }
1431 + if (e.keyCode == 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('SearchInput').value = x.substring(0, x.length - 1); processed = 1; }
1432 + if (e.keyCode == 27) { Q('SearchInput').value = ''; processed = 1; }
1433 + } else {
1434 + if (e.charCode != 0 && searchFocus == 0) { Q('SearchInput').value = ((Q('SearchInput').value + String.fromCharCode(e.charCode))); processed = 1; }
1435 + }
1436 + if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); }
1437 + }
1438 + if (Q('viewselect').value == 3) {
1439 + if (e.key) {
1440 + if (e.key.length === 1 && mapSearchFocus == 0) { Q('mapSearchLocation').value = ((Q('mapSearchLocation').value + e.key)); processed = 1; }
1441 + //if (e.keyCode == 8 && mapSearchFocus == 0) { var x = Q('mapSearchLocation').value; Q('mapSearchLocation').value = x.substring(0, x.length - 1); processed = 1; }
1442 + if (e.keyCode == 27) { Q('mapSearchLocation').value = ''; mapCloseSearchWindow(); processed = 1; }
1443 + if (e.keyCode == 13) { getSearchLocation(); }
1444 + } else {
1445 + if (e.charCode != 0 && mapSearchFocus == 0) { Q('mapSearchLocation').value = ((Q('mapSearchLocation').value + String.fromCharCode(e.charCode))); processed = 1; }
1446 + }
1447 + }
1448 + }
1449 +
1450 + function ondockeydown(e) {
1451 + setSessionActivity();
1452 + if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked) {
1453 + // Check what keys we are allows to send
1454 + if (currentNode != null) {
1455 + var mesh = meshes[currentNode.meshid];
1456 + var meshrights = mesh.links[userinfo._id].rights;
1457 + var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
1458 + if (inputAllowed == false) return false;
1459 + var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
1460 + if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
1461 + }
1462 + return desktop.m.handleKeyDown(e);
1463 + }
1464 + if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) { terminal.m.TermHandleKeyDown(e); if ((e.keyCode >= 37) && (e.keyCode <= 40)) { haltEvent(e); } }
1465 + if (!xxdialogMode && xxcurrentView == 13 && e.keyCode == 116 && p13filetree != null) { haltEvent(e); return false; } // F5 Refresh on files
1466 + if (!xxdialogMode && ((xxcurrentView == 15) || (xxcurrentView == 115))) { return agentConsoleHandleKeys(e); }
1467 + if (!xxdialogMode && xxcurrentView == 4) {
1468 + if (e.keyCode === 8 && userSearchFocus == 0) { var x = Q('UserSearchInput').value; Q('UserSearchInput').value = (x.substring(0, x.length - 1)); processed = 1; }
1469 + if (e.keyCode === 27) { Q('UserSearchInput').value = ''; processed = 1; }
1470 + if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); }
1471 + }
1472 + if (xxdialogMode || xxcurrentView != 1 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
1473 + var processed = 0;
1474 + if (Q('viewselect').value < 3) {
1475 + if (e.keyCode === 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('SearchInput').value = (x.substring(0, x.length - 1)); processed = 1; }
1476 + if (e.keyCode === 27) { Q('SearchInput').value = ''; processed = 1; }
1477 + if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); }
1478 + }
1479 + if (Q('viewselect').value == 3) {
1480 + if (e.keyCode === 8 && mapSearchFocus == 0) { var x = Q('mapSearchLocation').value; Q('mapSearchLocation').value = (x.substring(0, x.length - 1)); processed = 1; }
1481 + if (e.keyCode === 27) { Q('mapSearchLocation').value = ''; mapCloseSearchWindow(); processed = 1; }
1482 + }
1483 + }
1484 +
1485 + function ondockeyup(e) {
1486 + setSessionActivity();
1487 + if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked) {
1488 + // Check what keys we are allows to send
1489 + if (currentNode != null) {
1490 + var mesh = meshes[currentNode.meshid];
1491 + var meshrights = mesh.links[userinfo._id].rights;
1492 + var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
1493 + if (inputAllowed == false) return false;
1494 + var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
1495 + if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
1496 + }
1497 + return desktop.m.handleKeyUp(e);
1498 + }
1499 + if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) { return terminal.m.TermHandleKeyUp(e); }
1500 + if (!xxdialogMode && xxcurrentView == 13 && e.keyCode == 116 && p13filetree != null) { p13folderup(9999); haltEvent(e); return false; } // F5 Refresh on files
1501 + if (!xxdialogMode && xxcurrentView == 4) { if ((e.keyCode === 8 && searchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
1502 + if (xxdialogMode && e.keyCode == 27) { dialogclose(0); }
1503 + if (xxdialogMode || xxcurrentView != 0 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
1504 + if (Q('viewselect').value < 3) { if ((e.keyCode === 8 && searchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
1505 + if (Q('viewselect').value == 3) { if ((e.keyCode === 8 && mapSearchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
1506 + }
1507 +
1508 + //function ondocfocus() { }
1509 + // TODO: Add handleReleaseKeys() for Intel AMT.
1510 + function ondocblur() { if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked && desktop.m.handleReleaseKeys) { return desktop.m.handleReleaseKeys(); } }
1511 +
1512 + // Highlights the device being hovered
1513 + function devMouseHover(element, over) {
1514 + setSessionActivity();
1515 + var view = Q('viewselect').value;
1516 + if (view == 1) {
1517 + var e = element.children[1].children[1];
1518 + e.children[0].classList.remove('g1s');
1519 + e.children[1].classList.remove('e2s');
1520 + e.children[2].classList.remove('g2s');
1521 + if (over == 1) {
1522 + e.children[0].classList.add('g1s');
1523 + e.children[1].classList.add('e2s');
1524 + e.children[2].classList.add('g2s');
1525 + }
1526 + } else if (view == 2) {
1527 + var e = element;
1528 + e.children[2].classList.remove('g1s');
1529 + e.children[4].classList.remove('e2s');
1530 + e.children[3].classList.remove('g2s');
1531 + if (over == 1) {
1532 + e.children[2].classList.add('g1s');
1533 + e.children[4].classList.add('e2s');
1534 + e.children[3].classList.add('g2s');
1535 + }
1536 + }
1537 + }
1538 +
1539 + var deviceHeaderId = 0;
1540 + var deviceHeaderTotal = 0;
1541 + var deviceHeadersTitles = {};
1542 + var deviceHeaderCount;
1543 + var deviceHeaders = {};
1544 + var oldviewmode = 0;
1545 + function updateDevices() {
1546 + if (nodes == null) { return; }
1547 + var r = '', c = 0, current = null, count = 0, displayedMeshes = {}, view = Q('viewselect').value, groups = {}, groupCount = {};
1548 + QV('xdevices', view < 4);
1549 + QV('xdevicesmap', view == 4);
1550 + QV('devListToolbar', view < 3);
1551 + QV('kvmListToolbar', view == 3);
1552 + QV('devMapToolbar', view == 4);
1553 + QV('devListToolbarSize', view == 3);
1554 + QV('NoMeshesPanel', meshcount == 0);
1555 + //QV('devListToolbarView', (meshcount != 0) && (nodes.length > 0));
1556 + QV('devListToolbarViewIcons', (meshcount != 0) && (nodes.length > 0));
1557 + QV('devListToolbarSort', (meshcount != 0) && (nodes.length > 0) && (view < 4));
1558 + if ((meshcount == 0) || (nodes.length == 0)) { view = 1; sort = 0; }
1559 + if (view == 4) {
1560 + setTimeout( function() { if (xxmap.map != null) { xxmap.map.updateSize(); } }, 200);
1561 + // TODO
1562 + } else {
1563 + // 3 wide, list view or desktop view
1564 + deviceHeaderId = 0;
1565 + deviceHeaderCount = {};
1566 + deviceHeaderTotal = 0;
1567 + deviceHeaders = {};
1568 + deviceHeadersTitles = {};
1569 + var kvmDivs = [];
1570 +
1571 + // Perform node sort
1572 + if (sort == 0) { nodes.sort(meshSort); }
1573 + else if (sort == 1) { nodes.sort(powerSort); }
1574 + else if (sort == 2) { if (showRealNames == true) { nodes.sort(deviceHostSort); } else { nodes.sort(deviceSort); } }
1575 +
1576 + // Save the list of currently checked nodeid's
1577 + var checkedNodeids = [], elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = 0;
1578 + for (var i=0;i<elements.length;i++) { if (elements[i].checked) { checkedNodeids.push(elements[i].value); } }
1579 + if ((oldviewmode < 3) && (view == 3)) { multiDesktopFilter = checkedNodeids; }
1580 + else if ((oldviewmode == 3) && (view < 3)) { checkedNodeids = multiDesktopFilter; }
1581 +
1582 + // Compute the width of the device view.
1583 + var totalDeviceViewWidth = Q('column_l').clientWidth - 60;
1584 + var deviceBoxWidth = Math.floor(totalDeviceViewWidth / 301);
1585 + deviceBoxWidth = 301 + Math.floor((totalDeviceViewWidth - (deviceBoxWidth * 301)) / deviceBoxWidth);
1586 +
1587 + if ((view == 2) && (sort != 3)) {
1588 + r += '<table style=width:100%;margin-top:4px cellpadding=0 cellspacing=0><th style=color:gray><th style=color:gray;width:120px>' + "User" + '<th style=color:gray;width:120px>' + "Address" + '<th style=color:gray;width:100px>' + "Connectivity"; //<th style=color:gray;width:100px>State';
1589 + }
1590 +
1591 + // Go thru the list of nodes and display them
1592 + for (var i in nodes) {
1593 + var node = nodes[i];
1594 + if (node.v == false) continue;
1595 + var mesh2 = meshes[node.meshid], meshlinks = mesh2.links[userinfo._id];
1596 + if (meshlinks == null) continue;
1597 + var meshrights = meshlinks.rights;
1598 + if ((view == 3) && (mesh2.mtype == 1)) continue;
1599 + if (sort == 0) {
1600 + // Mesh header
1601 + if (node.meshid != current) {
1602 + deviceHeaderSet();
1603 + var extra = '';
1604 + if (view == 2) { r += '<tr><td colspan=5>'; }
1605 + if (meshes[node.meshid].mtype == 1) { extra = '<span class=devHeaderx>' + ", Intel&reg; AMT only" + '</span>'; }
1606 + if ((view == 1) && (current != null)) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } if (r != '') { r += '</tr></table>'; } }
1607 + if (view == 2) { r += '<div>'; }
1608 + r += '<div class=DevSt style=width:100%;padding-top:4px><span style=float:right>';
1609 + r += '<span id=DevxHeader' + deviceHeaderId + ' class=devHeaderx></span>' + extra;
1610 + r += '</span><span id=MxMESH tabindex=0 style=cursor:pointer onclick=gotoMesh("' + node.meshid + '") onkeypress="if (event.key==\'Enter\') gotoMesh(\'' + node.meshid + '\')">' + EscapeHtml(meshes[node.meshid].name) + '</span>' + getMeshActions(mesh2, meshrights) + '</div>';
1611 + if (view == 2) { r += '</div>'; }
1612 + current = node.meshid;
1613 + displayedMeshes[current] = 1;
1614 + c = 0;
1615 + }
1616 + } else if (sort == 1) {
1617 + // Power header
1618 + var pwr = node.pwr?node.pwr:0;
1619 + if (pwr !== current) {
1620 + deviceHeaderSet();
1621 + if ((view == 1) && (current !== null)) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } if (r != '') { r += '</tr></table>'; } }
1622 +
1623 + if (view == 2) { r += '<tr><td>'; }
1624 + r += '<div class=DevSt style=width:100%;padding-top:4px><span id=DevxHeader' + deviceHeaderId + ' class=devHeaderx style=float:right></span><span>' + PowerStateStr2(node.pwr) + '</span></div>';
1625 +
1626 + current = pwr;
1627 + c = 0;
1628 + }
1629 + } else if (sort == 2) {
1630 + // Device header
1631 + if (current == null) { current = '1'; }
1632 + }
1633 +
1634 + count++;
1635 + var title = EscapeHtml(node.name);
1636 + if (title.length == 0) { title = '<i>' + "None" + '</i>'; }
1637 + if ((node.rname != null) && (node.rname.length > 0)) { title += ' / ' + EscapeHtml(node.rname); }
1638 + var name = EscapeHtml(node.name);
1639 + if (showRealNames == true && node.rname != null) name = EscapeHtml(node.rname);
1640 + if (name.length == 0) { name = '<i>' + "None" + '</i>'; }
1641 +
1642 + // Node
1643 + var icon = node.icon;
1644 + if ((!node.conn) || (node.conn == 0)) { icon += ' gray'; }
1645 + if (view == 1) {
1646 + r += '<div id=devs onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=display:inline-block;width:' + deviceBoxWidth + 'px;height:50px;padding-top:1px;padding-bottom:1px><div style=width:22px;height:50%;float:left;padding-top:12px><input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox></div><div style=height:100%;cursor:pointer tabindex=0 onclick=gotoDevice(\'' + node._id + '\',null,null,event) onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',null,null,event)"><div class="i' + icon + '" style=width:50px;float:left></div><div style=height:100%><div class=g1></div><div class=e2><div class=e1 style=width:' + (deviceBoxWidth - 100) + 'px title="' + title + '">' + name + '</div><div>' + NodeStateStr(node) + '</div></div><div class=g2></div></div></div></div>';
1647 + } else if (view == 2) {
1648 + var states = [];
1649 + if (node.conn) {
1650 + if ((node.conn & 1) != 0) { states.push('<span title=\"' + "Mesh agent is connected and ready for use." + '\">' + "Agent" + '</span>'); }
1651 + if ((node.conn & 2) != 0) { states.push('<span title=\"' + "Intel&reg; AMT CIRA is connected and ready for use." + '\">' + "CIRA" + '</span>'); }
1652 + else if ((node.conn & 4) != 0) { states.push('<span title=\"' + "Intel&reg; AMT is routable." + '\">' + "AMT" + '</span>'); }
1653 + if ((node.conn & 8) != 0) { states.push('<span title=\"' + "Mesh agent is reachable using another agent as relay." + '\">' + "Relay" + '</span>'); }
1654 + if ((node.conn & 16) != 0) { states.push('<span title=\"' + "MQTT connection to the device is active." + '\">' + "MQTT" + '</span>'); }
1655 + }
1656 + r += '<tr><td><div id=devs class=bar18 tabindex=0 onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=height:18px;width:100%;font-size:medium onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',null,null,event)">';
1657 + r += '<div class=deviceBarCheckbox><input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox></div>';
1658 + r += '<div class=deviceBarIcon onclick=gotoDevice(\'' + node._id + '\',null,null,event)><div class=\"j' + icon + '\" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>';
1659 + r += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>';
1660 + r += '<div style=cursor:pointer;font-size:14px title="' + title + '" onclick=gotoDevice(\'' + node._id + '\',null,null,event)><span style=width:300px>' + name + '</span></div></div></td>';
1661 + r += '<td style=text-align:center>' + getUserShortStr(node);
1662 + r += '<td style=text-align:center>' + (node.ip != null ? node.ip : '');
1663 + r += '<td style=text-align:center>' + states.join('&nbsp;+&nbsp;');
1664 + //r += '<td style=text-align:center>' + (node.pwr != null ? powerStateStrings[node.pwr] : '');
1665 + r += '</tr>';
1666 + } else if ((view == 3) && (node.conn & 1) && (((meshrights & 8) || (meshrights & 256)) != 0) && ((node.agent.caps & 1) != 0)) { // Check if we have rights and agent is capable of KVM.
1667 + if ((multiDesktopFilter) && ((multiDesktopFilter.length == 0) || (multiDesktopFilter.indexOf('devid_' + node._id) >= 0))) {
1668 + r += '<div id=devs style=display:inline-block;margin:1px;background-color:lightgray;border-radius:5px;position:relative><div tabindex=0 style=padding:3px;cursor:pointer onclick=gotoDevice(\'' + node._id + '\',11,null,event) onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',11,null,event)">';
1669 + //r += '<input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox style=float:left>';
1670 + r += '<div class="j' + icon + '" style=width:16px;float:left></div>&nbsp;' + name + '</div>';
1671 + r += '<span onclick=gotoDevice(\'' + node._id + '\',null,null,event)></span><div id=xkvmid_' + node._id.split('/')[2] + '><div id=skvmid_' + node._id.split('/')[2] + ' tabindex=0 style="position:absolute;color:white;left:5px;top:27px;text-shadow:0px 0px 5px #000;z-index:1000;cursor:default" onclick=toggleKvmDevice(\'' + node._id + '\') onkeypress="if (event.key==\'Enter\') toggleKvmDevice(\'' + node._id + '\')">' + "Disconnected" + '</div></div>';
1672 + r += '</div>';
1673 + kvmDivs.push(node._id);
1674 + }
1675 + }
1676 +
1677 + // If we are displaying devices by group, put the device in the right group.
1678 + if ((sort == 3) && (r != '')) {
1679 + if (node.tags) {
1680 + for (var j in node.tags) {
1681 + var tag = node.tags[j];
1682 + if (groups[tag] == null) { groups[tag] = r; groupCount[tag] = 1; } else { groups[tag] += r; groupCount[tag] += 1; }
1683 + if (view == 3) break;
1684 + }
1685 + }
1686 + r = '';
1687 + }
1688 +
1689 + deviceHeaderTotal++;
1690 + if (typeof deviceHeaderCount[node.state] == 'undefined') { deviceHeaderCount[node.state] = 1; } else { deviceHeaderCount[node.state]++; }
1691 + }
1692 +
1693 + // Display "connect all" and "auto"
1694 + QV('kvmMultiConnectButtonSpan', (kvmDivs.length < 128));
1695 + QV('kvmAutoConnectButtonSpan', (kvmDivs.length < 128));
1696 + if (kvmDivs.length >= 64) { Q('autoConnectDesktopCheckbox').checked = false; }
1697 +
1698 + // If displaying devices by groups, sort the group names and display the devices.
1699 + if (sort == 3) {
1700 + if (view == 2) { r = '<table style=width:100%;margin-top:4px cellpadding=0 cellspacing=0><th style=color:gray><th style=color:gray;width:120px>' + "User" + '<th style=color:gray;width:120px>' + "Address" + '<th style=color:gray;width:100px>' + "Connectivity"; }
1701 +
1702 + var groupNames = [];
1703 + for (var i in groups) { groupNames.push(i); }
1704 + groupNames.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); });
1705 + for (var j in groupNames) {
1706 + var i = groupNames[j];
1707 + if (view == 2) {
1708 + r += '<tr><td colspan=4><div class=DevSt style=width:100%;padding-top:4px><span class=devHeaderx style=float:right>' + groupCount[i] + ' node' + ((groupCount[i] > 1) ? 's' : '') + '</span><span>' + i + '</span></div>' + groups[i];
1709 + } else {
1710 + r += '<div class=DevSt style=width:100%;padding-top:4px><span class=devHeaderx style=float:right>' + groupCount[i] + ' node' + ((groupCount[i] > 1) ? 's' : '') + '</span><span>' + i + '</span></div>' + groups[i];
1711 + }
1712 + }
1713 + }
1714 +
1715 + // If there is nothing to display, explain the problem
1716 + if ((r == '') && (meshcount > 0) && (Q('SearchInput').value != '')) {
1717 + if (sort == 3) {
1718 + r = '<div style="margin:30px">' + "No devices are included in any groups, click on a device\'s \"Groups\" to add to a group." + '</div>';
1719 + } else {
1720 + r = '<div style="margin:30px">' + "Aucun appareil ne correspond à cette recherche." + '</div>';
1721 + }
1722 + }
1723 +
1724 + if ((view == 1) && (c == 2)) r += '<td><div style=width:301px></div></td>'; // Adds device padding
1725 +
1726 + // Display all empty device groups, we need to do this because users can add devices to these at any time.
1727 + if ((sort == 0) && (Q('SearchInput').value == '') && (view < 3)) {
1728 + for (var i in meshes) {
1729 + var mesh = meshes[i], meshlink = mesh.links[userinfo._id];
1730 + if (meshlink != null) {
1731 + var meshrights = meshlink.rights;
1732 + if (displayedMeshes[mesh._id] == null) {
1733 + if ((current != '') && (r != '')) { r += '</tr></table>'; }
1734 + r += '<table style=width:100%;padding-top:4px cellpadding=0 cellspacing=0><tr><td colspan=3 class=DevSt><span id=MxMESH style=cursor:pointer onclick=gotoMesh("' + mesh._id + '")>' + EscapeHtml(mesh.name) + '</span><span>';
1735 + r += getMeshActions(mesh, meshrights);
1736 + r += '</span></td></tr><tr>';
1737 + if (mesh.mtype == 1) {
1738 + r += '<td><div style=padding:10px><i>' + "No Intel&reg; AMT devices in this mesh";
1739 + if ((meshrights & 4) != 0) { r += ', <a href=# style=cursor:pointer onclick=\'return addDeviceToMesh(\"' + mesh._id + '\")\'>' + "ajoute un" + '</a>'; }
1740 + }
1741 + if (mesh.mtype == 2) {
1742 + r += '<td><div style=padding:10px><i>' + "Aucun appareil dans ce groupe";
1743 + if ((meshrights & 4) != 0) { r += ', <a href=# style=cursor:pointer onclick=\'return addAgentToMesh(\"' + mesh._id + '\")\'>' + "ajoute un" + '</a>'; }
1744 + }
1745 + r += '.</i></div></td>';
1746 + current = mesh._id;
1747 + count++;
1748 + }
1749 + }
1750 + }
1751 + }
1752 + r += '</tr></table><div style=height:1px></div>'; // This height of 1 div fixes a problem in Linux firefox browsers
1753 +
1754 + // Add a "Add Device Group" option
1755 + r += '<div style=border-top-style:solid;border-top-width:1px;border-top-color:#DDDDDD;cursor:pointer;font-size:10px>';
1756 + if ((view < 3) && (sort == 0) && (meshcount > 0) && ((userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.siteadmin & 64) == 0))) {
1757 + r += '<a href=# onclick="return account_createMesh()" title=\"' + "Create a new group of devices." + '\" style=cursor:pointer>' + "Ajouter un groupe" + '</a>&nbsp';
1758 + }
1759 + if ((userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.siteadmin & 128) == 0)) {
1760 + r += '<a href=# onclick=\'return p10showMeshCmdDialog(0)\' style=cursor:pointer title=\"' + "Download MeshCmd, a command line tool that performs many functions." + '\">' + "MeshCmd" + '</a>&nbsp';
1761 + if (navigator.platform.toLowerCase() == 'win32') { r += '<a href=# onclick=\'return p10showMeshRouterDialog()\' style=cursor:pointer title=\"' + "Download MeshCentral Router, a TCP port mapping tool." + '\">' + "Router" + '</a>&nbsp'; }
1762 + }
1763 + r += '</div><br/>';
1764 +
1765 + QH('xdevices', r);
1766 + deviceHeaderSet();
1767 +
1768 + // Re-check nodeid's
1769 + var elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = 0;
1770 + if (checkedNodeids) { for (var i=0;i<elements.length;i++) { elements[i].checked = (checkedNodeids.indexOf(elements[i].value) >= 0); } }
1771 +
1772 + for (var i in deviceHeaders) { QH(i, deviceHeaders[i]); }
1773 + for (var i in deviceHeadersTitles) { Q(i).title = deviceHeadersTitles[i]; }
1774 + p1updateInfo();
1775 +
1776 + // Take care of KVM surfaces in desktop view mode
1777 + if (view == 3) {
1778 + // Figure out and adjust the size to fill the width of the div
1779 + var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex];
1780 + //var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw);
1781 + var realw = vsize.x + 2, tw = totalDeviceViewWidth - 5, xw = Math.floor(tw / realw);
1782 + xw = realw + Math.floor((tw - (xw * realw)) / xw);
1783 + vsize.y = vsize.y * (xw / vsize.x);
1784 + vsize.x = xw;
1785 +
1786 + for (var i in multiDesktop) { multiDesktop[i].xxdelete = true; }
1787 + for (var i in kvmDivs) {
1788 + var id = kvmDivs[i], shortid = id.split('/')[2], desk = multiDesktop[id];
1789 + if (desk != null) {
1790 + // This device already has a canvas, use it.
1791 + desk.m.CanvasId.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px');
1792 + Q('xkvmid_' + shortid).appendChild(desk.m.CanvasId);
1793 + delete desk.xxdelete;
1794 + QH('skvmid_' + shortid, ["Disconnected", "Connecting...", "Setup...", '', ''][((desk.m.State == null)?desk.m.state:desk.m.State)]);
1795 + } else {
1796 + var node = getNodeFromId(id);
1797 + if ((desktopNode == node) && (desktop != null)) { // Check if the main desktop is this device, if it is, use that.
1798 + // This device already has a canvas, use it.
1799 + var c = desktop.m.CanvasId;
1800 + c.setAttribute('id', 'kvmid_' + shortid);
1801 + c.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px');
1802 + c.setAttribute('onclick', 'toggleKvmDevice(\'' + id + '\')');
1803 + c.removeAttribute('onmousedown');
1804 + c.removeAttribute('onmouseup');
1805 + c.removeAttribute('onmousemove');
1806 + Q('xkvmid_' + shortid).appendChild(c);
1807 + QH('skvmid_' + shortid, ["Disconnected", "Connecting...", "Setup...", '', ''][((desktop.m.State == null)?desktop.m.state:desktop.m.State)]);
1808 + if (desktop.m.SendCompressionLevel) { desktop.m.SendCompressionLevel(1, multidesktopsettings.quality, multidesktopsettings.scaling, multidesktopsettings.framerate); }
1809 + desktop.shortid = shortid;
1810 + desktop.onStateChanged = onMultiDesktopStateChange;
1811 + multiDesktop[id] = desktop;
1812 + desktop = desktopNode = currentNode = null;
1813 + // Setup a replacement desktop
1814 + QH('DeskParent', '<canvas id="Desk" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');
1815 + } else {
1816 + // This is a new device, create a canvas for it.
1817 + var c = document.createElement('canvas');
1818 + c.setAttribute('id', 'kvmid_' + shortid);
1819 + c.setAttribute('width', 640);
1820 + c.setAttribute('height', 480);
1821 + c.setAttribute('oncontextmenu', 'return false');
1822 + c.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px');
1823 + c.setAttribute('onclick', 'toggleKvmDevice(\'' + id + '\')');
1824 + try { Q('xkvmid_' + shortid).appendChild(c); } catch (ex) {}
1825 + // Check if we need to auto-connect
1826 + if (Q('autoConnectDesktopCheckbox').checked == true) { setTimeout(function() { connectMultiDesktop(node, 1); }, 100); }
1827 + }
1828 + }
1829 + }
1830 + for (var i in multiDesktop) {
1831 + // If a device is no longer viewed, disconnect it.
1832 + if (multiDesktop[i].xxdelete == true) { multiDesktop[i].Stop(); delete multiDesktop[i]; }
1833 + else if (debugmode && multiDesktop[i].m && multiDesktop[i].m.onScreenSizeChange) {
1834 + mdeskAdjust(multiDesktop[i].m, multiDesktop[i].m.ScreenWidth, multiDesktop[i].m.ScreenHeight, multiDesktop[i].m.CanvasId); // Adjust screen size change
1835 + }
1836 + }
1837 + deskAdjust();
1838 + } else {
1839 + disconnectAllKvmFunction();
1840 + Q('autoConnectDesktopCheckbox').checked = false;
1841 + }
1842 + }
1843 + oldviewmode = view;
1844 + }
1845 +
1846 + function toggleKvmDevice(nodeid) {
1847 + var node = getNodeFromId(nodeid), mesh = meshes[node.meshid], meshrights = mesh.links[userinfo._id].rights;
1848 + if ((meshrights & 8) || (meshrights & 256)) { // Requires remote control rights or desktop view only rights
1849 + //var conn = 0;
1850 + //if ((node.conn & 1) != 0) { conn = 1; } else if ((node.conn & 6) != 0) { conn = 2; } // Check what type of connect we can do (Agent vs AMT)
1851 + if (node.conn & 1) { connectMultiDesktop(node, 1); }
1852 + }
1853 + }
1854 +
1855 + function getUserShortStr(node) {
1856 + if (node == null || node.users == null || node.users.length == 0) return '';
1857 + if (node.users.length > 1) { return '<span title="' + EscapeHtml(node.users.join(', ')) + '">' + nobreak(format("{0} users", node.users.length)) + '</span>'; }
1858 + var u = node.users[0], su = u, i = u.indexOf('\\');
1859 + if (i > 0) { su = u.substring(i + 1); }
1860 + su = EscapeHtml(su);
1861 + if (su.length > 15) { su = su.substring(0, 14) + '&#8230;'; }
1862 + return '<span title="' + EscapeHtml(u) + '">' + su + '</span>';
1863 + }
1864 +
1865 + function autoConnectDesktops() { if (Q('autoConnectDesktopCheckbox').checked == true) { connectAllKvmFunction(); } }
1866 + function connectAllKvmFunction() { for (var i in nodes) { if (multiDesktop[nodes[i]._id] == null) { toggleKvmDevice(nodes[i]._id); } } }
1867 + function disconnectAllKvmFunction() { for (var nodeid in multiDesktop) { multiDesktop[nodeid].Stop(); } multiDesktop = {}; }
1868 + function onMultiDesktopStateChange(desk, state) { try { QH('skvmid_' + desk.shortid, ["Disconnected", "Connecting...", "Setup...", '', ''][state]); } catch (ex) {} }
1869 +
1870 + function showMultiDesktopSettings() {
1871 + QV('d7amtkvm', false);
1872 + QV('d7meshkvm', true);
1873 + d7bitmapquality.value = multidesktopsettings.quality;
1874 + d7bitmapscaling.value = multidesktopsettings.scaling;
1875 + if (multidesktopsettings.framerate) { d7framelimiter.value = multidesktopsettings.framerate; } else { d7framelimiter.value = 1000; }
1876 + setDialogMode(7, "Remote Desktop Settings", 3, showMultiDesktopSettingsChanged);
1877 + }
1878 +
1879 + function showMultiDesktopSettingsChanged() {
1880 + multidesktopsettings.quality = d7bitmapquality.value;
1881 + multidesktopsettings.scaling = d7bitmapscaling.value;
1882 + multidesktopsettings.framerate = d7framelimiter.value;
1883 + localStorage.setItem('multidesktopsettings', JSON.stringify(multidesktopsettings));
1884 + // Make changes to all current connections
1885 + for (var i in multiDesktop) { multiDesktop[i].m.SendCompressionLevel(1, multidesktopsettings.quality, multidesktopsettings.scaling, multidesktopsettings.framerate); }
1886 + }
1887 +
1888 + function connectMultiDesktop(node, contype) {
1889 + var nodeid = node._id, shortid = nodeid.split('/')[2];
1890 + var desk = multiDesktop[nodeid];
1891 + if (desk == null) {
1892 + if (Q('kvmid_' + shortid) == null) return; // Check if this device is being displayed, if not, exit now.
1893 + if (contype == 2) {
1894 + // Setup the Intel AMT remote desktop
1895 + if ((node.intelamt.user == null) || (node.intelamt.user == '')) { return; }
1896 + desk = CreateAmtRedirect(CreateAmtRemoteDesktop('kvmid_' + shortid), authCookie);
1897 + desk.shortid = shortid;
1898 + //desk.debugmode = debugmode;
1899 + desk.onStateChanged = onMultiDesktopStateChange;
1900 + desk.m.bpp = 1;
1901 + desk.m.useZRLE = true;
1902 + desk.m.showmouse = true;
1903 + desk.m.onKvmData = function (data) { console.log('KVM Data received in multi-desktop mode, this is not supported.'); }; // KVM Data Channel not supported in multi-desktop right now.
1904 + //desk.m.onScreenSizeChange = deskAdjust;
1905 + if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust
1906 + desk.Start(nodeid, 16994, '*', '*', 0);
1907 + desk.contype = 2;
1908 + multiDesktop[nodeid] = desk;
1909 + } else if (contype == 1) {
1910 + // Setup the Mesh Agent remote desktop
1911 + desk = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('kvmid_' + shortid), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
1912 + desk.shortid = shortid;
1913 + desk.attemptWebRTC = attemptWebRTC;
1914 + desk.onStateChanged = onMultiDesktopStateChange;
1915 + //desk.onConsoleMessageChange = function () { console.log('CONSOLEMSG:', desk.consoleMessage); }
1916 + desk.m.CompressionLevel = multidesktopsettings.quality;
1917 + desk.m.ScalingLevel = multidesktopsettings.scaling;
1918 + desk.m.FrameRateTimer = multidesktopsettings.framerate;
1919 + //desk.m.onDisplayinfo = deskDisplayInfo;
1920 + //desk.m.onScreenSizeChange = deskAdjust;
1921 + if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust
1922 + desk.Start(nodeid);
1923 + desk.contype = 1;
1924 + multiDesktop[nodeid] = desk;
1925 + }
1926 + } else {
1927 + // Disconnect and clean up the remote desktop
1928 + desk.Stop();
1929 + delete multiDesktop[nodeid];
1930 + }
1931 + }
1932 +
1933 + function getMeshActions(mesh, meshrights) {
1934 + if ((meshrights & 4) == 0) return '';
1935 + var r = '';
1936 + if ((features & 1024) == 0) { // If CIRA is allowed
1937 + r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Add a new Intel&reg; AMT computer that is located on the internet." + '\" onclick=\'return addCiraDeviceToMesh(\"' + mesh._id + '\")\'>' + "Ajouter CIRA" + '</a>';
1938 + }
1939 + if (mesh.mtype == 1) {
1940 + if ((features & 1) == 0) { // If not WAN-Only
1941 + r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Add a new Intel&reg; AMT computer that is located on the local network." + '\" onclick=\'return addDeviceToMesh(\"' + mesh._id + '\")\'>' + "Add Local" + '</a>';
1942 + r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Add a new Intel&reg; AMT computer by scanning the local network." + '\" onclick=\'return addAmtScanToMesh(\"' + mesh._id + '\")\'>' + "Scan Network" + '</a>';
1943 + }
1944 + if (mesh.amt && (mesh.amt.type == 2)) { // CCM activation
1945 + r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Perform Intel AMT client control mode (CCM) activation." + '\" onclick=\'return showCcmActivation(\"' + mesh._id + '\")\'>' + "Activation" + '</a>';
1946 + } else if (mesh.amt && (mesh.amt.type == 3) && ((features & 0x00100000) != 0)) { // ACM activation
1947 + r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Perform Intel AMT admin control mode (ACM) activation." + '\" onclick=\'return showAcmActivation(\"' + mesh._id + '\")\'>' + "Activation" + '</a>';
1948 + }
1949 + }
1950 + if (mesh.mtype == 2) {
1951 + r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Add a new computer to this mesh by installing the mesh agent." + '\" onclick=\'return addAgentToMesh(\"' + mesh._id + '\")\'>' + "Ajouter un agent" + '</a>';
1952 + if ((features & 2) == 0) { r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Invitez quelqu'un à installer l'agent de maillage sur ce maillage." + '\" onclick=\'return inviteAgentToMesh(\"' + mesh._id + '\")\'>' + "Inviter" + '</a>'; }
1953 + }
1954 + return r;
1955 + }
1956 +
1957 + function addDeviceToMesh(meshid) {
1958 + if (xxdialogMode) return false;
1959 + var mesh = meshes[meshid];
1960 + var x = format("Add a new Intel&reg; AMT device to device group \"{0}\".", EscapeHtml(mesh.name)) + '<br /><br />';
1961 + x += addHtmlValue("Device Name", '<input id=dp1devicename style=width:230px maxlength=32 autocomplete=off onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
1962 + x += addHtmlValue("Hostname", '<input id=dp1hostname style=width:230px maxlength=32 autocomplete=off placeholder=\"' + "Identique au nom de l'appareil" + '\" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
1963 + x += addHtmlValue("Nom d'utilisateur", '<input id=dp1username style=width:230px maxlength=32 autocomplete=off placeholder=\"' + "admin" + '\" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
1964 + x += addHtmlValue("Mot de passe", '<input id=dp1password type=password style=width:230px autocomplete=off maxlength=32 onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
1965 + x += addHtmlValue("Sécurité", '<select id=dp1tls style=width:236px><option value=0>' + "No TLS security" + '</option><option value=1>' + "Sécurité TLS requise" + '</option></select>');
1966 + setDialogMode(2, "Add Intel&reg; AMT device", 3, addDeviceToMeshEx, x, meshid);
1967 + validateDeviceToMesh();
1968 + Q('dp1devicename').focus();
1969 + return false;
1970 + }
1971 +
1972 + // Intel AMT CCM Activation
1973 + function showCcmActivation(meshid) {
1974 + if (xxdialogMode) return false;
1975 + var servername = serverinfo.name, mesh = meshes[meshid];
1976 + if ((servername.indexOf('.') == -1) || ((features & 2) != 0)) { servername = window.location.hostname; } // If the server name is not set or it's in LAN-only mode, use the URL hostname as server name.
1977 + var url, domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
1978 + if (serverinfo.https == true) {
1979 + var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
1980 + url = 'wss://' + servername + portStr + domainUrl;
1981 + } else {
1982 + var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port);
1983 + url = 'ws://' + servername + portStr + domainUrl;
1984 + }
1985 + var x = format("Perform Intel AMT client control mode (CCM) activation to group \"{0}\" by downloading the MeshCMD tool and running it like this:", EscapeHtml(mesh.name)) + '<br /><br />';
1986 + x += '<textarea readonly=readonly style=width:100%;resize:none;height:100px;overflow:auto;font-size:12px readonly>meshcmd amtccm --url ' + url + 'amtactivate?id=' + meshid.split('/')[2] + ' --serverhttpshash ' + serverinfo.tlshash + '</textarea>';
1987 + setDialogMode(2, "Intel&reg; AMT activation", 9, null, x);
1988 + Q('idx_dlgOkButton').focus();
1989 + return false;
1990 + }
1991 +
1992 + // Intel AMT ACM Activation
1993 + function showAcmActivation(meshid) {
1994 + if (xxdialogMode) return false;
1995 + var servername = serverinfo.name, mesh = meshes[meshid];
1996 + if ((servername.indexOf('.') == -1) || ((features & 2) != 0)) { servername = window.location.hostname; } // If the server name is not set or it's in LAN-only mode, use the URL hostname as server name.
1997 + var url, domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
1998 + if (serverinfo.https == true) {
1999 + var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
2000 + url = 'wss://' + servername + portStr + domainUrl;
2001 + } else {
2002 + var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port);
2003 + url = 'ws://' + servername + portStr + domainUrl;
2004 + }
2005 + var x = format("Perform Intel AMT admin control mode (ACM) activation to group \"{0}\" by downloading the MeshCMD tool and running it like this:", EscapeHtml(mesh.name)) + '<br /><br />';
2006 + x += '<textarea readonly=readonly style=width:100%;resize:none;height:100px;overflow:auto;font-size:12px readonly>meshcmd amtacm --url ' + url + 'amtactivate?id=' + meshid.split('/')[2] + ' --serverhttpshash ' + serverinfo.tlshash + '</textarea>';
2007 + if (serverinfo.amtAcmFqdn != null) {
2008 + x += ('<div style=margin-top:8px>' + "Intel AMT will need to be set with a Trusted FQDN in MEBx or have a wired LAN on the network:" + ' <b>' + serverinfo.amtAcmFqdn.join(', ') + '</b></div>');
2009 + }
2010 + setDialogMode(2, "Intel&reg; AMT activation", 9, null, x);
2011 + Q('idx_dlgOkButton').focus();
2012 + return false;
2013 + }
2014 +
2015 + // Display the Intel AMT scanning dialog box
2016 + function addAmtScanToMesh(meshid) {
2017 + if (xxdialogMode) return false;
2018 + var x = "Enter a range of IP addresses to scan for Intel AMT devices." + '<br /><br />';
2019 + x += addHtmlValue("IP Range", '<input id=dp1range style=width:184px value="192.168.1.0/24" onkeyup=addAmtScanToMeshKeyUp(event) /><input id=dp1rangebutton type=button value=\"' + "Analyse" + '\" onclick=addAmtScanToMeshButton()></input>');
2020 + x += '<div id=dp1results style="width:100%;height:200px;background-color:white;border:1px gray solid;overflow-y:scroll"></div>';
2021 + setDialogMode(2, "Scan for Intel&reg; AMT devices", 3, addAmtScanToMeshEx, x, meshid);
2022 + QE('idx_dlgOkButton', false);
2023 + QH('dp1results', '<div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>');
2024 + focusTextBox('dp1range');
2025 + return false;
2026 + }
2027 +
2028 + function addAmtScanToMeshKeyUp(e) {
2029 + if (e.keyCode == 13) { haltEvent(e); addAmtScanToMeshButton(); }
2030 + }
2031 +
2032 + // Called when OK is pressed on the Intel AMT scanning box
2033 + function addAmtScanToMeshEx(button, meshid) {
2034 + var elements = document.getElementsByClassName('DevScanCheckbox'), checkcount = 0;
2035 + for (var i=0;i<elements.length;i++) {
2036 + if (elements[i].checked) {
2037 + var ipaddr = elements[i].getAttribute('tag');
2038 + var amtinfo = amtScanResults[ipaddr];
2039 + meshserver.send({ action: 'addamtdevice', meshid: meshid, devicename: ipaddr, hostname: amtinfo.hostname, amtusername: '', amtpassword: '', amttls: amtinfo.tls });
2040 + }
2041 + }
2042 + }
2043 +
2044 + // If the user presses the "Scan" button on the Intel AMT scanning dialog box, start a scan.
2045 + function addAmtScanToMeshButton() {
2046 + QE('dp1range', false);
2047 + QE('dp1rangebutton', false);
2048 + QH('dp1results', '<div style=width:100%;text-align:center;margin-top:12px>' + "Balayage..." + '</div>');
2049 + meshserver.send({ action: 'scanamtdevice', range: Q('dp1range').value });
2050 + }
2051 +
2052 + // Called when a scanned computer is checked or unchecked.
2053 + function addAmtScanToMeshCheckbox() {
2054 + var elements = document.getElementsByClassName('DevScanCheckbox'), checkcount = 0;
2055 + for (var i=0;i<elements.length;i++) { if (elements[i].checked) checkcount++; }
2056 + QE('idx_dlgOkButton', checkcount > 0);
2057 + }
2058 +
2059 + function addCiraDeviceToMesh(meshid) {
2060 + if (xxdialogMode) return false;
2061 + var mesh = meshes[meshid];
2062 +
2063 + // Replace non alphabetic characters (@ and $) with 'X' because MPS username cannot accept it.
2064 + var meshidx = meshid.split('/')[2].replace(/\@/g, 'X').replace(/\$/g, 'X');
2065 +
2066 + var y = '<select id=dlgAddCiraSel onclick=dlgAddCiraSelClick() style=width:230px><option value=0>' + "MeshCommander Script" + '</option><option value=1>' + "Nom d'utilisateur / mot de passe manuel" + '</option>';
2067 + if ((features & 16) == 0) { y += ('<option value=2>' + "Certificat manuel" + '</option></select>'); } // Only display this option if Intel AMT CIRA with Mutual-Auth is allowed.
2068 +
2069 + var x = '';
2070 + x += addHtmlValue("Setup Method", y);
2071 + x += '<hr>';
2072 +
2073 + // Setup CIRA using a MeshCommander script (Pretty Simple)
2074 + x += '<div id=dlgAddCira0>' + format("To add a new Intel&reg; AMT device to device group \"{0}\" with CIRA, download the following script files and use <a href='http://meshcommander.com' rel='noreferrer noopener' target='_blank'>MeshCommander</a> to run the script to configure computers.", EscapeHtml(mesh.name)) + '<br /><br />';
2075 + //x += addHtmlValue('Setup CIRA', '<a href="mescript.ashx?type=1&meshid=' + meshidx.substring(0, 16) + '" download>cira_setup.mescript</a>');
2076 + x += addHtmlValue("Setup CIRA", '<a href="mescript.ashx?type=1&meshid=' + meshid + '" download>cira_setup.mescript</a>');
2077 + x += addHtmlValue("Cleanup CIRA", '<a href="mescript.ashx?type=2" download>cira_clean.mescript</a>');
2078 + x += '</div>';
2079 +
2080 + // Setup CIRA with user/pass authentication (Somewhat difficult)
2081 + x += '<div id=dlgAddCira1 style=display:none>' + format("To add a new Intel&reg; AMT device to device group \"{0}\" with CIRA, load the following certificate as trusted root within Intel AMT", EscapeHtml(mesh.name));
2082 + if (serverinfo.mpspass) { x += ("et authentifiez-vous sur le serveur en utilisant ce nom d'utilisateur et mot de passe." + '<br /><br />'); } else { x += ("et vous authentifier sur le serveur en utilisant ce nom d'utilisateur et n'importe quel mot de passe." + '<br /><br />'); }
2083 + x += addHtmlValue("Root Certificate", '<a href=\"' + "MeshServerRootCert.cer" + '\" download>' + "Root Certificate File" + '</a>');
2084 + x += addHtmlValue("Nom d'utilisateur", '<input style=width:230px readonly value="' + meshidx.substring(0, 16) + '" />');
2085 + if (serverinfo.mpspass) { x += addHtmlValue("Mot de passe", '<input style=width:230px readonly value="' + EscapeHtml(serverinfo.mpspass) + '" />'); }
2086 + if (serverinfo != null) { x += addHtmlValue("MPS Server", '<input style=width:230px readonly value="' + EscapeHtml(serverinfo.mpsname) + ':' + serverinfo.mpsport + '" />'); }
2087 + x += '</div>';
2088 +
2089 + // Setup CIRA with certificate authentication (Really difficult, only if TLS offload is not used)
2090 + if ((features & 16) == 0) {
2091 + x += '<div id=dlgAddCira2 style=display:none>' + format("To add a new Intel&reg; AMT device to device group \"{0}\" with CIRA, load the following certificate as trusted root within Intel AMT, authenticate using a client certificate with the following common name and connect to the following server.", EscapeHtml(mesh.name)) + '<br /><br />';
2092 + x += addHtmlValue("Root Certificate", '<a href="MeshServerRootCert.cer" download>' + "Root Certificate File" + '</a>');
2093 + x += addHtmlValue("Organisation", '<input style=width:230px readonly value="' + meshidx + '" />');
2094 + if (serverinfo != null) { x += addHtmlValue("MPS Server", '<input style=width:230px readonly value="' + EscapeHtml(serverinfo.mpsname) + ':' + serverinfo.mpsport + '" />'); }
2095 + x += '</div>';
2096 + }
2097 +
2098 + setDialogMode(2, "Add Intel&reg; AMT CIRA device", 2, null, x, 'fileDownload');
2099 + Q('dlgAddCiraSel').focus();
2100 + return false;
2101 + }
2102 +
2103 + function dlgAddCiraSelClick() {
2104 + var val = Q('dlgAddCiraSel').value;
2105 + QV('dlgAddCira0', val == 0);
2106 + QV('dlgAddCira1', val == 1);
2107 + QV('dlgAddCira2', val == 2);
2108 + }
2109 +
2110 + // Return true is the input string looks like an email address
2111 + function checkEmail(str) {
2112 + var x = str.split('@');
2113 + var ok = ((x.length == 2) && (x[0].length > 0) && (x[1].split('.').length > 1) && (x[1].length > 2));
2114 + if (ok == true) { var y = x[1].split('.'); for (var i in y) { if (y[i].length == 0) { ok = false; } } }
2115 + return ok;
2116 + }
2117 +
2118 + function inviteAgentToMesh(meshid) {
2119 + if (xxdialogMode) return false;
2120 + var x = '', mesh = meshes[meshid];
2121 + if (features & 64) {
2122 + x += addHtmlValue("Type d'invitation", '<select id=d2InviteType onchange=d2ChangedInviteType() style=width:236px><option value=0>Link invitation</option><option value=1>Email invitation</option></select>') + '<hr />';
2123 + x += '<div id=emailInviteDiv style=display:none>' + format("Invitez quelqu'un à installer l'agent de maillage. Un email doit être envoyé avec le lien vers l’installation de l’agent de maillage pour le groupe de périphériques \"{0}\".", EscapeHtml(mesh.name)) + '<br /><br />';
2124 + x += addHtmlValue("Nom: (optionnel)", '<input id=agentInviteName value="" style=width:230px maxlength=64 />');
2125 + x += addHtmlValue("Email", '<input id=agentInviteEmail style=width:230px placeholder=\"' + "example@email.com" + '\" onkeyup=validateAgentInvite()></input>');
2126 + x += addHtmlValue("Système opérateur", '<select id=agentInviteNameOs onchange=d2ChangedInviteType() style=width:236px><option value=4>' + "Send installation link" + '</option><option value=0 selected>' + "Any supported" + '</option><option value=1>' + "Windows only" + '</option><option value=3>' + "Apple MacOS only" + '</option><option value=2>' + "Linux only" + '</option></select>');
2127 + x += '<div id=d2agentexpirediv>';
2128 + x += addHtmlValue("Link Expiration", '<select id=agentInviteExpire style=width:236px><option value=1>' + "1 heure" + '</option><option value=8>' + "8 heures" + '</option><option value=24>' + "1 jour" + '</option><option value=168>' + "1 semaine" + '</option><option value=5040>' + "1 mois" + '</option><option value=0>' + "Illimité" + '</option></select>');
2129 + x += '</div>';
2130 + x += addHtmlValue("Installation Type", '<select id=agentInviteType style=width:236px><option value=0>' + "Background and interactive" + '</option><option value=2>' + "Background only" + '</option><option value=1>' + "Interactive only" + '</option></select>');
2131 + x += addHtmlValue("Message" + '<br />' + "(optional)", '<textarea id=agentInviteMessage value="" style=width:230px;height:100px;resize:none maxlength=1024 /></textarea>');
2132 + x += '</div>';
2133 + }
2134 + x += '<div id=urlInviteDiv>' + format("Invitez quelqu'un à installer l'agent de maillage en partageant un lien d'invitation. Ce lien renvoie l'utilisateur aux instructions d'installation du groupe de périphériques \"{0}\". Le lien est public et aucun compte n'est requis pour ce serveur.", EscapeHtml(mesh.name)) + '<br /><br />';
2135 + x += addHtmlValue("Link Expiration", '<select id=d2inviteExpire style=width:236px onchange=d2RequestInvitationLink()><option value=1>' + "1 heure" + '</option><option value=8>' + "8 heures" + '</option><option value=24>' + "1 jour" + '</option><option value=168>' + "1 semaine" + '</option><option value=5040>' + "1 mois" + '</option><option value=0>' + "Illimité" + '</option></select>');
2136 + x += '<div id=agentInvitationLinkDiv style="text-align:center;font-size:large;margin:16px;display:none"><a href=# id=agentInvitationLink target="_blank" style=cursor:pointer></a> <img src=images/link4.png height=10 width=10 title=\"' + "Copy link to clipboard" + '\" style=cursor:pointer onclick=d2CopyInviteToClip()></div></div>';
2137 + setDialogMode(2, "Inviter", 3, performAgentInvite, x, meshid);
2138 + if (features & 64) { Q('d2InviteType').focus(); d2ChangedInviteType(); } else { Q('d2inviteExpire').focus(); validateAgentInvite(); }
2139 + d2RequestInvitationLink();
2140 + return false;
2141 + }
2142 +
2143 + function d2RequestInvitationLink() {
2144 + meshserver.send({ action: 'createInviteLink', meshid: xxdialogTag, expire: parseInt(Q('d2inviteExpire').value), flags: 0 });
2145 + }
2146 +
2147 + function d2ChangedInviteType() {
2148 + QV('urlInviteDiv', Q('d2InviteType').value == 0);
2149 + QV('d2agentexpirediv', Q('agentInviteNameOs').value == 4);
2150 + QV('emailInviteDiv', Q('d2InviteType').value == 1);
2151 + validateAgentInvite();
2152 + }
2153 +
2154 + function d2CopyInviteToClip() { copyTextToClip(Q('agentInvitationLink').href); }
2155 +
2156 + function validateAgentInvite() {
2157 + if ((features & 64) && (Q('d2InviteType').value == 1)) {
2158 + QE('idx_dlgOkButton', checkEmail(Q('agentInviteEmail').value));
2159 + QV('idx_dlgCancelButton', true);
2160 + } else {
2161 + QE('idx_dlgOkButton', true);
2162 + QV('idx_dlgCancelButton', false);
2163 + }
2164 + }
2165 +
2166 + function performAgentInvite(button, meshid) {
2167 + if ((features & 64) && (Q('d2InviteType').value == 1)) {
2168 + meshserver.send({ action: 'inviteAgent', meshid: meshid, email: Q('agentInviteEmail').value, name: Q('agentInviteName').value, os: Q('agentInviteNameOs').value, flags: Q('agentInviteType').value, msg: Q('agentInviteMessage').value, expire: parseInt(Q('agentInviteExpire').value) });
2169 + }
2170 + }
2171 +
2172 + function addAgentToMesh(meshid) {
2173 + if (xxdialogMode) return false;
2174 + var mesh = meshes[meshid], x = '', installType = 0;
2175 + x += addHtmlValue("Système opérateur", '<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>' + "Windows" + '</option><option value=1>' + "Linux / BSD" + '</option><option value=2>' + "Apple MacOS" + '</option><option value=3>' + "Windows (UnInstall)" + '</option><option value=4>' + "Linux / BSD (UnInstall)" + '</option></select>');
2176 + x += '<div id=aginsTypeDiv>';
2177 + x += addHtmlValue("Installation Type", '<select id=aginsType onchange=addAgentToMeshClick() style=width:236px><option value=0>' + "Background & interactive" + '</option><option value=2>' + "Background only" + '</option><option value=1>' + "Interactive only" + '</option></select>');
2178 + x += '</div><hr>';
2179 +
2180 + // \/:*?"<>|
2181 + var meshfilename = mesh.name
2182 + meshfilename = meshfilename.split('\\').join('').split('/').join('').split(':').join('').split('*').join('').split('?').join('').split('"').join('').split('<').join('').split('>').join('').split('|').join('').split(' ').join('').split('\'').join('');
2183 +
2184 + // Windows agent install
2185 + //x += "<div id=agins_windows>To add a new computer to device group \"" + EscapeHtml(mesh.name) + "\", download the mesh agent and configuration file and install the agent on the computer to manage.<br /><br />";
2186 + x += '<div id=agins_windows>' + format("To add a new computer to device group \"{0}\", download the mesh agent and install it the computer to manage. This agent has server and device group information embedded within it.", EscapeHtml(mesh.name)) + '<br /><br />';
2187 + x += addHtmlValue("Mesh Agent", '<a id=aginsw32lnk href="meshagents?id=3&meshid=' + meshid.split('/')[2] + '&installflags=0" download onclick="setDialogMode(0)" title=\"' + "32bit version of the MeshAgent" + '\">' + "Windows (.exe)" + '</a> <img src=images/link4.png height=10 width=10 title="Copy Windows 32bit agent URL to clipboard" style=cursor:pointer onclick=copyAgentUrl("meshagents?id=3&meshid=' + meshid.split('/')[2] + '&installflags=",1)>');
2188 + x += addHtmlValue("Mesh Agent", '<a id=aginsw64lnk href="meshagents?id=4&meshid=' + meshid.split('/')[2] + '&installflags=0" download onclick="setDialogMode(0)" title=\"' + "64bit version of the MeshAgent" + '\">' + "Windows x64 (.exe)" + '</a> <img src=images/link4.png height=10 width=10 title="Copy Windows 64bit agent URL to clipboard" style=cursor:pointer onclick=copyAgentUrl("meshagents?id=4&meshid=' + meshid.split('/')[2] + '&installflags=",1)>');
2189 + if (debugmode > 0) { x += addHtmlValue("Settings File", '<a id=aginswmshlnk href="meshsettings?id=' + meshid.split('/')[2] + '&installflags=0" rel="noreferrer noopener" target="_blank">' + format("{0} settings (.msh)", EscapeHtml(mesh.name)) + '</a>'); }
2190 + x += '</div>';
2191 +
2192 + // Linux agent install
2193 + x += '<div id=agins_linux style=display:none>' + format("To add a computer to {0} run the following command. Root credentials will be needed.", EscapeHtml(mesh.name)) + '<br />';
2194 + x += '<textarea id=agins_linux_area rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>';
2195 + x += '<div style=\'font-size:x-small\'>' + "* For BSD, run \"pkg install wget sudo bash\" first." + '</div></div>';
2196 +
2197 + // MacOS agent install
2198 + x += '<div id=agins_osx style=display:none>' + format("To add a new computer to device group \"{0}\", download the mesh agent and install it the computer to manage. This agent installer has server and device group information embedded within it.", EscapeHtml(mesh.name)) + '<br /><br />';
2199 + x += addHtmlValue("Mesh Agent", '<a href="meshosxagent?id=16&meshid=' + meshid.split('/')[2] + '" rel="noreferrer noopener" target="_blank" title="64bit version of MacOS Mesh Agent">MacOS Agent (64bit)</a> <img src=images/link4.png height=10 width=10 title="' + "Copy MacOS agent URL to clipboard" + '" style=cursor:pointer onclick=copyAgentUrl("meshosxagent?id=16&meshid=' + meshid.split('/')[2] + '",0)>');
2200 + x += '</div>';
2201 +
2202 + // Windows agent uninstall
2203 + x += '<div id=agins_windows_un style=display:none>' + "To remove a mesh agent, download the file below, run it and click \"uninstall\"." + '<br /><br />';
2204 + x += addHtmlValue("Mesh Agent", '<a href="meshagents?id=3" download onclick="setDialogMode(0)" title="' + "32bit version of the MeshAgent" + '">' + "Windows (.exe)" + '</a>');
2205 + x += addHtmlValue("Mesh Agent", '<a href="meshagents?id=4" download onclick="setDialogMode(0)" title="' + "64bit version of the MeshAgent" + '">' + "Windows x64 (.exe)" + '</a>');
2206 + x += '</div>';
2207 +
2208 + // Linux agent uninstall
2209 + x += '<div id=agins_linux_un style=display:none>' + "To remove a mesh agent, run the following command. Root credentials will be needed." + '<br />';
2210 + x += '<textarea id=agins_linux_area_un rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>';
2211 + x += '</div>';
2212 +
2213 + setDialogMode(2, "Add Mesh Agent", 2, null, x, 'fileDownload');
2214 + var servername = serverinfo.name;
2215 + if ((servername.indexOf('.') == -1) || ((features & 2) != 0)) { servername = window.location.hostname; } // If the server name is not set or it's in LAN-only mode, use the URL hostname as server name.
2216 + var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
2217 +
2218 + if (serverinfo.https == true)
2219 + {
2220 + var portStr = (serverinfo.port == 443)?'':(':' + serverinfo.port);
2221 + if ((features & 0x2000) == 0)
2222 + {
2223 + Q('agins_linux_area').value = '(wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
2224 + Q('agins_linux_area_un').value = '(wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
2225 + }
2226 + else
2227 + {
2228 + // Server asked that agent be installed to preferably not use a HTTP proxy.
2229 + Q('agins_linux_area').value = 'wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
2230 + Q('agins_linux_area_un').value = 'wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
2231 + }
2232 + }
2233 + else
2234 + {
2235 + var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port);
2236 + if ((features & 0x2000) == 0)
2237 + {
2238 + Q('agins_linux_area').value = '(wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 -O ./meshinstall.sh || wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
2239 + Q('agins_linux_area_un').value = '(wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 -O ./meshinstall.sh || wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
2240 + }
2241 + else
2242 + {
2243 + // Server asked that agent be installed to preferably not use a HTTP proxy.
2244 + Q('agins_linux_area').value = 'wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
2245 + Q('agins_linux_area_un').value = 'wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
2246 + }
2247 + }
2248 + Q('aginsSelect').focus();
2249 + addAgentToMeshClick();
2250 + return false;
2251 + }
2252 +
2253 + function copyAgentUrl(url,addflag) {
2254 + var servername = serverinfo.name;
2255 + if ((servername.indexOf('.') == -1) || ((features & 2) != 0)) { servername = window.location.hostname; } // If the server name is not set or it's in LAN-only mode, use the URL hostname as server name.
2256 + var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
2257 + var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
2258 + var c = 'https://' + servername + portStr + domainUrl + url;
2259 + if (addflag == 1) c += Q('aginsType').value;
2260 + copyTextToClip(c);
2261 + }
2262 +
2263 + function addAgentToMeshClick() {
2264 + var v = Q('aginsSelect').value;
2265 + QV('agins_windows', v == 0);
2266 + QV('agins_linux', v == 1);
2267 + QV('agins_osx', v == 2);
2268 + QV('agins_windows_un', v == 3);
2269 + QV('agins_linux_un', v == 4);
2270 + QV('aginsTypeDiv', v == 0);
2271 +
2272 + // Fix the links if needed
2273 + Q('aginsw32lnk').href = (Q('aginsw32lnk').href.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value;
2274 + Q('aginsw64lnk').href = (Q('aginsw64lnk').href.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value;
2275 + if (debugmode > 0) { Q('aginswmshlnk').href = (Q('aginswmshlnk').href.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value; }
2276 + }
2277 +
2278 + function validateDeviceToMesh() {
2279 + QE('idx_dlgOkButton', (Q('dp1devicename').value.length > 0) && (passwordcheck(Q('dp1password').value)));
2280 + }
2281 +
2282 + function addDeviceToMeshEx(button, meshid) {
2283 + var amtuser = Q('dp1username').value;
2284 + if (amtuser == '') amtuser = 'admin';
2285 + var host = Q('dp1hostname').value;
2286 + if (host == '') host = Q('dp1devicename').value;
2287 + meshserver.send({ action: 'addamtdevice', meshid: meshid, devicename: Q('dp1devicename').value, hostname: host, amtusername: amtuser, amtpassword: Q('dp1password').value, amttls: Q('dp1tls').value });
2288 + }
2289 +
2290 + function deviceHeaderSet() {
2291 + if (deviceHeaderId == 0) { deviceHeaderId = 1; return; }
2292 + deviceHeaders['DevxHeader' + deviceHeaderId] = ((deviceHeaderTotal == 1) ? "1 appareil" : format("{0} appareil", deviceHeaderTotal));
2293 + //var title = '';
2294 + //for (x in deviceHeaderCount) { if (title.length > 0) title += ', '; title += deviceHeaderCount[x] + ' ' + PowerStateStr2(x); }
2295 + //deviceHeadersTitles["DevxHeader" + deviceHeaderId] = title;
2296 + deviceHeaderId++;
2297 + deviceHeaderCount = {};
2298 + deviceHeaderTotal = 0;
2299 + }
2300 +
2301 + var powerStateStrings = ['', '<span title=\"' + "Device is powered on." + '\">' + "Alimenté" + '</span>', '<span title=\"' + "Device is in sleep state (S1)." + '\">' + "Sleeping" + '</span>', '<span title=\"' + "Device is in sleep state (S2)." + '\">' + "Sleeping" + '</span>', '<span title=\"' + "Device is in deep sleep state (S3)." + '\">' + "Deep Sleep" + '</span>', '<span title=\"' + "Device is in hibernating state (S4)." + '\">' + "Hibernating" + '</span>', '<span title=\"' + "Device is in powered off state (S5)." + '\">' + "Soft-Off" + '</span>', '<span title=\"' + "Device is detected but power state could not be obtained." + '\">' + "Présent" + '</span>'];
2302 + var powerStateStrings2 = ['', "Device is powered", "Device is in sleep state (S1)", "Device is in sleep state (S2)", "Device is in deep sleep state (S3)", "Device is hibernating (S4)", "Device is in soft-off state (S5)", "Device is present, but power state cannot be determined"];
2303 + var powerColorTable = ['pwsTransparent', 'pwsBlack', 'pwsBlue', 'pwsBlue2', 'pwsLightblue', 'pwsBlueviolet', 'pwsDarkgreen', 'pwsLightseagreen', 'pwsLightseagreen2'];
2304 + function NodeStateStr(node) {
2305 + var states = [];
2306 + if (node.state > 0 && node.state < powerStatetable.length) state.push(powerStatetable[node.state]);
2307 + if (node.conn) {
2308 + if ((node.conn & 1) != 0) { states.push('<span title=\"' + "Mesh agent is connected and ready for use." + '\">' + "Agent" + '</span>'); }
2309 + if ((node.conn & 2) != 0) { states.push('<span title=\"' + "Intel&reg; AMT CIRA is connected and ready for use." + '\">' + "CIRA" + '</span>'); }
2310 + else if ((node.conn & 4) != 0) { states.push('<span title=\"' + "Intel&reg; AMT is routable." + '\">' + "AMT" + '</span>'); }
2311 + if ((node.conn & 8) != 0) { states.push('<span title=\"' + "Mesh agent is reachable using another agent as relay." + '\">' + "Relay" + '</span>'); }
2312 + if ((node.conn & 16) != 0) { states.push('<span title=\"' + "MQTT connection to the device is active." + '\">' + "MQTT" + '</span>'); }
2313 + }
2314 + if ((node.pwr != null) && (node.pwr != 0)) { states.push(powerStateStrings[node.pwr]); }
2315 + return states.join(', ');
2316 + }
2317 +
2318 + function PowerStateStr(x) {
2319 + if (x < powerStatetable.length) return powerStatetable[x];
2320 + return '';
2321 + }
2322 +
2323 + function PowerStateStr2(x) {
2324 + if ((x != 0) && (x < powerStatetable.length)) return powerStatetable[x];
2325 + return "Inconnue";
2326 + }
2327 +
2328 + function selectallButtonFunction() {
2329 + var elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = 0;
2330 + for (var i=0;i<elements.length;i++) { if (elements[i].checked === true) checkcount++; }
2331 + for (var i=0;i<elements.length;i++) { elements[i].checked = (checkcount == 0); }
2332 + p1updateInfo();
2333 + }
2334 +
2335 + function p1updateInfo() {
2336 + var elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = 0;
2337 + for (var i=0;i<elements.length;i++) { if (elements[i].checked === true) { checkcount++; } }
2338 + if (checkcount > 0) {
2339 + QE('GroupActionButton', true);
2340 + Q('SelectAllButton').value = "Rien sélectionner";
2341 + QV('cxmgroupsplit', true);
2342 + QV('cxmdesktop', true);
2343 + } else {
2344 + QE('GroupActionButton', false);
2345 + Q('SelectAllButton').value = "Tout Sélectionner";
2346 + QV('cxmgroupsplit', false);
2347 + QV('cxmdesktop', false);
2348 + }
2349 + }
2350 +
2351 + function groupActionFunction() {
2352 + var mqttx = '';
2353 + if (features & 0x00400000) { // Check if any of the selected devices have a MQTT connection active
2354 + var nodeids = getCheckedDevices();
2355 + for (var i in nodeids) { if ((getNodeFromId(nodeids[i]).conn & 16) != 0) { mqttx = '<option value=103>' + "Envoyer un Message MQTT" + '</option>'; } }
2356 + }
2357 + var x = "Select an operation to perform on all selected devices. Actions will be performed only with proper rights." + '<br /><br />';
2358 + x += addHtmlValue("Opération", '<select id=d2groupop><option value=100>' + "Wake-up devices" + '</option><option value=4>' + "Sleep devices" + '</option><option value=3>' + "Réinitialiser les appareils" + '</option><option value=2>' + "Éteindre les appareils" + '</option><option value=102>' + "Move to device group" + '</option>' + mqttx + '<option value=101>' + "Delete devices" + '</option></select>');
2359 + setDialogMode(2, "Action de groupe", 3, groupActionFunctionEx, x);
2360 + }
2361 +
2362 + // Get the list of checked devices, removes any duplicates.
2363 + function getCheckedDevices() {
2364 + var nodeids = [], elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
2365 + for (var i=0;i<elements.length;i++) { if (elements[i].checked) { if (elements[i].value) { var nid = elements[i].value.substring(6); if (nodeids.indexOf(nid) == -1) { nodeids.push(nid); } } } }
2366 + return nodeids;
2367 + }
2368 +
2369 + function groupActionFunctionEx() {
2370 + var op = Q('d2groupop').value;
2371 + if (op == 100) {
2372 + // Group wake
2373 + meshserver.send({ action: 'wakedevices', nodeids: getCheckedDevices() });
2374 + } else if (op == 101) {
2375 + // Group delete, ask for confirmation
2376 + var x = "Confirm delete selected devices(s)?" + '<br /><br />';
2377 + x += '<label><input id=d2check type=checkbox onchange=d2groupActionFunctionDelEx() />' + "Confirm" + '</label>';
2378 + setDialogMode(2, "Delete Nodes", 3, groupActionFunctionDelEx, x);
2379 + QE('idx_dlgOkButton', false);
2380 + } else if (op == 102) {
2381 + // Move computers to a different group
2382 + p10showChangeGroupDialog(getCheckedDevices());
2383 + } else if (op == 103) {
2384 + // Send MQTT Message
2385 + p10showSendMqttMsgDialog(getCheckedDevices());
2386 + } else {
2387 + // Power operation
2388 + meshserver.send({ action: 'poweraction', nodeids: getCheckedDevices(), actiontype: parseInt(op) });
2389 + }
2390 + }
2391 +
2392 + function d2groupActionFunctionDelEx() { QE('idx_dlgOkButton', Q('d2check').checked); }
2393 + function groupActionFunctionDelEx() { meshserver.send({ action: 'removedevices', nodeids: getCheckedDevices() }); }
2394 +
2395 + function onSortSelectChange(skipsave) {
2396 + sort = document.getElementById('sortselect').selectedIndex;
2397 + if (!skipsave) { putstore('sort', sort); }
2398 + }
2399 +
2400 + function meshSort(a, b) { if (a.meshnamel > b.meshnamel) return 1; if (a.meshnamel < b.meshnamel) return -1; if (a.meshid == b.meshid) { if (showRealNames == true) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; } else { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; } } return 0; }
2401 + function powerSort(a, b) { var ap = a.pwr?a.pwr:0; var bp = b.pwr?b.pwr:0; if (ap > bp) return -1; if (ap < bp) return 1; if (ap == bp) { if (showRealNames == true) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; } else { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; } } return 0; }
2402 + function deviceSort(a, b) { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; }
2403 + function deviceHostSort(a, b) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; }
2404 + function onSearchFocus(x) { searchFocus = x; }
2405 + function onMapSearchFocus(x) { mapSearchFocus = x; }
2406 + function onUserSearchFocus(x) { userSearchFocus = x; }
2407 + function onConsoleFocus(x) { consoleFocus = x; }
2408 +
2409 + function onSearchInputChanged() {
2410 + var x = Q('SearchInput').value.toLowerCase().trim(); putstore('_search', x);
2411 + var userSearch = null, ipSearch = null, groupSearch = null;
2412 + if (x.startsWith('user:')) { userSearch = x.substring(5); }
2413 + else if (x.startsWith('u:')) { userSearch = x.substring(2); }
2414 + else if (x.startsWith('ip:')) { ipSearch = x.substring(3); }
2415 + else if (x.startsWith('group:')) { groupSearch = x.substring(6); }
2416 + else if (x.startsWith('g:')) { groupSearch = x.substring(2); }
2417 +
2418 + if (x == '') {
2419 + // No search
2420 + for (var d in nodes) { nodes[d].v = true; }
2421 + } else if (ipSearch != null) {
2422 + // IP address search
2423 + for (var d in nodes) { nodes[d].v = ((nodes[d].ip != null) && (nodes[d].ip.indexOf(ipSearch) >= 0)); }
2424 + } else if (groupSearch != null) {
2425 + // Group filter
2426 + for (var d in nodes) { nodes[d].v = (meshes[nodes[d].meshid].name.toLowerCase().indexOf(groupSearch) >= 0); }
2427 + } else if (userSearch != null) {
2428 + // User search
2429 + for (var d in nodes) {
2430 + nodes[d].v = false;
2431 + if (nodes[d].users && nodes[d].users.length > 0) { for (var i in nodes[d].users) { if (nodes[d].users[i].toLowerCase().indexOf(userSearch) >= 0) { nodes[d].v = true; } } }
2432 + }
2433 + } else {
2434 + // Device name search
2435 + try {
2436 + var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
2437 + for (var d in nodes) {
2438 + nodes[d].v = (rx.test(nodes[d].name.toLowerCase())) || (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase()));
2439 + if ((nodes[d].v == false) && nodes[d].tags) {
2440 + for (var s in nodes[d].tags) {
2441 + if (rx.test(nodes[d].tags[s].toLowerCase())) {
2442 + nodes[d].v = true;
2443 + break;
2444 + } else {
2445 + nodes[d].v = false;
2446 + }
2447 + }
2448 + }
2449 + }
2450 + } catch (ex) { for (var d in nodes) { nodes[d].v = true; } }
2451 + }
2452 + }
2453 +
2454 + var contextelement = null;
2455 + function handleContextMenu(event) {
2456 + hideContextMenu();
2457 + var scrollLeft = (window.pageXOffset !== null) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft;
2458 + var scrollTop = (window.pageYOffset !== null) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
2459 + var elem = document.elementFromPoint(event.pageX - scrollLeft, event.pageY - scrollTop);
2460 + if (elem && elem != null && elem.id == 'connectbutton2' && currentNode && currentNode.agent && (currentNode.agent.id > 0) && (currentNode.agent.id < 5)) {
2461 + contextelement = elem;
2462 + var contextmenudiv = document.getElementById('termShellContextMenu');
2463 + contextmenudiv.style.left = event.pageX + 'px';
2464 + contextmenudiv.style.top = event.pageY + 'px';
2465 + contextmenudiv.style.display = 'block';
2466 + } else if (elem && elem != null && elem.id == 'MxMESH') {
2467 + contextelement = elem;
2468 + var contextmenudiv = document.getElementById('meshContextMenu');
2469 + contextmenudiv.style.left = event.pageX + 'px';
2470 + contextmenudiv.style.top = event.pageY + 'px';
2471 + contextmenudiv.style.display = 'block';
2472 + } else {
2473 + while (elem && elem != null && elem.id != 'devs') { elem = elem.parentElement; }
2474 + if (!elem || elem == null) return true;
2475 + contextelement = elem;
2476 + var contextmenudiv = document.getElementById('contextMenu');
2477 + contextmenudiv.style.left = event.pageX + 'px';
2478 + contextmenudiv.style.top = event.pageY + 'px';
2479 + contextmenudiv.style.display = 'block';
2480 +
2481 + // Get the node and set the menu options
2482 + var nodeid = contextelement.children[1].attributes.onclick.value;
2483 + var node = getNodeFromId(nodeid.substring(12, nodeid.length - 18));
2484 + var mesh = meshes[node.meshid];
2485 + var meshlinks = mesh.links[userinfo._id];
2486 + var meshrights = meshlinks.rights;
2487 + var consoleRights = ((meshrights & 16) != 0);
2488 +
2489 + // Check if we have terminal and file access
2490 + var terminalAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 512) == 0));
2491 + var fileAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 1024) == 0));
2492 +
2493 + QV('cxdesktop', ((mesh.mtype == 1) || (node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 1) != 0) || (node.intelamt && (node.intelamt.state == 2))) && ((meshrights & 8) || (meshrights & 256)));
2494 + QV('cxterminal', ((mesh.mtype == 1) || (node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 2) != 0) || (node.intelamt && (node.intelamt.state == 2))) && (meshrights & 8) && terminalAccess);
2495 + QV('cxfiles', ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 4) != 0))) && (meshrights & 8) && fileAccess);
2496 + QV('cxevents', (node.intelamt != null) && ((node.intelamt.state == 2) || (node.conn & 2)) && (meshrights & 8));
2497 + QV('cxconsole', (consoleRights && (mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 8) != 0))) && (meshrights & 8));
2498 + }
2499 +
2500 + return haltEvent(event);
2501 + }
2502 +
2503 + function cmaction(action,event) {
2504 + var nodeid = contextelement.children[1].attributes.onclick.value;
2505 + nodeid = nodeid.substring(12, nodeid.length - 18);
2506 + if (action == 7) { Q('viewselect').value = 3; Q('viewselect').onchange(); Q('autoConnectDesktopCheckbox').checked = true; Q('autoConnectDesktopCheckbox').onclick(); } // Multi-Desktop
2507 + if ((action > 0) && (action < 7)) {
2508 + var panel = [0, 10, 12, 11, 13, 16, 15][action]; // (invalid), General, Desktop, Terminal, Files, Events, Console
2509 + if (event && (event.shiftKey == true)) {
2510 + // Open the device in a different tab
2511 + window.open(window.location.origin + '?node=' + nodeid.split('/')[2] + '&viewmode=' + panel + '&hide=16', 'meshcentral:' + nodeid);
2512 + } else {
2513 + // Go to the right panel
2514 + gotoDevice(nodeid, panel);
2515 +
2516 + // If possible, connect...
2517 + var mesh = meshes[currentNode.meshid];
2518 + if ((currentNode.conn & 1) && (mesh.mtype == 2)) {
2519 + if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 1); } // Desktop
2520 + if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal
2521 + if ((panel == 13) && (files == null)) { connectFiles(null); } // files
2522 + }
2523 + }
2524 + }
2525 + }
2526 +
2527 + function cmmeshaction(action) {
2528 + var meshid = contextelement.attributes.onclick.value.substring(10, contextelement.attributes.onclick.value.length - 2);
2529 + var elements = document.getElementsByClassName('DeviceCheckbox');
2530 + if ((action == 1) || (action == 2)) {
2531 + for (var i = 0; i < elements.length; i++) {
2532 + if ((elements[i].attributes) && (elements[i].attributes['class']['value'].split(' ')[0] == meshid)) { elements[i].checked = (action == 1); }
2533 + }
2534 + }
2535 + //if (action == 3) { window.location = "multidesktop.aspx?mesh=" + meshid + "&auto=1"; }
2536 + p1updateInfo();
2537 + }
2538 +
2539 + function cmtermaction(action) {
2540 + connectTerminal(null, 1, { powershell: (action == 2) });
2541 + }
2542 +
2543 + function hideContextMenu() {
2544 + QV('contextMenu', false);
2545 + QV('meshContextMenu', false);
2546 + QV('termShellContextMenu', false);
2547 + contextelement = null;
2548 + }
2549 +
2550 + //
2551 + // DEVICES MAP
2552 + //
2553 +
2554 + // Maps code starts from here. Initialize all the variables
2555 + var xxmap = {
2556 + map: null,
2557 + contextmenu: null,
2558 + activeInteractions: [], // Save Modified features in this list
2559 + showindex: 0,
2560 + markersSource: null, // Initialize a Source Vector
2561 + markersLayer: null,
2562 + mapLayer: null, // Create a tile and use OSM source
2563 + mapView: null, // Sets the initial view
2564 + }
2565 +
2566 + // Add a feature for every Node and change style if connection status changes
2567 + function updateMapMarkers(selectedMesh) {
2568 + if ((xxmap != null) && (xxmap.map == null)) { try { loadmap(); } catch (ex) { console.error('loadmap() exception', ex); } }
2569 + if (xxmap == null) return;
2570 + var boundingBox = null;
2571 + for (var i in nodes) {
2572 + try {
2573 + var loc = map_parseNodeLoc(nodes[i]), feature = xxmap.markersSource.getFeatureById(nodes[i]._id);
2574 + if ((loc != null) && ((nodes[i].meshid == selectedMesh) || (selectedMesh == null))) { // Draw markers for devices with locations
2575 + var lat = loc[0], lon = loc[1], type = loc[2];
2576 + if (boundingBox == null) { boundingBox = [ lat, lon, lat, lon, 0 ]; } else { if (lat < boundingBox[0]) { boundingBox[0] = lat; } if (lon < boundingBox[1]) { boundingBox[1] = lon; } if (lat > boundingBox[2]) { boundingBox[2] = lat; } if (lon > boundingBox[3]) { boundingBox[3] = lon; } }
2577 + if (feature == null) { addFeature(nodes[i]); boundingBox[4] = 1; } else { updateFeature(nodes[i], feature); feature.setStyle(markerStyle(nodes[i], loc[2])); } // Update Feature
2578 + } else {
2579 + if (feature) { xxmap.markersSource.removeFeature(feature); }
2580 + }
2581 + } catch (ex) { console.error('updateMapMarkers() exception', ex, JSON.stringify(nodes[i])); }
2582 + }
2583 + return boundingBox;
2584 + }
2585 +
2586 + // Show node details on hovering over a feature
2587 + var map_cm_popup = new ol.Overlay({ element: Q('xmap-info-window'), positioning: 'bottom-center', stopEvent: false });
2588 +
2589 + // Edit Marker item
2590 + var map_cm_editMarker = { text: "Modify node location", callback: function (obj) { modifyMarkerloc(obj.data); } };
2591 +
2592 + // Clear Marker item
2593 + var map_cm_clearMarker = { text: "Remove node location", callback: function (obj) {
2594 + meshserver.send({ action: 'changedevice', nodeid: obj.data.a, userloc: [] }); // Clear the user position marker
2595 + }};
2596 +
2597 + // Save Marker item
2598 + var map_cm_saveMarker = { text: "Enregistrer l'emplacement", callback: function (obj) { saveMarkerloc(obj.data); } };
2599 +
2600 + // Build a context menu for a feature
2601 + var map_cm_nodemenu_items = [
2602 + { text: "General information", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 10); } } },
2603 + { text: "Desktop", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 11); } } },
2604 + { text: "Terminal", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 12); } } },
2605 + { text: "Intel&reg; AMT", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 14); } } },
2606 + '-',
2607 + { text: "Zoom-in to extent", callback: function(obj) { var coords = obj.data.getGeometry().getCoordinates(); zoomToLocation(coords, 19); } },
2608 + { text: "Zoom-out to extent", callback: function(obj) { var coords = obj.data.getGeometry().getCoordinates(); zoomToLocation(coords, 2); } }
2609 + ];
2610 +
2611 + // Context menu for clicks other than on feature
2612 + var contextmenu_items = [
2613 + { text: "Rafraîchir", callback: function () { refreshMap(true, true); } },
2614 + { text: "Zoom to fit extent", callback: function () { zoomToFitExtent(); } },
2615 + { text: "Centré la carte ici", callback: function(obj) { xxmap.mapView.animate({ center: obj.coordinate } ); } },
2616 + { text: "Place node here", callback: function(obj) { placeNode(obj.coordinate); } }
2617 + ];
2618 +
2619 + function stringToIntHash(str) {
2620 + var hash = 0, i;
2621 + for (i = 0; i < str.length; i++) { hash = ((hash << 5) - hash) + str.charCodeAt(i); hash |= 0; }
2622 + return hash;
2623 + };
2624 +
2625 + // Get the lat/lon from a node
2626 + function map_parseNodeLoc(node) {
2627 + var loc = null, t = 0;
2628 + if (node.iploc) { loc = node.iploc; t = 1; }
2629 + if (node.wifiloc) { loc = node.wifiloc; t = 2; }
2630 + if (node.gpsloc) { loc = node.gpsloc; t = 3; }
2631 + if (node.userloc) { loc = node.userloc; t = 4; }
2632 + if ((loc == null) || (typeof loc != 'string')) return null;
2633 + loc = loc.split(',');
2634 + if (t == 1) {
2635 + // If this is IP location, randomize the position a little.
2636 + return [ parseFloat(loc[0]) + (stringToIntHash(node._id.substring(0, 20)) / 100000000000), parseFloat(loc[1]) + (stringToIntHash(node._id.substring(20)) / 100000000000), t ];
2637 + } else {
2638 + // Return the real position
2639 + return [ parseFloat(loc[0]), parseFloat(loc[1]), t ];
2640 + }
2641 + }
2642 +
2643 + // Load the entire map
2644 + function loadmap() {
2645 + if (xxmap == null) return;
2646 + if ((features & 0x8000) == 0) { QV('viewselectmapoption', false); QV('devViewButton4', false); xxmap = null; return; } // Geolocation not supported
2647 + try {
2648 + // Initialize a Source Vector
2649 + xxmap.markersSource = new ol.source.Vector();
2650 +
2651 + xxmap.markersLayer = new ol.layer.Vector({
2652 + source: xxmap.markersSource
2653 + });
2654 +
2655 + // Create a tile and use OSM source
2656 + xxmap.mapLayer = new ol.layer.Tile({ source: new ol.source.OSM() });
2657 +
2658 + xxmap.mapView = new ol.View({ // Set the initial view
2659 + center: ol.proj.transform([0, 0], 'EPSG:4326', 'EPSG:3857'),
2660 + zoom: 2,
2661 + minZoom: 2,
2662 + maxZoom: 20,
2663 + extent: ol.proj.transformExtent([-100000, -69.55, 100000, 69.55], 'EPSG:4326', 'EPSG:3857')
2664 + });
2665 +
2666 + xxmap.map = new ol.Map({
2667 + target: 'xdevicesmap',
2668 + layers: [xxmap.mapLayer, xxmap.markersLayer],
2669 + view: xxmap.mapView
2670 + });
2671 +
2672 + xxmap.map.addOverlay(map_cm_popup);
2673 +
2674 + // Goto information tab if a user clicks on a feature
2675 + xxmap.map.on('click', function(evt) {
2676 + var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(feat, layer) { return feat; });
2677 + if (feature) {
2678 + var nodeid = feature.getId();
2679 + if (nodeid != null) { gotoDevice(nodeid, 10); } // Goto general info tab
2680 + else { // For pointer
2681 + var nodeFeatgoto = getCorrespondingFeature(feature); gotoDevice(nodeFeatgoto.getId(), 10);
2682 + }
2683 + }
2684 + });
2685 +
2686 + // On hover feature show the name of the node. Also add pointer style
2687 + xxmap.map.on('pointermove', function(evt) {
2688 + var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(feat, layer) { return feat; });
2689 + if (feature) {
2690 + xxmap.map.getTargetElement().style.cursor = 'pointer';
2691 + var coord = feature.getGeometry().getCoordinates();
2692 + // map_cm_popup.setPosition(evt.coordinate);
2693 + map_cm_popup.setPosition(coord);
2694 + var featid = feature.getId();
2695 + if (featid) {
2696 + QH('xmap-info-window', feature.get('name'));
2697 + } else {
2698 + var nodeFeat = getCorrespondingFeature(feature); // Return the node feature associated to pointer.
2699 + QH('xmap-info-window', nodeFeat.get('name'));
2700 + }
2701 + } else {
2702 + xxmap.map.getTargetElement().style.cursor = '';
2703 + QH('xmap-info-window', '');
2704 + }
2705 + });
2706 +
2707 + // Initialize context menu for openlayers
2708 + var contextmenu = new ContextMenu({
2709 + width: 160,
2710 + defaultItems: false, // defaultItems are Zoom In/Zoom Out
2711 + items: contextmenu_items
2712 + });
2713 +
2714 + // On right click open the context menu
2715 + contextmenu.on("open", function (evt) {
2716 + var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(ft, l){ return ft; });
2717 + xxmap.contextmenu.clear(); //Clear the context menu
2718 + if (feature) {
2719 + var featId = feature.getId();
2720 + if (featId) { addContextMenuItems(feature); } // Node feature will have an id
2721 + else { // If the feature is a pointer, Get its corresponding Node feature
2722 + var nodeFeature = getCorrespondingFeature(feature); //return the node feature associated to pointer.
2723 + if (nodeFeature) { addContextMenuItems(nodeFeature); }
2724 + else{ xxmap.contextmenu.extend(contextmenu_items); }
2725 + }
2726 + }
2727 + else { xxmap.contextmenu.extend(contextmenu_items); }
2728 + });
2729 + if (xxmap.contextmenu == null) { xxmap.contextmenu = contextmenu; }
2730 + xxmap.map.addControl(xxmap.contextmenu);
2731 + //addMeshOptions(); // Adds Mesh names to mesh dropdown
2732 + } catch (ex) {
2733 + console.log(ex);
2734 + QV('viewselectmapoption', false);
2735 + QV('devViewButton4', false);
2736 + xxmap = null;
2737 + }
2738 + }
2739 +
2740 + // Add feature on to Map for a Node
2741 + function addFeature(node, lat, lon) {
2742 + var existingfeature = getModifiedFeature(node._id); // Check if Corresponding feature was Modified ( Modifed feature are in active interactions list)
2743 + if (existingfeature) { xxmap.markersSource.addFeature(existingfeature); } // Add that existing feature
2744 + else { // Add new feature for this node
2745 + if (!lat && !lon) { var loc = map_parseNodeLoc(node); lat = loc[0]; lon = loc[1]; }
2746 +
2747 + // Fix the longiture and send an event to patch the db to correct coordinate format. It will cause second unnecessary updateFeature on this node to the map.
2748 + if (lon > 180) { lon = 180 - lon; meshserver.send({ action: 'changedevice', nodeid: node._id, userloc: [ lat, lon ] }); }
2749 +
2750 + if ((lat < 90) && (lat > -90) && (lon < 180) && (lon > -180)) { // Check valid lat/lon
2751 + var feature = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.transform([lon, lat], 'EPSG:4326','EPSG:3857')), name: node.name, status: node.conn, lat: lat, lon: lon });
2752 + feature.setId(node._id); // Set id for the device as nodeid
2753 + feature.setStyle(markerStyle(node));
2754 + xxmap.markersSource.addFeature(feature); // Add the feature to Marker Source
2755 + }
2756 + }
2757 + }
2758 +
2759 + // Removing any feature from map
2760 + function removeFeature(node) {
2761 + var feature = xxmap.markersSource.getFeatureById(node._id);
2762 + if (feature) { xxmap.markersSource.removeFeature(feature); }
2763 + }
2764 +
2765 + // Update feature
2766 + function updateFeature(node, feature) {
2767 + if (node.conn != feature.get('status') ) { // Update status if changed
2768 + feature.set('status',node.conn)
2769 + feature.setStyle(markerStyle(node));
2770 + }
2771 +
2772 + // Since this is IP address location, add some fixed randomness to the location. Avoid pin pile-up.
2773 + var loc = map_parseNodeLoc(node);
2774 + if (loc != null) {
2775 + var lat = loc[0], lon = loc[1];
2776 + if ((lat != feature.get('lat')) || (lon != feature.get('lon'))) { // Update lat and lon if changed
2777 + feature.set('lat', lat); feature.set('lon', lon);
2778 + var modifiedCoordinates = ol.proj.transform([parseFloat(lon), parseFloat(lat)], 'EPSG:4326', 'EPSG:3857');
2779 + feature.getGeometry().setCoordinates(modifiedCoordinates);
2780 + }
2781 + }
2782 +
2783 + if (node.name != feature.get('name') ) { feature.set('name', node.name); } // Update name
2784 + }
2785 +
2786 + // Enable dragging of a marker after edit option is clicked in context menu
2787 + function modifyMarkerloc(ft){
2788 + var featid = ft.getId();
2789 + if (featid) {
2790 + ft.setStyle(markerStyle(getNodeFromId(ft.a), 4)); // Switch to a user marker
2791 + if ( !getActiveInteractions(ft)) {
2792 + var dragInteration = new ol.interaction.Modify({
2793 + features: new ol.Collection([ft]),
2794 + pixelTolerance: 10
2795 + });
2796 + xxmap.activeInteractions.push({ featureid: featid, feature:ft, interaction: dragInteration }); // Also keep track of Interactions
2797 + xxmap.map.addInteraction(dragInteration);
2798 + }
2799 + }
2800 + }
2801 +
2802 + // This will be called when save location option is clicked in context menu
2803 + function saveMarkerloc(ft){
2804 + var featid = ft.getId()
2805 + if (featid) {
2806 + var actInteraction = getActiveInteractions(ft);
2807 + if (actInteraction) { // Check if the interaction exists
2808 + xxmap.map.removeInteraction(actInteraction); //Clear Interaction for that node
2809 + removeInteraction(featid);
2810 + var coord = ft.getGeometry().getCoordinates();
2811 + var v = ol.proj.transform(coord, 'EPSG:3857', 'EPSG:4326');
2812 + if (v[0] > 180) { v[0] = 180 - v[0]; }
2813 + var vx = [ v[1], v[0] ]; // Flip the coordinates around, lat/long
2814 + meshserver.send({ action: 'changedevice', nodeid: featid, userloc: vx }); // Send them to server to save changes
2815 + }
2816 + }
2817 + }
2818 +
2819 + // Style the Markers
2820 + function markerStyle(node, type) {
2821 + if (type == null) {
2822 + type = 0;
2823 + if (node.iploc) { type = 1; }
2824 + if (node.wifiloc) { type = 2; }
2825 + if (node.gpsloc) { type = 3; }
2826 + if (node.userloc) { type = 4; }
2827 + }
2828 + var types = ['', '-ip','-wifi','-gps','-user'];
2829 + var color = connStateColor(node);
2830 + var style = new ol.style.Style({
2831 + image: new ol.style.Icon({ color: color, anchor: [0.5, 1], src: 'images/mapmarker' + types[type] + '.png' })
2832 + //stroke: new ol.style.Stroke({ color: '#000', width: 20 })
2833 + //text: new ol.style.Text({ text: 'bob!', textAlign: 'right', offsetX: -10, fill: new ol.style.Fill({ color: '#000' }), stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) })
2834 + });
2835 +
2836 + /*
2837 + deviceMark.setStyle(new ol.style.Style({
2838 + text: new ol.style.Text({
2839 + //font: '12px helvetica,sans-serif',
2840 + text: currentNode.name,
2841 + textAlign: 'right',
2842 + offsetX: -10,
2843 + fill: new ol.style.Fill({ color: '#000' }),
2844 + stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
2845 + }),
2846 + image: new ol.style.Icon(({ color: [113, 140, 0], src: 'images/dot.png' })) }));
2847 + */
2848 +
2849 + return [ style ];
2850 + }
2851 +
2852 + // TODO: Add more connection status types. Currently we only change color if connection status changes
2853 + function connStateColor(nodeConn){
2854 + if (nodeConn.conn == 1 || nodeConn.conn == 3 || nodeConn.conn == 5) { return '#00ffdd'; } // Green for connected devices
2855 + return '#C70039'; // Red if the Agent is not connected
2856 + }
2857 +
2858 + // Add save/edit option to context menu
2859 + function addContextMenuItems(feature) {
2860 + if (getActiveInteractions(feature)) { // If this feature is modified then display save option in contextmenu
2861 + map_cm_saveMarker.data = feature;
2862 + xxmap.contextmenu.push(map_cm_saveMarker);
2863 + } else {
2864 + map_cm_editMarker.data = feature;
2865 + xxmap.contextmenu.push(map_cm_editMarker);
2866 + var node = getNodeFromId(feature.a);
2867 + if (node.userloc) {
2868 + map_cm_clearMarker.data = feature;
2869 + xxmap.contextmenu.push(map_cm_clearMarker);
2870 + }
2871 + }
2872 + map_cm_nodemenu_items.forEach(function (item){
2873 + if (item.text == "Zoom-in to extent" || item.text == "Zoom-out to extent") { item.data = feature; }
2874 + else { if (item != '-') { item.data = feature.getId(); } }
2875 + });
2876 + xxmap.contextmenu.extend(map_cm_nodemenu_items);
2877 + }
2878 +
2879 + // Return a active Interaction if it exists in activeInteractions list
2880 + function getActiveInteractions(feature) {
2881 + var featid = feature.getId();
2882 + for (var i = 0; i < xxmap.activeInteractions.length; i++) {
2883 + if (xxmap.activeInteractions[i].featureid == featid) { return xxmap.activeInteractions[i].interaction; }
2884 + }
2885 + return false;
2886 + }
2887 +
2888 + // Return Modified feature based on Id
2889 + function getModifiedFeature(featid) {
2890 + if (featid) {
2891 + for (var i = 0; i < xxmap.activeInteractions.length; i++) {
2892 + if (xxmap.activeInteractions[i].featureid == featid) { return xxmap.activeInteractions[i].feature; }
2893 + }
2894 + }
2895 + return null;
2896 + }
2897 +
2898 + // Remove Interaction
2899 + function removeInteraction(ftid) {
2900 + var index = -1;
2901 + for (var i = 0; i < xxmap.activeInteractions.length; i++) {
2902 + if (xxmap.activeInteractions[i].featureid === ftid) { index = i; break; }
2903 + }
2904 + if (index >= 0) { xxmap.activeInteractions.splice(index, 1); }
2905 + }
2906 +
2907 + // Check if pointer coordinates are equal to features and return node feature
2908 + function getCorrespondingFeature(pointerFeat) {
2909 + var pointerCoord = pointerFeat.getGeometry().getCoordinates();
2910 + for (var i = 0; i < xxmap.activeInteractions.length ; i++) {
2911 + var modifiedFeatures = xxmap.activeInteractions[i].feature;
2912 + var fearCoord = modifiedFeatures.getGeometry().getCoordinates();
2913 + if (fearCoord[0].toFixed(5) == pointerCoord[0].toFixed(5) && fearCoord[1].toFixed(5) == pointerCoord[1].toFixed(5) ) { return modifiedFeatures; }
2914 + }
2915 + return null;
2916 + }
2917 +
2918 + // Refresh the map and clear list
2919 + function refreshMap(reset, rebound){
2920 + if (reset) {
2921 + xxmap.map.setTarget(null);
2922 + xxmap.map = null;
2923 + xxmap.markersSource = null;
2924 + xxmap.mapView = null;
2925 + xxmap.mapLayer = null;
2926 + xxmap.activeInteractions = []; // Clear Active Interaction list
2927 + }
2928 + //clearMeshOptions();
2929 + //onSelectMeshChange();
2930 + var box = updateMapMarkers();
2931 + if ((box != null) && (rebound || (box[4] == 1))) {
2932 + var clat = (box[0] + box[2]) / 2;
2933 + var clon = (box[1] + box[3]) / 2;
2934 + var cscale = Math.max(Math.abs(box[0] - box[2]), Math.abs(box[1] - box[3]));
2935 + var view = xxmap.map.getView();
2936 + view.setCenter(ol.proj.transform([clon, clat], 'EPSG:4326', 'EPSG:3857'));
2937 + var i = 360, j = -2;
2938 + while (i > cscale) { j++; i = i / 2; }
2939 + view.setZoom(j);
2940 + }
2941 + }
2942 +
2943 + // Called When Place a node option is clicked from context menu
2944 + function placeNode(coords) {
2945 + if (xxdialogMode) return;
2946 + var x = '<div style=margin-bottom:6px><label for=selectnode-search>Search</label>&nbsp&nbsp<input type=text placeholder="' + "Device name" + '" id="selectnode-search" onchange=onPlaceNodeInputChange() onkeyup=onPlaceNodeInputChange() autocomplete=off style=width:120px></div><div id=placenode style="height:254px;overflow-y:auto;width:100%;margin:12px 1px 4px 1px;"><div id=noNodesMapPlace style=text-align:center;width:100%;display:none>' + "Aucun périphérique trouvé." + '</div>';
2947 + for (var i in nodes) {
2948 + x += '<div class=noselect id=' + nodes[i]._id + '-rowid onclick=selectNodeToPlace(event,\''+ nodes[i]._id +'\') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id=' + nodes[i]._id + '-checkid type=checkbox style=width:16px;display:inline />';
2949 + x += '<div class=j' + nodes[i].icon + ' style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>' + nodes[i].name + '</div></div>';
2950 + }
2951 + setDialogMode(2, "Select a node to place", 3, placeNodeEx, x + '</div>', coords);
2952 + onPlaceNodeInputChange();
2953 + }
2954 +
2955 + function placeNodeEx(button, coords) {
2956 + var elements = document.getElementsByName('PlaceMapDeviceCheckbox');
2957 + for (var i in elements) {
2958 + if (elements[i].checked) {
2959 + var node = getNodeFromId(elements[i].id.substring(0, elements[i].id.length - 8));
2960 + if (node) {
2961 + var feature = xxmap.markersSource.getFeatureById(i);
2962 + var v = ol.proj.transform(coords, 'EPSG:3857', 'EPSG:4326');
2963 + var vx = [ v[1], v[0] ]; // Flip the coordinates around, lat/long
2964 + if (feature) {
2965 + feature.getGeometry().setCoordinates(coords);
2966 + var activeInteraction = getActiveInteractions(feature);
2967 + if (activeInteraction) {
2968 + saveMarkerloc(feature);
2969 + } else { // If this feature is not saved after its location is changed, then send updated coords to server.
2970 + meshserver.send({ action: 'changedevice', nodeid: node._id, userloc: vx }); // Send them to server to save changes
2971 + }
2972 + } else {
2973 + meshserver.send({ action: 'changedevice', nodeid: node._id, userloc: vx }); // This Node is not yet added to maps.
2974 + }
2975 + }
2976 + }
2977 + }
2978 + }
2979 +
2980 + // Called when the user changes the search box
2981 + function onPlaceNodeInputChange() {
2982 + updatePlaceNodeTable(Q('selectnode-search').value.trim().toLowerCase());
2983 + }
2984 +
2985 + // Update the list of devices in the "place on map" table
2986 + function updatePlaceNodeTable(inputSearch) {
2987 + var elements = document.getElementsByName('PlaceMapDeviceCheckbox'), count = 0;
2988 + for (var i in nodes) {
2989 + var visible = ((nodes[i].namel.indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.indexOf(inputSearch) >= 0));
2990 + if (visible) { count++; }
2991 + QV(nodes[i]._id + '-rowid', visible);
2992 + }
2993 + QV('noNodesMapPlace', count == 0);
2994 + /*
2995 + console.log(selected);
2996 + for (var i in nodes) {
2997 + if ((nodes[i].name.toLowerCase().indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.toLowerCase().indexOf(inputSearch) >= 0)) {
2998 + console.log(selected.indexOf(nodes[i]._id));
2999 + x += '<div class=noselect id=' + nodes[i]._id + '-rowid onclick=selectNodeToPlace(event,\''+ nodes[i]._id +'\') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id=' + nodes[i]._id + '-checkid type=checkbox style=width:16px;display:inline ' + ((selected.indexOf(nodes[i]._id) >= 0)?'checked':'') + ' />';
3000 + x += '<div class=j' + nodes[i].icon + ' style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>' + nodes[i].name + '</div></div>';
3001 + }
3002 + }
3003 + if (x == '') { x = '<div style=text-align:center;width:100%>No devices found.</div>'; }
3004 + QH('placenode', '');
3005 + */
3006 + }
3007 +
3008 + // Called when a user clicks on a device to toggle selection for placement on map.
3009 + function selectNodeToPlace(e, id) {
3010 + // Toggle checkbox if needed
3011 + if (e.target.name != 'PlaceMapDeviceCheckbox') { var inputElement = Q(id + '-checkid'); inputElement.checked = !inputElement.checked; }
3012 +
3013 + // Check button state
3014 + var elements = document.getElementsByName('PlaceMapDeviceCheckbox'), checkcount = 0;
3015 + for (var i in elements) { if (elements[i].checked) checkcount++; }
3016 + QE('idx_dlgOkButton', checkcount > 0);
3017 + }
3018 +
3019 + // Add option for available meshes in mesh Dropdown
3020 + function addMeshOptions(addMeshid, meshName) {
3021 + /*
3022 + var meshOptions = Q('select-mesh');
3023 + if (addMeshid && meshName) {
3024 + var option = document.createElement('option');
3025 + option.value =addMeshid;
3026 + option.text = meshName;
3027 + meshOptions.add(option); // Add specific option
3028 + }
3029 + else {
3030 + for (var i in meshes) { // Add all options
3031 + var option = document.createElement('option');
3032 + option.value = i;
3033 + option.text = meshes[i].name;
3034 + meshOptions.add(option);
3035 + }
3036 + }
3037 + */
3038 + }
3039 +
3040 + // Remove/Modify options in Mesh dropdown (if modMeshname is defined then Modify else Remove)
3041 + function meshOptionRmvMod(delMeshid, modMeshname){
3042 + /*
3043 + var meshOptions = Q('select-mesh');
3044 + if (delMeshid) {
3045 + var index=-1;
3046 + for (var i = 1; i < meshOptions.options.length; i++) {
3047 + if (meshOptions[i].value === delMeshid) { index=i; }
3048 + }
3049 + if (index > 0) {
3050 + if (modMeshname) {
3051 + meshOptions[index].innerHTML=modMeshname; // If Mesh name is Modified
3052 + }
3053 + else { meshOptions.remove(index); }
3054 + }
3055 + }
3056 + */
3057 + }
3058 +
3059 + //Check if there is any mesh created
3060 + function meshExists() {
3061 + for (var i in meshes) { if (meshes[i]) { return true; } }
3062 + return false;
3063 + }
3064 +
3065 + // Reset Mesh dropdown option to 'All' when a current view mesh is deleted.
3066 + function setMeshView(emeshid) {
3067 + var selectMeshElement=Q('select-mesh');
3068 + var selectedIndex = selectMeshElement.selectedIndex;
3069 + if (selectMeshElement[selectedIndex].value == emeshid) { selectMeshElement[0].selected = true; onSelectMeshChange(); }
3070 + }
3071 +
3072 + // Clear all mesh options except 'All'
3073 + function clearMeshOptions() {
3074 + /*
3075 + var meshOptions=Q('select-mesh');
3076 + for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); }
3077 + */
3078 + }
3079 +
3080 + // Make a http get call- Replace this with AJAX get if jquery is used
3081 + function getSearchLocation() {
3082 + try {
3083 + var searchdata = Q('mapSearchLocation').value.trim();
3084 + if (searchdata.length > 0) {
3085 + var xmlhttp = new XMLHttpRequest(); // Compatible with Chrome, Opera, Safari, IE7+, Firefox.
3086 + xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { formatSearchData(xmlhttp.responseText); } }
3087 + xmlhttp.open('GET', 'https://nominatim.openstreetmap.org/search?q=' + searchdata + '&format=json', true); // Get request
3088 + xmlhttp.send();
3089 + }
3090 + } catch (e) {}
3091 + }
3092 +
3093 + // Format data recieved from nominatim API and display it on content window
3094 + function formatSearchData(data) {
3095 + try {
3096 + QH('xmapSearchResults','');
3097 + var dataInfo = JSON.parse(data), count = 0, x = '<div class="xmapItem">';
3098 + for (var i = 0; i < dataInfo.length; i++) {
3099 + if (dataInfo[i].display_name && dataInfo[i].boundingbox[0] && dataInfo[i].boundingbox[1] && dataInfo[i].boundingbox[2] && dataInfo[i].boundingbox[3]) {
3100 + count++;
3101 + var itemclass = (i % 2 == 0)?'xmapItemSel1':'xmapItemSel1';
3102 + x += '<div class="' + itemclass + '" onclick=mapGotoSelectedLocation(this)><div>' + dataInfo[i].display_name + '</div><div style=display:none>' + dataInfo[i].boundingbox[0] + '!#!' + dataInfo[i].boundingbox[1] + '!#!' + dataInfo[i].boundingbox[2] + '!#!' + dataInfo[i].boundingbox[3] + '</div></div>';
3103 + }
3104 + }
3105 + x += '</div>';
3106 + if (count == 1) {
3107 + // If only one result is returned then zoom to that location
3108 + var extent = [ parseFloat(dataInfo[0].boundingbox[2]), parseFloat(dataInfo[0].boundingbox[0]), parseFloat(dataInfo[0].boundingbox[3]), parseFloat(dataInfo[0].boundingbox[1]) ];
3109 + zoomToExtent(extent);
3110 + } else {
3111 + if (count == 0) { x = '<div style=width:200px>' + "No location found." + '<div>'; }
3112 + QV('xmapSearchResultsDlg', true);
3113 + }
3114 + QH('xmapSearchResults', x);
3115 + }
3116 + catch (e) {}
3117 + }
3118 +
3119 + // Zoom into the bounding box
3120 + function mapGotoSelectedLocation(obj) {
3121 + var objchildren = obj.children;
3122 + var boundingBox = objchildren[1].innerHTML.split('!#!');
3123 + var extent = [parseFloat(boundingBox[2]), parseFloat(boundingBox[0]), parseFloat(boundingBox[3]), parseFloat(boundingBox[1])];
3124 + //Q('search-location').value = objchildren[0].innerHTML;
3125 + zoomToExtent(extent);
3126 + mapCloseSearchWindow();
3127 + }
3128 +
3129 + // Close the search window
3130 + function mapCloseSearchWindow() {
3131 + QH('xmapSearchResults', '');
3132 + QV('xmapSearchResultsDlg', false);
3133 + }
3134 +
3135 + // Zoom to specific cordinates
3136 + function zoomToLocation(coordinates, zoomVal) {
3137 + var view = xxmap.map.getView();
3138 + view.setCenter(coordinates);
3139 + view.setZoom(zoomVal);
3140 + }
3141 +
3142 + function zoomToFitExtent() {
3143 + var features = xxmap.markersSource.getFeatures();
3144 + if (features.length > 0) {
3145 + var extent = xxmap.markersSource.getExtent();
3146 + xxmap.map.getView().fit(extent, xxmap.map.getSize());
3147 + }
3148 + }
3149 +
3150 + function zoomToExtent(extent){
3151 + var boundingExtent = ol.proj.transformExtent(extent, ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857'));
3152 + xxmap.map.getView().fit(boundingExtent, xxmap.map.getSize());
3153 + }
3154 +
3155 +
3156 + //
3157 + // MY DEVICE
3158 + //
3159 + function refreshDevice(nodeid) {
3160 + if (!currentNode || currentNode._id != nodeid) return;
3161 + gotoDevice(nodeid, xxcurrentView, true);
3162 + }
3163 +
3164 + function getNodeRights(nodeid) {
3165 + var node = getNodeFromId(nodeid), mesh = meshes[node.meshid];
3166 + return mesh.links[userinfo._id].rights;
3167 + }
3168 +
3169 + var currentNode;
3170 + var powerTimelineNode = null;
3171 + var powerTimelineReq = null;
3172 + var powerTimelineUpdate = null;
3173 + var powerTimeline = null;
3174 + function getCurrentNode() { return currentNode; };
3175 + function gotoDevice(nodeid, panel, refresh, event) {
3176 + // Remind the user to verify the email address
3177 + if ((userinfo.emailVerified !== true) && (serverinfo.emailcheck == true) && (userinfo.siteadmin != 0xFFFFFFFF)) { setDialogMode(2, "Account Security", 1, null, "Unable to access a device until a email address is verified. This is required for password recovery. Go to the \"My Account\" tab to change and verify an email address."); return; }
3178 +
3179 + // Remind the user to add two factor authentication
3180 + if ((features & 0x00040000) && !((userinfo.otpsecret == 1) || (userinfo.otphkeys > 0) || (userinfo.otpkeys > 0))) { setDialogMode(2, "Account Security", 1, null, "Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the \"My Account\" tab and look at the \"Account Security\" section."); return; }
3181 +
3182 + if (event && (event.shiftKey == true)) {
3183 + // Open the device in a different tab
3184 + window.open(window.location.origin + '?node=' + nodeid.split('/')[2] + '&viewmode=10&hide=16', 'meshcentral:' + nodeid);
3185 + return;
3186 + }
3187 +
3188 + //disconnectAllKvmFunction();
3189 + var node = getNodeFromId(nodeid);
3190 + var mesh = meshes[node.meshid];
3191 + var meshrights = mesh.links[userinfo._id].rights;
3192 + if (!currentNode || currentNode._id != node._id || refresh == true) {
3193 + currentNode = node;
3194 +
3195 + // Add node name
3196 + var nname = EscapeHtml(node.name);
3197 + if (nname.length == 0) { nname = '<i>' + "None" + '</i>'; }
3198 + if (((meshrights & 4) != 0) && ((!mesh.flags) || ((mesh.flags & 2) == 0))) { nname = '<span tabindex=0 title=\"' + "Click here to edit the server-side device name" + '\" onclick=showEditNodeValueDialog(0) onkeyup="if (event.key == \'Enter\') showEditNodeValueDialog(0)" style=cursor:pointer>' + nname + ' <img class=hoverButton src="images/link5.png" /></span>'; }
3199 + nname += '<span style=color:#AAA;font-size:small> - ' + EscapeHtml(mesh.name) + '</span>';
3200 + QH('p10deviceName', nname);
3201 + QH('p11deviceName', nname);
3202 + QH('p12deviceName', nname);
3203 + QH('p13deviceName', nname);
3204 + QH('p14deviceName', nname);
3205 + QH('p15deviceName', "Console - " + nname);
3206 + QH('p16deviceName', nname);
3207 + QH('p17deviceName', nname);
3208 + QH('p19deviceName', nname);
3209 +
3210 + // Node attributes
3211 + var x = '<table style=width:100%>';
3212 +
3213 + // Attribute: Mesh
3214 + x += addDeviceAttribute('<span title=\"' + "The name of the device group this computer belong to." + '\">' + "Groupe" + '</span>', '<a href=# title=\"' + "Le nom du groupe de périphériques auquel cet ordinateur appartient" + '\" onclick=gotoMesh("' + node.meshid + '") style=cursor:pointer>' + EscapeHtml(meshes[node.meshid].name) + '</a>');
3215 +
3216 + // Attribute: Name
3217 + if ((node.rname != null) && (node.name != node.rname)) { x += addDeviceAttribute('<span title="The name of this computer as set in the operating system">Name</span>', '<span title="The name of this computer as set in the operating system">' + EscapeHtml(node.rname) + '</span>'); }
3218 +
3219 + // Attribute: Host
3220 + if ((features & 1) == 0) { // If not WAN-only, local hostname is in use
3221 + if ((meshrights & 4) != 0) {
3222 + if (node.host) {
3223 + x += addDeviceAttribute("Hostname", '<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>' + EscapeHtml(node.host) + '</span>');
3224 + } else {
3225 + x += addDeviceAttribute("Hostname", '<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>' + "None" + '</i></span>');
3226 + }
3227 + } else {
3228 + x += addDeviceAttribute("Hostname", EscapeHtml(node.host));
3229 + }
3230 + }
3231 +
3232 + // Attribute: Description
3233 + var description = node.desc?EscapeHtml(node.desc):('<i>' + "None" + '</i>');
3234 + if ((meshrights & 4) != 0) {
3235 + x += addDeviceAttribute("Description", '<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>' + description + ' <img class=hoverButton src="images/link5.png" /></span>');
3236 + } else {
3237 + x += addDeviceAttribute("Description", description);
3238 + }
3239 +
3240 + // Attribute: Mesh Agent
3241 + var agentsStr = ["Inconnue", "Windows 32bit console", "Windows 64bit console", "Windows 32bit service", "Windows 64bit service", "Linux 32bit", "Linux 64bit", "MIPS", "XENx86", "Android ARM", "Linux ARM", "MacOS 32bit", "Android x86", "PogoPlug ARM", "Android APK", "Linux Poky x86-32bit", "MacOS 64bit", "ChromeOS", "Linux Poky x86-64bit", "Linux NoKVM x86-32bit", "Linux NoKVM x86-64bit", "Windows MinCore console", "Windows MinCore service", "NodeJS", "ARM-Linaro", "ARMv6l / ARMv7l", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "Inconnue", "Inconnue", "FreeBSD x86-64"];
3242 + if ((node.agent != null) && (node.agent.id != null) && (node.agent.ver != null)) {
3243 + var str = '';
3244 + if (node.agent.id <= agentsStr.length) { str = agentsStr[node.agent.id]; } else { str = agentsStr[0]; }
3245 + if (node.agent.ver != 0) { str += ' v' + node.agent.ver; }
3246 + x += addDeviceAttribute("Mesh Agent", str);
3247 + }
3248 +
3249 + // Attribute: Intel AMT
3250 + if (node.intelamt != null) {
3251 + var str = '';
3252 + var provisioningStates = { 0: nobreak("Not Activated (Pre)"), 1: nobreak("Not Activated (In)"), 2: nobreak("Activé") };
3253 + if (node.intelamt.ver != null && node.intelamt.state == null) { str += '<i>' + "Etat inconnu" + '</i>, v' + node.intelamt.ver; } else
3254 +
3255 + if ((node.intelamt.ver == null) && (node.intelamt.state == 2)) { str += '<i>' + "Activé" + '</i>'; }
3256 + else if ((node.intelamt.ver == null) || (node.intelamt.state == null)) { str += '<i>' + "Version et état inconnus" + '</i>'; }
3257 + else {
3258 + str += provisioningStates[node.intelamt.state];
3259 + if ((node.intelamt.state == 2) && node.intelamt.flags) { if (node.intelamt.flags & 2) { str += ' <span title=\"' + "Intel AMT is activated in Client Control Mode" + '\">' + "CCM" + '</span>'; } else if (node.intelamt.flags & 4) { str += ' <span title=\"' + "Intel AMT is activated in Admin Control Mode" + '\">' + "ACM" + '</span>'; } }
3260 + str += (', v' + node.intelamt.ver);
3261 + }
3262 +
3263 + if (node.intelamt.tls == 1) { str += ', <span title=\"' + "Intel AMT is setup with TLS network security" + '\">' + "TLS" + '</span>'; }
3264 + if (node.intelamt.state == 2) {
3265 + if (node.intelamt.user == null || node.intelamt.user == '') {
3266 + if ((meshrights & 4) != 0) {
3267 + str += ', <i style=color:#FF0000;cursor:pointer title=\"' + "Edit Intel&reg; AMT credentials" + '\" onclick=editDeviceAmtSettings("' + node._id + '")>' + "No Credentials" + '</i>';
3268 + } else {
3269 + str += ', <i style=color:#FF0000>' + "No Credentials" + '</i>';
3270 + }
3271 + }
3272 + str += ' ';
3273 + if ((meshrights & 4) != 0) {
3274 + str += '<img src=images/link4.png height=10 width=10 title=\"' + "Edit Intel&reg; AMT credentials" + '\" style=cursor:pointer onclick=editDeviceAmtSettings("' + node._id + '")>';
3275 + }
3276 + }
3277 +
3278 + var meName = '<span title=\"Intel&reg; Manageability Engine\">' + "Intel&reg; ME" + '<span>';
3279 + if (typeof node.intelamt.sku == 'number') {
3280 + if ((node.intelamt.sku & 8) != 0) { meName = '<span title=\"' + "Intel&reg; Active Management Technology" + '\">' + "Intel&reg; AMT" + '<span>'; }
3281 + else if ((node.intelamt.sku & 16) != 0) { meName = '<span title=\"' + "Intel&reg; Standard Manageability" + '\">' + "Intel&reg; SM" + '<span>'; }
3282 + }
3283 + x += addDeviceAttribute(meName, str);
3284 + }
3285 +
3286 + if (mesh.mtype == 2) {
3287 + // Attribute: Mesh Agent Tag
3288 + if ((node.agent != null) && (node.agent.tag != null)) {
3289 + var tag = EscapeHtml(node.agent.tag);
3290 + if (tag.startsWith('mailto:')) { tag = '<a href="' + tag + '">' + tag.substring(7) + '</a>'; }
3291 + x += addDeviceAttribute("Agent Tag", tag);
3292 + }
3293 + } else {
3294 + // Attribute: Intel AMT Tag
3295 + if ((node.intelamt != null) && (node.intelamt.tag != null)) {
3296 + var tag = EscapeHtml(node.intelamt.tag);
3297 + if (tag.startsWith('mailto:')) { tag = '<a href="' + tag + '">' + tag.substring(7) + '</a>'; }
3298 + x += addDeviceAttribute("Intel&reg; AMT Tag", tag);
3299 + }
3300 + }
3301 +
3302 + // Attribute: Intel AMT
3303 + //if (node.intelamt && node.intelamt.user) { x += addDeviceAttribute('Intel&reg; AMT', node.intelamt.user); }
3304 +
3305 + // Operating system description
3306 + if (node.osdesc) { x += addDeviceAttribute("Système opérateur", node.osdesc); }
3307 +
3308 + // Antivirus
3309 + if (node.av && node.av.length > 0) {
3310 + var y = [];
3311 + for (var i in node.av) {
3312 + if (node.av[i].product) {
3313 + var avx = EscapeHtml(node.av[i].product);
3314 + if (node.av[i].enabled !== true) { avx += ' - <span style=color:red>' + "Disabled" + '</span>'; }
3315 + if (node.av[i].updated !== true) { avx += ' - <span style=color:red>' + "Périmé" + '</span>'; }
3316 + if ((node.av[i].enabled == true) && (node.av[i].updated == true)) { avx += ' - <span style=color:green>' + "OK" + '</span>'; }
3317 + y.push(avx);
3318 + }
3319 + }
3320 + x += addDeviceAttribute("Antivirus", y.join('<br />'));
3321 + }
3322 +
3323 + // Active Users
3324 + if (node.users && node.conn && (node.users.length > 0) && (node.conn & 1)) { x += addDeviceAttribute(format("Active User{0}", ((node.users.length > 1)?'s':'')), node.users.join(', ')); }
3325 +
3326 + // Attribute: Connectivity (Only show this if more than just the agent is connected).
3327 + var connectivity = node.conn;
3328 + if (connectivity && connectivity > 1) {
3329 + var cstate = [];
3330 + if ((node.conn & 1) != 0) cstate.push('<span title=\"' + "Mesh agent is connected and ready for use." + '\">' + "Mesh Agent" + '</span>');
3331 + if ((node.conn & 2) != 0) cstate.push('<span title=\"' + "Intel&reg; AMT CIRA is connected and ready for use." + '\">' + "Intel&reg; AMT CIRA" + '</span>');
3332 + else if ((node.conn & 4) != 0) cstate.push('<span title=\"' + "Intel&reg; AMT is routable and ready for use." + '\">' + "Intel&reg; AMT" + '</span>');
3333 + if ((node.conn & 8) != 0) cstate.push('<span title=\"' + "Mesh agent is reachable using another agent as relay." + '\">' + "Mesh Relay" + '</span>');
3334 + if ((node.conn & 16) != 0) { cstate.push('<span title=\"' + "MQTT connection to the device is active." + '\">' + "MQTT" + '</span>'); }
3335 + x += addDeviceAttribute("Connectivity", cstate.join(', '));
3336 + }
3337 +
3338 + // Node grouping tags
3339 + var groupingTags = '<i>' + "None" + '</i>';
3340 + if (node.tags != null) { groupingTags = ''; for (var i in node.tags) { groupingTags += '<span class="tagSpan">' + node.tags[i] + '</span>'; } }
3341 + if ((meshrights & 4) != 0) {
3342 + x += addDeviceAttribute('Tags', '<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>' + groupingTags + ' <img class=hoverButton src="images/link5.png" /></span>');
3343 + } else {
3344 + x += addDeviceAttribute('Tags', groupingTags);
3345 + }
3346 +
3347 + x += '</table><br />';
3348 + // Show action button, only show if we have permissions 4, 8, 64
3349 + if ((meshrights & 76) != 0) { x += '<input type=button value=\"' + "Actions" + '\" title=\"' + "Effectuer des actions d'alimentation sur le périphérique" + '\" onclick=deviceActionFunction() />'; }
3350 + x += '<input type=button value=\"' + "Notes" + '\" title=\"' + "View notes about this device" + '\" onclick=showNotes(' + ((meshrights & 128) == 0) + ',"' + encodeURIComponent(node._id) + '") />';
3351 + x += '<input type=button value=\"' + "Log Event" + '\" title=\"' + "Écrire un événement pour ce périphérique" + '\" onclick=writeDeviceEvent("' + encodeURIComponent(node._id) + '") />';
3352 + //if ((connectivity & 1) && (meshrights & 8) && (node.agent.id < 5)) { x += '<input type=button value=Toast title="Display a text message of the remote device" onclick=deviceToastFunction() />'; }
3353 + QH('p10html', x);
3354 +
3355 + // Show node last 7 days timeline
3356 + masterUpdate(256);
3357 +
3358 + // Show bottom buttons
3359 + x = '<div class="p10html3right">';
3360 + if ((meshrights & 4) != 0) {
3361 + // TODO: Show change group only if there is another mesh of the same type.
3362 + x += '&nbsp;<a href=# onclick=p10showChangeGroupDialog(["' + node._id + '"]) title=\"' + "Move this device to a different device group" + '\">' + "Change Group" + '</a>';
3363 + x += '&nbsp;<a href=# onclick=p10showDeleteNodeDialog("' + node._id + '") title=\"' + "Retirer ce périphérique" + '\">' + "Delete Device" + '</a>';
3364 + }
3365 + x += '</div><div class="p10html3left">';
3366 + if (mesh.mtype == 2) x += '<a href=# onclick=p10showNodeNetInfoDialog("' + node._id + '") title=\"' + "Show device network interface information" + '\">' + "Interfaces" + '</a>&nbsp;';
3367 + if (xxmap != null) x += '<a href=# onclick=p10showNodeLocationDialog("' + node._id + '") title=\"' + "Show device locations information" + '\">' + "Location" + '</a>&nbsp;';
3368 + if (((meshrights & 8) != 0) && (mesh.mtype == 2)) x += '<a href=# onclick=p10showMeshCmdDialog(1,"' + node._id + '") title=\"' + "Traffic router used to connect to a device thru this server" + '.\">' + "Router" + '</a>&nbsp;';
3369 +
3370 + // RDP link, show this link only of the remote machine is Windows.
3371 + if (((connectivity & 1) != 0) && (clickOnce == true) && (mesh.mtype == 2) && ((meshrights & 8) != 0)) {
3372 + if ((node.agent.id > 0) && (node.agent.id < 5)) { x += '<a href=# onclick=p10clickOnce("' + node._id + '","RDP2",3389) title=\"' + "Requiert Microsoft ClickOnce dans votre navigateur" + '.\">' + "RDP" + '</a>&nbsp;'; }
3373 + if (node.agent.id > 4) {
3374 + x += '<a href=# onclick=p10clickOnce("' + node._id + '","PSSH",22) title=\"' + "Requiert Microsoft ClickOnce dans votre navigateur." + '\">' + "Putty" + '</a>&nbsp;';
3375 + x += '<a href=# onclick=p10clickOnce("' + node._id + '","WSCP",22) title=\"' + "Requiert Microsoft ClickOnce dans votre navigateur." + '\">' + "WinSCP" + '</a>&nbsp;';
3376 + }
3377 + }
3378 +
3379 + // MQTT options
3380 + if ((meshrights == 0xFFFFFFFF) && (features & 0x00400000)) { x += '<a href=# onclick=p10showMqttLoginDialog("' + node._id + '") title=\"' + "Get MQTT login credentials for this device." + '\">' + "MQTT Login" + '</a>&nbsp;'; }
3381 + x += '</div><br>'
3382 +
3383 + QH('p10html3', x);
3384 +
3385 + // Set the node power state
3386 + var powerstate = PowerStateStr(node.state);
3387 + //if (node.state == 0) { powerstate = 'Unknown State'; }
3388 + if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title=\"' + "Agent connected" + '\">' + "Agent connected" + '</span>'; }
3389 + if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title=\"' + "Intel&reg; AMT connected" + '\">' + "Intel&reg; AMT connected" + '</span>'; }
3390 + else if ((connectivity & 4) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title=\"' + "Intel&reg; AMT detected" + '\">' + "Intel&reg; AMT detected" + '</span>'; }
3391 + if ((connectivity & 16) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title=\"' + "MQTT connected" + '\">' + "MQTT channel connected" + '</span>'; }
3392 + if ((powerstate == '') && node.lastconnect) { powerstate = '<span style=font-size:12px>' + "Last seen:" + '<br />' + printDateTime(new Date(node.lastconnect)) + '</span>'; }
3393 + QH('MainComputerState', powerstate);
3394 +
3395 + // Set the node icon
3396 + Q('MainComputerImage').setAttribute('src', 'images/icons256-' + node.icon + '-1.png');
3397 + Q('MainComputerImage').className = ((!node.conn) || (node.conn == 0)?'gray':'');
3398 +
3399 + // Check if we have terminal and file access
3400 + var terminalAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 512) == 0));
3401 + var fileAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 1024) == 0));
3402 + var amtAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 2048) == 0));
3403 +
3404 + // Setup/Refresh the desktop tab
3405 + if (terminalAccess) { setupTerminal(); }
3406 + if (fileAccess) { setupFiles(); }
3407 + var consoleRights = ((meshrights & 16) != 0);
3408 + if (consoleRights) { setupConsole(); } else { if (panel == 15) { panel = 10; } }
3409 +
3410 + // Show or hide the tabs
3411 + // mesh.mtype: 1 = Intel AMT only, 2 = Mesh Agent
3412 + // node.agent.caps (bitmask): 1 = Desktop, 2 = Terminal, 4 = Files, 8 = Console
3413 + QV('MainDevDesktop', (((mesh.mtype == 1) && ((typeof node.intelamt.sku !== 'number') || ((node.intelamt.sku & 8) != 0)))
3414 + || ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 1) != 0) || (node.intelamt && (node.intelamt.state == 2)))))
3415 + && ((meshrights & 8) || (meshrights & 256))
3416 + );
3417 + QV('MainDevTerminal', ((mesh.mtype == 1) || (node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 2) != 0) || (node.intelamt && (node.intelamt.state == 2))) && (meshrights & 8) && terminalAccess);
3418 + QV('MainDevFiles', ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 4) != 0))) && (meshrights & 8) && fileAccess);
3419 + QV('MainDevAmt', (node.intelamt != null) && ((node.intelamt.state == 2) || (node.conn & 2)) && (meshrights & 8) && amtAccess);
3420 + QV('MainDevConsole', (consoleRights && (mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 8) != 0))) && (meshrights & 8));
3421 + QV('MainDevPlugins', pluginHandler != null);
3422 + QV('p15uploadCore', (node.agent != null) && (node.agent.caps != null) && ((node.agent.caps & 16) != 0));
3423 + QH('p15coreName', ((node.agent != null) && (node.agent.core != null))?node.agent.core:'');
3424 +
3425 + // Setup/Refresh Intel AMT tab
3426 + var amtFrameNode = Q('p14iframe').contentWindow.getCurrentMeshNode();
3427 + if ((amtFrameNode != null) && (amtFrameNode._id != currentNode._id)) { Q('p14iframe').contentWindow.disconnect(); }
3428 + var online = ((node.conn & 6) != 0)?true:false; // If CIRA (2) or AMT (4) connected, enable Commander
3429 + Q('p14iframe').contentWindow.setConnectionState(online);
3430 + Q('p14iframe').contentWindow.setFrameHeight('650px');
3431 + Q('p14iframe').contentWindow.setAuthCallback(updateAmtCredentials);
3432 +
3433 + // Display "action" button on desktop/terminal/files
3434 + QV('deskActionsBtn', (meshrights & 72) != 0); // 72 = Wake-up + Remote Control permissions
3435 + QV('termActionsBtn', (meshrights & 72) != 0);
3436 + QV('filesActionsBtn', (meshrights & 72) != 0);
3437 +
3438 + // Request the power timeline
3439 + if ((powerTimelineNode != currentNode._id) && (powerTimelineReq != currentNode._id)) {
3440 + QH('p10html2', '');
3441 + powerTimelineReq = currentNode._id;
3442 + meshserver.send({ action: 'powertimeline', nodeid: currentNode._id });
3443 + meshserver.send({ action: 'lastconnect', nodeid: currentNode._id });
3444 + meshserver.send({ action: 'getsysinfo', nodeid: currentNode._id });
3445 + QH('p17info', '');
3446 + }
3447 +
3448 + // Reset the desktop tools
3449 + QV('DeskTools', false);
3450 + showDeskToolsProcesses();
3451 +
3452 + // Ask for device events
3453 + refreshDeviceEvents();
3454 +
3455 + // Update the web page title
3456 + if ((currentNode) && (xxcurrentView >= 10) && (xxcurrentView < 20)) {
3457 + document.title = decodeURIComponent('{{{extitle}}}') + ' - ' + currentNode.name + ' - ' + mesh.name;
3458 + } else {
3459 + document.title = decodeURIComponent('{{{extitle}}}');
3460 + }
3461 +
3462 + // Clear user consent status if present
3463 + p11clearConsoleMsg();
3464 + p12clearConsoleMsg();
3465 + p13clearConsoleMsg();
3466 +
3467 + // Device refresh plugin handler
3468 + if (pluginHandler != null) { pluginHandler.onDeviceRefeshEnd(nodeid, panel, refresh, event); }
3469 + }
3470 + setupDesktop(); // Always refresh the desktop, even if we are on the same device, we need to do some canvas switching.
3471 + if (!panel) panel = 10;
3472 + go(panel);
3473 + }
3474 +
3475 + function writeDeviceEvent(nodeid) {
3476 + if (xxdialogMode) return;
3477 + setDialogMode(2, "Ajouter un événement", 3, writeDeviceEventEx, '<textarea id=d2devEvent style=background-color:#fcf3cf;width:100%;height:200px;resize:none;overflow-y:scroll></textarea><span style=font-size:10px>' + "This will add an entry to this device\'s event log." + '<span>', nodeid);
3478 + }
3479 +
3480 + function writeDeviceEventEx(buttons, tag) { meshserver.send({ action: 'setDeviceEvent', nodeid: decodeURIComponent(tag), msg: encodeURIComponent(Q('d2devEvent').value) }); }
3481 +
3482 + function showNotes(readonly, noteid) {
3483 + if (xxdialogMode) return;
3484 + setDialogMode(2, "Notes", 2, showNotesEx, '<textarea id=d2devNotes ro=' + readonly + ' noteid=' + noteid + ' readonly style=background-color:#fcf3cf;width:100%;height:200px;resize:none;overflow-y:scroll></textarea><span style=font-size:10px>' + "Device group notes can be viewed and changed by other device group administrators." + '<span>', noteid);
3485 + meshserver.send({ action: 'getNotes', id: decodeURIComponent(noteid) });
3486 + }
3487 +
3488 + function showNotesEx(buttons, tag) { meshserver.send({ action: 'setNotes', id: decodeURIComponent(tag), notes: encodeURIComponent(Q('d2devNotes').value) }); }
3489 +
3490 + function deviceChat() {
3491 + if (xxdialogMode) return;
3492 + var url = '/messenger?id=meshmessenger/' + encodeURIComponent(currentNode._id) + '/' + encodeURIComponent(userinfo._id) + '&title=' + currentNode.name;
3493 + if ((authCookie != null) && (authCookie != '')) { url += '&auth=' + authCookie; }
3494 + window.open(url, 'meshmessenger:' + currentNode._id);
3495 + meshserver.send({ action: 'meshmessenger', nodeid: decodeURIComponent(currentNode._id) });
3496 + }
3497 +
3498 + function deviceUrlFunction() {
3499 + if (xxdialogMode) return;
3500 + setDialogMode(2, "Open Page on Device", 3, deviceUrlFunctionEx, '<input id=d2devurl placeholder="http://server.com" style=width:100%;overflow-y:scroll></input>');
3501 + Q('d2devurl').focus();
3502 + }
3503 +
3504 + function deviceUrlFunctionEx() {
3505 + meshserver.send({ action: 'msg', type: 'openUrl', nodeid: currentNode._id, url: Q('d2devurl').value });
3506 + }
3507 +
3508 + function deviceToastFunction() {
3509 + if (xxdialogMode) return;
3510 + setDialogMode(2, "Device Notification", 3, deviceToastFunctionEx, '<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>');
3511 + Q('d2devToast').focus();
3512 + }
3513 +
3514 + function deviceToastFunctionEx() {
3515 + meshserver.send({ action: 'toast', nodeids: [ currentNode._id ], title: 'MeshCentral', msg: Q('d2devToast').value });
3516 + }
3517 +
3518 + function deviceActionFunction() {
3519 + if (xxdialogMode) return;
3520 + var meshrights = meshes[currentNode.meshid].links[userinfo._id].rights;
3521 + var x = "Select an operation to perform on this device." + '<br /><br />';
3522 + var y = '<select id=d2deviceop style=float:right;width:250px>';
3523 + if ((meshrights & 64) != 0) { y += '<option value=100>' + "Wake-up" + '</option>'; } // Wake-up permission
3524 + if ((meshrights & 8) != 0) { y += '<option value=4>' + "Dormir" + '</option><option value=3>' + "Réinitialiser" + '</option><option value=2>' + "Éteindre" + '</option>'; } // Remote control permission
3525 + if ((currentNode.conn & 16) != 0) { y += '<option value=103>' + "Envoyer un Message MQTT" + '</option>'; }
3526 + y += '</select>';
3527 + x += addHtmlValue("Opération", y);
3528 + setDialogMode(2, "Device Action", 3, deviceActionFunctionEx, x);
3529 + }
3530 +
3531 + function deviceActionFunctionEx() {
3532 + var op = Q('d2deviceop').value;
3533 + if (op == 100) {
3534 + // Device wake
3535 + meshserver.send({ action: 'wakedevices', nodeids: [currentNode._id] });
3536 + } else if (op == 103) {
3537 + // Send MQTT Message
3538 + p10showSendMqttMsgDialog([currentNode._id]);
3539 + } else {
3540 + // Power operation
3541 + meshserver.send({ action: 'poweraction', nodeids: [ currentNode._id ], actiontype: parseInt(op) });
3542 + }
3543 + }
3544 +
3545 + // Called when MeshCommander needs new credentials or updated credentials.
3546 + function updateAmtCredentials(forceDialog) {
3547 + var node = getNodeFromId(currentNode._id);
3548 + if ((forceDialog == true) || (node.intelamt.user == null) || (node.intelamt.user == '')) {
3549 + editDeviceAmtSettings(currentNode._id, updateAmtCredentialsEx);
3550 + } else {
3551 + Q('p14iframe').contentWindow.connectButtonfunctionEx();
3552 + }
3553 + }
3554 +
3555 + function updateAmtCredentialsEx(button, tag) {
3556 + Q('p14iframe').contentWindow.connectButtonfunctionEx();
3557 + }
3558 +
3559 + // Look to see if we need to update the device timeline
3560 + function updateDeviceTimeline() {
3561 + if ((meshserver.State != 2) || (powerTimelineNode == null) || (powerTimelineUpdate == null) || (currentNode == null)) return;
3562 + if ((powerTimelineNode == powerTimelineReq) && (currentNode._id == powerTimelineNode) && (powerTimelineUpdate < Date.now())) {
3563 + powerTimelineUpdate = null;
3564 + meshserver.send({ action: 'powertimeline', nodeid: currentNode._id });
3565 + meshserver.send({ action: 'lastconnect', nodeid: currentNode._id });
3566 + }
3567 + }
3568 +
3569 + // Draw device power bars. The bars are 766px wide.
3570 + function drawDeviceTimeline() {
3571 + if ((currentNode == null) || (xxcurrentView < 10) || (xxcurrentView > 19)) return;
3572 + var timeline = null, now = Date.now();
3573 + if (currentNode._id == powerTimelineNode) { timeline = powerTimeline; }
3574 +
3575 + // Calculate when the timeline starts
3576 + var d = new Date();
3577 + d.setHours(0, 0, 0, 0);
3578 + d = new Date(d.getTime() - (1000 * 60 * 60 * 24 * 6));
3579 + var timelineStart = d.getTime();
3580 +
3581 + // De-compact the timeline
3582 + var timeline2 = [];
3583 + if (timeline != null && timeline.length > 1) {
3584 + timeline2.push([ 0, timeline[1], timeline[0] ]); // Start, End, Power
3585 + var ct = timeline[1];
3586 + for (var i = 2; i < timeline.length; i += 2) {
3587 + var power = timeline[i], dt = now;
3588 + if (timeline.length > (i + 1)) { dt = timeline[i + 1]; }
3589 + timeline2.push([ ct, ct + dt, power ]); // Start, End, Power
3590 + ct = ct + dt;
3591 + }
3592 + }
3593 +
3594 + // Draw the timeline
3595 + var x = '', count = 1, date = new Date();
3596 + var totalWidth = Q('masthead').offsetWidth - (160 + 9 + 9 + 14); // Compute the total width of the power bar
3597 + date.setHours(0, 0, 0, 0);
3598 + for (var i = 0; i < 7; i++) {
3599 + var datavalue = '', start = date.getTime(), end = start + (1000 * 60 * 60 * 24);
3600 + for (var j in timeline2) {
3601 + var block = timeline2[j];
3602 + if (isTimeBlockInside(start, end, block[0], block[1]) == true) {
3603 + var ts = Math.max(start, block[0]);
3604 + var te = Math.min(Math.min(end, block[1]), now);
3605 + var width = Math.round(((te - ts) * totalWidth) / 86400000);
3606 + if (width > 0) {
3607 + var title = format('{0} from {1} to {2}.', powerStateStrings2[block[2]], printTime(new Date(ts)), printTime(new Date(te)));
3608 + datavalue += '<div class="pwState ' + powerColor(block[2]) + '" title="' + title + '" style="width:' + width + 'px;"></div>';
3609 + }
3610 + }
3611 + }
3612 + x += '<tr class=' + (((count % 2) == 0)?'altBack':'') + '><td><div>&nbsp;' + printDate(date) + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
3613 + ++count;
3614 + date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
3615 + }
3616 + QH('p10html2', '<table cellpadding=2 cellspacing=0><thead><tr style=><th scope=col style=text-align:center;width:150px>' + "Day" + '</th><th scope=col style=text-align:center><a download href="devicepowerevents.ashx?id=' + currentNode._id + '" onclick="setDialogMode(0)"><img title=\"' + "Download power events" + '\" src="images/link4.png" /></a>' + "7 Day Power State" + '</th></tr></thead><tbody>' + x + '</tbody></table>');
3617 + }
3618 +
3619 + // Return a color for the given power state
3620 + function powerColor(x) { if (x < powerColorTable.length) { return powerColorTable[x]; } return 'pwsYellow'; }
3621 +
3622 + // Return true if the time block is visible within the start/end period
3623 + function isTimeBlockInside(start, end, blockStart, blockEnd) {
3624 + if ((blockStart < start) && (blockEnd > end)) return true; // Block is wider than timespan
3625 + if ((blockStart > start) && (blockStart < end)) return true;
3626 + if ((blockEnd > start) && (blockEnd < end)) return true;
3627 + return false;
3628 + }
3629 +
3630 + function addDeviceAttribute(name, value) { return '<tr><td class=style7>' + name + '</td><td class=style9>' + value + '</td></tr>'; }
3631 +
3632 + function editDeviceAmtSettings(nodeid, func, arg) {
3633 + if (xxdialogMode) return;
3634 + var x = '', node = getNodeFromId(nodeid), buttons = 3, meshrights = getNodeRights(nodeid);
3635 + if ((meshrights & 4) == 0) return;
3636 + x += addHtmlValue("Nom d'utilisateur", '<input id=dp10username style=width:230px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');
3637 + x += addHtmlValue("Mot de passe", '<input id=dp10password type=password style=width:230px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');
3638 + x += addHtmlValue("Sécurité", '<select id=dp10tls style=width:236px><option value=0>' + "No TLS security" + '</option><option value=1>' + "Sécurité TLS requise" + '</option></select>');
3639 + if ((node.intelamt.user != null) && (node.intelamt.user != '')) { buttons = 7; }
3640 + setDialogMode(2, "Edit Intel&reg; AMT credentials", buttons, editDeviceAmtSettingsEx, x, { node: node, func: func, arg: arg });
3641 + if ((node.intelamt.user != null) && (node.intelamt.user != '')) { Q('dp10username').value = node.intelamt.user; } else { Q('dp10username').value = 'admin'; }
3642 + Q('dp10tls').value = node.intelamt.tls;
3643 + validateDeviceAmtSettings();
3644 + }
3645 +
3646 + function validateDeviceAmtSettings() {
3647 + QE('idx_dlgOkButton', passwordcheck(Q('dp10password').value));
3648 + }
3649 +
3650 + function editDeviceAmtSettingsEx(button, tag) {
3651 + if (button == 2) {
3652 + // Delete button pressed, remove credentials
3653 + meshserver.send({ action: 'changedevice', nodeid: tag.node._id, intelamt: { user: '', pass: '' } });
3654 + } else {
3655 + // Change Intel AMT credentials
3656 + var amtuser = Q('dp10username').value;
3657 + if (amtuser == '') amtuser = 'admin';
3658 + var amtpass = Q('dp10password').value;
3659 + if (amtpass == '') amtuser = '';
3660 + meshserver.send({ action: 'changedevice', nodeid: tag.node._id, intelamt: { user: amtuser, pass: amtpass, tls: Q('dp10tls').value } });
3661 + tag.node.intelamt.user = amtuser;
3662 + tag.node.intelamt.tls = Q('dp10tls').value;
3663 + if (tag.func) { setTimeout(function () { tag.func(null, tag.arg); }, 300); }
3664 + }
3665 + }
3666 +
3667 + function p10showSendMqttMsgDialog(nodeids) {
3668 + if (xxdialogMode) return false;
3669 + var x = addHtmlValue("Topic", '<input id=dp2topic style=width:230px maxlength=64 onchange=p10validateSendMqttMsgDialog() onkeyup=p10validateSendMqttMsgDialog(event,1) />');
3670 + x += addHtmlValue("Message", '<div style=width:230px;margin:0;padding:0><textarea id=dp2msg maxlength=4096 style=width:100%;height:150px;resize:none onchange=p10validateSendMqttMsgDialog() onkeyup=p10validateSendMqttMsgDialog(event,1)></textarea></div>');
3671 + setDialogMode(2, "Envoyer un message MQTT", 3, p10showSendMqttMsgDialogEx, x, nodeids);
3672 + p10validateSendMqttMsgDialog();
3673 + Q('dp2topic').focus();
3674 + return false;
3675 + }
3676 +
3677 + function p10validateSendMqttMsgDialog() {
3678 + QE('idx_dlgOkButton', (Q('dp2topic').value.length > 0) && (Q('dp2msg').value.length > 0));
3679 + }
3680 +
3681 + function p10showSendMqttMsgDialogEx(b, nodeids) {
3682 + meshserver.send({ action: 'sendmqttmsg', nodeids: nodeids, topic: Q('dp2topic').value, msg: Q('dp2msg').value });
3683 + }
3684 +
3685 + function p10showChangeGroupDialog(nodeids) {
3686 + if (xxdialogMode) return false;
3687 + var targetMeshId = null;
3688 + if (nodeids.length == 1) { try { targetMeshId = meshes[getNodeFromId(nodeids[0])]._id; } catch (ex) { } }
3689 +
3690 + // List all available alternative groups
3691 + var y = '<select id=p10newGroup style=width:236px>', count = 0;
3692 + for (var i in meshes) {
3693 + var meshrights = meshes[i].links[userinfo._id].rights;
3694 + if ((meshes[i]._id != targetMeshId) && (meshrights & 4)) { count++; y += '<option value=\'' + meshes[i]._id + '\'>' + meshes[i].name + '</option>'; }
3695 + }
3696 + y += '</select>';
3697 +
3698 + if (count > 0) {
3699 + var x = (nodeids.length == 1) ? ("Select a new group for this device" + '<br /><br />') : ("Select a new group for selected devices" + '<br /><br />');
3700 + x += addHtmlValue("Nouveau Group", y);
3701 + setDialogMode(2, "Change Group", 3, p10showChangeGroupDialogEx, x, nodeids);
3702 + } else {
3703 + setDialogMode(2, "Change Group", 1, null, "No other device group of same type exists.");
3704 + }
3705 + return false;
3706 + }
3707 +
3708 + function p10showChangeGroupDialogEx(b, nodeids) {
3709 + meshserver.send({ action: 'changeDeviceMesh', nodeids: nodeids, meshid: Q('p10newGroup').value });
3710 + }
3711 +
3712 + function p10showDeleteNodeDialog(nodeid) {
3713 + if (xxdialogMode) return false;
3714 + var x = format("Êtes-vous sûr de vouloir supprimer le noeud {0}?", EscapeHtml(currentNode.name)) + '<br /><br /><label><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />' + "Confirm" + '</label>';
3715 + setDialogMode(2, "Delete Node", 3, p10showDeleteNodeDialogEx, x, nodeid);
3716 + p10validateDeleteNodeDialog();
3717 + return false;
3718 + }
3719 +
3720 + function p10validateDeleteNodeDialog() {
3721 + QE('idx_dlgOkButton', Q('p10check').checked);
3722 + }
3723 +
3724 + function p10showDeleteNodeDialogEx(buttons, nodeid) {
3725 + meshserver.send({ action: 'removedevices', nodeids: [ nodeid ] });
3726 + }
3727 +
3728 + function p10clickOnce(nodeid, protocol, port) {
3729 + meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tag: 'clickonce', protocol: protocol });
3730 + return false;
3731 + }
3732 +
3733 + // Show current location
3734 + var d2map = null;
3735 + function p10showNodeLocationDialog() {
3736 + if ((xxdialogMode != null) && (xxdialogTag == '@xxmap')) { setDialogMode(0); } else { if (xxdialogMode) return false; }
3737 + var markers = [], types = ['iploc', 'wifiloc', 'gpsloc', 'userloc'], boundingBox = null;
3738 +
3739 + for (var loctype in types) {
3740 + if (currentNode[types[loctype]] != null) {
3741 + var loc = currentNode[types[loctype]].split(','), lat = parseFloat(loc[0]), lon = parseFloat(loc[1]);
3742 + if ((lat < 90) && (lat > -90) && (lon < 180) && (lon > -180)) { // Check valid lat/lon
3743 + var deviceMark = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.fromLonLat([lon, lat])) });
3744 + deviceMark.setStyle(markerStyle(currentNode, parseInt(loctype) + 1));
3745 + markers.push(deviceMark);
3746 +
3747 + if (boundingBox == null) { boundingBox = [ lat, lon, lat, lon, 0 ]; } else { if (lat < boundingBox[0]) { boundingBox[0] = lat; } if (lon < boundingBox[1]) { boundingBox[1] = lon; } if (lat > boundingBox[2]) { boundingBox[2] = lat; } if (lon > boundingBox[3]) { boundingBox[3] = lon; } }
3748 + }
3749 + }
3750 + }
3751 +
3752 + // Setup the device mark layer
3753 + var vectorSource = new ol.source.Vector({ features: markers });
3754 + var vectorLayer = new ol.layer.Vector({ source: vectorSource });
3755 +
3756 + //var x = '<div><a href="https://www.google.com/maps/preview/@' + lat + ',' + lng + ',12z" rel="noreferrer noopener" target=_blank>Open in Google maps</a></div>';
3757 + var x = '<div id=d2map style=width:100%;height:300px></div>';
3758 + setDialogMode(2, "Device Location", 1, null, x, '@xxmap');
3759 +
3760 + var clng = 0, clat = 0, zoom = 8;
3761 + if (boundingBox != null) {
3762 + var clat = (boundingBox[0] + boundingBox[2]) / 2;
3763 + var clng = (boundingBox[1] + boundingBox[3]) / 2;
3764 + var cscale = Math.max(Math.abs(boundingBox[0] - boundingBox[2]), Math.abs(boundingBox[1] - boundingBox[3]));
3765 + var i = 360, zoom = -2;
3766 + while (i > cscale) { zoom++; i = i / 2; }
3767 + }
3768 +
3769 + if (markers.length == 1) { zoom = 8; }
3770 +
3771 + // Setup the map
3772 + d2map = new ol.Map({
3773 + target: 'd2map',
3774 + interactions: ol.interaction.defaults({dragPan:false, mouseWheelZoom:false}),
3775 + layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }), vectorLayer ],
3776 + view: new ol.View({ center: ol.proj.fromLonLat([clng, clat]), zoom: zoom })
3777 + });
3778 + return false;
3779 + }
3780 +
3781 + // Show network interfaces
3782 + function p10showNodeNetInfoDialog() {
3783 + if (xxdialogMode) return false;
3784 + setDialogMode(2, "Network Interfaces", 1, null, '<div id=d2netinfo>' + "Loading..." + '</div>', 'if' + currentNode._id );
3785 + meshserver.send({ action: 'getnetworkinfo', nodeid: currentNode._id });
3786 + return false;
3787 + }
3788 +
3789 + // Show MeshCentral Router dialog
3790 + function p10showMeshRouterDialog() {
3791 + if (xxdialogMode) return;
3792 + var x = '<div>' + "MeshCentral Router is a Windows tool for TCP port mapping. You can, for example, RDP into a remote device thru this server." + '</div><br />';
3793 + x += addHtmlValue('Win32 Executable', '<a style=cursor:pointer download href="meshagents?meshaction=winrouter" onclick="setDialogMode(0)">MeshCentralRouter.exe</a>');
3794 + setDialogMode(2, "MeshCentral Router", 1, null, x, 'fileDownload');
3795 + }
3796 +
3797 + // Request MQTT login credentials
3798 + function p10showMqttLoginDialog(nodeid) { meshserver.send({ action: 'getmqttlogin', nodeid: nodeid }); }
3799 +
3800 + // Show MeshCmd dialog
3801 + function p10showMeshCmdDialog(mode, nodeid) {
3802 + if (xxdialogMode) return;
3803 + var y = '<select id=aginsSelect onclick=meshCmdOsClick() style=width:236px>';
3804 + y += '<option value=3>' + "Windows (32bit)" + '</option>';
3805 + y += '<option value=4>' + "Windows (64bit)" + '</option>';
3806 + y += '<option value=5>' + "Linux x86 (32bit)" + '</option>';
3807 + y += '<option value=6>' + "Linux x86 (64bit)" + '</option>';
3808 + y += '<option value=16>' + "MacOS (64bit)" + '</option>';
3809 + y += '<option value=25>' + "Linux ARM, Raspberry Pi (32bit)" + '</option>';
3810 + y += '</select>';
3811 +
3812 + var x = '';
3813 + if (mode == 0) { x += '<div>MeshCmd is a command line tool that performs lots of different operations. The action file can optionally be downloaded and edited to provide server information and credentials.<br /><br />'; }
3814 + if (mode == 1) { x += '<div>Download "meshcmd" with an action file to route traffic thru this server to this device. Make sure to edit meshaction.txt and add your account password or make any changes needed.<br /><br />'; }
3815 + x += addHtmlValue('Operating System', y);
3816 + x += addHtmlValue('MeshCmd', '<a id=meshcmddownloadid href="meshagents?meshcmd=3" download></a>');
3817 + if (mode == 0) { x += addHtmlValue('Action File', '<a href="meshagents?meshaction=generic" download>MeshAction (.txt)</a>'); }
3818 + if (mode == 1) { x += addHtmlValue('Action File', '<a href="meshagents?meshaction=route&nodeid=' + nodeid + '" download>MeshAction (.txt)</a>'); }
3819 + x += '</div>';
3820 + setDialogMode(2, [ "Download MeshCmd", "Network Router" ][mode], 9, null, x, 'fileDownload');
3821 + meshCmdOsClick();
3822 + }
3823 +
3824 + function meshCmdOsClick() {
3825 + var os = Q('aginsSelect').value, osn = '', osurl = '';
3826 + //Q('meshcmddownloadid').href = 'meshagents?meshcmd=' + os;
3827 + if (os == 3) { osn = 'MeshCmd (Win32 executable)'; }
3828 + if (os == 4) { osn = 'MeshCmd (Win64 executable)'; }
3829 + if (os == 5) { osn = 'MeshCmd (Linux x86, 32bit)'; }
3830 + if (os == 6) { osn = 'MeshCmd (Linux x86, 64bit)'; }
3831 + if (os == 16) { osn = 'MeshCmd (MacOS, 64bit)'; }
3832 + if (os == 25) { osn = 'MeshCmd (Linux ARM, 32bit)'; }
3833 + QH('meshcmddownloadid', osn);
3834 + Q('meshcmddownloadid').setAttribute('href', 'meshagents?meshcmd=' + os);
3835 + }
3836 +
3837 + function p10showiconselector() {
3838 + if (xxdialogMode) return;
3839 + var mesh = meshes[currentNode.meshid];
3840 + var meshrights = mesh.links[userinfo._id].rights;
3841 + if ((meshrights & 4) == 0) return;
3842 +
3843 + var x = '<br><div style=display:inline-block;width:40px></div>';
3844 + x += '<div tabindex=0 style=display:inline-block class=i1 onclick=p10setIcon(1) onkeypress="if (event.key==\'Enter\') p10setIcon(1)"></div>';
3845 + x += '<div tabindex=0 style=display:inline-block class=i2 onclick=p10setIcon(2) onkeypress="if (event.key==\'Enter\') p10setIcon(2)"></div>';
3846 + x += '<div tabindex=0 style=display:inline-block class=i3 onclick=p10setIcon(3) onkeypress="if (event.key==\'Enter\') p10setIcon(3)"></div>';
3847 + x += '<div tabindex=0 style=display:inline-block class=i4 onclick=p10setIcon(4) onkeypress="if (event.key==\'Enter\') p10setIcon(4)"></div>';
3848 + x += '<div tabindex=0 style=display:inline-block class=i5 onclick=p10setIcon(5) onkeypress="if (event.key==\'Enter\') p10setIcon(5)"></div>';
3849 + x += '<div tabindex=0 style=display:inline-block class=i6 onclick=p10setIcon(6) onkeypress="if (event.key==\'Enter\') p10setIcon(6)"></div><br><br>';
3850 + setDialogMode(2, "Icon Selection", 0, null, x);
3851 + QV('id_dialogclose', true);
3852 + }
3853 +
3854 + function p10setIcon(icon) {
3855 + setDialogMode(0);
3856 + meshserver.send({ action: 'changedevice', nodeid: currentNode._id, icon: icon });
3857 + }
3858 +
3859 + var showEditNodeValueDialog_modes = ["Device Name", "Hostname", "Description", "Tags"];
3860 + var showEditNodeValueDialog_modes2 = ['name', 'host', 'desc', 'tags'];
3861 + var showEditNodeValueDialog_modes3 = ['', '', '', "Tag1, Tag2, Tag3"];
3862 + function showEditNodeValueDialog(mode) {
3863 + if (xxdialogMode) return;
3864 + var x = addHtmlValue(showEditNodeValueDialog_modes[mode], '<input id=dp10devicevalue maxlength=64 placeholder="' + showEditNodeValueDialog_modes3[mode] + '" onchange=p10editdevicevalueValidate(' + mode + ',event) onkeyup=p10editdevicevalueValidate(' + mode + ',event) />');
3865 + setDialogMode(2, "Edit Device", 3, showEditNodeValueDialogEx, x, mode);
3866 + var v = currentNode[showEditNodeValueDialog_modes2[mode]];
3867 + if (v == null) v = '';
3868 + if (Array.isArray(v)) { v = v.join(', '); }
3869 + Q('dp10devicevalue').value = v;
3870 + p10editdevicevalueValidate();
3871 + Q('dp10devicevalue').focus();
3872 + }
3873 +
3874 + function showEditNodeValueDialogEx(button, mode) {
3875 + var x = { action: 'changedevice', nodeid: currentNode._id };
3876 + x[showEditNodeValueDialog_modes2[mode]] = Q('dp10devicevalue').value;
3877 + meshserver.send(x);
3878 + }
3879 +
3880 + function p10editdevicevalueValidate(mode, e) {
3881 + var x = ((mode > 1) || (Q('dp10devicevalue').value.length > 0));
3882 + QE('idx_dlgOkButton', x);
3883 + if ((e != null) && (x == true) && (e.keyCode == 13)) { dialogclose(1); }
3884 + }
3885 +
3886 + //
3887 + // DESKTOP
3888 + //
3889 +
3890 + var desktopNode;
3891 + function setupDesktop() {
3892 + // Setup the remote desktop
3893 + if ((desktopNode != currentNode) && (desktop != null)) { desktop.Stop(); desktopNode = null; desktop = null; }
3894 +
3895 + // If the device desktop is already connected in multi-desktop, use that.
3896 + if ((desktopNode != currentNode) || (desktop == null)) {
3897 + var xdesk = multiDesktop[currentNode._id];
3898 + if (xdesk != null) {
3899 + // This device already has a canvas, use it.
3900 + QH('DeskParent', '');
3901 + var c = xdesk.m.CanvasId;
3902 + c.setAttribute('id', 'Desk');
3903 + c.setAttribute('onmousedown', 'dmousedown(event)');
3904 + c.setAttribute('onmouseup', 'dmouseup(event)');
3905 + c.setAttribute('onmousemove', 'dmousemove(event)');
3906 + c.removeAttribute('onclick');
3907 + Q('DeskParent').appendChild(c);
3908 + desktop = xdesk;
3909 + if (desktop.m.SendCompressionLevel) { desktop.m.SendCompressionLevel(1, desktopsettings.quality, desktopsettings.scaling, desktopsettings.framerate); }
3910 + desktop.onStateChanged = onDesktopStateChange;
3911 + desktopNode = currentNode;
3912 + onDesktopStateChange(desktop, desktop.State);
3913 + delete multiDesktop[currentNode._id];
3914 + } else {
3915 + // Device is not already connected, just setup a blank canvas
3916 + QH('DeskParent', '<canvas id=Desk oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');
3917 + desktopNode = currentNode;
3918 + }
3919 + // Setup the mouse wheel
3920 + Q('Desk').addEventListener('DOMMouseScroll', function (e) { return dmousewheel(e); });
3921 + Q('Desk').addEventListener('mousewheel', function (e) { return dmousewheel(e); });
3922 + }
3923 + desktopNode = currentNode;
3924 + updateDesktopButtons();
3925 + deskAdjust();
3926 +
3927 + // On some browsers like IE, we can't save screen shots. Hide the scheenshot/capture buttons.
3928 + if (!Q('Desk')['toBlob']) { QV('deskSaveBtn', false); }
3929 + }
3930 +
3931 + // Show and enable the right buttons
3932 + function updateDesktopButtons() {
3933 + var mesh = meshes[currentNode.meshid];
3934 + var deskState = 0;
3935 + if (desktop != null) { deskState = desktop.State; }
3936 + var meshrights = mesh.links[userinfo._id].rights;
3937 +
3938 + // Show the right buttons
3939 + QV('disconnectbutton1span', (deskState != 0));
3940 + QV('connectbutton1span', (deskState == 0) && ((meshrights & 8) || (meshrights & 256)) && (mesh.mtype == 2) && (currentNode.agent.caps & 1));
3941 + QV('connectbutton1hspan',
3942 + (deskState == 0) &&
3943 + (meshrights & 8) &&
3944 + ((mesh.mtype == 1) ||
3945 + ((currentNode.intelamt != null) &&
3946 + (currentNode.intelamt.state == 2) &&
3947 + (currentNode.intelamt.ver != null) &&
3948 + (typeof currentNode.intelamt.sku == 'number') &&
3949 + ((currentNode.intelamt.sku & 8) != 0))
3950 + )
3951 + );
3952 +
3953 + // Show the right settings
3954 + QV('d7amtkvm', (currentNode.intelamt != null && ((currentNode.intelamt.ver != null) || (mesh.mtype == 1))) && ((deskState == 0) || (desktop.contype == 2)));
3955 + QV('d7meshkvm', (webRtcDesktop) || ((mesh.mtype == 2) && (currentNode.agent.caps & 1) && ((deskState == false) || (desktop.contype == 1))));
3956 +
3957 + // Enable buttons
3958 + var inputAllowed = (meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) == 0));
3959 + var online = ((currentNode.conn & 1) != 0); // If Agent (1) connected, enable remote desktop
3960 + QE('connectbutton1', online);
3961 + var hwonline = ((currentNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal
3962 + QE('connectbutton1h', hwonline);
3963 + QE('deskSaveBtn', deskState == 3);
3964 + QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (deskState != 0) && (desktopsettings.showfocus));
3965 + QV('DeskClip', (currentNode.agent) && (currentNode.agent.id != 11) && (currentNode.agent.id != 16) && ((desktop == null) || (desktop.contype != 2))); // Clipboard not supported on MacOS
3966 + QE('DeskClip', deskState == 3);
3967 + QE('DeskType', deskState == 3);
3968 + QV('DeskWD', inputAllowed);
3969 + QE('DeskWD', deskState == 3);
3970 + QV('deskkeys', inputAllowed);
3971 + QE('deskkeys', deskState == 3);
3972 +
3973 + // Display this only if we have Chat & Notify permissions
3974 + QV('DeskChatButton', ((meshrights & 16384) != 0) && (browserfullscreen == false) && (inputAllowed) && (mesh.mtype == 2) && online);
3975 + QV('DeskNotifyButton', ((meshrights & 16384) != 0) && (browserfullscreen == false) && (currentNode.agent) && (currentNode.agent.id < 5) && (inputAllowed) && (mesh.mtype == 2) && online);
3976 +
3977 + QV('DeskToolsButton', (inputAllowed) && (mesh.mtype == 2) && online);
3978 + QV('DeskOpenWebButton', (browserfullscreen == false) && (inputAllowed) && (mesh.mtype == 2) && online);
3979 + QV('DeskControlSpan', inputAllowed)
3980 + QV('deskActionsBtn', (browserfullscreen == false));
3981 + QV('deskActionsSettings', (browserfullscreen == false));
3982 + if (meshrights & 8) { Q('DeskControl').checked = (getstore('DeskControl', 1) == 1); } else { Q('DeskControl').checked = false; }
3983 + if (online == false) QV('DeskTools', false);
3984 + }
3985 +
3986 + // Debug
3987 + var autoConnectDesktopTimer = null;
3988 + function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(connectDesktop, 100); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } }
3989 +
3990 + function connectDesktop(e, contype) {
3991 + p11clearConsoleMsg();
3992 + if (desktop == null) {
3993 + desktopNode = currentNode;
3994 + if (contype == 2) {
3995 + // Setup the Intel AMT remote desktop
3996 + if ((desktopNode.intelamt.user == null) || (desktopNode.intelamt.user == '')) { editDeviceAmtSettings(desktopNode._id, connectDesktop, 2); return; }
3997 + desktop = CreateAmtRedirect(CreateAmtRemoteDesktop('Desk'), authCookie);
3998 + desktop.debugmode = debugmode;
3999 + desktop.onStateChanged = onDesktopStateChange;
4000 + desktop.m.bpp = (desktopsettings.encoding == 1 || desktopsettings.encoding == 3) ? 1 : 2;
4001 + desktop.m.useZRLE = (desktopsettings.encoding < 3);
4002 + desktop.m.localKeyMap = desktopsettings.localkeymap;
4003 + desktop.m.showmouse = desktopsettings.showmouse;
4004 + desktop.m.onScreenSizeChange = deskAdjust;
4005 + desktop.m.onKvmData = function (x) {
4006 + //console.log('onKvmData (' + x.length + '): ' + x);
4007 + // Send the presense probe only once if needed.
4008 + if (x.length == 0) { if (!desktop.m._sentPresence) { desktop.m._sentPresence = true; desktop.m.sendKvmData(JSON.stringify({ action: 'present', ver: 1 })); } return; }
4009 + var data = null;
4010 + try { data = JSON.parse(x); } catch (e) { }
4011 + if ((data != null) && (data.action != null)) {
4012 + if (data.action == 'restart') {
4013 + // Clear WebRTC channel
4014 + webRtcDesktopReset();
4015 + desktop.m.sendKvmData(JSON.stringify({ action: 'present', ver: 1 }));
4016 + } else if ((data.action == 'present') && (webRtcDesktop == null)) {
4017 + // Setup WebRTC channel
4018 + webRtcDesktop = { platform: data.platform };
4019 + var configuration = null; //{ "iceServers": [ { 'urls': 'stun:stun.services.mozilla.com' }, { 'urls': 'stun:stun.l.google.com:19302' } ] };
4020 + if (typeof RTCPeerConnection !== 'undefined') { webRtcDesktop.webrtc = new RTCPeerConnection(configuration); }
4021 + else if (typeof webkitRTCPeerConnection !== 'undefined') { webRtcDesktop.webrtc = new webkitRTCPeerConnection(configuration); }
4022 +
4023 + webRtcDesktop.webchannel = webRtcDesktop.webrtc.createDataChannel("DataChannel", {}); // { ordered: false, maxRetransmits: 2 }
4024 + webRtcDesktop.webchannel.onopen = function () {
4025 + // Switch to software KVM
4026 + //if (urlvars && urlvars['kvmdatatrace']) { console.log('WebRTC Data Channel Open'); }
4027 + console.log('WebRTC Data Channel Open');
4028 + Q('deskstatus').textContent = StatusStrs[desktop.State] + ", Soft-KVM";
4029 + desktop.m.hold(true);
4030 + webRtcDesktop.webRtcActive = true;
4031 + webRtcDesktop.softdesktop = CreateKvmDataChannel(webRtcDesktop.webchannel, CreateAgentRemoteDesktop('Desk', Q('id_mainarea')), desktop.m);
4032 + webRtcDesktop.softdesktop.m.setRotation(desktop.m.rotation);
4033 + webRtcDesktop.softdesktop.m.onScreenSizeChange = deskAdjust;
4034 + if (desktopsettings.quality) { webRtcDesktop.softdesktop.m.CompressionLevel = desktopsettings.quality; } // Number from 1 to 100. 50 or less is best.
4035 + if (desktopsettings.scaling) { webRtcDesktop.softdesktop.m.ScalingLevel = desktopsettings.scaling; }
4036 + webRtcDesktop.softdesktop.Start();
4037 +
4038 + // Check if we can get remote file access
4039 + // ###BEGIN###{DesktopInbandFiles}
4040 + /*
4041 + QV('go24', true); // Files
4042 + downloadFile = null;
4043 + p24files = webRtcDesktop.softdesktop;
4044 + p24targetpath = '';
4045 + webRtcDesktop.softdesktop.onControlMsg = onFilesControlData;
4046 + webRtcDesktop.softdesktop.sendCtrlMsg(JSON.stringify({ action: 'ls', reqid: 1, path: '' })); // Ask for the root folder
4047 + */
4048 + // ###END###{DesktopInbandFiles}
4049 + }
4050 + webRtcDesktop.webchannel.onclose = function (event) {
4051 + //if (urlvars['kvmdatatrace']) { console.log('WebRTC Data Channel Closed'); }
4052 + console.log('WebRTC Data Channel Closed');
4053 + webRtcDesktopReset();
4054 + }
4055 + webRtcDesktop.webrtc.onicecandidate = function (e) {
4056 + if (e.candidate == null) {
4057 + desktop.m.sendKvmData(JSON.stringify({ action: 'offer', ver: 1, sdp: webRtcDesktop.webrtcoffer.sdp }));
4058 + } else {
4059 + webRtcDesktop.webrtcoffer.sdp += ('a=' + e.candidate.candidate + '\r\n'); // New candidate, add it to the SDP
4060 + }
4061 + }
4062 + webRtcDesktop.webrtc.oniceconnectionstatechange = function () {
4063 + if ((webRtcDesktop != null) && (webRtcDesktop.webrtc != null) && ((webRtcDesktop.webrtc.iceConnectionState == 'disconnected') || (webRtcDesktop.webrtc.iceConnectionState == 'failed'))) { /*console.log('WebRTC ICE Failed');*/ webRtcDesktopReset(); }
4064 + }
4065 + webRtcDesktop.webrtc.createOffer(function (offer) {
4066 + // Got the offer
4067 + webRtcDesktop.webrtcoffer = offer;
4068 + webRtcDesktop.webrtc.setLocalDescription(offer, function () { }, webRtcDesktopReset);
4069 + }, webRtcDesktopReset, { mandatory: { OfferToReceiveAudio: false, OfferToReceiveVideo: false } });
4070 + } else if ((data.action == 'answer') && (webRtcDesktop != null)) {
4071 + // Complete the WebRTC channel
4072 + webRtcDesktop.webrtc.setRemoteDescription(new RTCSessionDescription({ type: 'answer', sdp: data.sdp }), function () { }, webRtcDesktopReset);
4073 + }
4074 + }
4075 + };
4076 + desktop.Start(desktopNode._id, 16994, '*', '*', 0);
4077 + desktop.contype = 2;
4078 + } else {
4079 + // Setup the Mesh Agent remote desktop
4080 + desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
4081 + desktop.debugmode = debugmode;
4082 + desktop.m.debugmode = debugmode;
4083 + desktop.attemptWebRTC = attemptWebRTC;
4084 + desktop.onStateChanged = onDesktopStateChange;
4085 + desktop.onConsoleMessageChange = function () {
4086 + p11clearConsoleMsg();
4087 + if (desktop.consoleMessage) {
4088 + QH('p11DeskConsoleMsg', EscapeHtml(desktop.consoleMessage).split('\n').join('<br />'));
4089 + QV('p11DeskConsoleMsg', true);
4090 + p11DeskConsoleMsgTimer = setTimeout(p11clearConsoleMsg, 8000);
4091 + }
4092 + }
4093 + desktop.m.CompressionLevel = desktopsettings.quality; // Number from 1 to 100. 50 or less is best.
4094 + desktop.m.ScalingLevel = desktopsettings.scaling;
4095 + desktop.m.FrameRateTimer = desktopsettings.framerate;
4096 + desktop.m.onDisplayinfo = deskDisplayInfo;
4097 + desktop.m.onScreenSizeChange = deskAdjust;
4098 + desktop.Start(desktopNode._id);
4099 + desktop.contype = 1;
4100 + }
4101 + } else {
4102 + // Disconnect and clean up the remote desktop
4103 + desktop.Stop();
4104 + webRtcDesktopReset();
4105 + desktopNode = desktop = null;
4106 + }
4107 + }
4108 +
4109 + function p11clearConsoleMsg() { QV('p11DeskConsoleMsg', false); if (p11DeskConsoleMsgTimer) { clearTimeout(p11DeskConsoleMsgTimer); p11DeskConsoleMsgTimer = null; } }
4110 + function p12clearConsoleMsg() { QV('p12TermConsoleMsg', false); if (p12TermConsoleMsgTimer) { clearTimeout(p12TermConsoleMsgTimer); p12TermConsoleMsgTimer = null; } }
4111 + function p13clearConsoleMsg() { QV('p13FilesConsoleMsg', false); if (p13FilesConsoleMsgTimer) { clearTimeout(p13FilesConsoleMsgTimer); p13FilesConsoleMsgTimer = null; } }
4112 +
4113 + var webRtcDesktop = null;
4114 + function webRtcDesktopReset() {
4115 + if (webRtcDesktop == null) return;
4116 + if (webRtcDesktop.softdesktop != null) { webRtcDesktop.softdesktop.Stop(); webRtcDesktop.softdesktop = null; }
4117 + if (webRtcDesktop.webchannel != null) { try { webRtcDesktop.webchannel.close(); } catch (e) { } webRtcDesktop.webchannel = null; }
4118 + if (webRtcDesktop.webrtc != null) { try { webRtcDesktop.webrtc.close(); } catch (e) { } webRtcDesktop.webrtc = null; }
4119 + webRtcDesktop = null;
4120 + // Switch back to hardware KVM
4121 + if (desktop && desktop.m) {
4122 + desktop.m.hold(false);
4123 + Q('deskstatus').textContent = StatusStrs[desktop.State];
4124 + }
4125 + // ###BEGIN###{DesktopInbandFiles}
4126 + /*
4127 + p24files = null;
4128 + p24downloadFileCancel() // If any downloads are in process, cancel them.
4129 + p24uploadFileCancel(); // If any uploads are in process, cancel them.
4130 + QV('go24', false); // Files
4131 + if (currentView == 24) { go(14); }
4132 + */
4133 + // ###END###{DesktopInbandFiles}
4134 + }
4135 +
4136 + function onDesktopStateChange(xdesktop, state) {
4137 + var xstate = state;
4138 + if ((xstate == 3) && (xdesktop.contype == 2)) { xstate++; }
4139 + var str = StatusStrs[xstate];
4140 + if ((desktop != null) && (desktop.webRtcActive == true)) { str += ", WebRTC"; }
4141 + //if (desktop.m.stopInput == true) { str += ', Loopback'; }
4142 + QH('deskstatus', str);
4143 + switch (state) {
4144 + case 0:
4145 + // Disconnect and clean up the remote desktop
4146 + desktop.Stop();
4147 + desktopNode = desktop = null;
4148 + QV('DeskFocus', false);
4149 + QV('termdisplays', false);
4150 + QV('deskRecordIcon', false);
4151 + deskFocusBtn.value = "All Focus";
4152 + if (fullscreen == true) { deskToggleFull(); }
4153 + webRtcDesktopReset();
4154 + deskPreferedStickyDisplay = 0;
4155 + break;
4156 + case 2:
4157 + break;
4158 + case 3:
4159 + if (desktop && (desktop.serverIsRecording == true)) { QV('deskRecordIcon', true); }
4160 + desktop.startTime = new Date();
4161 + if (updateSessionTimer == null) { updateSessionTimer = setInterval(updateSessionTime, 1000); }
4162 + break;
4163 + default:
4164 + //console.log('Unknown onDesktopStateChange state', state);
4165 + break;
4166 + }
4167 + updateDesktopButtons();
4168 + deskAdjust();
4169 + setTimeout(deskAdjust, 50);
4170 + }
4171 +
4172 + function updateSessionTime() {
4173 + // Desktop
4174 + var seconds = 0;
4175 + if (desktop && desktop.startTime) {
4176 + seconds = Math.floor((new Date() - desktop.startTime) / 1000);
4177 + QH('DeskTimer', zeroPad(Math.floor(seconds / 3600), 2) + ':' + zeroPad((Math.floor(seconds / 60) % 60), 2) + ':' + zeroPad((seconds % 60), 2));
4178 + } else {
4179 + QH('DeskTimer', '');
4180 + }
4181 +
4182 + // Terminal
4183 + seconds = 0;
4184 + if (terminal && terminal.startTime) {
4185 + seconds = Math.floor((new Date() - terminal.startTime) / 1000);
4186 + QH('TermTimer', zeroPad(Math.floor(seconds / 3600), 2) + ':' + zeroPad((Math.floor(seconds / 60) % 60), 2) + ':' + zeroPad((seconds % 60), 2));
4187 + } else {
4188 + QH('TermTimer', '');
4189 + }
4190 +
4191 + if ((desktop == null) && (terminal == null)) { clearInterval(updateSessionTimer); updateSessionTimer = null; }
4192 + }
4193 +
4194 + function showDesktopSettings() {
4195 + if (xxdialogMode) return;
4196 + applyDesktopSettings();
4197 + updateDesktopButtons();
4198 + setDialogMode(7, "Remote Desktop Settings", 3, showDesktopSettingsChanged);
4199 + }
4200 +
4201 + function showDesktopSettingsChanged() {
4202 + desktopsettings.encoding = d7desktopmode.value;
4203 + desktopsettings.showfocus = d7showfocus.checked;
4204 + desktopsettings.showmouse = d7showcursor.checked;
4205 + desktopsettings.quality = d7bitmapquality.value;
4206 + desktopsettings.scaling = d7bitmapscaling.value;
4207 + desktopsettings.framerate = d7framelimiter.value;
4208 + desktopsettings.localkeymap = d7localKeyMap.checked;
4209 + localStorage.setItem('desktopsettings', JSON.stringify(desktopsettings));
4210 + applyDesktopSettings();
4211 + if (desktop) {
4212 + if (desktop.contype == 1) {
4213 + if (desktop.State != 0) {
4214 + desktop.m.SendCompressionLevel(1, desktopsettings.quality, desktopsettings.scaling, desktopsettings.framerate);
4215 + }
4216 + }
4217 + if (desktop.contype == 2) {
4218 + if (desktopsettings.showfocus == false) { desktop.m.focusmode = 0; deskFocusBtn.value = "All Focus"; }
4219 + if (desktop.State != 0) { desktop.Stop(); setTimeout(function () { connectDesktop(null, 2); }, 50); }
4220 + }
4221 + }
4222 + }
4223 +
4224 + function applyDesktopSettings() {
4225 + var r = '', ops = (features & 512)?[90,80,70,60,50,40,30,20,10,5,1]:[60,50,40,30,20,10,5,1];
4226 + for (var i in ops) { r += '<option value=' + ops[i] + '>' + ops[i] + '%</option>'; }
4227 + QH('d7bitmapquality', r);
4228 + d7desktopmode.value = desktopsettings.encoding;
4229 + d7showfocus.checked = desktopsettings.showfocus;
4230 + d7showcursor.checked = desktopsettings.showmouse;
4231 + d7bitmapquality.value = 40; // Default value
4232 + if (ops.indexOf(parseInt(desktopsettings.quality)) >= 0) { d7bitmapquality.value = desktopsettings.quality; }
4233 + d7bitmapscaling.value = desktopsettings.scaling;
4234 + if (desktopsettings.framerate) { d7framelimiter.value = desktopsettings.framerate; }
4235 + if (desktopsettings.localkeymap) { d7localKeyMap.checked = desktopsettings.localkeymap; }
4236 + QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (desktop.state != 0) && (desktopsettings.showfocus));
4237 + }
4238 +
4239 + // Enter browser fullscreen
4240 + function enterBrowserFullscreen(elem) {
4241 + if (elem.requestFullscreen) { elem.requestFullscreen(); }
4242 + else if (elem.msRequestFullscreen) { elem.msRequestFullscreen(); }
4243 + else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); }
4244 + else if (elem.webkitRequestFullscreen) { elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); }
4245 + }
4246 +
4247 + // Exit browser fullscreen
4248 + function exitBrowserFullscreen() {
4249 + if (document.exitFullscreen) { document.exitFullscreen(); }
4250 + else if (document.msExitFullscreen) { document.msExitFullscreen(); }
4251 + else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); }
4252 + else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); }
4253 + }
4254 +
4255 + // Return true if the browser is fullscreen. This is a delayed method that will return true/false late. Not very useful.
4256 + function isBrowserFullscreen() {
4257 + if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { return false; } else { return true; }
4258 + }
4259 +
4260 + var fullscreen = false;
4261 + var browserfullscreen = false;
4262 + function deskToggleFull(e) {
4263 + fullscreen = !fullscreen;
4264 + if (fullscreen) {
4265 + QC('body').add("fulldesk");
4266 + QS('deskarea3x')['height'] = '100%';
4267 + QS('deskarea3x')['max-height'] = '100%';
4268 + // If shift is pressed, enter browser full screen.
4269 + if (e.shiftKey == true) { enterBrowserFullscreen(Q('deskarea0')); browserfullscreen = true; }
4270 + } else {
4271 + QC('body').remove("fulldesk");
4272 + QS('deskarea3x')['height'] = null;
4273 + QS('deskarea3x')['max-height'] = null;
4274 + if (browserfullscreen == true) { exitBrowserFullscreen(); browserfullscreen = false; }
4275 + }
4276 + deskAdjust();
4277 + updateDesktopButtons();
4278 + }
4279 +
4280 + function deskToggleFocus() {
4281 + desktop.m.focusmode = (desktop.m.focusmode + 64) % 192;
4282 + Q('deskFocusBtn').value = ["All Focus", "Small Focus", "Large Focus"][desktop.m.focusmode / 64];
4283 + }
4284 +
4285 + function deskAdjust() {
4286 + var parentH = Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth;
4287 + var deskH = Q('Desk').height, deskW = Q('Desk').width;
4288 +
4289 + if (deskAspectRatio == 2) {
4290 + // Scale mode
4291 + QS('Desk')['margin-top'] = null;
4292 + QS('Desk').height = '100%';
4293 + QS('Desk').width = '100%';
4294 + //QS('deskarea3x').height = null;
4295 + QS('DeskParent').overflow = 'hidden';
4296 + } else if (deskAspectRatio == 1) {
4297 + // Zoomed mode
4298 + QS('Desk')['margin-top'] = '0px';
4299 + QS('Desk').height = deskH + 'px';
4300 + QS('Desk').width = deskW + 'px';
4301 + QS('DeskParent').overflow = 'scroll';
4302 + } else {
4303 + // Fixed aspect ratio
4304 + if ((parentH / parentW) > (deskH / deskW)) {
4305 + var hNew = ((deskH * parentW) / deskW) + 'px';
4306 + //if (webPageFullScreen || fullscreen) {
4307 + //QS('deskarea3x').height = null;
4308 + //} else {
4309 + // QS('deskarea3x').height = hNew;
4310 + //QS('deskarea3x').height = null;
4311 + //}
4312 + QS('Desk').height = hNew;
4313 + QS('Desk').width = '100%';
4314 + } else {
4315 + var wNew = ((deskW * parentH) / deskH) + 'px';
4316 + if (webPageFullScreen || fullscreen) {
4317 + QS('Desk').height = null;
4318 + } else {
4319 + QS('Desk').height = '100%';
4320 + }
4321 + QS('Desk').width = wNew;
4322 + }
4323 + QS('Desk')['margin-top'] = null;
4324 + QS('DeskParent').overflow = 'hidden';
4325 + }
4326 + }
4327 +
4328 + function mdeskAdjust(mod, sw, sh, cv) {
4329 + if (!mod || !sw || !sh || !cv) return;
4330 +
4331 + // Check if we are in single desktop mode
4332 + if (cv.id == 'Desk') { deskAdjust(); return; }
4333 +
4334 + // Figure out and adjust the size to fill the width of the div
4335 + var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex];
4336 + var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw);
4337 + xw = realw + Math.floor((tw - (xw * realw)) / xw);
4338 + vsize.y = vsize.y * (xw / vsize.x);
4339 + vsize.x = xw;
4340 + var mh = vsize.y, mw = vsize.x;
4341 + if (mod.State != 0) { mh = vsize.y; mw = (sw / sh) * vsize.y; }
4342 + QS(cv.id)['max-height'] = mh + 'px';
4343 + QS(cv.id)['max-width'] = mw + 'px';
4344 + QS(cv.id)['margin-top'] = '0';
4345 + QS(cv.id)['margin-bottom'] = '0';
4346 + }
4347 +
4348 + // Remote desktop special key combos for Windows
4349 + function deskSendKeys() {
4350 + if (xxdialogMode || desktop == null || desktop.State != 3) return;
4351 + var ks = Q('deskkeys').value;
4352 + if (ks == 0) { // WIN+Down arrow
4353 + if (desktop.contype == 2) {
4354 + desktop.m.sendkey([[0xffe7,1],[0xff54,1],[0xff54,0],[0xffe7,0]]); // Intel AMT: Meta-left down, Down arrow press, Down arrow release, Meta-left release
4355 + } else {
4356 + desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,0x5B]]); // Agent: L-Winkey press, Down arrow press, Down arrow release, L-Winkey release
4357 + }
4358 + } else if (ks == 1) { // WIN+Up arrow
4359 + if (desktop.contype == 2) {
4360 + desktop.m.sendkey([[0xffe7,1],[0xff52,1],[0xff52,0],[0xffe7,0]]); // Intel AMT: Meta-left down, Up arrow press, Up arrow release, Meta-left release
4361 + } else {
4362 + desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, Up arrow press, Up arrow release, L-Winkey release
4363 + }
4364 + } else if (ks == 2) { // WIN+L arrow
4365 + if (desktop.contype == 2) {
4366 + desktop.m.sendkey([[0xffe7,1],[0x6c,1],[0x6c,0],[0xffe7,0]]); // Intel AMT: Meta-left down, 'l' press, 'l' release, Meta-left release
4367 + } else {
4368 + desktop.sendCtrlMsg('{"action":"lock"}');
4369 + //desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,76],[desktop.m.KeyAction.UP,76],[desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, 'L' press, 'L' release, L-Winkey release
4370 + //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.EXDOWN, 0x5B);
4371 + //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.DOWN, 76);
4372 + //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.UP, 76);
4373 + //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.EXUP, 0x5B);
4374 + }
4375 + } else if (ks == 3) { // WIN+M arrow
4376 + if (desktop.contype == 2) {
4377 + desktop.m.sendkey([[0xffe7,1],[0x6d,1],[0x6d,0],[0xffe7,0]]); // Intel AMT: Meta-left down, 'm' press, 'm' release, Meta-left release
4378 + } else {
4379 + desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, 'M' press, 'M' release, L-Winkey release
4380 + }
4381 + } else if (ks == 4) { // Shift+WIN+M arrow
4382 + if (desktop.contype == 2) {
4383 + desktop.m.sendkey([[0xffe1,1],[0xffe7,1],[0x6d,1],[0x6d,0],[0xffe7,0],[0xffe1,0]]); // Intel AMT: Shift-left down, Meta-left down, 'm' press, 'm' release, Meta-left release, Shift-left release
4384 + } else {
4385 + desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,0x5B],[desktop.m.KeyAction.UP, 16]]); // MeshAgent: L-shift press, L-Winkey press, 'M' press, 'M' release, L-Winkey release, L-shift release
4386 + }
4387 + } else if (ks == 5) { // WIN
4388 + if (desktop.contype == 2) {
4389 + desktop.m.sendkey([[0xffe7,1],[0xffe7,0]]); // Intel AMT: Meta-left down, Meta-left release
4390 + } else {
4391 + desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B], [desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, L-Winkey release
4392 + }
4393 + } else if (ks == 6) { // WIN+R
4394 + if (desktop.contype == 2) {
4395 + desktop.m.sendkey([[0xffe7,1],[0x72,1],[0x72,0],[0xffe7,0]]); // Intel AMT: Meta-left down, 'r' press, 'r' release, Meta-left release
4396 + } else {
4397 + desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.DOWN, 82], [desktop.m.KeyAction.UP, 82], [desktop.m.KeyAction.EXUP, 0x5B]]); // MeshAgent: L-Winkey press, 'R' press, 'R' release, L-Winkey release
4398 + }
4399 + } else if (ks == 7) { // ALT-F4
4400 + if (desktop.contype == 2) {
4401 + desktop.m.sendkey([[0xffe9,1],[0xffc1,1],[0xffc1,0],[0xffe9,0]]); // Intel AMT: Alt down, 'F4' press, 'F4' release, Alt release
4402 + } else {
4403 + desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 18], [desktop.m.KeyAction.DOWN, 115], [desktop.m.KeyAction.UP, 115], [desktop.m.KeyAction.EXUP, 18]]); // MeshAgent: Alt press, 'F4' press, 'F4' release, Alt release
4404 + }
4405 + } else if (ks == 8) { // CTRL-W
4406 + if (desktop.contype == 2) {
4407 + desktop.m.sendkey([[0xffe3,1],[0x77,1],[0x77,0],[0xffe3,0]]); // Intel AMT: Ctrl down, 'w' press, 'w' release, Ctrl release
4408 + } else {
4409 + desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 17], [desktop.m.KeyAction.DOWN, 87], [desktop.m.KeyAction.UP, 87], [desktop.m.KeyAction.EXUP, 17]]); // MeshAgent: Ctrl press, 'W' press, 'W' release, Ctrl release
4410 + }
4411 + } else if (ks == 9) { // ALT-TAB
4412 + if (desktop.contype == 2) {
4413 + desktop.m.sendkey([[0xffe9, 1], [0xff09, 1], [0xff09, 0], [0xffe9, 0]]); // Intel AMT: Alt down, 'TAB' press, 'TAB' release, Alt release
4414 + } else {
4415 + desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 18], [desktop.m.KeyAction.DOWN, 9], [desktop.m.KeyAction.UP, 9], [desktop.m.KeyAction.EXUP, 18]]); // MeshAgent: Alt press, 'TAB' press, 'TAB' release, Alt release
4416 + }
4417 + } else if (ks == 10) { // CTRL-ALT-DEL
4418 + desktop.m.sendcad();
4419 + } else if (ks == 11) { // WIN-LEFT
4420 + if (desktop.contype == 2) {
4421 + desktop.m.sendkey([[0xffe7, 1], [0xff51, 1], [0xff51, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, Left arrow press, Left arrow release, Meta-left release
4422 + } else {
4423 + desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.DOWN, 37], [desktop.m.KeyAction.UP, 37], [desktop.m.KeyAction.EXUP, 0x5B]]);
4424 + }
4425 + } else if (ks == 12) { // WIN-RIGHT
4426 + if (desktop.contype == 2) {
4427 + desktop.m.sendkey([[0xffe7, 1], [0xff53, 1], [0xff53, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, Right arrow press, Right arrow release, Meta-left release
4428 + } else {
4429 + desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.DOWN, 39], [desktop.m.KeyAction.UP, 39], [desktop.m.KeyAction.EXUP, 0x5B]]);
4430 + }
4431 + }
4432 + }
4433 +
4434 + // Remote desktop typing
4435 + function showDeskType() {
4436 + if (xxdialogMode || desktop == null || desktop.State != 3) return;
4437 + Q('DeskType').blur();
4438 + var x = '<div>' + "Enter text and click OK to remotely type it using a US english keyboard. Make sure to place the remote cursor at the correct position before proceeding." + '<div>';
4439 + x += '<textarea id=d2typeText style="margin-top:5px;width:100%;height:184px;resize:none" maxlength=2000></textarea>';
4440 + setDialogMode(2, "Remote Keyboard Entry", 3, showDeskTypeEx, x);
4441 + Q('d2typeText').focus();
4442 + }
4443 +
4444 + var AmtDeskTypeTimer = null;
4445 + var AmtDeskTypeContent = null;
4446 + var DeskTypeTranslate = { 39: 222, 42: 106, 43: 107, 44: 188, 45: 189, 46: 190, 47: 191, 59: 186, 61: 187, 91: 219, 92: 220, 93: 221, 96: 192, 191: 111 };
4447 + var DeskTypeShiftTranslate = { 33: 49, 34: 222, 35: 51, 36: 52, 37: 53, 38: 55, 40: 57, 41: 48, 58: 186, 60: 188, 62: 190, 63: 191, 64: 50, 94: 54, 95: 189, 106: 56, 107: 187, 123: 219, 124: 220, 125: 221, 126: 192 };
4448 + function showDeskTypeEx() {
4449 + var txt = Q('d2typeText').value, ltxt = Q('d2typeText').value.toUpperCase(), x = [], shift = false;
4450 + if (desktop.contype == 2) {
4451 + // Intel AMT
4452 + for (var i in txt) { var a = txt.charCodeAt(i); x.push([a, 1], [a, 0]); }
4453 + AmtDeskTypeContent = x;
4454 + AmtDeskTypeTimer = setInterval(function () {
4455 + var key = AmtDeskTypeContent.shift();
4456 + if (desktop) { desktop.m.sendkey(key[0], key[1]); }
4457 + if ((desktop == null) || (AmtDeskTypeContent.length == 0)) { clearInterval(AmtDeskTypeTimer); AmtDeskTypeContent = null; }
4458 + }, 10);
4459 + } else {
4460 + // MeshAgent
4461 + for (var i in txt) {
4462 + var a = txt.charCodeAt(i), b = ltxt.charCodeAt(i);
4463 + if (((a >= 65) && (a <= 90)) || ((a >= 97) && (a <= 122))) {
4464 + if ((a == b) && (shift == false)) { x.push([desktop.m.KeyAction.DOWN, 16]); shift = true; } // LShift down
4465 + if ((a != b) && (shift == true)) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // LShift up
4466 + } else if ((a >= 48) && (a <= 57)) {
4467 + if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up
4468 + } else if (DeskTypeTranslate[a]) {
4469 + if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up
4470 + b = DeskTypeTranslate[a];
4471 + } else if (DeskTypeShiftTranslate[a]) {
4472 + if (shift == false) { x.push([desktop.m.KeyAction.DOWN, 16]); shift = true; } // LShift down
4473 + b = DeskTypeShiftTranslate[a];
4474 + }
4475 + x.push([desktop.m.KeyAction.DOWN, b], [desktop.m.KeyAction.UP, b]);
4476 + }
4477 + if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up
4478 + desktop.m.SendKeyMsgKC(x);
4479 + }
4480 + }
4481 +
4482 + // Show clipboard dialog
4483 + function showDeskClip() {
4484 + if (xxdialogMode || desktop == null || desktop.State != 3) return;
4485 + Q('DeskClip').blur();
4486 + var x = '';
4487 + x += '<input id=dlgClipGet type=button value="Get Clipboard" style=width:120px onclick=showDeskClipGet()>';
4488 + x += '<input id=dlgClipSet type=button value="Set Clipboard" style=width:120px onclick=showDeskClipSet()>';
4489 + x += '<div id=dlgClipStatus style="display:inline-block;margin-left:8px" ></div>';
4490 + x += '<textarea id=d2clipText style="width:100%;height:184px;resize:none" maxlength=65535></textarea>';
4491 + x += '<input type=button value="Close" style=width:80px;float:right onclick=dialogclose(0)><div style=height:26px;margin-top:3px><span id=linuxClipWarn style=display:none>' + "Remote clipboard is valid for 60 seconds." + '</span>&nbsp;</div><div></div>';
4492 + setDialogMode(2, "Remote Clipboard", 8, null, x, 'clipboard');
4493 + Q('d2clipText').focus();
4494 + }
4495 +
4496 + function showDeskClipGet() {
4497 + if (desktop == null || desktop.State != 3) return;
4498 + meshserver.send({ action: 'msg', type: 'getclip', nodeid: currentNode._id });
4499 + }
4500 +
4501 + function showDeskClipSet() {
4502 + if (desktop == null || desktop.State != 3) return;
4503 + meshserver.send({ action: 'msg', type: 'setclip', nodeid: currentNode._id, data: Q('d2clipText').value });
4504 + QV('linuxClipWarn', currentNode && currentNode.agent && (currentNode.agent.id > 4) && (currentNode.agent.id != 21) && (currentNode.agent.id != 22));
4505 + }
4506 +
4507 + // Send CTRL-ALT-DEL
4508 + function sendCAD() {
4509 + if (xxdialogMode || desktop == null || desktop.State != 3) return;
4510 + desktop.m.sendcad();
4511 + }
4512 +
4513 + // Show process dialogs
4514 + function toggleDeskTools() {
4515 + if (xxdialogMode) return;
4516 + if (QS('DeskTools').display == 'none') {
4517 + QV('DeskTools', true);
4518 + Q('DeskTools').nodeid = currentNode._id;
4519 + QH('DeskToolsProcesses', '');
4520 + QH('DeskToolsServices', '');
4521 + QV('deskToolsTopTabService', false);
4522 + changeDeskToolTab(0)
4523 + refreshDeskTools(0);
4524 + refreshDeskTools(1);
4525 + } else {
4526 + QV('DeskTools', false);
4527 + }
4528 + }
4529 +
4530 + var deskToolTabSelection = 0;
4531 + function changeDeskToolTab(tabnum) {
4532 + deskToolTabSelection = tabnum;
4533 + QV('DeskToolsProcessTab', tabnum == 0);
4534 + QV('DeskToolsServiceTab', tabnum == 1);
4535 + QS('deskToolsTopTabProcess')['bottom'] = (tabnum == 0) ? '0px' : '3px';
4536 + QS('deskToolsTopTabService')['bottom'] = (tabnum == 1) ? '0px' : '3px';
4537 + QS('deskToolsTopTabProcess')['color'] = (tabnum == 0) ? 'black' : 'gray';
4538 + QS('deskToolsTopTabService')['color'] = (tabnum == 1) ? 'black' : 'gray';
4539 + }
4540 +
4541 + // Refresh all of the desktop tool panels
4542 + function refreshDeskTools(x) {
4543 + var sel = (x == null) ? deskToolTabSelection : x;
4544 + QV('DeskToolsRefreshButton', false);
4545 + setTimeout(refreshDeskToolsEx, 500);
4546 + if (sel == 0) meshserver.send({ action: 'msg', type: 'ps', nodeid: currentNode._id });
4547 + if (sel == 1) meshserver.send({ action: 'msg', type: 'services', nodeid: currentNode._id });
4548 + }
4549 + function refreshDeskToolsEx() { QV('DeskToolsRefreshButton', true); }
4550 + var deskTools = { sort: 1, ssort: 1, msg: null, smsg: null };
4551 + function sortProcess(sort) { deskTools.sort = sort; showDeskToolsProcesses(deskTools.msg); }
4552 + function sortService(sort) { deskTools.ssort = sort; showDeskToolsServices(deskTools.smsg); }
4553 + function sortProcessPid(a, b) { if (a.p > b.p) return 1; if (a.p < b.p) return (-1); return sortProcessName(a, b); }
4554 + function sortProcessName(a, b) { if (a.d > b.d) return 1; if (a.d < b.d) return (-1); return 0; }
4555 + function showDeskToolsProcesses(message) {
4556 + deskTools.msg = message;
4557 + if (message == null) { QH('DeskToolsProcesses', ''); return; }
4558 + if (Q('DeskTools').nodeid != message.nodeid) return;
4559 + var p = [], processes = null;
4560 + try { processes = JSON.parse(message.value); } catch (e) { }
4561 + if (processes != null) {
4562 + for (var pid in processes) { p.push( { p:parseInt(pid), c:processes[pid].cmd, d:processes[pid].cmd.toLowerCase(), u: processes[pid].user } ); }
4563 + if (deskTools.sort == 0) { p.sort(sortProcessPid); } else if (deskTools.sort == 1) { p.sort(sortProcessName); }
4564 + var x = '';
4565 + for (var i in p) {
4566 + if (p[i].p != 0) {
4567 + var c = p[i].c;
4568 + if (c.length > 30) { c = '<span title="' + c + '">' + c.substring(0,30) + '...</span>' }
4569 + x += '<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>' + p[i].p + '</div><a href=# style=float:right;padding-right:5px;cursor:pointer title="Stop process" onclick=\'return stopProcess(' + p[i].p + ',"' + p[i].c + '")\'><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>' + (p[i].u ? p[i].u : '') + '</div><div>' + c + '</div></div>';
4570 + }
4571 + }
4572 + QH('DeskToolsProcesses', x);
4573 + }
4574 + }
4575 + function showDeskToolsServices(message) {
4576 + deskTools.smsg = message;
4577 + if (message == null) { QH('DeskToolsProcesses', ''); return; }
4578 + if (Q('DeskTools').nodeid != message.nodeid) return;
4579 + QV('deskToolsTopTabService', true);
4580 + var s = [], services = null;
4581 + try { services = JSON.parse(message.value); } catch (e) { }
4582 + deskTools.services = services;
4583 + if (services != null) {
4584 + for (var i in services) {
4585 + if (services[i].status) {
4586 + // Windows
4587 + s.push({ p: capitalizeFirstLetter(services[i].status.state.toLowerCase()), d: services[i].displayName, i: i });
4588 + } else if (services[i].serviceType) {
4589 + // Linux (TODO: This the service status is not displayed, not sure start/stop/restart will work).
4590 + s.push({ p: services[i].serviceType, d: services[i].name, i: i });
4591 + }
4592 + }
4593 + if (deskTools.ssort == 0) { s.sort(sortProcessPid); } else if (deskTools.ssort == 1) { s.sort(sortProcessName); }
4594 + var x = '';
4595 + for (var i in s) {
4596 + if (s[i].p != 0) {
4597 + var c = s[i].d;
4598 + if (c.length > 30) { c = '<span title="' + c + '">' + c.substring(0, 30) + '...</span>' }
4599 + x += '<div onclick=showServiceDetailsDialog(' + s[i].i + ') class=deskToolsBar><div style=width:70px;float:left;padding-right:5px>' + s[i].p + '</div><div>' + c + '</div></div>';
4600 + }
4601 + }
4602 + QH('DeskToolsServices', x);
4603 + }
4604 + }
4605 +
4606 + function showServiceDetailsDialog(index) {
4607 + if (xxdialogMode) return;
4608 + var service = deskTools.services[index];
4609 + if (service != null) {
4610 + var x = '';
4611 + if (service.name) { x += addHtmlValue("Nom", service.name); }
4612 + if (service.displayName) { x += addHtmlValue("Display name", service.displayName); }
4613 + if (service.status) {
4614 + if (service.status.state) { x += addHtmlValue("State", capitalizeFirstLetter(service.status.state.toLowerCase())); }
4615 + if (service.status.pid) { x += addHtmlValue("PID", service.status.pid); }
4616 + var serviceTypes = [];
4617 + if (service.status.isFileSystemDriver === true) { serviceTypes.push("FileSystemDriver"); }
4618 + if (service.status.isInteractive === true) { serviceTypes.push("Interactive"); }
4619 + if (service.status.isKernelDriver === true) { serviceTypes.push("KernelDriver"); }
4620 + if (service.status.isOwnProcess === true) { serviceTypes.push("OwnProcess"); }
4621 + if (service.status.isSharedProcess === true) { serviceTypes.push("SharedProcess"); }
4622 + if (serviceTypes.length > 0) { x += addHtmlValue("Type", serviceTypes.join(', ')); }
4623 + }
4624 + x += '<br/><div style=float:right;margin-bottom:12px><input type=button value=\"' + "Close" + '\" onclick=showServiceDetailsDialogEx(0,' + index + ')></div><div style=margin-bottom:12px><input type=button value=\"' + "Start" + '\" onclick=showServiceDetailsDialogEx(1,' + index + ')><input type=button value=\"' + "Arrêtez" + '\" onclick=showServiceDetailsDialogEx(2,' + index + ')><input type=button value=\"' + "Redémarrer" + '\" onclick=showServiceDetailsDialogEx(3,' + index + ')></div>';
4625 + setDialogMode(2, "Service Details", 8, null, x, name);
4626 + }
4627 + }
4628 +
4629 + function showServiceDetailsDialogEx(action, index) {
4630 + setDialogMode(0);
4631 + if (action == 0) return;
4632 + var service = deskTools.services[index];
4633 + if (service != null) {
4634 + if (action == 1) { meshserver.send({ action: 'msg', type: 'serviceStart', nodeid: currentNode._id, serviceName: service.name }); }
4635 + if (action == 2) { meshserver.send({ action: 'msg', type: 'serviceStop', nodeid: currentNode._id, serviceName: service.name }); }
4636 + if (action == 3) { meshserver.send({ action: 'msg', type: 'serviceRestart', nodeid: currentNode._id, serviceName: service.name }); }
4637 + setTimeout(function () { refreshDeskTools(1) }, 1000);
4638 + }
4639 + }
4640 +
4641 + // Toggle mouse and keyboard input
4642 + function toggleKvmControl() { putstore('DeskControl', (Q("DeskControl").checked?1:0)); }
4643 +
4644 + // Save the desktop image to file
4645 + function deskSaveImage() {
4646 + if (xxdialogMode || desktop == null || desktop.State != 3) return;
4647 + var d = new Date(), n = 'Desktop-' + currentNode.name + '-' + d.getFullYear() + '-' + ('0' + (d.getMonth() + 1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + '-' + ('0' + d.getHours()).slice(-2) + '-' + ('0' + d.getMinutes()).slice(-2);
4648 + Q('Desk')['toBlob'](function (blob) { saveAs(blob, n + '.jpg'); });
4649 + }
4650 +
4651 + function deskDisplayInfo(sender, displays, selDisplay) {
4652 + var displayCount = 0, displaySelector = '';
4653 + for (var i in displays) {
4654 + displayCount++;
4655 + displaySelector += '<option' + ((selDisplay == i) ? ' selected' : '') + ' value=' + i + '>' + displays[i] + '</option>';
4656 + if ((deskPreferedStickyDisplay == i) && (selDisplay != deskPreferedStickyDisplay)) { desktop.m.SetDisplay(i); }
4657 + }
4658 + QH('termdisplays', displaySelector);
4659 + QV('termdisplays', displayCount > 1);
4660 + }
4661 +
4662 + function deskGetDisplayNumbers(e) { desktop.m.GetDisplayNumbers(); }
4663 + var deskPreferedStickyDisplay = 0;
4664 + function deskSetDisplay(e) { desktop.m.SetDisplay(deskPreferedStickyDisplay = parseInt(Q('termdisplays').value)); Q('termdisplays').blur(); }
4665 +
4666 + // Double click detection. This is important for MacOS.
4667 + var dblClickDetectArgs = { t:0, x:0, y:0 };
4668 + function dblClickDetect(e) {
4669 + if (e.buttons != 1) return;
4670 + var t = Date.now();
4671 + if (((t - dblClickDetectArgs.t) < 250) && (Math.abs(e.clientX - dblClickDetectArgs.x) < 2) && (Math.abs(e.clientY - dblClickDetectArgs.y) < 2)) {
4672 + if (!xxdialogMode && desktop != null && Q('DeskControl').checked) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousedblclick(e); desktop.m.sendKeepAlive(); } else { desktop.m.mousedblclick(e); } }
4673 + }
4674 + dblClickDetectArgs.t = t;
4675 + dblClickDetectArgs.x = e.clientX;
4676 + dblClickDetectArgs.y = e.clientY;
4677 + }
4678 +
4679 + function dmousedown(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; if (!xxdialogMode && desktop != null && Q('DeskControl').checked) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousedown(e); desktop.m.sendKeepAlive(); } else { desktop.m.mousedown(e); } } dblClickDetect(e); }
4680 + function dmouseup(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; if (!xxdialogMode && desktop != null && Q('DeskControl').checked) if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mouseup(e); desktop.m.sendKeepAlive(); } else { desktop.m.mouseup(e); } }
4681 + function dmousemove(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; if (!xxdialogMode && desktop != null && Q('DeskControl').checked) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousemove(e); desktop.m.sendKeepAlive(); } else { desktop.m.mousemove(e); } } }
4682 + function dmousewheel(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; if (!xxdialogMode && desktop != null && Q('DeskControl').checked) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousewheel(e); desktop.m.sendKeepAlive(); } else { if (desktop.m.mousewheel) { desktop.m.mousewheel(e); } } haltEvent(e); return true; } return false; }
4683 + function drotate(x) { if (!xxdialogMode && desktop != null) { desktop.m.setRotation(desktop.m.rotation + x); deskAdjust(); deskAdjust(); } }
4684 + function stopProcess(id, name) { setDialogMode(2, "Process Control", 3, stopProcessEx, format("Stop process #{0} \"{1}\"?", id, name), id); return false; }
4685 + function stopProcessEx(buttons, tag) { meshserver.send({ action: 'msg', type: 'pskill', nodeid: currentNode._id, value: tag }); setTimeout(refreshDeskTools, 300); }
4686 +
4687 + //
4688 + // TERMINAL
4689 + //
4690 +
4691 + var terminalNode;
4692 + function setupTerminal() {
4693 + // Setup the terminal
4694 + if ((terminalNode != currentNode) && (terminal != null)) { terminal.Stop(); terminal = null; }
4695 + terminalNode = currentNode;
4696 + updateTerminalButtons();
4697 + }
4698 +
4699 + // Show and enable the right buttons
4700 + function updateTerminalButtons() {
4701 + var mesh = meshes[terminalNode.meshid];
4702 + var termState = ((terminal != null) && (terminal.state != 0));
4703 +
4704 + // Show the right buttons
4705 + QV('disconnectbutton2span', (termState == true));
4706 + QV('connectbutton2span', (termState == false) && (mesh.mtype == 2) && (currentNode.agent.caps & 2));
4707 + QV('connectbutton2hspan', (termState == false) && ((terminalNode.intelamt != null) && (mesh.mtype == 1 || terminalNode.intelamt.state == 2) && ((terminalNode.intelamt.ver != null) || (mesh.mtype == 1))));
4708 +
4709 + // Enable buttons
4710 + var online = ((terminalNode.conn & 1) != 0); // If Agent (1) connected, enable Terminal
4711 + QE('connectbutton2', online);
4712 + var hwonline = ((terminalNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal
4713 + QE('connectbutton2h', hwonline);
4714 +
4715 + // Key buttons
4716 + QE('ctrlcbutton', termState);
4717 + QE('ctrlxbutton', termState);
4718 + QE('escbutton', termState);
4719 + QE('bsbutton', termState);
4720 + QE('pastebutton', termState);
4721 + QE('specialkeylist', termState);
4722 + QE('specialkeylistinput', termState);
4723 +
4724 + // Terminal settings
4725 + QV('terminalSettingsButtons', (terminal) && (terminal.contype == 2));
4726 + if (terminal) {
4727 + Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation];
4728 + Q('id_tfxkeysbutton').value = fxEmulations[terminal.m.fxEmulation];
4729 + Q('id_tcrbutton').value = (terminal.m.lineFeed == '\r\n')?"CR+LF":"LF";
4730 + }
4731 + }
4732 +
4733 + // Called when the terminal state changes
4734 + function onTerminalStateChange(xterminal, state) {
4735 + var xstate = state;
4736 + if ((xstate == 3) && (xterminal.contype == 2)) { xstate++; }
4737 + var str = StatusStrs[xstate];
4738 + if (terminal.webRtcActive == true) { str += ", WebRTC"; }
4739 + QH('termstatus', str);
4740 + switch (state) {
4741 + case 0:
4742 + // Disconnected, clear the terminal
4743 + QE('termSizeList', true);
4744 + QH('termtitle', '');
4745 + QV('termRecordIcon', false);
4746 + xterminal.m.TermResetScreen();
4747 + xterminal.m.TermDraw();
4748 + if (terminal != null) { terminal.Stop(); terminal = null; }
4749 + break;
4750 + case 3:
4751 + QE('termSizeList', false);
4752 + if (xterminal && (xterminal.serverIsRecording == true)) { QV('termRecordIcon', true); }
4753 + terminal.startTime = new Date();
4754 + if (updateSessionTimer == null) { updateSessionTimer = setInterval(updateSessionTime, 1000); }
4755 + break;
4756 + default:
4757 + QE('termSizeList', false);
4758 + //console.log('Unhandled onTerminalStateChange state', state);
4759 + break;
4760 + }
4761 + updateTerminalButtons();
4762 + }
4763 +
4764 + // DEBUG
4765 + var autoConnectTerminalTimer = null;
4766 + function autoConnectTerminal(e) { if (autoConnectTerminalTimer == null) { autoConnectTerminalTimer = setInterval(connectTerminal, 100); } else { clearInterval(autoConnectTerminalTimer); autoConnectTerminalTimer = null; } }
4767 +
4768 + function connectTerminal(e, contype, options) {
4769 + p12clearConsoleMsg();
4770 + if (!terminal) {
4771 + if (contype == 2) {
4772 + // Setup the Intel AMT terminal
4773 + if ((terminalNode.intelamt.user == null) || (terminalNode.intelamt.user == '')) { editDeviceAmtSettings(terminalNode._id, connectTerminal, 2); return; }
4774 + var termoptions = {};
4775 + if (Q('termSizeList').value == 2) { termoptions.width = 100; termoptions.height = 30; }
4776 + terminal = CreateAmtRedirect(CreateAmtRemoteTerminal('Term', termoptions), authCookie);
4777 + terminal.debugmode = debugmode;
4778 + terminal.m.debugmode = debugmode;
4779 + terminal.m.onTitleChange = function (sender, title) { QH('termtitle', ' - ' + EscapeHtml(title)); }
4780 + terminal.onStateChanged = onTerminalStateChange;
4781 + terminal.Start(terminalNode._id, 16994, '*', '*', 0);
4782 + terminal.contype = 2;
4783 + Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation];
4784 + } else {
4785 + // Setup a mesh agent terminal
4786 + var termoptions = {};
4787 + if ([1, 2, 3, 4, 21, 22].indexOf(currentNode.agent.id) == -1) {
4788 + if (Q('termSizeList').value == 2) { termoptions.width = 100; termoptions.height = 30; termoptions.xterm = true; }
4789 + if (Q('termSizeList').value == 3) {
4790 + // TODO: Try to improve terminal auto-size.
4791 + termoptions.width = Math.floor((Q('column_l').clientWidth - 60) / 10);
4792 + termoptions.height = Math.floor((Q('column_l').clientHeight - 120) / 20);
4793 + termoptions.xterm = true;
4794 + }
4795 + }
4796 + if ((e && (e.shiftKey == true)) || (options && (options.powershell))) { termoptions.protocol = 6; }
4797 + terminal = CreateAgentRedirect(meshserver, CreateAmtRemoteTerminal('Term', termoptions), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
4798 + terminal.debugmode = debugmode;
4799 + terminal.m.debugmode = debugmode;
4800 + terminal.m.onTitleChange = function (sender, title) { QH('termtitle', ' - ' + EscapeHtml(title)); }
4801 + terminal.m.lineFeed = ([1, 2, 3, 4, 21, 22].indexOf(currentNode.agent.id) >= 0) ? '\r\n' : '\r'; // On windows, send \r\n, on Linux only \r
4802 + terminal.attemptWebRTC = attemptWebRTC;
4803 + terminal.onStateChanged = onTerminalStateChange;
4804 + terminal.onConsoleMessageChange = function () {
4805 + p12clearConsoleMsg();
4806 + if (terminal.consoleMessage) {
4807 + QH('p12TermConsoleMsg', EscapeHtml(terminal.consoleMessage).split('\n').join('<br />'));
4808 + QV('p12TermConsoleMsg', true);
4809 + p12TermConsoleMsgTimer = setTimeout(p12clearConsoleMsg, 8000);
4810 + }
4811 + }
4812 + terminal.Start(terminalNode._id);
4813 + terminal.contype = 1;
4814 + terminal.m.terminalEmulation = 0;
4815 + terminal.m.fxEmulation = 0;
4816 + Q('id_ttypebutton').value = terminalEmulations[0];
4817 + }
4818 + } else {
4819 + //QH('Term', '');
4820 + terminal.Stop();
4821 + terminal = null;
4822 + }
4823 + Q('connectbutton2').blur(); // Deselect the connect button so the button does not get key presses.
4824 + }
4825 +
4826 + var terminalEmulations = ["Terminal UTF8", "Extended ASCII", "Intel ASCII"];
4827 + function termToggleType() {
4828 + if (!terminal || xxdialogMode) return;
4829 + terminal.m.terminalEmulation = (terminal.m.terminalEmulation + 1) % 3;
4830 + Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation];
4831 + Q('id_ttypebutton').blur(); // Deselect the connect button so the button does not get key presses.
4832 + }
4833 +
4834 + var fxEmulations = ["Intel (F10 = ESC+[OM)", "Alternate (F10 = ESC+0)", "VT100+ (F10 = ESC+[OY)"];
4835 + function termToggleFx() {
4836 + if (!terminal || xxdialogMode) return;
4837 + terminal.m.fxEmulation = (terminal.m.fxEmulation + 1) % 3;
4838 + Q('id_tfxkeysbutton').value = fxEmulations[terminal.m.fxEmulation];
4839 + Q('id_tfxkeysbutton').blur(); // Deselect the connect button so the button does not get key presses.
4840 + }
4841 +
4842 + function termToggleCr() {
4843 + if (!terminal || xxdialogMode) return;
4844 + if (terminal.m.lineFeed == '\n') { terminal.m.lineFeed = '\r\n'; } else { terminal.m.lineFeed = '\n'; }
4845 + Q('id_tcrbutton').value = (terminal.m.lineFeed == '\r\n') ? "CR+LF" : "LF";
4846 + }
4847 +
4848 + function termSendKey(key, id) {
4849 + if (!terminal || xxdialogMode) return;
4850 + terminal.m.TermSendKey(key);
4851 + Q(id).blur(); // Deselect the connect button so the button does not get key presses.
4852 + }
4853 +
4854 + function showTermPasteDialog() {
4855 + if (!terminal || xxdialogMode) return;
4856 + Q('pastebutton').blur();
4857 + setDialogMode(2, "Paste", 3, showTermPasteDialogEx, '<textarea id=d2pasteText style="width:100%;height:184px;resize:none"></textarea>');
4858 + Q('d2pasteText').focus();
4859 + }
4860 +
4861 + function showTermPasteDialogEx() {
4862 + if (!terminal) return;
4863 + terminal.m.TermSendKeys(Q('d2pasteText').value);
4864 + }
4865 +
4866 + // Send special key
4867 + function sendSpecialKey() {
4868 + terminal.m.TermSendKey(Q('specialkeylist').value);
4869 + Q('specialkeylist').blur();
4870 + Q('specialkeylistinput').blur();
4871 + }
4872 +
4873 + //
4874 + // FILES
4875 + //
4876 +
4877 + var filesNode;
4878 + function setupFiles() {
4879 + // Setup the files tab
4880 + var samenode = (filesNode == currentNode);
4881 + filesNode = currentNode;
4882 + var online = ((filesNode.conn & 1) != 0)?true:false; // If Agent (1) connected, enable Terminal
4883 + QE('p13Connect', online);
4884 + if (((samenode == false) || (online == false)) && files) { files.Stop(); files = null; }
4885 + }
4886 +
4887 + function onFilesStateChange(xfiles, state) {
4888 + p13Connect.value = (state == 0) ? "Connect" : "Disconnect";
4889 + var str = StatusStrs[state];
4890 + if (files.webRtcActive == true) { str += ", WebRTC"; }
4891 + Q('p13Status').textContent = str;
4892 + switch (state) {
4893 + case 0:
4894 + // Disconnected, clear the files
4895 + QH('p13files', '');
4896 + p13filetree = null;
4897 + p13filetreelocation = [];
4898 + QH('p13currentpath', '');
4899 + QE('p13FolderUp', false);
4900 + QV('filesRecordIcon', false);
4901 + p13setActions();
4902 + if (files != null) { files.Stop(); files = null; }
4903 + break;
4904 + case 3:
4905 + p13targetpath = '';
4906 + if (files) {
4907 + files.sendText({ action: 'ls', reqid: 1, path: '' });
4908 + if (files.serverIsRecording == true) { QV('filesRecordIcon', true); }
4909 + }
4910 + break;
4911 + default:
4912 + //console.log('Unknown onFilesStateChange state', state);
4913 + break;
4914 + }
4915 + }
4916 +
4917 + function CreateRemoteFiles(onFileUpdate) {
4918 + var obj = { protocol: 5 };
4919 + obj.onFileUpdate = onFileUpdate;
4920 + obj.xxStateChange = function(state) { }
4921 + obj.ProcessData = function(data) { obj.onFileUpdate(data); }
4922 + return obj;
4923 + }
4924 +
4925 + // Debug Only
4926 + var autoConnectFilesTimer = null;
4927 + function autoConnectFiles(e) { if (autoConnectFilesTimer == null) { autoConnectFilesTimer = setInterval(connectFiles, 100); } else { clearInterval(autoConnectFilesTimer); autoConnectFilesTimer = null; } }
4928 +
4929 + function connectFiles(e) {
4930 + p13clearConsoleMsg();
4931 + if (!files) {
4932 + // Setup a mesh agent files
4933 + files = CreateAgentRedirect(meshserver, CreateRemoteFiles(p13gotFiles), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
4934 + files.attemptWebRTC = attemptWebRTC;
4935 + files.onStateChanged = onFilesStateChange;
4936 + files.onConsoleMessageChange = function () {
4937 + p13clearConsoleMsg();
4938 + if (files.consoleMessage) {
4939 + QH('p13FilesConsoleMsg', EscapeHtml(files.consoleMessage).split('\n').join('<br />'));
4940 + QV('p13FilesConsoleMsg', true);
4941 + p13FilesConsoleMsgTimer = setTimeout(p13clearConsoleMsg, 8000);
4942 + }
4943 + }
4944 + files.Start(filesNode._id);
4945 + } else {
4946 + //QH('Term', '');
4947 + files.Stop();
4948 + files = null;
4949 + }
4950 + p13clipboard = p13clipboardFolder = null;
4951 + p13clipboardCut = 0;
4952 + p13updateClipview();
4953 + }
4954 +
4955 + var p13filetree = null;
4956 + var p13targetpath = null;
4957 + var p13filetreelocation = [];
4958 +
4959 + function p13gotFiles(data) {
4960 + if ((data.length > 0) && (data.charCodeAt(0) != 123)) { p13gotDownloadBinaryData(data); return; }
4961 + //console.log('p13gotFiles', data);
4962 + data = JSON.parse(decode_utf8(data));
4963 + if (data.action == 'download') { p13gotDownloadCommand(data); return; }
4964 + data.path = data.path.replace(/\//g, '\\');
4965 + if ((p13filetree != null) && (data.path == p13filetree.path)) {
4966 + // This is an update to the same folder
4967 + var checkedNames = p13getCheckedNames();
4968 + p13filetree = data;
4969 + p13updateFiles(checkedNames);
4970 + } else {
4971 + // Make both paths use the same seperator not start with /
4972 + var x1 = data.path.replace(/\//g, '\\'), x2 = p13targetpath.replace(/\//g, '\\');
4973 + while ((x1.length > 0) && (x1[0] == '\\')) { x1 = x1.substring(1); }
4974 + while ((x2.length > 0) && (x2[0] == '\\')) { x2 = x2.substring(1); }
4975 + if ((x1 == x2) || ((data.path == '\\') && (p13targetpath == ''))) {
4976 + // This is a different folder
4977 + p13filetree = data;
4978 + p13updateFiles();
4979 + }
4980 + }
4981 + }
4982 +
4983 + function p13getCheckedNames() {
4984 + // Save all existing checked boxes
4985 + var checkedNames = [], checkboxes = document.getElementsByName('fd');
4986 + for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { checkedNames.push(p13filetree.dir[checkboxes[i].value].n) }; }
4987 + return checkedNames;
4988 + }
4989 +
4990 + function p13updateFiles(checkedNames) {
4991 + var html1 = '', html2 = '', displayPath = '<a href=# style=cursor:pointer onclick="return p13folderup(0)">' + "Root" + '</a>', fullPath = 'Root';
4992 +
4993 + // Work on parsing the file path
4994 + var x = p13filetree.path.split('\\');
4995 + p13filetreelocation = [];
4996 + for (var i in x) { if (x[i] != '') { p13filetreelocation.push(x[i]); } } // Remove empty spaces
4997 + for (var i in p13filetreelocation) { displayPath += ' / <a href=# style=cursor:pointer onclick="return p13folderup(' + (parseInt(i) + 1) + ')">' + p13filetreelocation[i] + '</a>' } // Setup the path we display
4998 + var newlinkpath = p13filetreelocation.join('/');
4999 +

This file is too large to show in full.

views/translations/default-mobile-min_fr.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link rel="shortcut icon"type=image/x-icon href={{{domainurl}}}favicon.ico><script src=scripts/common-0.0.1.js></script><script src=scripts/meshcentral.js></script><script src=scripts/agent-redir-ws-0.1.1.js></script><script src=scripts/agent-desktop-0.0.2.js></script><script src=scripts/amt-0.2.0.js></script><script src=scripts/amt-redir-ws-0.1.0.js></script><script src=scripts/amt-desktop-0.0.2.js></script><script src=scripts/zlib.js></script><script src=scripts/zlib-inflate.js></script><script src=scripts/zlib-adler32.js></script><script src=scripts/zlib-crc32.js></script><script keeplink=1 src=scripts/filesaver.js></script><title>{{{title}}}</title><style>a{color:#036;text-decoration:underline}#footer a{color:#fff;text-decoration:underline}#footer a:hover{color:#fff;text-decoration:none}.i1{background:url(../images/icons50.png) 0 0;height:50px;width:50px;border:none}.i2{background:url(../images/icons50.png) -50px 0;height:50px;width:50px;border:none}.i3{background:url(../images/icons50.png) -100px 0;height:50px;width:50px;border:none}.i4{background:url(../images/icons50.png) -150px 0;height:50px;width:50px;border:none}.i5{background:url(../images/icons50.png) -200px 0;height:50px;width:50px;border:none}.i6{background:url(../images/icons50.png) -250px 0;height:50px;width:50px;border:none}.m0{background:url(../images/images16.png) -32px 0;height:16px;width:16px;border:none;float:left}.m1{background:url(../images/images16.png) -16px 0;height:16px;width:16px;border:none;float:left}.m2{background:url(../images/images16.png) -96px 0;height:16px;width:16px;border:none;float:left}.m3{background:url(../images/images16.png) -112px 0;height:16px;width:16px;border:none;float:left}.gray{filter:gray;-webkit-filter:grayscale(100%) opacity(60%)}.DevSt{padding-left:5px;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#ddd}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:#fff;clear:both}</style><body onload='"undefined"!=typeof startup&&startup()'style="overflow-y:hidden;margin:0;padding:0;border:0;color:#000;font-size:13px;font-family:\'Trebuchet MS\',Arial,Helvetica,sans-serif"><div id=container><div id=mastheadx></div><div id=masthead style="background:url(logo.png) 0 0;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"><div style="width:calc(100% - 50px);overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px><strong><font style=font-size:36px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px><strong><font style=font-size:12px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div></div><img id=topMenuIcon class=noselect style=position:absolute;right:0;top:10px;bottom:50px;color:#c8c8c8;font-size:44px;margin-right:8px;cursor:pointer;display:none onclick=topMenu() src=/images/3bars-30.png width=30 height=30></div><div id=page_content style=overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%><div id=column_l style=width:100%;padding:0;position:absolute;bottom:0;top:0><div id=p0 style=display:none;width:100%;height:100%><div style=display:flex;align-items:center;width:100%;height:100%><div id=p0message style=text-align:center;width:100%><span id=p0span>Server disconnected</span>,<href onclick=reload() style=cursor:pointer><u>click to reconnect</u></href>.</div></div></div><div id=p1 style=display:none;width:100%;height:100%><div style=display:flex;align-items:center;width:100%;height:100%><div id=p1message style=text-align:center;width:100%></div></div></div><div id=p2 style=display:none><div id=xdevices></div></div><div id=p3 style=display:none;position:absolute;bottom:0;top:0;width:100%><table cellspacing=0 style=margin:0;padding:0;border-spacing:0;border:0><tr style=padding:0><td style=padding:0;color:#c8c8c8;text-align:center;cursor:pointer width=60px valign=top onclick=goBack()><div style=padding:0;background-color:#036;width:10px;height:10px;float:right;border:0><div style="background-color:#fff;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid #fff;border-bottom:1px solid #fff"></div></div><div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div><td><img src=/images/user-50.png width=50 height=50><td><div style=margin-left:5px><strong style=font-size:large><span id=p3userName></span></strong><br></div></table><div id=p3info style=overflow-y:scroll;position:absolute;top:55px;bottom:0;width:100%><div style=margin-left:8px><div id=p3AccountActions><p><strong>Account Security</strong><div style=margin-left:9px;margin-bottom:8px><div id=manageAuthApp style=margin-top:5px;display:none><a onclick=account_manageAuthApp() style=cursor:pointer>Manage authenticator app</a></div><div id=manageOtp style=margin-top:5px;display:none><a onclick=account_manageOtp(0) style=cursor:pointer>Manage backup codes</a></div></div><p><strong>Account Actions</strong><div style=margin-left:9px;margin-bottom:8px><div style=margin-top:5px><span id=verifyEmailId style=display:none><a onclick=account_showVerifyEmail() style=cursor:pointer>Verify email</a></span></div><div style=margin-top:5px><span id=changeEmailId style=display:none><a onclick=account_showChangeEmail() style=cursor:pointer>Change email address</a></span></div><div style=margin-top:5px><a onclick=account_showChangePassword() style=cursor:pointer>Change password</a><span id=p2nextPasswordUpdateTime></span></div><div style=margin-top:5px><a onclick=account_showDeleteAccount() style=cursor:pointer>Delete account</a></div></div><br style=clear:both></div><strong>Device Groups</strong><span id=p3createMeshLink1>(<a onclick=account_createMesh() style=cursor:pointer><img src=images/icon-addnew.png width=12 height=12 border=0> Nouveau</a>)</span><br><br><div id=p3meshes></div><div id=p3noMeshFound style=margin-left:9px;display:none>Aucun groupe d'appareils.<span id=p3createMeshLink2><a onclick=account_createMesh() style=cursor:pointer><strong>Get started here!</strong></a></span></div><br style=clear:both></div></div></div><div id=p5 style=display:none><table cellspacing=0 style=margin:0;padding:0;border-spacing:0;border:0><tr style=padding:0><td style=padding:0;color:#c8c8c8;text-align:center;cursor:pointer width=60px valign=top onclick=goBack()><div style=padding:0;background-color:#036;width:10px;height:10px;float:right;border:0><div style="background-color:#fff;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid #fff;border-bottom:1px solid #fff"></div></div><div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div><td><img src=/images/user-50.png width=50 height=50><td><div style=margin-left:5px><strong style=font-size:large>Mes Dossiers</strong><br></div></table><div id=p5myfiles style=overflow-y:scroll;position:absolute;top:55px;bottom:0;width:100%><table id=p5toolbar style=width:100%;height:78px cellpadding=0 cellspacing=0><tr><td style=width:100%;background-color:#d3d9d6;text-align:left;padding:4px valign=bottom><div style=width:100%;text-align:center><input type=button style="width:calc(100%/5 - 5px)"id=p5FolderUp disabled onclick=p5folderup() value=Up> <input type=button style="width:calc(100%/5 - 5px)"id=p5SelectAllButton disabled onclick=p5selectallfile() value=ToutSélectionner onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5RenameFileButton disabled value=Renommer onclick=p5renamefile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5DeleteFileButton disabled value=Delete onclick=p5deletefile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5NewFolderButton disabled value=Folder onclick=p5createfolder() onkeypress=return!1 onkeydown=return!1></div><div style=width:100%;text-align:center><input type=button style="width:calc(100%/5 - 5px)"id=p5UploadButton disabled value=Télécharger onclick=p5uploadFile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5CutButton disabled value=Cut onclick=p5copyFile(1) onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5CopyButton disabled value=Copy onclick=p5copyFile(0) onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5PasteButton disabled value=Paste onclick=p5pasteFile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5RefreshButton value=Rafraîchir onclick=p5refreshFiles() onkeypress=return!1 onkeydown=return!1></div><tr><td style=background-color:#e4e9e7;height:28px><table style=width:100%><tr><td id=p5currentpath style=overflow:hidden;padding-left:4px;padding-top:2px><td style=text-align:right;padding-right:4px><select id=p5sortdropdown onchange=updateFiles()><option value=1 selected>Trier par nom<option value=2>Trier par taille<option value=3>Trier par date<option value=4>Descend by name<option value=5>Descend by size<option value=6>Descend by date</select></table></table><div id=p5filetable style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"><span id=p5files></span></div><table id=p5toolbarBottom style=width:100%;height:22px;position:absolute;bottom:0;background-color:#d3d9d6 cellpadding=0 cellspacing=0><tr><td style=text-align:left;padding:3px>&nbsp;<span id=p5bottomstatus></span><td id=p5rightOfButtons style=text-align:right;padding:3px></table></div></div><div id=p10 style=display:none;position:absolute;bottom:0;top:0;width:100%;overflow:hidden><table cellspacing=0 style=margin:0;padding:0;border-spacing:0;border:0;position:absolute;top:0><tr style=padding:0><td style=padding:0;color:#c8c8c8;text-align:center;cursor:pointer width=60px valign=top onclick=goBack()><div style=padding:0;background-color:#036;width:10px;height:10px;float:right;border:0><div style="background-color:#fff;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid #fff;border-bottom:1px solid #fff"></div></div><div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div><td><a id=MainComputerImage style=cursor:pointer onclick=p10showiconselector()></a><td><div style=margin-left:5px><strong><span id=p10deviceName></span></strong><br><span id=MainComputerState></span></div></table><div id=p10general style=overflow-y:scroll;position:absolute;top:55px;bottom:0;width:100%><div id=p10html style=margin-left:8px;margin-right:8px></div><div id=p10html2></div><div id=p10html3></div></div><div id=p10desktop style=overflow:hidden;position:absolute;top:55px;bottom:0;width:100%;display:none><div id=deskarea1 style=position:absolute;top:0;width:100%;height:25px><div style=padding-top:2px;padding-bottom:2px;background:silver><div style=float:right;text-align:right><span id=p14power></span>&nbsp; <input id=DeskSoftInput style=width:25px;display:none;opacity:.2 onblur=toggleSoftKeys(0) onkeypress="return ondeskkeypress(event)"onkeydown="return ondeskkeydown(event)"onkeyup="return ondeskkeyup(event)"></div><div style=margin-left:3px><input type=button id=connectbutton1 value=Connect onclick=connectDesktop(event,1) onkeypress=return!1 onkeydown=return!1 disabled> <input type=button id=connectbutton1h value="HW Connect"onclick=connectDesktop(event,2) onkeypress=return!1 onkeydown=return!1 disabled> <input type=button id=disconnectbutton1 value=Disconnect onclick=connectDesktop(event,0) onkeypress=return!1 onkeydown=return!1><span id=deskstatus>Disconnected</span></div></div></div><div id=deskarea3 style="position:absolute;top:25px;width:100%;height:calc(100% - 50px)"><div id=deskarea3x style=background:#000;text-align:center;height:100%;position:relative><div id=DeskParent style=height:100%><canvas id=Desk width=640 height=200 style=width:100%;-ms-touch-action:none;margin-left:0 oncontextmenu=return!1 onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event) onmousewheel=dmousewheel(event)></canvas></div><div id=DeskTools style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid #d3d3d3;display:none"><a id=DeskToolsRefreshButton style=float:right;padding:3px;cursor:pointer onclick=refreshDeskTools()>Rafraîchir</a><div id=DeskToolsBar style="position:absolute;padding:3px;border-radius:3px 3px 0 0;top:5px;left:4px;bottom:26px;background-color:#d3d3d3;cursor:pointer">Processes</div><div style=position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:#d3d3d3;text-align:left><div style="border-bottom:1px solid #a9a9a9;padding:3px"><a style=width:50px;padding-right:5px;float:left;cursor:pointer onclick=sortProcess(0)>PID</a><a style=cursor:pointer onclick=sortProcess(1)>Nom</a></div><div id=DeskToolsProcesses style=overflow-y:scroll;position:absolute;top:24px;bottom:0;width:100%></div></div></div></div></div><div id=deskarea4 style=position:absolute;bottom:0;width:100%;height:25px><div style=padding-top:2px;padding-bottom:2px;background:silver><div style=float:right;text-align:right><select id=termdisplays style=display:none onchange=deskSetDisplay(event) onclick=deskGetDisplayNumbers(event)></select>&nbsp;<span id=DeskToastButton><img src=images/icon-notify.png onclick=deviceToastFunction() height=16 width=16 style=padding-top:2px></span>&nbsp;</div><div><input id=deskActionsBtn type=button style=margin-left:3px onkeypress=return!1 onkeydown=return!1 value=Actions onclick=deviceActionFunction()> <input type=button value=Settings onkeypress=return!1 onkeydown=return!1 onclick=showDesktopSettings()> <input type=button onkeypress=return!1 onkeydown=return!1 value="Power Actions..."onclick=showPowerActionDlg() style=display:none> <input id=DeskSpecialKeys type=button value="Special Keys"onkeypress=return!1 onkeydown=return!1 onclick=sendSpecialKeys()> <input id=DeskSoftKeys type=button value=Clavier onkeypress=return!1 onkeydown=return!1 onclick=toggleSoftKeys(1)><label><span id=DeskControlSpan style=display:none><input id=DeskControl type=checkbox onkeypress=return!1 onkeydown=return!1>Input</span></label></div></div></div></div><div id=p10files style=overflow-y:scroll;position:absolute;top:55px;bottom:0;width:100%;display:none><table id=p13toolbar style=width:100%;height:111px cellpadding=0 cellspacing=0><tr><td style="background-color:silver;border-bottom:2px solid #000;padding:2px"><div style=float:right;text-align:right><input id=filesActionsBtn type=button onkeypress=return!1 onkeydown=return!1 value=Actions onclick=deviceActionFunction() style=margin-right:2px></div><div style=margin-left:2px><input id=p13AutoConnect value=AutoConnect onclick=autoConnectFiles(event) onkeypress=return!1 onkeydown=return!1 type=button style=display:none> <input id=p13Connect value=Connect onclick=connectFiles(event) onkeypress=return!1 onkeydown=return!1 type=button><span id=p13Status>Disconnected</span></div><tr><td style=width:100%;background-color:#d3d9d6;text-align:left;padding:4px valign=bottom><div style=width:100%;text-align:center><input type=button style="width:calc(100%/5 - 5px)"id=p13FolderUp disabled onclick=p13folderup() value=Up> <input type=button style="width:calc(100%/5 - 5px)"id=p13SelectAllButton disabled onclick=p13selectallfile() value=ToutSélectionner onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13RenameFileButton disabled value=Renommer onclick=p13renamefile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13DeleteFileButton disabled value=Delete onclick=p13deletefile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13NewFolderButton disabled value=Folder onclick=p13createfolder() onkeypress=return!1 onkeydown=return!1></div><div style=width:100%;text-align:center><input type=button style="width:calc(100%/5 - 5px)"id=p13UploadButton disabled value=Télécharger onclick=p13uploadFile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13CutButton disabled value=Cut onclick=p13copyFile(1) onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13CopyButton disabled value=Copy onclick=p13copyFile(0) onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13PasteButton disabled value=Paste onclick=p13pasteFile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13RefreshButton disabled value=Rafraîchir onclick=p13folderup(9999) onkeypress=return!1 onkeydown=return!1></div><tr><td style=background-color:#e4e9e7;height:28px><table style=width:100%><tr><td id=p13currentpath style=overflow:hidden;padding-left:4px;padding-top:2px><td style=text-align:right;padding-right:4px><select id=p13sortdropdown onchange=p13updateFiles()><option value=1 selected>Trier par nom<option value=2>Trier par taille<option value=3>Trier par date<option value=4>Descend by name<option value=5>Descend by size<option value=6>Descend by date</select></table></table><div id=p13filetable style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"><span id=p13files></span></div><table id=p13toolbarBottom style=width:100%;height:22px;position:absolute;bottom:0 cellpadding=0 cellspacing=0><tr><td style=text-align:left;padding:3px;text-align:center;background-color:#d3d9d6>&nbsp;<span id=p13bottomstatus></span></table></div></div><div id=p20 style=display:none;position:absolute;bottom:0;top:0;width:100%><table cellspacing=0 style=margin:0;padding:0;border-spacing:0;border:0><tr style=padding:0><td style=padding:0;color:#c8c8c8;text-align:center;cursor:pointer width=60px valign=top onclick=goBack()><div style=padding:0;background-color:#036;width:10px;height:10px;float:right;border:0><div style="background-color:#fff;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid #fff;border-bottom:1px solid #fff"></div></div><div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div><td onclick=p20editmesh(1)><img src=/images/meshicon50.png width=50 height=50><td onclick=p20editmesh(1)><div style=margin-left:5px><strong style=font-size:large><span id=p20meshName></span></strong><br></div></table><div id=p20info style=margin-left:8px;margin-right:8px></div></div></div></div><div id=footer style=height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0><table id=footerMenu cellpadding=0 cellspacing=0 style=height:32px;width:100%;color:#fff;cursor:pointer;table-layout:fixed></table></div></div><div id=dialog style="z-index:1000;background-color:#eee;box-shadow:0 0 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:90px;width:300px;display:none"><div style="width:100%;background-color:#036;color:#fff;border-radius:5px 5px 0 0"><div id=id_dialogclose style=float:right;padding:5px;cursor:pointer onclick=setDialogMode()><b>X</b></div><div id=id_dialogtitle style=padding:5px></div><div style=width:100%;margin:6px></div></div><div style=margin-right:16px;margin-left:8px><div id=dialog1 style=margin:auto;text-align:center;margin:3px><div id=id_dialogMessage style=padding:10px></div></div><div id=dialog2 style=margin:auto;margin:3px><div id=id_dialogOptions></div></div><div id=dialog3 style=margin:auto;margin:3px><select id=deskkeys style=width:100%><option value=10>Ctrl+Alt+Del<option value=11>Tab<option value=5>Win<option value=0>Win+Down<option value=1>Win+Up<option value=2>Win+L<option value=3>Win+M<option value=4>Shift+Win+M<option value=6>Win+R<option value=7>Alt-F4<option value=8>Ctrl-W<option value=9>Alt-Tab</select></div><div id=dialog7 style=margin:auto;margin:3px><div id=d7meshkvm><h4 style="width:100%;border-bottom:1px solid gray">Agent Remote Desktop</h4><div style="margin:3px 0 3px 0"><select id=d7bitmapquality style=float:right;width:200px;height:20px dir=rtl></select><div style=height:20px>Qualité</div></div><div style="margin:3px 0 3px 0"><select id=d7bitmapscaling style=float:right;width:200px;height:20px dir=rtl><option selected value=1024>100%<option value=896>87.5%<option value=768>75%<option value=640>62.5%<option value=512>50%<option value=384>37.5%<option value=256>25%<option value=128>12.5%</select><div style=height:20px>Mise à l'échelle</div></div><div style="margin:3px 0 3px 0"><select id=d7framelimiter style=float:right;width:200px;height:20px dir=rtl><option selected value=50>Fast<option value=100>Medium<option value=400>Lent<option value=1000>Very slow</select><div style=height:20px>Rate</div></div></div><div id=d7amtkvm><h4 style="width:100%;border-bottom:1px solid gray">Intel® AMT Hardware KVM</h4><div style=height:26px><select id=d7desktopmode style=float:right;width:200px><option value=1>RLE8, le plus rapide<option value=2>RLE16, recommandé<option value=3>RAW8, Slow<option value=4>RAW16, Very Slow</select><div>Encoding</div></div><div style=height:60px><div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:#fff"><label><input type=checkbox id=d7showfocus>Show Focus Tool</label><br><label><input type=checkbox id=d7showcursor>Show Local Mouse Cursor</label><br></div><div>Autre</div></div></div></div></div><div id=idx_dlgButtonBar style=padding:10px;margin-bottom:20px><input id=idx_dlgCancelButton type=button value=Annuler style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK style=float:right;width:80px onclick=dialogclose(1)></div></div><div id=topMenu style="z-index:1000;background-color:#eee;box-shadow:0 0 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:0 0 5px 5px;position:fixed;top:50px;right:5px;width:170px;display:none"><div style="padding:12px;border-top:1px solid gray;color:#000;cursor:pointer"onclick=topMenu(2)>Mes Dossiers</div><div style="padding:12px;border-top:1px solid gray;color:#000;cursor:pointer"onclick=topMenu(1)>Mon Compte</div><div id=logoutMenuOption><a href=/logout><div style="padding:12px;border-top:1px solid gray;color:#000;cursor:pointer">Logout</div></a></div></div><iframe name=fileUploadFrame style=display:none></iframe><script>"use strict";var webState="{{{webstate}}}";for(var i in""!=webState&&(webState=JSON.parse(decodeURIComponent(webState))),webState)localStorage.setItem(i,webState[i]);webState.loctag||localStorage.removeItem("loctag");var files,args=parseUriArgs(),debugLevel=parseInt("{{{debuglevel}}}"),features=parseInt("{{{features}}}"),sessionTime=parseInt("{{{sessiontime}}}"),domain="{{{domain}}}",domainUrl="{{{domainurl}}}",authCookie="{{{authCookie}}}",authRelayCookie="{{{authRelayCookie}}}",authCookieRenewTimer=null,meshserver=null,xdr=null,serverinfo=null,nodes=[],meshes={},filetree={},userinfo=null,users=(serverinfo=null,null),nodeShortIdent=0,serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}",debugmode=!1,attemptWebRTC=0!=(128&features),StatusStrs=["Disconnected","Connecting...","Setup...","Connected","Intel&reg; AMT Connected"],passRequirements="{{{passRequirements}}}";""!=passRequirements&&(passRequirements=JSON.parse(decodeURIComponent(passRequirements)));var sessionActivity=Date.now();function startup(){if(0==(32&features)){var e=null;try{e=top.location.toString().toLowerCase()}catch(e){}if(top!=self&&(null==e||0==top.active))return void(top.location=self.location)}if(!args.locale){var t=getstore("loctag",0);null!=t&&"*"!=t&&(args.locale=t)}(window.onresize=center)(),QV("changeEmailId",0==(2097152&features)),QH("p1message","Connecting..."),go(1),(meshserver=MeshServerCreateControl(domainUrl,authCookie)).onStateChanged=onStateChanged,meshserver.onMessage=onMessage,meshserver.Start();var o=localStorage.getItem("desktopsettings");null!=o&&(desktopsettings=JSON.parse(o)),applyDesktopSettings()}function onStateChanged(e,t,o,n){if(0==t){if(setDialogMode(0),go(0),"noauth"==n)return void QH("p0span","Unable to perform authentication");2==o?setTimeout(serverPoll,5e3):QH("p0span","Unable to connect web socket"),null!=authCookieRenewTimer&&(clearInterval(authCookieRenewTimer),authCookieRenewTimer=null)}else 2==t&&(meshserver.send({action:"meshes"}),meshserver.send({action:"nodes"}),meshserver.send({action:"files"}),xxcurrentView<2&&go(2),authCookieRenewTimer=setInterval(function(){meshserver.send({action:"authcookie"})},18e5));QV("topMenuIcon",2==t)}function serverPoll(){xdr=null;try{xdr=new XDomainRequest}catch(e){}(xdr=xdr||new XMLHttpRequest).open("HEAD",window.location.href),xdr.timeout=15e3,xdr.onload=function(){reload()},xdr.onerror=xdr.ontimeout=function(){setTimeout(serverPoll,1e4)},xdr.send()}function updateSelf(){if(QV("verifyEmailId",!0!==userinfo.emailVerified&&null!=userinfo.email&&1==serverinfo.emailcheck),QV("manageAuthApp",4096&features),QV("manageOtp",0!=(4096&features)&&(1==userinfo.otpsecret||0<userinfo.otphkeys)),QV("p3createMeshLink1",!1),QV("p3createMeshLink2",!1),"number"==typeof userinfo.passchange)if(-1==userinfo.passchange)QH("p2nextPasswordUpdateTime","- Réinitialiser à la prochaine connexion.");else if(null!=passRequirements&&"number"==typeof passRequirements.reset){var e=userinfo.passchange+86400*passRequirements.reset-Math.floor(Date.now()/1e3);e<0?QH("p2nextPasswordUpdateTime","- Réinitialiser à la prochaine connexion."):e<3600?QH("p2nextPasswordUpdateTime",format("- Réinitialisation en {0} minute {1}.",Math.floor(e/60),addLetterS(Math.floor(e/60)))):e<86400?QH("p2nextPasswordUpdateTime",format("- Réinitialisation dans {0} heure {1}.",Math.floor(e/3600),addLetterS(Math.floor(e/3600)))):QH("p2nextPasswordUpdateTime",format("- Réinitialiser dans le {0} jour {1}."),Math.floor(e/86400),addLetterS(Math.floor(e/86400)))}}function addLetterS(e){return 1<e?"s":""}function setSessionActivity(){sessionActivity=Date.now()}function checkIdleSessionTimeout(){Date.now()-sessionActivity>serverinfo.timeout&&(window.location.href="logout")}function onMessage(e,t){switch(t.action){case"serverinfo":(serverinfo=t.serverinfo).timeout&&(setInterval(checkIdleSessionTimeout,1e4),checkIdleSessionTimeout()),QV("p3AccountActions",0==(4&features)&&0==serverinfo.domainauth),QV("logoutMenuOption",0==(4&features)&&0==serverinfo.domainauth);break;case"authcookie":authCookie=t.cookie,authRelayCookie=t.rcookie;break;case"userinfo":userinfo=t.userinfo,QH("p3userName",userinfo.name),updateSelf();break;case"users":for(var o in users={},t.users)users[t.users[o]._id]=t.users[o];updateUsers();break;case"wssessioncount":wssessions=t.wssessions,updateUsers();break;case"meshes":for(var o in meshes={},t.meshes)meshes[t.meshes[o]._id]=t.meshes[o];updateMeshes(),updateDevices();break;case"files":filetree=setupBackPointers(t.filetree),updateFiles();break;case"nodes":for(var o in nodes=[],t.nodes)for(var n in t.nodes[o])meshes[o]?(t.nodes[o][n].namel=t.nodes[o][n].name.toLowerCase(),t.nodes[o][n].rname?t.nodes[o][n].rnamel=t.nodes[o][n].rname.toLowerCase():t.nodes[o][n].rnamel=t.nodes[o][n].namel,t.nodes[o][n].meshnamel=meshes[o].name.toLowerCase(),t.nodes[o][n].meshid=o,t.nodes[o][n].state=t.nodes[o][n].state?t.nodes[o][n].state:0,t.nodes[o][n].desc=t.nodes[o][n].desc,t.nodes[o][n].icon||(t.nodes[o][n].icon=1),t.nodes[o][n].ident=++nodeShortIdent,nodes.push(t.nodes[o][n])):console.log("Invalid mesh (1): "+o);updateDevices(),0==xxcurrentView&&go(parseInt("{{viewmode}}")),gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"));break;case"powertimeline":if(t.nodeid!=powerTimelineReq)break;powerTimelineNode=t.nodeid,powerTimeline=t.timeline,powerTimelineUpdate=Date.now()+3e5,currentNode._id==t.nodeid&&drawDeviceTimeline();break;case"otpauth-request":if(2==xxdialogMode&&"otpauth-request"==xxdialogTag){var i=t.secret;52==i.length?i=i.split(/(.............)/).filter(Boolean).join(" "):32==i.length&&(i=(i=i.split(/(....)/).filter(Boolean).join(" ")).substring(0,20)+"<br/>"+i.substring(20)),QH("d2optinfo",'Install <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" rel="noreferrer noopener" target=_blank>Google Authenticator</a> or a compatible application, use <a href="\' + message.url + \'" rel="noreferrer noopener" target=_blank> this link</a> or enter the secret below. Then, enter the current 6 digit token to activate 2-Step login.<br /><br /><div style=width:100%;text-align:center><tt id=d2optsecret secret="'+t.secret+'" style=font-size:15px>'+i+'</tt><br /><br />Token: <input type=text onkeypress="return (event.keyCode == 8) || (event.charCode >= 48 && event.charCode <= 57)" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text></div>'),QV("idx_dlgOkButton",!0),QE("idx_dlgOkButton",!1),Q("d2otpauthinput").focus()}break;case"otpauth-setup":if(xxdialogMode)return;setDialogMode(2,"Authenticator App",1,null,t.success?"<b style=color:green>2-step login activation successful</b>. You will now need a valid token to login again.":"<b style=color:red>2-step login activation failed</b>. Clear the secret from the application and try again. You only have a few minutes to enter the proper code.");break;case"otpauth-clear":if(xxdialogMode)return;setDialogMode(2,"Authenticator App",1,null,t.success?"<b style=color:green>2-step login activation removed</b>. You can reactivate this feature at any time.":"<b style=color:red>2-step login activation removal failed</b>. Try again.");break;case"otpauth-getpasswords":if(xxdialogMode)return;var a="One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place.";if(a+="<div style='border-radius:6px;border: 2px dashed #888;width:100%;margin-top:8px'><div style='padding:8px;font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold'><table style=width:100%;text-align:center>",t.passwords){var s=0;for(var l in t.passwords){++s%2&&(a+="<tr>");for(var r=""+t.passwords[l].p;r.length<8;)r="0"+r;!0===t.passwords[l].u?a+="<td>"+r.substring(0,4)+"&nbsp;"+r.substring(4):a+="<td><strike style=color:#BBB>"+r.substring(0,4)+"&nbsp;"+r.substring(4)}}else a+="<tr><td>No Active Tokens";a+="</table></div></div><br />",a+="<div><input type=button value='Close' onclick=setDialogMode(0) style=float:right></input>",a+="<input type=button value='Nouveaux Jetons' onclick='account_manageOtp(1);'></input>",null!=t.passwords&&(a+="<input type=button value='Clear' onclick='account_manageOtp(2);'></input>"),setDialogMode(2,"Manage Backup Codes",8,null,a+="</div><br />","otpauth-manage");break;case"event":if(t.event.noact)break;switch(t.event.action){case"userWebState":if(null!=localStorage){var d=JSON.parse(t.event.state);for(var l in d)localStorage.setItem(l,d[l]);null!=d.loctag&&d.loctag!=oldLoctag&&(null!=d.loctag?args.locale=d.loctag:delete args.locale,updateDevices(),updateMeshes())}break;case"accountchange":if(userinfo.name==t.event.account.name){var p=t.event.account.siteadmin?t.event.account.siteadmin:0,c=userinfo.siteadmin?userinfo.siteadmin:0;(t.event.account.quota!=userinfo.quota||0==(8&userinfo.siteadmin)&&0!=(8&t.event.account.siteadmin))&&meshserver.send({action:"files"}),userinfo=t.event.account,c!=p&&updateSiteAdmin(),updateSelf()}break;case"createmesh":null!=t.event.links[userinfo._id]&&(meshes[t.event.meshid]={_id:t.event.meshid,name:t.event.name,mtype:t.event.mtype,desc:t.event.desc,links:t.event.links},updateMeshes(),updateDevices(),meshserver.send({action:"files"}));break;case"meshchange":if(null==meshes[t.event.meshid])meshes[t.event.meshid]={_id:t.event.meshid,name:t.event.name,mtype:t.event.mtype,desc:t.event.desc,links:t.event.links},meshserver.send({action:"nodes"});else{if(meshes[t.event.meshid].name!=t.event.name)for(var l in meshes[t.event.meshid].name=t.event.name,nodes)nodes[l].meshid==t.event.meshid&&(nodes[l].meshnamel=t.event.name.toLowerCase());if(meshes[t.event.meshid].desc=t.event.desc,meshes[t.event.meshid].links=t.event.links,null==meshes[t.event.meshid].links[userinfo._id]){20==xxcurrentView&&currentMesh==meshes[t.event.meshid]&&go(2),delete meshes[t.event.meshid];var u=[];for(var l in nodes)nodes[l].meshid!=t.event.meshid&&u.push(nodes[l]);nodes=u,10<=xxcurrentView&&xxcurrentView<20&&currentNode&&currentNode.meshid==t.event.meshid&&(setDialogMode(0),go(2))}}updateMeshes(),updateDevices(),meshserver.send({action:"files"}),20==xxcurrentView&&currentMesh._id==t.event.meshid&&p20updateMesh();break;case"deletemesh":meshes[t.event.meshid]&&(delete meshes[t.event.meshid],updateMeshes(),meshserver.send({action:"files"}));u=[];for(var l in nodes)nodes[l].meshid!=t.event.meshid&&u.push(nodes[l]);nodes=u,updateDevices(),20<=xxcurrentView&&xxcurrentView<30&&currentMesh._id==t.event.meshid&&(setDialogMode(0),go(2)),10<=xxcurrentView&&xxcurrentView<20&&currentNode&&currentNode.meshid==t.event.meshid&&(setDialogMode(0),go(2));break;case"addnode":var m=t.event.node;if(!meshes[m.meshid])break;if(null!=getNodeFromId(m._id))break;m.namel=m.name.toLowerCase(),m.rname?m.rnamel=m.rname.toLowerCase():m.rnamel=m.namel,m.meshnamel=meshes[m.meshid].name.toLowerCase(),m.state=0,m.icon||(m.icon=1),m.ident=++nodeShortIdent,nodes.push(m),updateDevices();break;case"removenode":var h=-1;for(var l in nodes)if(nodes[l]._id==t.event.nodeid){h=l;break}if(-1!=h){m=nodes[h];currentNode==m&&(10<=xxcurrentView&&xxcurrentView<20&&(setDialogMode(0),go(2)),currentNode=null),nodes.splice(h,1),updateDevices()}break;case"changenode":h=-1;for(var l in nodes)if(nodes[l]._id==t.event.nodeid){h=l;break}if(-1!=h)(m=nodes[h]).name=t.event.node.name,m.rname=t.event.node.rname,m.host=t.event.node.host,m.desc=t.event.node.desc,m.publicip=t.event.node.publicip,m.iploc=t.event.node.iploc,m.wifiloc=t.event.node.wifiloc,m.gpsloc=t.event.node.gpsloc,m.tags=t.event.node.tags,m.userloc=t.event.node.userloc,null!=t.event.node.agent&&(null==m.agent&&(m.agent={}),null!=t.event.node.agent.ver&&(m.agent.ver=t.event.node.agent.ver),null!=t.event.node.agent.id&&(m.agent.id=t.event.node.agent.id),null!=t.event.node.agent.caps&&(m.agent.caps=t.event.node.agent.caps),null!=t.event.node.agent.core?m.agent.core=t.event.node.agent.core:m.agent.core&&delete m.agent.core,m.agent.tag=t.event.node.agent.tag),null!=t.event.node.intelamt&&(null==m.intelamt&&(m.intelamt={}),null!=t.event.node.intelamt.state&&(m.intelamt.state=t.event.node.intelamt.state),null!=t.event.node.intelamt.host&&(m.intelamt.user=t.event.node.intelamt.host),null!=t.event.node.intelamt.user&&(m.intelamt.user=t.event.node.intelamt.user),null!=t.event.node.intelamt.tls&&(m.intelamt.tls=t.event.node.intelamt.tls),null!=t.event.node.intelamt.ver&&(m.intelamt.ver=t.event.node.intelamt.ver),null!=t.event.node.intelamt.tag&&(m.intelamt.tag=t.event.node.intelamt.tag),null!=t.event.node.intelamt.uuid&&(m.intelamt.uuid=t.event.node.intelamt.uuid),null!=t.event.node.intelamt.realm&&(m.intelamt.realm=t.event.node.intelamt.realm)),m.namel=m.name.toLowerCase(),m.rname?m.rnamel=m.rname.toLowerCase():m.rnamel=m.namel,t.event.node.icon&&(m.icon=t.event.node.icon),refreshDevice(m._id),updateDevices();break;case"nodemeshchange":h=-1;for(var l in nodes)if(nodes[l]._id==t.event.nodeid){h=l;break}if(-1!=h){m=nodes[h];null==meshes[t.event.newMeshId]?(currentNode==m&&(10<=xxcurrentView&&xxcurrentView<20&&(setDialogMode(0),go(2)),currentNode=null),nodes.splice(h,1)):(m.meshid=t.event.newMeshId,m.meshnamel=meshes[t.event.newMeshId].name.toLowerCase()),updateDevices(),refreshDevice(t.event.nodeid)}else{m=t.event.node;if(!meshes[m.meshid])break;m.namel=m.name.toLowerCase(),m.rname?m.rnamel=m.rname.toLowerCase():m.rnamel=m.namel,m.meshnamel=meshes[m.meshid].name.toLowerCase(),m.state=0,m.icon||(m.icon=1),m.ident=++nodeShortIdent,nodes.push(m),updateDevices()}break;case"nodeconnect":h=-1;for(var l in nodes)if(nodes[l]._id==t.event.nodeid){h=l;break}if(-1!=h)(m=nodes[h]).conn=t.event.conn,m.pwr=t.event.pwr,updateDevices();break;case"login":null!=users&&users["user/"+domain+"/"+t.event.username.toLowerCase()]&&(users["user/"+domain+"/"+t.event.username.toLowerCase()].login=t.event.time)}}}function topMenu(e){null!=xxdialogMode&&0!=xxdialogMode&&999!=xxdialogMode||(void 0===e?1==("none"==QS("topMenu").display)?0!=xxdialogMode&&null!=xxdialogMode||(QV("topMenu",!0),xxdialogMode=999):(QV("topMenu",!1),xxdialogMode=0):(QV("topMenu",!1),xxdialogMode=0,1==e&&3!=xxcurrentView&&goForward("account"),2==e&&5!=xxcurrentView&&goForward("files")))}var filetreelinkpath,backStack=[];function goBack(){xxdialogMode||(0<backStack.length&&backStack.pop(),goStack())}function goForward(e){xxdialogMode||(backStack.push(e),goStack())}function goStack(){if(0!=backStack.length){var e=backStack[backStack.length-1],t=e.split("/")[0];"node"==t&&(setupDeviceMenu(0),gotoDevice(e)),"mesh"==t&&gotoMesh(e),"account"==t&&go(3),"devices"==t&&go(2),"files"==t&&go(5)}else go(2)}function updateFooterMenu(e){for(;null!=e&&e.length<3;)e.push({n:""});var t="",o="";if(null!=e)for(var n in e)t+='<td style="cursor:pointer'+(""==o?"":";border-left:solid 1px white")+'" onclick="'+e[n].f+'">'+e[n].n,o=e[n].n;QH("footerMenu","<tr>"+t)}function account_manageAuthApp(){xxdialogMode||0==(4096&features)||(1==userinfo.otpsecret?account_removeOtp():account_addOtp())}function account_addOtp(){xxdialogMode||1==userinfo.otpsecret||0==(4096&features)||(setDialogMode(2,"Authenticator App",2,function(){meshserver.send({action:"otpauth-setup",secret:Q("d2optsecret").attributes.secret.value,token:Q("d2otpauthinput").value})},"<div id=d2optinfo>Loading...</div>","otpauth-request"),meshserver.send({action:"otpauth-request"}))}function account_addOtpCheck(e){var t=6==Q("d2otpauthinput").value.length;QE("idx_dlgOkButton",t),e&&13==e.keyCode&&t&&dialogclose(1)}function account_removeOtp(){xxdialogMode||1!=userinfo.otpsecret||0==(4096&features)||setDialogMode(2,"Authenticator App",3,function(){meshserver.send({action:"otpauth-clear"})},"Confirm removal of authenticator application 2-step login?")}function account_manageOtp(e){2==xxdialogMode&&"otpauth-manage"==xxdialogTag&&dialogclose(0),xxdialogMode||1!=userinfo.otpsecret||0==(4096&features)||meshserver.send({action:"otpauth-getpasswords",subaction:e})}function account_showVerifyEmail(){xxdialogMode||1==userinfo.emailVerified||1!=serverinfo.emailcheck||setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,"Click ok to send a verification mail to:<br /><div style=padding:8px><b>"+EscapeHtml(userinfo.email)+"</b></div>Please wait a few minute to receive the verification.")}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){xxdialogMode||(setDialogMode(2,"Email Address Change",3,account_changeEmail,addHtmlValue("Email","<input id=dp3email style=width:170px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />")),null!=userinfo.email&&(Q("dp3email").value=userinfo.email),account_validateEmail(),Q("dp3email").focus())}function account_validateEmail(e,t){QE("idx_dlgOkButton",validateEmail(Q("dp3email").value)&&Q("dp3email").value!=userinfo.email),null!=e&&13==e.keyCode&&dialogclose(1)}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp3email").value})}function account_showDeleteAccount(){if(!xxdialogMode){var e="<form method=post><table style=margin-left:10px><input type=hidden name=action value=deleteaccount /><input type=hidden name=authcookie value="+authCookie+" /><tr>";e+="<td align=right>Mot de passe:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>",e+="</tr><tr><td align=right>Mot de passe:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>",e+="</tr></table><div style=padding:10px;margin-bottom:4px>",e+='<input id=account_dlgCancelButton type=button value="Annuler" style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>',e+='<input id=account_dlgOkButton type=submit value="OK" style="float:right;width:80px" onclick=dialogclose(1)>',setDialogMode(2,"Delete Account",0,null,e+="</div><br /></form>"),account_validateDeleteAccount(),Q("apassword1").focus()}}function account_showChangePassword(){if(xxdialogMode)return!1;var e="<table style=margin-left:10px>";if(e+="<tr><td align=right>"+nobreak("Old password:")+"</td><td><input id=apassword0 type=password name=apassword0 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b></b></td></tr>",e+="<tr><td align=right>"+nobreak("Nouveau mot de passe:")+"</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td></tr>",e+="<tr><td align=right>"+nobreak("Nouveau mot de passe:")+"</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>",65536&features&&(e+="<tr><td align=right>Password hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>"),e+="</table>",passRequirements){var t=[],o=0;for(var n in passRequirements)"reset"!=n&&"hint"!=n&&(t.push(n+":"+passRequirements[n]),o++);0<o&&(e+="<br /><span style=font-size:x-small>"+format("Exigences: {0}.",t.join(", "))+"</span>")}return setDialogMode(2,"Change Password",3,account_showChangePasswordEx,e+="<br />"),Q("apassword0").focus(),account_validateNewPassword(),!1}function account_showChangePasswordEx(){if(Q("apassword1").value==Q("apassword2").value){var e={action:"changepassword",oldpass:Q("apassword0").value,newpass:Q("apassword1").value};65536&features&&(e.hint=Q("apasswordhint").value),meshserver.send(e)}}function account_createMesh(){if(!xxdialogMode)if(4294967295==userinfo.siteadmin||0==(64&userinfo.siteadmin))if(!0===userinfo.emailVerified||1!=serverinfo.emailcheck||4294967295==userinfo.siteadmin)if(!(262144&features)||1==userinfo.otpsecret||0<userinfo.otphkeys||0<userinfo.otpkeys){var e=addHtmlValue("Nom","<input id=dp3meshname style=width:170px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />");e+=addHtmlValue("Type","<div style=width:170px;margin:0;padding:0><select id=dp3meshtype style=width:100% onchange=account_validateMeshCreate() ><option value=2>Groupe d'agents logiciels</option><option value=1>Intel&reg; AMT only</option></select></div>"),setDialogMode(2,"Create Device Group",3,account_createMeshEx,e+=addHtmlValue("Description","<div style=width:170px;margin:0;padding:0><textarea id=dp3meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>")),account_validateMeshCreate(),Q("dp3meshname").focus()}else setDialogMode(2,"Account Security",1,null,'Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the "My Account" and look at the "Account Security" section.');else setDialogMode(2,"Account Security",1,null,'Unable to access a device until a email address is verified. This is required for password recovery. Go to the "My Account" to change and verify an email address.');else setDialogMode(2,"Nouveau Group",1,null,"This account does not have the rights to create a new device group.")}function account_validateMeshCreate(){QE("idx_dlgOkButton",0<Q("dp3meshname").value.length)}function account_createMeshEx(e,t){meshserver.send({action:"createmesh",meshname:Q("dp3meshname").value,meshtype:Q("dp3meshtype").value,desc:Q("dp3meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",0<Q("apassword1").value.length&&Q("apassword1").value==Q("apassword2").value)}function account_validateNewPassword(){var e="",t=0<Q("apassword0").value.length&&0<Q("apassword1").value.length&&Q("apassword1").value==Q("apassword2").value&&Q("apassword0").value!=Q("apassword1").value;if(65536&features&&Q("apasswordhint").value==Q("apassword1").value&&(t=!1),""!=Q("apassword1").value)if(null==passRequirements||""==passRequirements){var o=checkPasswordStrength(Q("apassword1").value);e=80<=o?"<span style=color:green>Strong<span>":60<=o?"<span style=color:blue>&#9679;<span>":"<span style=color:red>&#9679;<span>"}else{0==checkPasswordRequirements(Q("apassword1").value,passRequirements)&&(t=!1,e="<span style=color:red>Politique<span>")}QH("dxPassWarn",e),QE("idx_dlgOkButton",t)}function checkPasswordStrength(e){var t=0,o={},n=0,i={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e)return 0;for(var a=0;a<e.length;a++)o[e[a]]=(o[e[a]]||0)+1,t+=5/o[e[a]];for(var s in i)n+=1==i[s]?1:0;return parseInt(t+10*(n-1))}function checkPasswordRequirements(e,t){if(null==t||""==t||"object"!=typeof t)return!0;if(t.min&&e.length<t.min)return!1;if(t.max&&e.length>t.max)return!1;for(var o=0,n=0,i=0,a=0,s=0;s<e.length;s++)/\d/.test(e[s])&&o++,/[a-z]/.test(e[s])&&n++,/[A-Z]/.test(e[s])&&i++,/\W/.test(e[s])&&a++;return!(t.num&&o<t.num)&&(!(t.lower&&n<t.lower)&&(!(t.upper&&i<t.upper)&&!(t.nonalpha&&a<t.nonalpha)))}function updateMeshes(){var e="",t=0;for(i in meshes){t++;var o=meshes[i].links[userinfo._id].rights,n="Partial Rights";4294967295==o?n="Full Administrator":0==o&&(n="No Rights"),e+="<div style=cursor:pointer onclick=goForward('"+i+"')>",e+='<div style="float:left;margin-left:4px"><img src="/images/meshicon50.png" width=50 height=50 /></div>',e+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">',e+="<div><div style=padding-left:12px;padding-top:2px><b>"+EscapeHtml(meshes[i].name)+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+n+"</div></div>",e+="</div></div>"}QH("p3meshes",e),QV("p3noMeshFound",0==t)}function gotoMesh(e){null==(currentMesh=meshes[e])&&goBack(),p20updateMesh(),go(20)}var sortorder,filetreelocation=[];function p5refreshFiles(){meshserver.send({action:"files"})}function updateFiles(){if(QV("MainMenuMyFiles",0==(8&features)),0==(8&features)){for(var e,t="",o="",n="<a style=cursor:pointer onclick=p5folderup(0)>Root</a>",i="Root",a=filetree,s=1,l=[],r=filetreelinkpath,d=[],p=document.getElementsByName("fc"),c=0;c<p.length;c++)p[c].checked&&d.push(p[c].value);for(var c in filetreelinkpath="",filetreelocation){if(null==a.f||null==a.f[filetreelocation[c]])break;if(l.push(filetreelocation[c]),i+=" / "+filetreelocation[c],1==s){var u=filetreelocation[c].split("/");e=window.location+u[0]+"files/"+u[2],filetreelinkpath+=filetreelocation[c]}else""!=filetreelinkpath&&(filetreelinkpath+="/"+filetreelocation[c],2<s&&(e+="/"+filetreelocation[c]));n+=" / <a style=cursor:pointer onclick=p5folderup("+s+")>"+(null!=(a=a.f[filetreelocation[c]]).n?a.n:filetreelocation[c])+"</a>",s++}filetreelocation=l;var m=i.toLowerCase().startsWith("root / "+userinfo._id+" / public"),h=p5sort_files(a.f);for(var c in h){var f,g=h[c],v=g.n;f=40<(f=v).length?EscapeHtml(v.substring(0,40))+"...":EscapeHtml(v),v=EscapeHtml(v);var k="";null!=g.s&&(k=getFileSizeStr(g.s));var y="";if(g.t<3||4==g.t){y="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+v+"'>&nbsp;<span style=float:right;padding-right:4px>"+(1==g.t||4==g.t?p5getQuotabar(g):"")+"</span><span><div class=fileIcon"+g.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(g.nx)+'")>'+f+"</a></span></div>"}else{var x=f,b="";m&&(b=" (<a style=cursor:pointer onclick='p5showPublicLink(\""+e+"/"+g.nx+"\")'>Link</a>)"),0<g.s&&(x='<a rel="noreferrer noopener" target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+g.nx)+'">'+f+"</a>"+b),y="<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+g.nx+"'>&nbsp;<span style=float:right;padding-right:4px>"+k+"</span><span><div class=fileIcon"+g.t+"></div>"+x+"</span></div>"}g.t<3?t+=y:o+=y}if(QH("p5rightOfButtons",p5getQuotabar(a)),QH("p5files",t+o),QH("p5currentpath",n),QE("p5FolderUp",0!=filetreelocation.length),QV("p5PublicShare",m),r==filetreelinkpath){p=document.getElementsByName("fc");for(c=0;c<p.length;c++)p[c].checked=0<=d.indexOf(p[c].value)}p5setActions()}}function getNiceSize(e){return e<=0?"Storage exceed":e<2048?format("{0}b left",e):e<2097152?format("{0}k left",Math.round(e/1024)):e<2147483648?format("{0}m left",Math.round(e/1024/1024)):format("{0}g left",Math.round(e/1024/1024/1024))}function p5getQuotabar(e){for(;1<e.t&&4!=e.t;)e=e.parent;return 1!=e.t&&4!=e.t||null==e.maxbytes?"":getNiceSize(e.maxbytes-e.s)+" <progress style=height:10px;width:100px value="+e.s+" max="+e.maxbytes+" />"}function p5showPublicLink(e){setDialogMode(2,"Public Link",1,null,'<input type=text style=width:100% value="'+e+'" readonly />')}function p5sort_filename(e,t){return e.ln>t.ln?1*sortorder:e.ln<t.ln?-1*sortorder:0}function p5sort_timestamp(e,t){return e.d>t.d?1*sortorder:e.d<t.d?-1*sortorder:0}function p5sort_bysize(e,t){return e.s==t.s?p5sort_filename(e,t):(e.s-t.s)*sortorder}function p5sort_files(e){var t=[],o=Q("p5sortdropdown").value;for(var n in e)e[n].nx=n,null==e[n].n&&(e[n].n=n),e[n].ln=e[n].n.toLowerCase(),t.push(e[n]);return sortorder=1,3<o&&(sortorder=-1,o-=3),1==o?t.sort(p5sort_filename):2==o?t.sort(p5sort_bysize):3==o&&t.sort(p5sort_timestamp),t}function p5setActions(){var e=getFileSelCount(),t=getFileCount(),o=getFileSelCount(!1);QE("p5DeleteFileButton",0<e&&0<filetreelocation.length),QE("p5NewFolderButton",0<filetreelocation.length),QE("p5UploadButton",0<filetreelocation.length),QE("p5RenameFileButton",1==e&&0<filetreelocation.length),QE("p5SelectAllButton",0<t),Q("p5SelectAllButton").value=0<e?"None":"Tout",QE("p5CutButton",0<o&&e==o),QE("p5CopyButton",0<o&&e==o),QE("p5PasteButton",null!=p5clipboard&&0<p5clipboard.length&&0<filetreelocation.length)}function getFileSelCount(e){for(var t=0,o=document.getElementsByName("fc"),n=0;n<o.length;n++)!o[n].checked||0==e&&"3"!=o[n].attributes.file.value||t++;return t}function getFileSelDirCount(){for(var e=0,t=document.getElementsByName("fc"),o=0;o<t.length;o++)t[o].checked&&"999"==t[o].attributes.file.value&&e++;return e}function getFileCount(){return document.getElementsByName("fc").length}function p5selectallfile(){for(var e=0==getFileSelCount(),t=document.getElementsByName("fc"),o=0;o<t.length;o++)t[o].checked=e;p5setActions()}function setupBackPointers(e){if(null!=e.f){var t=0,o=0;for(var n in e.f)setupBackPointers(e.f[n]),(e.f[n].parent=e).f[n].s&&(t+=e.f[n].s),e.f[n].c&&(o+=e.f[n].c),3==e.f[n].t&&o++;e.s=t,e.c=o}return e}function getFileSizeStr(e){return 1==e?"1 octet":format("{0} octets",e)}function p5folderup(e){if(null==e)filetreelocation.pop();else for(;filetreelocation.length>e;)filetreelocation.pop();return updateFiles(),!1}function p5folderset(e){return filetreelocation.push(decodeURIComponent(e)),updateFiles(),!1}function p5createfolder(){setDialogMode(2,"Nouveau Dossier",3,p5createfolderEx,"<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% />"),focusTextBox("p5renameinput"),p5fileNameCheck()}function p5createfolderEx(){meshserver.send({action:"fileoperation",fileop:"createfolder",path:filetreelocation,newfolder:Q("p5renameinput").value})}function p5deletefile(){var e=getFileSelCount(),t=0<getFileSelDirCount()?"<br /><br /><label><input type=checkbox id=p5recdeleteinput>Recursive delete</label><br>":"<input type=checkbox id=p5recdeleteinput style='display:none'>";setDialogMode(2,"Delete",3,p5deletefileEx,1<e?format("Delete {0} selected items?",e)+t:"Delete selected item?"+t)}function p5deletefileEx(){for(var e=[],t=document.getElementsByName("fc"),o=0;o<t.length;o++)t[o].checked&&e.push(t[o].value);meshserver.send({action:"fileoperation",fileop:"delete",path:filetreelocation,delfiles:e,rec:Q("p5recdeleteinput").checked})}function p5renamefile(){for(var e,t=document.getElementsByName("fc"),o=0;o<t.length;o++)t[o].checked&&(e=t[o].value);setDialogMode(2,"Renommer",3,p5renamefileEx,'<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="'+e+'" />',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:e}),focusTextBox("p5renameinput"),p5fileNameCheck()}function p5renamefileEx(e,t){t.newname=Q("p5renameinput").value,meshserver.send(t)}function p5fileNameCheck(e){var t=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",t),1==t&&e&&13==e.keyCode&&dialogclose(1)}var isFilenameValid=function(){var t=/^[^\\/:\*\?"<>\|]+$/,o=/^\./,n=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function(e){return t.test(e)&&!o.test(e)&&!n.test(e)&&"."!=e[0]}}();function p5uploadFile(){setDialogMode(2,"Upload File",3,p5uploadFileEx,'<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p5uploadpath value="'+encodeURIComponent(filetreelinkpath)+'" /><input type=file name=files id=p5uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p5uploadinput\')" /><input type=hidden name=authCookie value='+authCookie+" /><input type=submit id=p5loginSubmit style=display:none /></form>"),updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(e){QE("idx_dlgOkButton",""!=Q(e).value)}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(e){var t=document.getElementsByName("fc");p5clipboard=[],p5clipboardCut=e,p5clipboardFolder=Clone(filetreelocation);for(var o=0;o<t.length;o++)t[o].checked&&"3"==t[o].attributes.file.value&&p5clipboard.push(t[o].value);p5updateClipview()}function p5pasteFile(){var e="";null!=p5clipboard&&0<p5clipboard.length&&(e=format("Confim {0} of {1} entrie{2} to this location?",0==p5clipboardCut?"copy":"move",p5clipboard.length,1<p5clipboard.length?"s":"")),setDialogMode(2,"Paste",3,p5pasteFileEx,e)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:0==p5clipboardCut?"copy":"move",scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard}),p5folderup(999),1==p5clipboardCut&&(p5clipboardFolder=p5clipboard=null,p5clipboardCut=0,p5updateClipview())}function p5updateClipview(){var e="";null!=p5clipboard&&0<p5clipboard.length&&(e=format("Holding {0} entrie{1} for {2}",p5clipboard.length,1<p5clipboard.length?"s":"",0==p5clipboardCut?"copy":"move")+', <a href=# onclick="return p5clearClip()" style=cursor:pointer>Clear</a>.'),QH("p5bottomstatus",e),p5setActions()}function p5clearClip(){return p5clipboardFolder=p5clipboard=null,p5clipboardCut=0,p5updateClipview(),!1}function p5fileDragDrop(e){if(haltEvent(e),QV("bigfail",!1),QV("bigok",!1),null!=e.dataTransfer&&0!=e.dataTransfer.files.length&&0!=filetreelocation.length)for(var t=[],o=[],n=[],i=[],a=e.dataTransfer.files.length,s=0;s<e.dataTransfer.files.length;s++){var l=new FileReader,r=e.dataTransfer.files[s];t.push(r.name),o.push(r.size),n.push(r.type),l.onload=function(e){i.push(e.target.result),0==--a&&(Q("p5fileDragName").value=t.join("*"),Q("p5fileDragSize").value=o.join("*"),Q("p5fileDragType").value=n.join("*"),Q("p5fileDragData").value=i.join("*"),Q("p5fileDragLink").value=encodeURIComponent(filetreelinkpath),Q("p5loginSubmit2").click())},l.readAsDataURL(r)}}var p5dragtimer=null;function p5fileDragOver(e){haltEvent(e),null!=p5dragtimer&&(clearTimeout(p5dragtimer),p5dragtimer=null);var t=!0;0==filetreelocation.length&&(t=!1),QV("bigok",t),QV("bigfail",!t)}function p5fileDragLeave(e){haltEvent(e),"p5filetable"!=e.target.id?(QV("bigfail",!1),QV("bigok",!1)):p5dragtimer=setTimeout("QV('bigfail',false);QV('bigok',false);p5dragtimer=null;",200)}function ondeskkeypress(e){if(toggleSoftKeys(0),Q("DeskSoftInput").value="",setSessionActivity(),desktop&&!xxdialogMode&&10==xxcurrentView){if(null!=currentNode){var t=meshes[currentNode.meshid].links[userinfo._id].rights;if(0==(4294967295==t||0!=(8&t)&&0==(256&t)))return!1;if(1==(4294967295!=t&&0!=(8&t)&&0==(256&t)&&0!=(4096&t))&&(1==e.altKey||1==e.ctrlKey||e.keyCode<32&&8!=e.keyCode&&13!=e.keyCode||90<e.keyCode))return!1}return desktop.m.handleKeys(e)}}function ondeskkeydown(e){if(toggleSoftKeys(0),Q("DeskSoftInput").value="",setSessionActivity(),desktop&&!xxdialogMode&&10==xxcurrentView){if(null!=currentNode){var t=meshes[currentNode.meshid].links[userinfo._id].rights;if(0==(4294967295==t||0!=(8&t)&&0==(256&t)))return!1;if(1==(4294967295!=t&&0!=(8&t)&&0==(256&t)&&0!=(4096&t))&&(1==e.altKey||1==e.ctrlKey||e.keyCode<32&&8!=e.keyCode&&13!=e.keyCode||90<e.keyCode))return!1}return desktop.m.handleKeyDown(e)}}function ondeskkeyup(e){if(toggleSoftKeys(0),Q("DeskSoftInput").value="",setSessionActivity(),desktop&&!xxdialogMode&&10==xxcurrentView){if(null!=currentNode){var t=meshes[currentNode.meshid].links[userinfo._id].rights;if(0==(4294967295==t||0!=(8&t)&&0==(256&t)))return!1;if(1==(4294967295!=t&&0!=(8&t)&&0==(256&t)&&0!=(4096&t))&&(1==e.altKey||1==e.ctrlKey||e.keyCode<32&&8!=e.keyCode&&13!=e.keyCode||90<e.keyCode))return!1}return desktop.m.handleKeyUp(e)}}var updateDevicesTimer=null;function updateDevices(){null==updateDevicesTimer&&(updateDevicesTimer=setTimeout(updateDevicesEx,200))}var deviceHeaderCount,sort=0,deviceHeaderId=0,deviceHeaders={},showRealNames=!1,deviceHeaderTotal=0,deviceHeadersTitles=(deviceHeaders={},{});function updateDevicesEx(){null!=updateDevicesTimer&&(clearTimeout(updateDevicesTimer),updateDevicesTimer=null);var e="",t=0,o=null,n=0,i={};for(var a in deviceHeaderCount={},deviceHeaders={},deviceHeadersTitles={},(deviceHeaderTotal=deviceHeaderId=0)==sort?nodes.sort(meshSort):1==sort?nodes.sort(powerSort):2==sort&&(1==showRealNames?nodes.sort(deviceHostSort):nodes.sort(deviceSort)),nodes)if(0!=nodes[a].v){var s=meshes[nodes[a].meshid].links[userinfo._id];if(null!=s){s.rights;if(0==sort){if(nodes.sort(meshSort),nodes[a].meshid!=o){deviceHeaderSet();var l="";1==meshes[nodes[a].meshid].mtype&&(l="<span style=color:lightgray>, Intel&reg; AMT only</span>"),null!=o&&(2==t&&(e+="<td><div style=width:301px></div></td>"),""!=e&&(e+="</tr></table>")),e+="<div class=DevSt style=padding-top:4px><span style=float:right>",e+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+nodes[a].meshid+'")>'+EscapeHtml(meshes[nodes[a].meshid].name)+"</span>"+l+"<span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>",i[o=nodes[a].meshid]=1,t=0}}else 1==sort?nodes[a].pwr!==o&&(deviceHeaderSet(),null!==o&&(2==t&&(e+="<td><div style=width:301px></div></td>"),""!=e&&(e+="</tr></table>")),e+="<div class=DevSt style=width:100%;padding-top:4px><span>"+PowerStateStr2(nodes[a].pwr)+"</span><span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>",o=nodes[a].pwr,t=0):2==sort&&null==o&&(o="1");n++;var r=EscapeHtml(nodes[a].name);0==r.length&&(r="<i>None</i>"),null!=nodes[a].rname&&0<nodes[a].rname.length&&(r+=" / "+EscapeHtml(nodes[a].rname));var d=EscapeHtml(nodes[a].name);1==showRealNames&&null!=nodes[a].rname&&(d=EscapeHtml(nodes[a].rname)),0==d.length&&(d="<i>None</i>");var p=nodes[a].icon,c=NodeStateStr(nodes[a]);nodes[a].conn&&0!=nodes[a].conn||(p+=" gray"),e+="<div style=cursor:pointer onclick=goForward('"+nodes[a]._id+"')>",e+='<div class="i'+p+'" style="float:left;margin-left:4px"></div>',e+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">',e+="<div><div style=padding-left:12px;padding-top:2px><b>"+d+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+c+"</div></div>",e+="</div></div>",deviceHeaderTotal++,void 0===deviceHeaderCount[nodes[a].state]?deviceHeaderCount[nodes[a].state]=1:deviceHeaderCount[nodes[a].state]++}}if(0==sort)for(var a in meshes){var u=meshes[a],m=u.links[userinfo._id];if(null!=m){m.rights;null==i[u._id]&&(""!=o&&""!=e&&(e+="</tr></table>"),e+="<div><div colspan=3 class=DevSt><span style=float:right>",e+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+u._id+'")>'+EscapeHtml(u.name)+"</span></div>",1==u.mtype&&(e+="<div style=padding:10px><i>No Intel&reg; AMT devices in this group"),2==u.mtype&&(e+="<div style=padding:10px><i>Aucun appareil dans ce groupe"),e+=".</i></div></div>",o=u._id,n++)}}for(var a in 0==n?QH("xdevices",'<div style="margin-top:50px;text-align:center"><span style="font-size:30px">Aucun appareil</span><br /><br />Use the desktop version of this website to add devices.</div>'):QH("xdevices",e),deviceHeaderSet(),deviceHeaders)QH(a,deviceHeaders[a]);for(var a in deviceHeadersTitles)Q(a).title=deviceHeadersTitles[a]}var powerStatetable=["","Alimenté","Dormir","Dormir","Dormir","Hibernating","Éteindre","Présent"],powerStateStrings=["","Alimenté","Sleeping","Sleeping","Deep Sleep","Hibernating","Soft-Off","Présent"],powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"],powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(e){var t=[];return 0<e.state&&e.state<powerStatetable.length&&state.push(powerStatetable[e.state]),e.conn&&(0!=(1&e.conn)&&t.push("<span>Agent</span>"),0!=(2&e.conn)?t.push("<span>CIRA</span>"):0!=(4&e.conn)&&t.push("<span>Intel&reg; AMT</span>"),0!=(8&e.conn)&&t.push("<span>Relay</span>"),0!=(16&e.conn)&&t.push("<span>MQTT</span>")),null!=e.pwr&&0!=e.pwr&&t.push(powerStateStrings[e.pwr]),t.join(", ")}function PowerStateStr(e){return e<powerStatetable.length?powerStatetable[e]:""}function PowerStateStr2(e){return 0!=e&&e<powerStatetable.length?powerStatetable[e]:"Inconnue"}function onSortSelectChange(e){sort=document.getElementById("sortselect").selectedIndex,e||putstore("sort",sort),updateDevicesEx()}function deviceHeaderSet(){if(0!=deviceHeaderId){deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+(1==deviceHeaderTotal?"nœud":"noeuds");var e="";for(var t in deviceHeaderCount)0<e.length&&(e+=", "),e+=deviceHeaderCount[t]+" "+PowerStateStr2(t);deviceHeadersTitles["DevxHeader"+deviceHeaderId]=e,deviceHeaderId++,deviceHeaderCount={},deviceHeaderTotal=0}else deviceHeaderId=1}function meshSort(e,t){return e.meshnamel>t.meshnamel?1:e.meshnamel<t.meshnamel?-1:e.meshid==t.meshid?1==showRealNames?e.rnamel>t.rnamel?1:e.rnamel<t.rnamel?-1:0:e.namel>t.namel?1:e.namel<t.namel?-1:0:0}function powerSort(e,t){var o=e.pwr?e.pwr:0,n=t.pwr?t.pwr:0;return o==n?1==showRealNames?e.rnamel>t.rnamel?1:e.rnamel<t.rnamel?-1:0:e.namel>t.namel?1:e.namel<t.namel?-1:0:n<o?1:o<n?-1:0}function deviceSort(e,t){return e.namel>t.namel?1:e.namel<t.namel?-1:0}function deviceHostSort(e,t){return e.rnamel>t.rnamel?1:e.rnamel<t.rnamel?-1:0}function refreshDevice(e){currentNode&&currentNode._id==e&&gotoDevice(e,xxcurrentView,!0)}function getNodeRights(e){var t=getNodeFromId(e);return meshes[t.meshid].links[userinfo._id].rights}var currentNode,currentDevicePanel=0,powerTimelineNode=null,powerTimelineReq=null,powerTimelineUpdate=null,powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(e,t,o){if(!0===userinfo.emailVerified||1!=serverinfo.emailcheck||4294967295==userinfo.siteadmin)if(!(262144&features)||1==userinfo.otpsecret||0<userinfo.otphkeys||0<userinfo.otpkeys){var n=getNodeFromId(e);if(null!=n){var i=meshes[n.meshid];if(null!=i){var a=i.links[userinfo._id].rights;if(!currentNode||currentNode._id!=n._id||1==o){currentNode=n;var s=EscapeHtml(n.name);0==s.length&&(s="<i>None</i>"),0!=(4&a)&&(s="<span onclick=showEditNodeValueDialog(0) style=cursor:pointer>"+s+"</span>"),QH("p10deviceName",s);var l="<table style=width:100%>";l+=addDeviceAttribute("<span>Groupe</span>",'<a onclick=goForward("'+n.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[n.meshid].name)+"</a>"),null!=n.rname&&(l+=addDeviceAttribute("<span>Nom</span>","<span>"+EscapeHtml(n.rname)+"</span>")),1!=i.mtype&&n.name==n.host||(0!=(4&a)?n.host?l+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(n.host)+"</span>"):l+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>"):l+=addDeviceAttribute("Hostname",EscapeHtml(n.host)));var r=n.desc?EscapeHtml(n.desc):"<i>None</i>";l+=addDeviceAttribute("Description",0!=(4&a)?"<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+r+"</span>":r);var d=["Inconnue","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","MacOS 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","MacOS 64bit","ChromeOS","Linux Poky x86-64bit","Linux NoKVM x86-32bit","Linux NoKVM x86-64bit","Windows MinCore console","Windows MinCore service","NodeJS","ARM-Linaro","ARMv6l / ARMv7l","ARMv8 64bit","ARMv6l / ARMv7l / NoKVM","Inconnue","Inconnue","FreeBSD x86-64"];if(null!=n.agent&&null!=n.agent.id&&null!=n.agent.ver){var p="";p=n.agent.id<=d.length?d[n.agent.id]:d[0],0!=n.agent.ver&&(p+=" v"+n.agent.ver),l+=addDeviceAttribute("Agent",p)}if(null!=n.intelamt){p="";var c={0:nobreak("Not Activated (Pre)"),1:nobreak("Not Activated (In)"),2:nobreak("Activé")};null!=n.intelamt.ver&&null==n.intelamt.state?p+="<i>"+nobreak("Etat inconnu")+"</i>, v"+n.intelamt.ver:null==n.intelamt.ver&&2==n.intelamt.state?p+="<i>Activé</i>":null==n.intelamt.ver||null==n.intelamt.state?p+="<i>Version et état inconnus</i>":(p+=c[n.intelamt.state],n.intelamt.flags&&(2&n.intelamt.flags?p=" <span>CCM</span>":4&n.intelamt.flags&&(p=" <span>ACM</span>")),p+=", v"+n.intelamt.ver),1==n.intelamt.tls&&(p+=", <span>TLS</span>"),2==n.intelamt.state&&(null!=n.intelamt.user&&""!=n.intelamt.user||(p+=0!=(4&a)?', <i style=color:#FF0000;cursor:pointer onclick=editDeviceAmtSettings("'+n._id+'")>'+nobreak("No Credentials")+"</i>":", <i style=color:#FF0000>No Credentials</i>"),p+=" ",0!=(4&a)&&(p+='<img src=images/link4.png height=10 width=10 style=cursor:pointer onclick=editDeviceAmtSettings("'+n._id+'")>'));var u="Intel&reg; ME";"number"==typeof n.intelamt.sku&&(0!=(8&n.intelamt.sku)?u="Intel&reg; AMT":0!=(16&n.intelamt.sku)&&(u="Intel&reg; SM")),l+=addDeviceAttribute(u,p)}if(null!=n.agent&&null!=n.agent.tag&&"mailto:"!=n.agent.tag){var m=EscapeHtml(n.agent.tag);m.startsWith("mailto:")&&(m='<a href="'+m+'">'+m.substring(7)+"</a>"),l+=addDeviceAttribute("Agent Tag",m)}var h=n.conn;if(h&&1<h){var f=[];0!=(1&n.conn)&&f.push("<span>Agent</span>"),0!=(2&n.conn)?f.push("<span>Intel&reg; AMT CIRA</span>"):0!=(4&n.conn)&&f.push("<span>Intel&reg; AMT</span>"),0!=(8&n.conn)&&f.push("<span>Agent Relay</span>"),0!=(16&n.conn)&&f.push("<span>MQTT</span>"),l+=addDeviceAttribute("Connectivity",f.join(", "))}var g="<i>None</i>";if(null!=n.tags)for(var v in g="",n.tags)g+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+n.tags[v]+"</span>";l+=addDeviceAttribute("Tags",0!=(4&a)?"<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+g+"</span>":g),l+="</table><br />",0!=(76&a)&&(l+="<input type=button value=Actions onclick=deviceActionFunction() />"),QH("p10html",l),setupFiles(),l="<div style=float:right;font-size:x-small;margin-right:10px>",0!=(4&a)&&(l+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+n._id+'")>Delete Device</a>'),l+="</div><div style=font-size:x-small>",l+="</div><br>",QH("p10html3",l);var k=PowerStateStr(n.state);0!=(1&h)&&(0<k.length&&(k+=", "),k+="<span style=font-size:10px>Mesh Agent</span>"),0!=(2&h)?(0<k.length&&(k+=", "),k+="<span style=font-size:10px>Intel&reg; AMT connected</span>"):0!=(4&h)&&(0<k.length&&(k+=", "),k+="<span style=font-size:10px>Intel&reg; AMT detected</span>"),0!=(16&h)&&(0<k.length&&(k+="<br/>"),k+="<span style=font-size:12px>MQTT channel connected</span>"),QH("MainComputerState",k),QH("MainComputerImage",'<div class="i'+n.icon+'"></div>'),powerTimelineNode!=currentNode._id&&powerTimelineReq!=currentNode._id&&(QH("p10html2",""),powerTimelineReq=currentNode._id,meshserver.send({action:"powertimeline",nodeid:currentNode._id}))}setupDesktop(),go(t=t||10),setupDeviceMenu()}else goBack()}else goBack()}else setDialogMode(2,"Account Security",1,null,'Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the "My Account" and look at the "Account Security" section.');else setDialogMode(2,"Account Security",1,null,'Unable to access a device until a email address is verified. This is required for password recovery. Go to the "My Account" to change and verify an email address.')}function deviceToastFunction(){xxdialogMode||setDialogMode(2,"Device Toast",3,deviceToastFunctionEx,"<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function setupDeviceMenu(e,t){var o=0;currentNode&&(o=meshes[currentNode.meshid].links[userinfo._id].rights),null!=e&&(currentDevicePanel=e),QV("p10general",0==currentDevicePanel),QV("p10desktop",1==currentDevicePanel),QV("p10files",2==currentDevicePanel);var n=[];0!=currentDevicePanel&&n.push({n:"General",f:"setupDeviceMenu(0)"}),1!=currentDevicePanel&&null!=currentNode&&(8&o||256&o)&&(1==meshes[currentNode.meshid].mtype&&("number"!=typeof currentNode.intelamt.sku||0!=(8&currentNode.intelamt.sku))||currentNode.agent&&1&currentNode.agent.caps)&&n.push({n:"Desktop",f:"setupDeviceMenu(1)"}),2!=currentDevicePanel&&null!=currentNode&&8&o&&(4294967295==o||0==(1024&o))&&2==currentNode.mtype&&4&currentNode.agent.caps&&n.push({n:"Files",f:"setupDeviceMenu(2)"}),updateFooterMenu(n)}function deviceActionFunction(){if(!xxdialogMode){var e=meshes[currentNode.meshid].links[userinfo._id].rights,t="Select an operation to perform on this device.<br /><br />",o="<select id=d2deviceop style=float:right;width:170px>";0!=(64&e)&&(o+="<option value=100>Wake-up</option>"),0!=(8&e)&&(o+="<option value=4>Dormir</option><option value=3>Réinitialiser</option><option value=2>Éteindre</option>"),setDialogMode(2,"Device Action",3,deviceActionFunctionEx,t+=addHtmlValue("Opération",o+="</select>"))}}function deviceActionFunctionEx(){var e=Q("d2deviceop").value;100==e?meshserver.send({action:"wakedevices",nodeids:[currentNode._id]}):meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:e})}function updateDeviceTimeline(){2==meshserver.State&&null!=powerTimelineNode&&null!=powerTimelineUpdate&&null!=currentNode&&powerTimelineNode==powerTimelineReq&&currentNode._id==powerTimelineNode&&powerTimelineUpdate<Date.now()&&(powerTimelineUpdate=null,meshserver.send({action:"powertimeline",nodeid:currentNode._id}))}function drawDeviceTimeline(){var e=null,t=Date.now();currentNode._id==powerTimelineNode&&(e=powerTimeline);var o=new Date;o.setHours(0,0,0,0);(o=new Date(o.getTime()-5184e5)).getTime();var n=[];if(null!=e&&1<e.length){n.push([0,e[1],e[0]]);for(var i=e[1],a=2;a<e.length;a+=2){var s=e[a],l=t;e.length>a+1&&(l=e[a+1]),n.push([i,i+l,s]),i+=l}}var r="",d=1,p=new Date,c=Q("masthead").offsetWidth-122;p.setHours(0,0,0,0);for(a=0;a<7;a++){var u="",m=p.getTime(),h=m+864e5;for(var f in n){var g=n[f];if(1==isTimeBlockInside(m,h,g[0],g[1])){var v=Math.max(m,g[0]),k=Math.min(Math.min(h,g[1]),t),y=Math.round((k-v)*c/864e5);0<y&&(u+="<div style=display:table-cell;width:"+y+"px;background-color:"+powerColor(g[2])+";height:16px></div>")}}r+="<tr style="+(d%2==0?"background-color:#DDD":"")+"><td><div>&nbsp;"+printDate(p)+"<div></div></div></td><td><div>"+u+"</div></td></tr>",++d,p=new Date(p.getTime()-864e5)}QH("p10html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse;width:calc(100% - 18px);margin:9px" border=0 cellpadding=2 cellspacing=0><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:90px>Day</th><th scope=col style=text-align:center>Power State</th></tr>'+r+"</tbody></table>")}function powerColor(e){return e<powerColorTable.length?powerColorTable[e]:"yellow"}function isTimeBlockInside(e,t,o,n){return o<e&&t<n||(e<o&&o<t||e<n&&n<t)}function addDeviceAttribute(e,t){return"<tr><td style=width:100px;color:gray>"+e+"</td><td style=overflow:hidden>"+t+"</td></tr>"}function editDeviceAmtSettings(e,t){if(!xxdialogMode){var o="",n=getNodeFromId(e),i=3;0!=(4&getNodeRights(e))&&(o+=addHtmlValue("Nom d'utilisateur",'<input id=dp10username style=width:170px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />'),o+=addHtmlValue("Mot de passe","<input id=dp10password type=password style=width:170px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />"),o+=addHtmlValue("Sécurité","<select id=dp10tls style=width:176px><option value=0>No TLS security</option><option value=1>Sécurité TLS requise</option></select>"),null!=n.intelamt.user&&""!=n.intelamt.user&&(i=7),setDialogMode(2,"Edit Intel&reg; AMT credentials",i,editDeviceAmtSettingsEx,o,{node:n,func:t}),null!=n.intelamt.user&&""!=n.intelamt.user?Q("dp10username").value=n.intelamt.user:Q("dp10username").value="admin",Q("dp10tls").value=n.intelamt.tls,validateDeviceAmtSettings())}}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(e,t){if(2==e)meshserver.send({action:"changedevice",nodeid:t.node._id,intelamt:{user:"",pass:""}});else{var o=Q("dp10username").value;""==o&&(o="admin");var n=Q("dp10password").value;""==n&&(o=""),meshserver.send({action:"changedevice",nodeid:t.node._id,intelamt:{user:o,pass:n,tls:Q("dp10tls").value}}),t.node.intelamt.user=o,t.node.intelamt.tls=Q("dp10tls").value,t.func&&setTimeout(t.func,300)}}function p10showDeleteNodeDialog(e){xxdialogMode||(setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,format("Delete {0}?",EscapeHtml(currentNode.name))+"<br /><br /><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm",e),p10validateDeleteNodeDialog())}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(e,t){meshserver.send({action:"removedevices",nodeids:[t]})}function p10showiconselector(){if(!xxdialogMode&&0!=(4&meshes[currentNode.meshid].links[userinfo._id].rights)){"<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>","<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>","<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div><br>","<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>","<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>","<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div></table>",setDialogMode(2,"Icon Selection",0,null,"<table align=center><td><div style=display:inline-block class=i1 onclick=p10setIcon(1)></div><div style=display:inline-block class=i2 onclick=p10setIcon(2)></div><div style=display:inline-block class=i3 onclick=p10setIcon(3)></div><br><div style=display:inline-block class=i4 onclick=p10setIcon(4)></div><div style=display:inline-block class=i5 onclick=p10setIcon(5)></div><div style=display:inline-block class=i6 onclick=p10setIcon(6)></div></table>"),QV("id_dialogclose",!0)}}function p10setIcon(e){setDialogMode(0),meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:e})}var desktop,desktopNode,showEditNodeValueDialog_modes=["Device Name","Hostname","Description","Tags"],showEditNodeValueDialog_modes2=["name","host","desc","tags"],showEditNodeValueDialog_modes3=["","","","Group1, Group2, Group3"];function showEditNodeValueDialog(e){if(!xxdialogMode){setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,addHtmlValue(showEditNodeValueDialog_modes[e],'<input id=dp10devicevalue style=width:170px maxlength=64 placeholder="'+showEditNodeValueDialog_modes3[e]+'" onchange=p10editdevicevalueValidate('+e+",event) onkeyup=p10editdevicevalueValidate("+e+",event) />"),e);var t=currentNode[showEditNodeValueDialog_modes2[e]];null==t&&(t=""),Array.isArray(t)&&(t=t.join(", ")),Q("dp10devicevalue").value=t,p10editdevicevalueValidate(),Q("dp10devicevalue").focus()}}function showEditNodeValueDialogEx(e,t){var o={action:"changedevice",nodeid:currentNode._id};o[showEditNodeValueDialog_modes2[t]]=Q("dp10devicevalue").value,meshserver.send(o)}function p10editdevicevalueValidate(e,t){var o=1<e||0<Q("dp10devicevalue").value.length;QE("idx_dlgOkButton",o),null!=t&&1==o&&13==t.keyCode&&dialogclose(1)}var desktopsettings={encoding:2,showfocus:!1,showmouse:!0,showcad:!0,quality:40,scaling:1024,framerate:50};function setupDesktop(){desktopNode!=currentNode&&null!=desktop&&(desktop.Stop(),desktop=desktopNode=null),desktopNode==currentNode&&null!=desktop||(QH("DeskParent",'<canvas id=Desk width=640 height=200 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>'),desktopNode=currentNode,Q("Desk").addEventListener("DOMMouseScroll",function(e){return dmousewheel(e)}),Q("Desk").addEventListener("mousewheel",function(e){return dmousewheel(e)})),desktopNode=currentNode,updateDesktopButtons(),Q("Desk").toBlob||QV("deskSaveBtn",!1)}function updateDesktopButtons(){var e=meshes[currentNode.meshid],t=0;null!=desktop&&(t=desktop.State);var o=e.links[userinfo._id].rights;QV("disconnectbutton1",0!=t),QV("connectbutton1",0==t&&2==e.mtype&&(8&o||256&o)),QV("connectbutton1h",0==t&&8&o&&(1==e.mtype||null!=currentNode.intelamt&&2==currentNode.intelamt.state&&null!=currentNode.intelamt.ver&&"number"==typeof currentNode.intelamt.sku&&0!=(8&currentNode.intelamt.sku))),QV("d7amtkvm",!(null==currentNode.intelamt||null==currentNode.intelamt.ver&&1!=e.mtype||0!=t&&2!=desktop.contype)),QV("d7meshkvm",2==e.mtype&&(0==t||1==desktop.contype));var n=0!=(1&currentNode.conn);QE("connectbutton1",n);var i=0!=(6&currentNode.conn);QE("connectbutton1h",i),QV("DeskToastButton",0!=(16384&o)&&currentNode.agent&&currentNode.agent.id<5&&8&o),QV("deskActionsBtn",8&o),Q("DeskControl").checked=0!=(8&o),0==n&&QV("DeskTools",!1)}function connectDesktop(e,t){if(setSessionActivity(),null==desktop)if(desktopNode=currentNode,2==t){if(null==desktopNode.intelamt.user||""==desktopNode.intelamt.user)return void editDeviceAmtSettings(desktopNode._id,connectDesktop);(desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"),authCookie)).debugmode=debugmode,desktop.onStateChanged=onDesktopStateChange,desktop.m.bpp=1==desktopsettings.encoding||3==desktopsettings.encoding?1:2,desktop.m.useZRLE=desktopsettings.encoding<3,desktop.m.showmouse=desktopsettings.showmouse,desktop.m.onScreenSizeChange=deskAdjust,desktop.Start(desktopNode._id,16994,"*","*",0),desktop.contype=2}else(desktop=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("Desk"),serverPublicNamePort,authCookie,authRelayCookie,domainUrl)).debugmode=debugmode,desktop.m.debugmode=debugmode,desktop.attemptWebRTC=attemptWebRTC,desktop.onStateChanged=onDesktopStateChange,desktop.m.CompressionLevel=desktopsettings.quality,desktop.m.ScalingLevel=desktopsettings.scaling,desktop.m.FrameRateTimer=desktopsettings.framerate,desktop.m.onDisplayinfo=deskDisplayInfo,desktop.m.onScreenSizeChange=deskAdjust,desktop.Start(desktopNode._id),desktop.contype=1;else desktop.Stop(),desktopNode=desktop=null}function onDesktopStateChange(e,t){var o=t;3==o&&2==e.contype&&o++;var n=StatusStrs[o];switch(null!=desktop&&1==desktop.webRtcActive&&(n+=", WebRTC"),QH("deskstatus",n),t){case 0:desktop.Stop(),desktopNode=desktop=null,QV("termdisplays",!1),1==fullscreen&&deskToggleFull()}updateDesktopButtons(),deskAdjust(),setTimeout(deskAdjust,50)}function showDesktopSettings(){xxdialogMode||(applyDesktopSettings(),updateDesktopButtons(),setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged))}function showDesktopSettingsChanged(){desktopsettings.encoding=d7desktopmode.value,desktopsettings.showfocus=d7showfocus.checked,desktopsettings.showmouse=d7showcursor.checked,desktopsettings.quality=d7bitmapquality.value,desktopsettings.scaling=d7bitmapscaling.value,desktopsettings.framerate=d7framelimiter.value,localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings)),applyDesktopSettings(),desktop&&(1==desktop.contype&&0!=desktop.State&&desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate),2==desktop.contype&&0!=desktop.State&&(desktop.Stop(),setTimeout(function(){connectDesktop(null,2)},50)))}function applyDesktopSettings(){var e="",t=512&features?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1];for(var o in t)e+="<option value="+t[o]+">"+t[o]+"%</option>";QH("d7bitmapquality",e),d7desktopmode.value=desktopsettings.encoding,d7showfocus.checked=desktopsettings.showfocus,d7showcursor.checked=desktopsettings.showmouse,d7bitmapquality.value=40,0<=t.indexOf(parseInt(desktopsettings.quality))&&(d7bitmapquality.value=desktopsettings.quality),d7bitmapscaling.value=desktopsettings.scaling,desktopsettings.framerate&&(d7framelimiter.value=desktopsettings.framerate)}var fullscreen=!1;function deskAdjust(){var e=(Q("DeskParent").clientHeight-Q("Desk").clientHeight)/2;if(e<0){var t=Q("DeskParent").clientHeight,o=9999;desktop&&(o=desktop.m.width/desktop.m.height*t),QS("Desk")["max-height"]=t+"px",QS("Desk")["max-width"]=o+"px",e=0}else QS("Desk")["max-height"]=null,QS("Desk")["max-width"]=null;QS("Desk")["margin-top"]=e+"px",QS("Desk")["margin-bottom"]=e+"px"}function deskSendKeys(){if(!xxdialogMode&&null!=desktop&&3==desktop.State){var e=Q("deskkeys").value;0==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[65364,1],[65364,0],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,91]]):1==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[65362,1],[65362,0],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,91]]):2==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[108,1],[108,0],[65511,0]]):desktop.sendCtrlMsg('{"action":"lock"}'):3==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[109,1],[109,0],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91]]):4==e?2==desktop.contype?desktop.m.sendkey([[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91],[desktop.m.KeyAction.UP,16]]):5==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.EXUP,91]]):6==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[114,1],[114,0],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,82],[desktop.m.KeyAction.UP,82],[desktop.m.KeyAction.EXUP,91]]):7==e?2==desktop.contype?desktop.m.sendkey([[65513,1],[65473,1],[65473,0],[65513,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,18],[desktop.m.KeyAction.DOWN,115],[desktop.m.KeyAction.UP,115],[desktop.m.KeyAction.EXUP,18]]):8==e?2==desktop.contype?desktop.m.sendkey([[65507,1],[119,1],[119,0],[65507,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,17],[desktop.m.KeyAction.DOWN,87],[desktop.m.KeyAction.UP,87],[desktop.m.KeyAction.EXUP,17]]):9==e?2==desktop.contype?desktop.m.sendkey([[65513,1],[65289,1],[65289,0],[65513,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,18],[desktop.m.KeyAction.DOWN,9],[desktop.m.KeyAction.UP,9],[desktop.m.KeyAction.EXUP,18]]):10==e?desktop.m.sendcad():11==e&&(2==desktop.contype?desktop.m.sendkey([[65289,1],[65289,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,9],[desktop.m.KeyAction.UP,9]]))}}function sendSpecialKeys(){xxdialogMode||null==desktop||3!=desktop.State||setDialogMode(3,"Special Keys",3,deskSendKeys)}function toggleSoftKeys(e){QV("DeskSoftInput",1==e),1==e&&Q("DeskSoftInput").focus()}function toggleDeskTools(){setSessionActivity(),xxdialogMode||("none"==QS("DeskTools").display?(QV("DeskTools",!0),Q("DeskTools").nodeid=currentNode._id,refreshDeskTools()):QV("DeskTools",!1))}function refreshDeskTools(){setSessionActivity(),QV("DeskToolsRefreshButton",!1),setTimeout(refreshDeskToolsEx,500),meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",!0)}var filesNode,deskTools={sort:1,msg:null};function sortProcess(e){deskTools.sort=e,showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(e,t){return e.p>t.p?1:e.p<t.p?-1:0}function sortProcessName(e,t){return e.d>t.d?1:e.d<t.d?-1:0}function showDeskToolsProcesses(e){if(null!=(deskTools.msg=e)){if(Q("DeskTools").nodeid==e.nodeid){var t=[],o=null;try{o=JSON.parse(e.value)}catch(e){}if(console.log(o),null!=o){for(var n in o)t.push({p:parseInt(n),c:o[n].cmd,d:o[n].cmd.toLowerCase(),u:o[n].user});0==deskTools.sort?t.sort(sortProcessPid):1==deskTools.sort&&t.sort(sortProcessName);var i="";for(var a in t)0!=t[a].p&&(i+="<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>"+t[a].p+"</div><a style=float:right;padding-right:5px;cursor:pointer onclick=stopProcess("+t[a].p+',"'+t[a].c+'")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>'+(t[a].u?t[a].u:"")+"</div><div>"+t[a].c+"</div></div>");QH("DeskToolsProcesses",i)}}}else QH("DeskToolsProcesses","")}function deskSaveImage(){if(setSessionActivity(),!xxdialogMode&&null!=desktop&&3==desktop.State){var e=new Date,t="Desktop-"+currentNode.name+"-"+e.getFullYear()+"-"+("0"+(e.getMonth()+1)).slice(-2)+"-"+("0"+e.getDate()).slice(-2)+"-"+("0"+e.getHours()).slice(-2)+"-"+("0"+e.getMinutes()).slice(-2);Q("Desk").toBlob(function(e){saveAs(e,t+".jpg")})}}function deskDisplayInfo(e,t,o,n){var i=Q("termdisplays").value;if(0<t.length){var a="";for(var s in t)a+="<option"+(i==t[s]?" selected":"")+">"+t[s]+"</option>";QH("termdisplays",a)}QV("termdisplays",0<t.length)}function deskGetDisplayNumbers(e){desktop.m.GetDisplayNumbers()}function deskSetDisplay(e){setSessionActivity();var t=0,o=Q("termdisplays").value;t="All Displays"==o?65535:parseInt(o.substring(8)),desktop.m.SetDisplay(t)}function dmousedown(e){setSessionActivity(),xxdialogMode||null==desktop||desktop.m.mousedown(e)}function dmouseup(e){setSessionActivity(),xxdialogMode||null==desktop||desktop.m.mouseup(e)}function dmousemove(e){setSessionActivity(),xxdialogMode||null==desktop||desktop.m.mousemove(e)}function dmousewheel(e){return setSessionActivity(),!(xxdialogMode||null==desktop||!desktop.m.mousewheel)&&(desktop.m.mousewheel(e),haltEvent(e),!0)}function drotate(e){xxdialogMode||null==desktop||(desktop.m.setRotation(desktop.m.rotation+e),deskAdjust(),deskAdjust())}function stopProcess(e,t){return setDialogMode(2,"Process Control",3,stopProcessEx,format('Stop process #{0} "{1}"?',e,t),e),!1}function stopProcessEx(e,t){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:t}),setTimeout(refreshDeskTools,300)}function setupFiles(){var e=filesNode==currentNode,t=0!=(1&(filesNode=currentNode).conn);QE("p13Connect",t),0!=e&&0!=t||!files||(files.Stop(),files=null)}function onFilesStateChange(e,t){setSessionActivity(),p13Connect.value=0==t?"Connect":"Disconnect";var o=StatusStrs[t];switch(1==files.webRtcActive&&(o+=", WebRTC"),Q("p13Status").textContent=o,t){case 0:QH("p13files",""),p13filetree=null,p13filetreelocation=[],QH("p13currentpath",""),QE("p13FolderUp",!1),p13setActions(),null!=files&&(files.Stop(),files=null);break;case 3:p13targetpath="",files.sendText({action:"ls",reqid:1,path:""})}}function CreateRemoteFiles(e){var t={protocol:5};return t.onFileUpdate=e,t.xxStateChange=function(e){},t.ProcessData=function(e){t.onFileUpdate(e)},t}var autoConnectFilesTimer=null;function autoConnectFiles(e){autoConnectFilesTimer=null==autoConnectFilesTimer?setInterval(connectFiles,100):(clearInterval(autoConnectFilesTimer),null)}function connectFiles(e){files?(files.Stop(),files=null):((files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort,authCookie,authRelayCookie,domainUrl)).attemptWebRTC=attemptWebRTC,files.onStateChanged=onFilesStateChange,files.Start(filesNode._id)),p13clipboard=p13clipboardFolder=null,p13clipboardCut=0,p13updateClipview()}var p13sortorder,p13filetree=null,p13targetpath=null,p13filetreelocation=[];function p13gotFiles(e){if(setSessionActivity(),0<e.length&&123!=e.charCodeAt(0))p13gotDownloadBinaryData(e);else if("download"!=(e=JSON.parse(decode_utf8(e))).action)if(e.path=e.path.replace(/\//g,"\\"),null!=p13filetree&&e.path==p13filetree.path){var t=p13getCheckedNames();p13filetree=e,p13updateFiles(t)}else{for(var o=e.path.replace(/\//g,"\\"),n=p13targetpath.replace(/\//g,"\\");0<o.length&&"\\"==o[0];)o=o.substring(1);for(;0<n.length&&"\\"==n[0];)n=n.substring(1);(o==n||"\\"==e.path&&""==p13targetpath)&&(p13filetree=e,p13updateFiles())}else p13gotDownloadCommand(e)}function p13getCheckedNames(){for(var e=[],t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked&&e.push(p13filetree.dir[t[o].value].n);return e}function p13updateFiles(e){var t="",o="",n="<a style=cursor:pointer onclick=p13folderup(0)>Root</a>",i=p13filetree.path.split("\\");for(var a in p13filetreelocation=[],i)""!=i[a]&&p13filetreelocation.push(i[a]);for(var a in p13filetreelocation)n+=" / <a style=cursor:pointer onclick=p13folderup("+(parseInt(a)+1)+")>"+p13filetreelocation[a]+"</a>";var s=p13filetreelocation.join("/"),l=p13sort_files(p13filetree.dir);for(var a in l){var r,d=l[a],p=d.n;r=70<(r=p).length?EscapeHtml(p.substring(0,70))+"...":EscapeHtml(p),p=EscapeHtml(p);var c="";null!=d.s&&(c=getFileSizeStr(d.s));var u="";if(d.t<3){u="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span style=float:right></span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p13folderset("'+encodeURIComponent(d.nx)+'")>'+r+"</a></span></div>"}else{var m=r;0<d.s&&(m='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick="p13downloadfile(\''+encodeURIComponent(s+"/"+p)+"','"+encodeURIComponent(p)+"',"+d.s+')">'+r+"</a>"),u="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span style=float:right;padding-right:4px>"+c+"</span><span><div class=fileIcon"+d.t+"></div>"+m+"</span></div>"}d.t<3?t+=u:o+=u}if(QH("p13files",t+o),QH("p13currentpath",n),QE("p13FolderUp",0!=p13filetreelocation.length),null!=e){var h=document.getElementsByName("fd");for(a=0;a<h.length;a++)0<=e.indexOf(p13filetree.dir[h[a].value].n)&&(h[a].checked=!0)}p13setActions()}function p13folderset(e){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[e].n).split("\\").join("/"),files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(e){if(null==e)p13filetreelocation.pop();else for(;p13filetreelocation.length>e;)p13filetreelocation.pop();p13targetpath=p13filetreelocation.join("/"),files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13sort_filename(e,t){return e.ln>t.ln?1*p13sortorder:e.ln<t.ln?-1*p13sortorder:0}function p13sort_timestamp(e,t){return e.d>t.d?1*p13sortorder:e.d<t.d?-1*p13sortorder:0}function p13sort_bysize(e,t){return e.s==t.s?p13sort_filename(e,t):(e.s-t.s)*p13sortorder}function p13sort_files(e){var t=[],o=Q("p13sortdropdown").value;for(var n in e)e[n].nx=n,null==e[n].s&&(e[n].s=0),null==e[n].n&&(e[n].n=n),e[n].ln=e[n].n.toLowerCase(),t.push(e[n]);return p13sortorder=1,3<o&&(p13sortorder=-1,o-=3),1==o?t.sort(p13sort_filename):2==o?t.sort(p13sort_bysize):3==o&&t.sort(p13sort_timestamp),t}function p13setActions(){if(null==p13filetree)QE("p13DeleteFileButton",!1),QE("p13NewFolderButton",!1),QE("p13UploadButton",!1),QE("p13RenameFileButton",!1),QE("p13SelectAllButton",!1),Q("p13SelectAllButton").value="Tout",QE("p13RefreshButton",!1),QE("p13CutButton",!1),QE("p13CopyButton",!1),QE("p13PasteButton",!1);else{var e=p13getFileSelCount(),t=p13getFileCount(),o=p13getFileSelCount(!1),n=0<currentNode.agent.id&&currentNode.agent.id<5;QE("p13DeleteFileButton",0<e&&(0<p13filetreelocation.length||0==n)),QE("p13NewFolderButton",0<p13filetreelocation.length||0==n),QE("p13UploadButton",0<p13filetreelocation.length||0==n),QE("p13RenameFileButton",1==e&&(0<p13filetreelocation.length||0==n)),QE("p13SelectAllButton",0<t),Q("p13SelectAllButton").value=0<e?"None":"Tout",QE("p13RefreshButton",!0),QE("p13CutButton",0<e&&e==o&&(0<p13filetreelocation.length||0==n)),QE("p13CopyButton",0<e&&e==o&&(0<p13filetreelocation.length||0==n)),QE("p13PasteButton",(0<p13filetreelocation.length||0==n)&&null!=p13clipboard&&0<p13clipboard.length)}}function p13getFileSelCount(e){for(var t=0,o=document.getElementsByName("fd"),n=0;n<o.length;n++)!o[n].checked||0==e&&"3"!=o[n].attributes.file.value||t++;return t}function p13getFileSelDirCount(){for(var e=0,t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked&&"999"==t[o].attributes.file.value&&e++;return e}function p13getFileCount(){return document.getElementsByName("fd").length}function p13selectallfile(){for(var e=0==p13getFileSelCount(),t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked=e;p13setActions()}function p13createfolder(){setDialogMode(2,"Nouveau Dossier",3,p13createfolderEx,"<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />"),focusTextBox("p13renameinput"),p13fileNameCheck()}function p13createfolderEx(){files.sendText({action:"mkdir",reqid:1,path:p13filetreelocation.join("/")+"/"+Q("p13renameinput").value}),p13folderup(999)}function p13deletefile(){var e=p13getFileSelCount(),t=0<p13getFileSelDirCount()?"<br /><br /><label><input type=checkbox id=p13recdeleteinput>Recursive delete</label><br>":"<input type=checkbox id=p13recdeleteinput style='display:none'>";setDialogMode(2,"Delete",3,p13deletefileEx,1<e?format("Delete {0} selected items?",e)+t:"Delete selected item?"+t)}function p13deletefileEx(){for(var e=[],t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked&&e.push(p13filetree.dir[t[o].value].n);files.sendText({action:"rm",reqid:1,path:p13filetreelocation.join("/"),delfiles:e,rec:Q("p13recdeleteinput").checked}),p13folderup(999)}function p13renamefile(){for(var e,t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked&&(e=p13filetree.dir[t[o].value].n);setDialogMode(2,"Renommer",3,p13renamefileEx,'<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="'+e+'" />',{action:"rename",path:p13filetreelocation.join("/"),oldname:e}),focusTextBox("p13renameinput"),p13fileNameCheck()}function p13renamefileEx(e,t){t.newname=Q("p13renameinput").value,files.sendText(t),p13folderup(999)}function p13fileNameCheck(e){var t=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",t),1==t&&null!=e&&13==e.keyCode&&dialogclose(1)}function p13uploadFile(){setDialogMode(2,"Upload File",3,p13uploadFileEx,"<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p13uploadinput')\" />"),updateUploadDialogOk("p13uploadinput")}function p13uploadFileEx(){p13doUploadFiles(Q("p13uploadinput").files)}function p13viewfile(){for(var e=document.getElementsByName("fd"),t=0;t<e.length;t++)if(e[t].checked){p13filetree.dir[e[t].value].s<=204800?p13downloadfile(encodeURIComponent(p13filetreelocation.join("/")+"/"+p13filetree.dir[e[t].value].n),encodeURIComponent(p13filetree.dir[e[t].value].n),p13filetree.dir[e[t].value].s,"viewer"):messagebox("File Editor","Only files less than 200k can be edited.");break}}var downloadFile,uploadFile,currentMesh,p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(e){var t=document.getElementsByName("fd");p13clipboard=[],p13clipboardCut=e,p13clipboardFolder=p13targetpath;for(var o=0;o<t.length;o++)t[o].checked&&"3"==t[o].attributes.file.value&&p13clipboard.push(p13filetree.dir[t[o].value].n);p13updateClipview()}function p13pasteFile(){var e="";null!=p13clipboard&&0<p13clipboard.length&&(e=0==p13clipboardCut?1<p13clipboard.length?format("Confirm copy of {0} entries's to this location?",p13clipboard.length):format("Confirm copy of 1 entrie to this location?"):1<p13clipboard.length?format("Confirm move of {0} entries's to this location?",p13clipboard.length):format("Confirm move of 1 entrie to this location?")),setDialogMode(2,"Paste",3,p13pasteFileEx,e)}function p13pasteFileEx(){files.sendText({action:0==p13clipboardCut?"copy":"move",reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard}),p13folderup(999),1==p13clipboardCut&&(p13clipboardFolder=p13clipboard=null,p13clipboardCut=0,p13updateClipview())}function p13updateClipview(){var e="";null!=p13clipboard&&0<p13clipboard.length&&(e=0==p13clipboardCut?1<p13clipboard.length?format('Holding {0} entries for copy, <a href=# onclick="return p13clearClip()" style=cursor:pointer>Clear</a>.',p13clipboard.length):format('Holding 1 entrie for copy, <a href=# onclick="return p13clearClip()" style=cursor:pointer>Clear</a>.'):1<p13clipboard.length?format('Holding {0} entries for move, <a href=# onclick="return p13clearClip()" style=cursor:pointer>Clear</a>.',p13clipboard.length):format('Holding 1 entrie for move, <a href=# onclick="return p13clearClip()" style=cursor:pointer>Clear</a>.')),QH("p13bottomstatus",e),p13setActions()}function p13clearClip(){return p13clipboardFolder=p13clipboard=null,p13clipboardCut=0,p13updateClipview(),!1}function updateUploadDialogOk(e){QE("idx_dlgOkButton",""!=Q(e).value)}function getFileSelCount(e){for(var t=0,o=document.getElementsByName("fc"),n=0;n<o.length;n++)!o[n].checked||0==e&&"3"!=o[n].attributes.file.value||t++;return t}function getFileCount(){return document.getElementsByName("fc").length}function p13downloadfile(e,t,o){xxdialogMode||downloadFile||!files||(downloadFile={path:decodeURIComponent(e),file:decodeURIComponent(t),size:o,tsize:0,data:"",state:0,id:Math.random()},files.sendText({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path}),setDialogMode(2,"Download File",10,p13downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+o+" />"))}function p13downloadFileCancel(){setDialogMode(0),files.sendText({action:"download",sub:"cancel",id:downloadFile.id}),downloadFile=null}function p13gotDownloadCommand(e){null!=downloadFile&&e.id==downloadFile.id&&("start"==e.sub?(downloadFile.state=1,files.sendText({action:"download",sub:"startack",id:downloadFile.id})):"cancel"==e.sub&&(downloadFile=null,setDialogMode(0)))}function p13gotDownloadBinaryData(e){downloadFile&&0!=downloadFile.state&&(4<e.length&&(downloadFile.tsize+=e.length-4,downloadFile.data+=e.substring(4),Q("d2progressBar").value=downloadFile.tsize),0!=(1&ReadInt(e,0))?(saveAs(data2blob(downloadFile.data),downloadFile.file),downloadFile=null,setDialogMode(0)):files.sendText({action:"download",sub:"ack",id:downloadFile.id}))}function p13doUploadFiles(e){xxdialogMode||((uploadFile={}).xpath=p13filetreelocation.join("/"),uploadFile.xfiles=e,uploadFile.xfilePtr=-1,setDialogMode(2,"Upload File",10,p13uploadFileCancel,"<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />"),p13uploadReconnect())}function onFileUploadStateChange(e,t){switch(t){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break;default:console.log("Unknown onFileUploadStateChange state",t)}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort,authCookie,authRelayCookie,domainUrl),uploadFile.ws.attemptWebRTC=!1,uploadFile.ws.ctrlMsgAllowed=!1,uploadFile.ws.onStateChanged=onFileUploadStateChange,uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){if(uploadFile.xfilePtr++,uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var e=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",e.name),Q("d2progressBar").max=e.size,Q("d2progressBar").value=0,uploadFile.xreader=new FileReader,uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result,uploadFile.ws.sendText({action:"upload",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:e.name,size:uploadFile.xdata.byteLength})},uploadFile.xreader.readAsArrayBuffer(e)}else p13uploadFileCancel()}function p13uploadFileCancel(e,t){null!=uploadFile&&(null!=uploadFile.ws&&(uploadFile.ws.Stop(),uploadFile.ws=null),uploadFile=null),setDialogMode(0)}function p13gotUploadData(e){var t=JSON.parse(e);if(null!=uploadFile&&parseInt(uploadFile.xfilePtr)==parseInt(t.reqid))if("uploadstart"==t.action){p13uploadNextPart(!1);for(var o=0;o<8;o++)p13uploadNextPart(!0)}else"uploadack"==t.action?p13uploadNextPart(!1):"uploaderror"==t.action&&p13uploadFileCancel()}function p13uploadNextPart(e){var t=uploadFile.xdata,o=uploadFile.xptr,n=uploadFile.xptr+4096;if(n>t.byteLength){if(1==e)return;n=t.byteLength}if(o==t.byteLength)null!=uploadFile.ws&&(uploadFile.ws.Stop(),uploadFile.ws=null),uploadFile.xfiles.length>uploadFile.xfilePtr+1?p13uploadReconnect():p13uploadFileCancel();else{var i=t.slice(o,n);uploadFile.ws.send(i),uploadFile.xptr=n,Q("d2progressBar").value=n}}function p20updateMesh(){if(null!=currentMesh){QH("p20meshName",EscapeHtml(currentMesh.name));var e=format(" #{0} Inconnue",currentMesh.mtype),t=currentMesh.links[userinfo._id].rights;1==currentMesh.mtype&&(e="Intel&reg; AMT only, no agent"),2==currentMesh.mtype&&(e="Géré à l'aide d'un agent logiciel");var o="";o+=addHtmlValue("Nom",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",0!=(1&t))),o+=addHtmlValue("Description",addLinkConditional(currentMesh.desc&&""!=currentMesh.desc?EscapeHtml(currentMesh.desc):"<i>None</i>","p20editmesh(2)",0!=(1&t))),o+=addHtmlValue("Type",e),o+="<br style=clear:both><br>";var n=currentMesh.links[userinfo._id];n&&0!=(2&n.rights)&&(o+="<div style=margin-bottom:6px><a onclick=p20showAddMeshUserDialog() style=cursor:pointer><img src=images/icon-addnew.png border=0 height=12 width=12>Ajouter un utilisateur</a></div>"),o+='<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>User Authorizations</th></tr>';var i=1,a=[];for(var s in currentMesh.links)a.push({id:s,name:s.split("/")[2],rights:currentMesh.links[s].rights});for(var s in a.sort(function(e,t){return e.name>t.name?1:e.name<t.name?-1:0}),a){var l="",r="Partial Rights",d=a[s].rights;4294967295==d?r="Full Administrator":0==d&&(r="No Rights"),s==userinfo._id||4294967295!=t&&0==(2&t)||(l='<a onclick=p20deleteUser(event,"'+encodeURIComponent(a[s].id)+'") style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'),o+='<tr onclick=p20viewuser("'+encodeURIComponent(a[s].id)+'") style=height:32px;cursor:pointer'+(i%2==0?";background-color:#DDD":"")+"><td>",o+="<div style=float:right>"+l+"</div><div style=float:right;padding-right:4px>"+r+"</div><div class=m2></div><div>&nbsp;"+EscapeHtml(decodeURIComponent(a[s].name))+"<div></div></div>",o+="</td></tr>",++i}o+="</tbody></table>",4294967295==t&&(o+="<div style=font-size:small;text-align:right;margin-top:6px><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Group</a></span></div>"),QH("p20info",o)}}function p20showDeleteMeshDialog(){if(xxdialogMode)return!1;var e=format("Êtes-vous sûr de vouloir supprimer le groupe {0}? La suppression du groupe de périphériques supprimera également toutes les informations relatives aux périphériques de ce groupe.",EscapeHtml(currentMesh.name))+"<br /><br />";return setDialogMode(2,"Delete Group",3,p20showDeleteMeshDialogEx,e+="<label><input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm</label>"),p20validateDeleteMeshDialog(),!1}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(e,t){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(e){if(!xxdialogMode){var t=addHtmlValue("Nom","<input id=dp20meshname style=width:170px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />");setDialogMode(2,"Edit Device Group",3,p20editmeshEx,t+=addHtmlValue("Description","<input id=dp20meshdesc style=width:170px maxlength=1024 onkeyup=p20editmeshValidate() />")),Q("dp20meshname").value=currentMesh.name,currentMesh.desc&&(Q("dp20meshdesc").value=currentMesh.desc),p20editmeshValidate(),2==e?Q("dp20meshdesc").focus():Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",0<Q("dp20meshname").value.length)}function p20showAddMeshUserDialog(){if(!xxdialogMode){var e=addHtmlValue("User","<input id=dp20username style=width:170px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />");e+='<div style="border:2px groove gray;background-color:white;max-height:120px;overflow-y:scroll">',e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Device Group</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Device Group Users</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Device Group Computers</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remoteview style=margin-left:12px>Remote View Only</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotelimitedinput style=margin-left:12px>Limited Input Only</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20noterminal style=margin-left:12px>No Terminal Access</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20nofiles style=margin-left:12px>Pas d'accès au fichier</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20noamt style=margin-left:12px>No Intel&reg; AMT</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Mesh Agent Console</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20limitevents>Show Only Own Events</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20chatnotify>Chat & Notify</label><br>",setDialogMode(2,"Ajouter un utilisateur au groupe",3,p20showAddMeshUserDialogEx,e+="</div>"),p20validateAddMeshUserDialog(),Q("dp20username").focus()}}function p20validateAddMeshUserDialog(){var e=currentMesh.links[userinfo._id].rights;QE("idx_dlgOkButton",0<Q("dp20username").value.length),QE("p20fulladmin",4294967295==e),QE("p20editmesh",!Q("p20fulladmin").checked&&4294967295==e),QE("p20manageusers",!Q("p20fulladmin").checked),QE("p20managecomputers",!Q("p20fulladmin").checked),QE("p20remotecontrol",!Q("p20fulladmin").checked),QE("p20meshagentconsole",!Q("p20fulladmin").checked),QE("p20meshserverfiles",!Q("p20fulladmin").checked),QE("p20wakedevices",!Q("p20fulladmin").checked),QE("p20editnotes",!Q("p20fulladmin").checked),QE("p20remoteview",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked),QE("p20noterminal",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked),QE("p20nofiles",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked),QE("p20noamt",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked)}function p20showAddMeshUserDialogEx(){var e=0;1==Q("p20fulladmin").checked?e=4294967295:(1==Q("p20editmesh").checked&&(e+=1),1==Q("p20manageusers").checked&&(e+=2),1==Q("p20managecomputers").checked&&(e+=4),1==Q("p20remotecontrol").checked&&(e+=8),1==Q("p20meshagentconsole").checked&&(e+=16),1==Q("p20meshserverfiles").checked&&(e+=32),1==Q("p20wakedevices").checked&&(e+=64),1==Q("p20editnotes").checked&&(e+=128),1==Q("p20remoteview").checked&&(e+=256),1==Q("p20noterminal").checked&&(e+=512),1==Q("p20nofiles").checked&&(e+=1024),1==Q("p20noamt").checked&&(e+=2048)),meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,username:Q("dp20username").value,meshadmin:e})}function p20viewuser(e){if(!xxdialogMode){e=decodeURIComponent(e);var t=[],o=currentMesh.links[userinfo._id].rights,n=currentMesh.links[e].rights;4294967295==n?t.push("Full Administrator"):(0!=(1&n)&&t.push("Edit Device Group"),0!=(2&n)&&t.push("Manage Device Group Users"),0!=(4&n)&&t.push("Manage Device Group Computers"),0!=(8&n)&&t.push("Remote Control"),0!=(16&n)&&t.push("Agent Console"),0!=(32&n)&&t.push("Server Files"),0!=(64&n)&&t.push("Wake Devices"),0!=(128&n)&&t.push("Edit Notes"),0!=(256&n)&&t.push("Remote View Only"),0!=(512&n)&&t.push("No Terminal"),0!=(1024&n)&&t.push("Aucun fichier"),0!=(2048&n)&&t.push("No Intel&reg; AMT"),0!=(8&n)&&0!=(4096&n)&&0==(256&n)&&t.push("Limited Input"),0!=(8192&n)&&t.push("Self Events Only"),0!=(16384&n)&&t.push("Chat & Notify")),0==t.length&&t.push("No Rights");var i=1,a=addHtmlValue("User",EscapeHtml(decodeURIComponent(e.split("/")[2])));a+=addHtmlValue("Permissions",t.join(", ")),userinfo._id!=e&&(4294967295==o||0!=(2&o)&&4294967295!=n)&&(i+=4),setDialogMode(2,"Device Group User",i,p20viewuserEx,a,e)}}function p20viewuserEx(e,t){2==e&&setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,format("Confirm removal of user {0}?",t.split("/")[2]),t)}function p20deleteUser(e,t){haltEvent(e),p20viewuserEx(2,decodeURIComponent(t))}function p20viewuserEx2(e,t){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:t})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,xxcurrentView=-1;function go(e){if(setSessionActivity(),!xxdialogMode&&xxcurrentView!=e){updateFooterMenu(),setDialogMode(0);for(var t=0;t<32;t++)QV("p"+t,t==e);xxcurrentView=e}}function setDialogMode(e,t,o,n,i,a){setSessionActivity(),xxdialogMode=e,xxdialogFunc=n,xxdialogButtons=o,xxdialogTag=a,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&o),QV("idx_dlgCancelButton",2&o),QV("id_dialogclose",2&o||8&o),QV("idx_dlgButtonBar",7&o),t&&QH("id_dialogtitle",t);for(var s=1;s<24;s++)QV("dialog"+s,s==e);QV("dialog",e),i&&(2==e?QH("id_dialogOptions",i):QH("id_dialogMessage",i))}function dialogclose(e){setSessionActivity();var t=xxdialogFunc,o=xxdialogButtons,n=xxdialogTag;setDialogMode(),(8&o||e)&&t&&t(e,n)}function putstore(e,t){try{if("undefined"==typeof localStorage||localStorage.getItem(e)==t)return;null==t?localStorage.removeItem(e):localStorage.setItem(e,t)}catch(e){}if("_"!=e[0]){for(var o={},n=0,i=localStorage.length;n<i;++n){var a=localStorage.key(n);"_"!=a[0]&&(o[a]=localStorage.getItem(a))}meshserver.send({action:"userWebState",state:JSON.stringify(o)})}}function getstore(e,t){try{if("undefined"==typeof localStorage)return t;var o=localStorage.getItem(e);return null==o||null==o?t:o}catch(e){return t}}function center(){QS("dialog").left=(getDocWidth()-300)/2+"px",deskAdjust(),deskAdjust()}function messagebox(e,t){QH("id_dialogMessage",t),setDialogMode(1,e,1)}function statusbox(e,t){QH("id_dialogMessage",t),setDialogMode(1,e)}function getDocWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement.clientWidth:document.getElementsByTagName("body")[0].clientWidth}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function haltReturn(e){13==e.keyCode&&haltEvent(e)}function validateEmail(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}function reload(){window.location.href=window.location.href}function getNodeFromId(e){for(var t in nodes)if(nodes[t]._id==e)return nodes[t];return null}function addHtmlValue(e,t){return"<table><td style=width:120px>"+e+"<td><b>"+t+"</b></table>"}function addHtmlValue2(e,t){return"<div><div style=display:inline-block;float:right>"+t+"</div><div style=display:inline-block>"+e+"</div></div>"}function addLink(e,t){return"<a style=cursor:pointer;color:darkblue;text-decoration:none onclick='"+t+"'>&diams; "+e+"</a>"}function addLinkConditional(e,t,o){return o?addLink(e,t):e}function passwordcheck(e){return/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/.test(e)}function getFileSizeStr(e){return 1==e?"1 octet":format("{0} bytes",e)}function joinPaths(){var e=[];for(var t in arguments){var o=arguments[t];if(null!=o&&""!=o){for(;o.endsWith("/")||o.endsWith("\\");)o=o.substring(0,o.length-1);for(;o.startsWith("/")||o.startsWith("\\");)o=o.substring(1);e.push(o)}}return e.join("/")}function focusTextBox(e){setTimeout(function(){Q(e).selectionStart=Q(e).selectionEnd=65535,Q(e).focus()},0)}isFilenameValid=function(){var t=/^[^\\/:\*\?"<>\|]+$/,o=/^\./,n=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function(e){return t.test(e)&&!o.test(e)&&!n.test(e)&&"."!=e[0]}}();function parseUriArgs(){var e,t={},o=window.document.location.href.split(/[\?&|\=]/);for(n in o.splice(0,1),o)switch(n%2){case 0:e=decodeURIComponent(o[n]);break;case 1:t[e]=decodeURIComponent(o[n]);var n=parseInt(t[e]);n==t[e]&&(t[e]=n)}return t}function printDate(e){return e.toLocaleDateString(args.locale)}function printTime(e){return e.toLocaleTimeString(args.locale)}function printDateTime(e){return e.toLocaleString(args.locale)}function format(e){var o=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,t){return void 0!==o[t]?o[t]:e})}function nobreak(e){return e.split(" ").join("&nbsp;")}</script>
\ No newline at end of file
views/translations/default-mobile_fr.handlebars
+3 -3
@@ -566,9 +566,9 @@
566 </div>
567 <div style="height:60px">
568 <div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white">
569 - <label><input type="checkbox" id="d7showfocus">Show Focus Tool<br></label>
570 - <label><input type="checkbox" id="d7showcursor">Show Local Mouse Cursor<br< label="">&gt;
571 - </br<></label></div>
569 + <label><input type="checkbox" id="d7showfocus">Show Focus Tool</label><br>
570 + <label><input type="checkbox" id="d7showcursor">Show Local Mouse Cursor</label><br>
571 + </div>
572 <div>Autre</div>
573 </div>
574 </div>
views/translations/download-min_fr.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=/styles/style.css media=screen rel=stylesheet title=CSS><title>MeshCentral - Download</title><div id=container style=max-height:100vh><div id=mastheadx></div><div id=masthead style="background:url(logo.png) 0 0;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px><strong><font style=font-size:46px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px><strong><font style=font-size:14px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div></div><div id=page_content style=max-height:calc(100vh-138px)><div id=column_l><h1>Download</h1><p style=margin-left:20px>{{{message}}}</p><br></div><div id=footer><table cellpadding=0 cellspacing=10 style=width:100%><tr><td style=text-align:left><td style=text-align:right>{{{rootCertLink}}} &nbsp;<a href=terms>Terms &amp; Privacy</a></table></div></div></div>
\ No newline at end of file
views/translations/error404-min_fr.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><title>MeshCentral - Terms of use</title><body id=body onload='"undefined"!=typeof startup&&startup()'style=display:none;overflow:hidden><div id=container><div id=masthead class=noselect style="background:url(logo.png) 0 0;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px><strong><font style=font-size:46px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px><strong><font style=font-size:14px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div><p id=logoutControl style="color:#fff;font-size:11px;margin:10px 10px 0">{{{logoutControl}}}</div><div id=page_leftbar><div style=height:16px></div></div><div id=topbar class="noselect style3"style=height:24px;position:relative><div id=uiMenuButton title="User interface selection"onclick=showUserInterfaceSelectMenu()>♦<div id=uiMenu style=display:none><div id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"><div class=uiSelector1></div></div><div id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"><div class=uiSelector2></div></div><div id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"><div class=uiSelector3></div></div><div id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Basculer mode nuit"><div class=uiSelector4></div></div></div></div></div><div id=column_l style="max-height:calc(100vh - 135px);overflow-y:auto"><div style=text-align:center;padding-top:30px;font-size:200px;font-family:Arial;color:#bbb><b>404</b></div><div style=text-align:center;font-size:20px;font-family:Arial;color:#999>This page does not exist</div><div style=text-align:center;padding-top:20px;font-size:20px;font-family:Arial;color:#999><a href=/ style=text-decoration:none><b>Go to main site</b></a></div></div><div id=footer><table cellpadding=0 cellspacing=10 style=width:100%><tr><td style=text-align:left><td style=text-align:right><a href=/ >Retour</a></table></div></div><script>"use strict";var uiMode=parseInt(getstore("uiMode",1)),webPageStackMenu=!1,webPageFullScreen=!0,nightMode="1"==getstore("_nightMode","0"),terms="{{{terms}}}";function showUserInterfaceSelectMenu(){Q("uiViewButton1").classList.remove("uiSelectorSel"),Q("uiViewButton2").classList.remove("uiSelectorSel"),Q("uiViewButton3").classList.remove("uiSelectorSel"),Q("uiViewButton4").classList.remove("uiSelectorSel");try{Q("uiViewButton"+uiMode).classList.add("uiSelectorSel")}catch(e){}QV("uiMenu","none"==QS("uiMenu").display),nightMode&&Q("uiViewButton4").classList.add("uiSelectorSel")}function userInterfaceSelectMenu(e){e&&putstore("uiMode",uiMode=e),webPageFullScreen=uiMode<3,webPageStackMenu=!0,toggleFullScreen(0),toggleStackMenu(0),QC("column_l").add("room4submenu")}function toggleNightMode(){(nightMode=!nightMode)?QC("body").add("night"):QC("body").remove("night"),putstore("_nightMode",nightMode?"1":"0")}function toggleFullScreen(e){1===e&&putstore("webPageFullScreen",webPageFullScreen=!webPageFullScreen);0==webPageFullScreen?(QC("body").remove("menu_stack"),QC("body").remove("fullscreen"),QC("body").remove("arg_hide")):QC("body").add("fullscreen"),QV("body",!0)}function toggleStackMenu(e){1==webPageFullScreen&&(1===e&&putstore("webPageStackMenu",webPageStackMenu=!webPageStackMenu),0==webPageStackMenu?QC("body").remove("menu_stack"):QC("body").add("menu_stack"))}function putstore(e,t){try{if("undefined"==typeof localStorage)return;localStorage.setItem(e,t)}catch(e){}}function getstore(e,t){try{if("undefined"==typeof localStorage)return t;var o=localStorage.getItem(e);return null==o||null==o?t:o}catch(e){return t}}""!=terms&&QH("column_l",decodeURIComponent(terms)),QV("column_l",!0),userInterfaceSelectMenu()</script>
\ No newline at end of file
views/translations/error404-mobile-min_fr.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><title>MeshCentral - Terms of use</title><style type=text/css>a{color:#036;text-decoration:underline}#footer a{color:#fff;text-decoration:underline}#footer a:hover{color:#fff;text-decoration:none}</style><body onload='"undefined"!=typeof startup&&startup()'style="overflow-y:hidden;max-width:100%;margin:0;padding:0;border:0;color:#000;font-size:13px;font-family:\'Trebuchet MS\',Arial,Helvetica,sans-serif"><div id=container><div id=masthead style="background:url(logo.png) 0 0;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:4px><strong><font style=font-size:36px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:7px><strong><font style=font-size:12px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div><p>{{{logoutControl}}}</div><div id=page_content style=overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%><div id=column_l style=padding-left:10px;padding-right:10px><div style=text-align:center;padding-top:30px;font-size:100px;font-family:Arial;color:#bbb><b>404</b></div><div style=text-align:center;font-size:16px;font-family:Arial;color:#999>This page does not exist</div><div style=text-align:center;padding-top:16px;font-size:20px;font-family:Arial;color:#999><a href=/ style=text-decoration:none><b>Go to main site</b></a></div></div></div><div id=footer style=height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0><table cellpadding=0 cellspacing=6 style=width:100%><tr><td style=text-align:left;color:#fff>{{{footer}}}<td style=text-align:right>{{{rootCertLink}}}&nbsp;<a href=/ >Retour</a></table></div></div>
\ No newline at end of file
views/translations/error404-mobile_fr.handlebars new
+55
@@ -0,0 +1,55 @@
1 +<!DOCTYPE html><html><head>
2 + <meta http-equiv="X-UA-Compatible" content="IE=edge">
3 + <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
4 + <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
5 + <meta name="apple-mobile-web-app-capable" content="yes">
6 + <meta name="format-detection" content="telephone=no">
7 + <title>MeshCentral - Terms of use</title>
8 + <style type="text/css">
9 + a {
10 + color: #036;
11 + text-decoration: underline;
12 + }
13 +
14 + #footer a {
15 + color: #fff;
16 + text-decoration: underline;
17 + }
18 +
19 + #footer a:hover {
20 + color: #fff;
21 + text-decoration: none;
22 + }
23 + </style>
24 +</head>
25 +<body onload="if (typeof(startup) !== 'undefined') startup();" style="overflow-y:hidden;max-width:100%;margin:0;padding:0;border:0;color:black;font-size:13px;font-family:\'Trebuchet MS\', Arial, Helvetica, sans-serif">
26 + <div id="container">
27 + <!-- Begin Masthead -->
28 + <div id="masthead" style="background:url(logo.png) 0px 0px;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden">
29 + <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:4px">
30 + <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong>
31 + </div>
32 + <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:7px">
33 + <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong>
34 + </div>
35 + <p>{{{logoutControl}}}</p>
36 + </div>
37 + <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%">
38 + <div id="column_l" style="padding-left:10px;padding-right:10px">
39 + <div style="text-align:center;padding-top:30px;font-size:100px;font-family:Arial;color:#bbb"><b>404</b></div>
40 + <div style="text-align:center;font-size:16px;font-family:Arial;color:#999">This page does not exist</div>
41 + <div style="text-align:center;padding-top:16px;font-size:20px;font-family:Arial;color:#999"><a href="/" style="text-decoration:none"><b>Go to main site</b></a></div>
42 + </div>
43 + </div>
44 + <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px">
45 + <table cellpadding="0" cellspacing="6" style="width:100%">
46 + <tbody><tr>
47 + <td style="text-align:left;color:white">{{{footer}}}</td>
48 + <td style="text-align:right">{{{rootCertLink}}}&nbsp;<a href="/">Retour</a></td>
49 + </tr>
50 + </tbody></table>
51 + </div>
52 + </div>
53 +
54 +
55 +</body></html>
\ No newline at end of file
views/translations/login-min_fr.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link rel="shortcut icon"type=image/x-icon href={{{domainurl}}}favicon.ico><link keeplink=1 type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><script keeplink=1 src=scripts/u2f-api.js></script><title>{{{title}}} - Login</title><body id=body onload='"undefined"!=typeof startup&&startup()'class="arg_hide login"><div id=container><div id=masthead><div class=title>{{{title}}}</div><div class=title2>{{{title2}}}</div></div><div id=topbar class="noselect style3"style=height:24px><div id=uiMenuButton title="User interface selection"onclick=showUserInterfaceSelectMenu()>♦<div id=uiMenu style=display:none><div id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"><div class=uiSelector1></div></div><div id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"><div class=uiSelector2></div></div><div id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"><div class=uiSelector3></div></div><div id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Basculer mode nuit"><div class=uiSelector4></div></div></div></div></div><div id=column_l><h1>Bienvenue</h1><div id=welcomeText style=display:none>Connect to your home or office devices from anywhere in the world using<a href=http://www.meshcommander.com/meshcentral2>MeshCentral</a>, the real time, open source remote monitoring and management web site. You will need to download and install a management agent on your computers. Once installed, computers will show up in the "My Devices" section of this web site and you will be able to monitor them and take control of them.</div><table id=centralTable><tr><td id=welcomeimage><picture><img alt=""src=welcome.jpg style=border-radius:20px></picture><td id=logincell><div id=loginpanel style=display:none><form method=post><input type=hidden name=action value=login><div id=message1>{{{message}}}</div><div><b>Log In</b></div><table><tr><td id=loginusername align=right width=100>Nom d'utilisateur:<td><input id=username maxlength=64 name=username onchange=validateLogin(1) onkeyup=validateLogin(1,event)><tr><td align=right>Mot de passe:<td><input id=password type=password maxlength=256 name=password autocomplete=off onchange=validateLogin(2) onkeyup=validateLogin(2,event)><tr><td><div id=showPassHintLink style=display:none><a onclick="return showPassHint(event)"href=# style=cursor:pointer>Dévoiler indice</a></div><td align=right><input id=loginButton type=submit value="Log In"disabled></table><div id=hrAccountDiv style=display:none><hr></div><div id=resetAccountDiv style=display:none;padding:2px><span id=resetAccountSpan>Forgot username/password?</span><a onclick="return xgo(3,event)"href=# style=cursor:pointer>Réinitialiser le compte</a>.</div><div id=newAccountDiv style=display:none;padding:2px>Don't have an account?<a onclick="return xgo(2,event)"href=# style=cursor:pointer>Create one</a>.</div><input id=loginformargs name=urlargs type=hidden></form></div><div id=createpanel style=display:none;position:relative><form method=post><input type=hidden name=action value=createaccount><div id=message2>{{{message}}}</div><div><b>Account Creation</b></div><div id=passwordPolicyCallout style=display:none></div><table><tr id=nuUserRow><td id=nuUser align=right width=100>Nom d'utilisateur:<td><input id=ausername name=username onchange=validateCreate(1) maxlength=64 onkeydown=haltReturn(event) onkeyup=validateCreate(1,event)><tr><td id=nuEmail align=right width=100>Email:<td><input id=aemail name=email onchange=validateCreate(2) maxlength=256 onkeydown=haltReturn(event) onkeyup=validateCreate(2,event)><tr><td id=nuPass1 align=right>Mot de passe:<td><input id=apassword1 type=password name=password1 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(3,event) onkeyup=validateCreate(3,event)><tr><td id=nuPass2 align=right>Mot de passe:<td><input id=apassword2 type=password name=password2 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(4,event) onkeyup=validateCreate(4,event)><tr id=createPanelHint style=display:none><td id=nuHint align=right>Password Hint:<td><input id=apasswordhint name=apasswordhint autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(5,event) onkeyup=validateCreate(5,event)><tr id=newAccountPass title="Enter the account creation token"><td id=nuToken align=right>Creation Token:<td><input id=anewaccountpass type=password name=anewaccountpass autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(6,event) onkeyup=validateCreate(6,event)><tr><td colspan=2><div style=float:right><input id=createButton type=submit value="Create Account"disabled></div><div id=passWarning style=padding-top:6px></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a><input id=createformargs name=urlargs type=hidden></form></div><div id=resetpanel style=display:none><form method=post><input type=hidden name=action value=resetaccount><div id=message3>{{{message}}}</div><div><b>Account Reset</b></div><table><tr><td align=right width=100>Email:<td><input id=remail name=email maxlength=256 onchange=validateReset() onkeyup=validateReset(event)><tr><td colspan=2><div style=float:right><input id=eresetButton type=submit value="Réinitialiser le Compte"disabled></div><div id=passWarning style=padding-top:6px></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a><input id=resetformargs name=urlargs type=hidden></form></div><div id=tokenpanel style=display:none><form method=post autocomplete=off><input type=hidden name=action value=tokenlogin> <input type=hidden name=hwstate value={{{hwstate}}}><div id=message4>{{{message}}}</div><table><tr><td align=right width=100>Login token:<td><input id=tokenInput name=token maxlength=50 onchange=checkToken(event) onpaste=resetCheckToken(event) onkeyup=checkToken(event) onkeydown=checkToken(event)> <input id=hwtokenInput name=hwtoken style=display:none><tr><td colspan=2><div style=float:right><input id=tokenOkButton type=submit value=Login disabled></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a><input id=tokenformargs name=urlargs type=hidden></form></div><div id=resettokenpanel style=display:none><form method=post><input type=hidden name=action value=resetaccount><div id=message5>{{{message}}}</div><table><tr><td align=right width=100>Login token:<td><input id=resetTokenInput name=token maxlength=50 onchange=resetCheckToken(event) onkeyup=resetCheckToken(event) onkeydown=resetCheckToken(event)> <input id=resetHwtokenInput name=hwtoken style=display:none><tr><td colspan=2><div style=float:right><input id=resetTokenOkButton type=submit value=Login disabled></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a><input id=resettokenformargs name=urlargs type=hidden></form></div><div id=resetpasswordpanel style=display:none;position:relative><form method=post><input type=hidden name=action value=resetpassword><div id=message6>{{{message}}}</div><div id=rpasswordPolicyCallout style=display:none></div><table><tr><td id=rnuPass1 width=100 align=right>Mot de passe:<td><input id=rapassword1 type=password name=rpassword1 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(3,event) onkeyup=validatePassReset(3,event)><tr><td id=rnuPass2 align=right>Mot de passe:<td><input id=rapassword2 type=password name=rpassword2 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(4,event) onkeyup=validatePassReset(4,event)><tr id=resetpasswordpanelHint style=display:none><td id=rnuHint align=right>Password Hint:<td><input id=rapasswordhint name=rpasswordhint autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(5,event) onkeyup=validatePassReset(5,event)><tr><td colspan=2><div style=float:right><input id=resetPassButton type=submit value="Réinitialiser le mot de passe"disabled></div><div id=rpassWarning style=padding-top:6px></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a><input id=resetpasswordformargs name=urlargs type=hidden></form></div></table><br></div><div id=footer><div class=footer1>{{{footer}}}</div><div class=footer2>{{{rootCertLink}}} &nbsp;<a href=terms>Terms &amp; Privacy</a></div></div></div><div id=dialog style=display:none><div id=dialogHeader><div id=id_dialogclose style=float:right;padding:5px;cursor:pointer onclick=setDialogMode()><b>X</b></div><div id=id_dialogtitle style=padding:5px></div><div style=width:100%;margin:6px></div></div><div id=dialogBody><div id=dialog1><div id=id_dialogMessage></div></div><div id=dialog2><div id=id_dialogOptions></div></div></div><div id=idx_dlgButtonBar><input id=idx_dlgCancelButton type=button value=Annuler onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK onclick=dialogclose(1)></div></div><script>"use strict";var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,passhint="{{{passhint}}}",newAccountPass=parseInt("{{{newAccountPass}}}"),emailCheck=!1,passRequirements="{{{passRequirements}}}",hardwareKeyChallenge=decodeURIComponent("{{{hkey}}}"),passRequirementsEx=null!=(passRequirements=""!=passRequirements?JSON.parse(decodeURIComponent(passRequirements)):{}).min||null!=passRequirements.max||null!=passRequirements.upper||null!=passRequirements.lower||null!=passRequirements.numeric||null!=passRequirements.nonalpha,features=parseInt("{{{features}}}"),welcomeText=decodeURIComponent("{{{welcometext}}}"),currentpanel=0,uiMode=parseInt(getstore("uiMode","1")),webPageFullScreen=!0,nightMode="1"==getstore("_nightMode","0"),publicKeyCredentialRequestOptions=null;if(0<window.location.href.indexOf("?")){var urlargs=window.location.href.substring(window.location.href.indexOf("?"));Q("loginformargs").value=urlargs,Q("createformargs").value=urlargs,Q("resetformargs").value=urlargs,Q("tokenformargs").value=urlargs,Q("resettokenformargs").value=urlargs,Q("resetpasswordformargs").value=urlargs}function startup(){if(0==(32&features)){var e=null;try{e=top.location.toString().toLowerCase()}catch(e){}if(top!=self&&(null==e||0==top.active))return void(top.location=self.location)}2097152&features&&(QH("loginusername","Email:"),QH("resetAccountSpan","Forgot password?"),QV("nuUserRow",!1)),nightMode&&QC("body").add("night"),QV("createPanelHint",!0===passRequirements.hint),QV("resetpasswordpanelHint",!0===passRequirements.hint),welcomeText&&QH("welcomeText",welcomeText),QV("welcomeText",!0),(window.onresize=center)(),validateLogin(),validateCreate(),go(parseInt("{{loginmode}}")),QV("newAccountDiv",!1),null!=passhint&&0<passhint.length&&QV("showPassHintLink",!0),QV("newAccountPass",1==newAccountPass),QV("resetAccountDiv",1==emailCheck),QV("hrAccountDiv",1==emailCheck||1==newAccountPass),userInterfaceSelectMenu()}function showPassHint(e){return messagebox("Password Hint",passhint),haltEvent(e),!1}function xgo(e,n){return QV("message1",!1),QV("message2",!1),QV("message3",!1),QV("message4",!1),QV("message5",!1),QV("message6",!1),go(e),haltEvent(n),!1}function go(e){currentpanel=e,setDialogMode(0),QV("showPassHintLink",!1),QV("loginpanel",1==e),QV("createpanel",2==e),QV("resetpanel",3==e),QV("tokenpanel",4==e),QV("resettokenpanel",5==e),QV("resetpasswordpanel",6==e),1==e&&Q("username").focus(),2==e&&(2097152&features?Q("aemail").focus():Q("ausername").focus()),3==e&&Q("remail").focus(),4==e&&Q("tokenInput").focus(),5==e&&Q("resetTokenInput").focus(),6==e&&Q("rapassword1").focus()}function validateLogin(e,n){var s=0<Q("username").value.length&&-1==Q("username").value.indexOf(" ")&&0<Q("password").value.length;QE("loginButton",s),setDialogMode(0),null!=n&&13==n.keyCode&&(1==e&&""!=Q("username").value?Q("password").focus():2==e&&""!=Q("password").value&&Q("loginButton").click()),null!=n&&haltEvent(n)}function validateCreate(e,n){setDialogMode(0);var s=!1;s=!!(2097152&features)||0<Q("ausername").value.length&&-1==Q("ausername").value.indexOf(" ")&&-1==Q("ausername").value.indexOf('"')&&-1==Q("ausername").value.indexOf(",");var a=1==validateEmail(Q("aemail").value),t=0<Q("apassword1").value.length,o=0<Q("apassword2").value.length&&Q("apassword2").value==Q("apassword1").value,r=0==newAccountPass||0<Q("anewaccountpass").value.length,l=s&&a&&t&&o&&r;if(QS("nuUser").color=s?"black":"#7b241c",QS("nuEmail").color=a?"black":"#7b241c",QS("nuPass1").color=t?"black":"#7b241c",QS("nuPass2").color=o?"black":"#7b241c",QS("nuToken").color=r?"black":"#7b241c",""==Q("apassword1").value)QH("passWarning",""),QV("passwordPolicyCallout",!1);else if(passRequirementsEx){0==checkPasswordRequirements(Q("apassword1").value,passRequirements)?(l=!1,QS("nuPass1").color="#7b241c",QS("nuPass2").color="#7b241c",QH("passWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>"),QV("passwordPolicyCallout",!0),QH("passwordPolicyCallout",passwordPolicyText(Q("apassword1").value))):(QH("passWarning",""),QV("passwordPolicyCallout",!1))}else{var u=checkPasswordStrength(Q("apassword1").value);80<=u?QH("passWarning","<span style=color:green><b>Mot de passe fort</b><span>"):60<=u?QH("passWarning","<span style=color:blue><b>Bon mot de passe</b><span>"):QH("passWarning","<span style=color:red><b>Mot de passe faible</b><span>")}null!=n&&13==n.keyCode&&(1==e&&s&&Q("aemail").focus(),2==e&&a&&Q("apassword1").focus(),3==e&&t&&Q("apassword2").focus(),4==e&&o&&(!0===passRequirements.hint?Q("apasswordhint").focus():e=5),5==e&&(1==newAccountPass?Q("anewaccountpass").focus():e=6),6==e&&Q("createButton").click()),null!=n&&haltEvent(n),QE("createButton",l)}function validatePassReset(e,n){setDialogMode(0);var s=0<Q("rapassword1").value.length,a=0<Q("rapassword2").value.length&&Q("rapassword2").value==Q("rapassword1").value,t=s&&a;if(QS("rnuPass1").color=s?"black":"#7b241c",QS("rnuPass2").color=a?"black":"#7b241c",""==Q("rapassword1").value)QH("rpassWarning",""),QV("rpasswordPolicyCallout",!1);else if(passRequirementsEx){0==checkPasswordRequirements(Q("rapassword1").value,passRequirements)?(t=!1,QS("rnuPass1").color="#7b241c",QS("rnuPass2").color="#7b241c",QH("rpassWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>"),QV("rpasswordPolicyCallout",!0),QH("rpasswordPolicyCallout",passwordPolicyText(Q("rapassword1").value))):(QH("rpassWarning",""),QV("rpasswordPolicyCallout",!1))}else{var o=checkPasswordStrength(Q("rapassword1").value);80<=o?QH("rpassWarning","<span style=color:green><b>Mot de passe fort</b><span>"):60<=o?QH("rpassWarning","<span style=color:blue><b>Bon mot de passe</b><span>"):QH("rpassWarning","<span style=color:red><b>Mot de passe faible</b><span>")}null!=n&&13==n.keyCode&&(2==e&&Q("rapassword1").focus(),3==e&&Q("rapassword2").focus(),4==e&&Q("rapasswordhint").focus(),6==e&&Q("resetPassButton").click()),null!=n&&haltEvent(n),QE("resetPassButton",t)}function passwordPolicyText(e){var n="<div style=text-align:left>",s=strCount(e);return passRequirements.min&&(null==e||e.length<passRequirements.min)&&(n+=format("Minimum length of {0}",passRequirements.min)+"<br />"),passRequirements.max&&(null==e||e.length>passRequirements.max)&&(n+=format("Maximum length of {0}",passRequirements.max)+"<br />"),passRequirements.upper&&(null==e||s.upper<passRequirements.upper)&&(n+=format("{0} upper case",passRequirements.upper)+"<br />"),passRequirements.lower&&(null==e||s.lower<passRequirements.lower)&&(n+=format("{0} lower case",passRequirements.lower)+"<br />"),passRequirements.numeric&&(null==e||s.numeric<passRequirements.numeric)&&(n+=format("{0} numeric",passRequirements.numeric)+"<br />"),passRequirements.nonalpha&&(null==e||s.nonalpha<passRequirements.nonalpha)&&(n+=format("{0} non-alphanumeric",passRequirements.nonalpha)+"<br />"),n+="</div>"}function showPasswordPolicy(){messagebox("Password Policy",passwordPolicyText())}function validateReset(e){setDialogMode(0);var n=validateEmail(Q("remail").value);QE("eresetButton",n),null!=e&&13==e.keyCode&&1==n&&Q("eresetButton").click(),null!=e&&haltEvent(e)}function checkPasswordStrength(e){var n=0,s={},a=0,t={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e)return 0;for(var o=0;o<e.length;o++)s[e[o]]=(s[e[o]]||0)+1,n+=5/s[e[o]];for(var r in t)a+=1==t[r]?1:0;return parseInt(n+10*(a-1))}function checkPasswordRequirements(e,n){if(null==n||""==n||"object"!=typeof n)return!0;if(n.min&&e.length<n.min)return!1;if(n.max&&e.length>n.max)return!1;var s=strCount(e);return!(n.numeric&&s.numeric<n.numeric)&&(!(n.lower&&s.lower<n.lower)&&(!(n.upper&&s.upper<n.upper)&&!(n.nonalpha&&s.nonalpha<n.nonalpha)))}function strCount(e){var n={numeric:0,lower:0,upper:0,nonalpha:0};if("string"!=typeof e)return n;for(var s=0;s<e.length;s++)/\d/.test(e[s])&&n.numeric++,/[a-z]/.test(e[s])&&n.lower++,/[A-Z]/.test(e[s])&&n.upper++,/\W/.test(e[s])&&n.nonalpha++;return n}function checkToken(){var e=Q("tokenInput").value,n=e.split(" ").join("");e!=n&&(Q("tokenInput").value=n),QE("tokenOkButton",6==Q("tokenInput").value.length||8==Q("tokenInput").value.length||44==Q("tokenInput").value.length)}function resetCheckToken(){var e=Q("resetTokenInput").value,n=e.split(" ").join("");e!=n&&(Q("resetTokenInput").value=n),QE("resetTokenOkButton",6==Q("resetTokenInput").value.length||8==Q("resetTokenInput").value.length||44==Q("resetTokenInput").value.length)}var xxcurrentView=0;function setDialogMode(e,n,s,a,t,o){xxdialogMode=e,xxdialogFunc=a,xxdialogButtons=s,xxdialogTag=o,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&s),QV("idx_dlgCancelButton",2&s),QV("id_dialogclose",2&s||8&s),QV("idx_dlgButtonBar",7&s),n&&QH("id_dialogtitle",n);for(var r=1;r<24;r++)QV("dialog"+r,r==e);QV("dialog",e),t&&(2==e?QH("id_dialogOptions",t):QH("id_dialogMessage",t))}function dialogclose(e){var n=xxdialogFunc,s=xxdialogButtons,a=xxdialogTag;setDialogMode(),(8&s||e)&&n&&n(e,a)}function toggleFullScreen(e){0==webPageFullScreen?QC("body").remove("fullscreen"):QC("body").add("fullscreen"),QV("body",!0),center()}function showUserInterfaceSelectMenu(){Q("uiViewButton1").classList.remove("uiSelectorSel"),Q("uiViewButton2").classList.remove("uiSelectorSel"),Q("uiViewButton3").classList.remove("uiSelectorSel");try{Q("uiViewButton"+uiMode).classList.add("uiSelectorSel")}catch(e){}QV("uiMenu","none"==QS("uiMenu").display),nightMode&&Q("uiViewButton4").classList.add("uiSelectorSel")}function userInterfaceSelectMenu(e){e&&putstore("uiMode",uiMode=e),webPageFullScreen=uiMode<3,toggleFullScreen(0)}function toggleNightMode(){(nightMode=!nightMode)?QC("body").add("night"):QC("body").remove("night"),putstore("_nightMode",nightMode?"1":"0")}function center(){if(0==webPageFullScreen)QS("centralTable")["margin-top"]="";else{var e=Q("column_l").clientHeight/2-220;e<0&&(e=0),QS("centralTable")["margin-top"]=e+"px"}}function messagebox(e,n){QH("id_dialogMessage",n),setDialogMode(1,e,1)}function statusbox(e,n){QH("id_dialogMessage",n),setDialogMode(1,e)}function getDocWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement.clientWidth:document.getElementsByTagName("body")[0].clientWidth}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function haltReturn(e){13==e.keyCode&&haltEvent(e)}function validateEmail(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}function putstore(e,n){try{if("undefined"==typeof localStorage)return;localStorage.setItem(e,n)}catch(e){}}function getstore(e,n){try{if("undefined"==typeof localStorage)return n;var s=localStorage.getItem(e);return null==s||null==s?n:s}catch(e){return n}}function format(e){var s=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,n){return void 0!==s[n]?s[n]:e})}</script>
\ No newline at end of file
views/translations/login-mobile-min_fr.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link rel="shortcut icon"type=image/x-icon href={{{domainurl}}}favicon.ico><script src=scripts/common-0.0.1.js></script><script src=scripts/u2f-api.js></script><title>MeshCentral - Login</title><style>a{color:#036;text-decoration:underline}#footer a{color:#fff;text-decoration:underline}#footer a:hover{color:#fff;text-decoration:none}</style><body onload='"undefined"!=typeof startup&&startup()'style="overflow-y:hidden;margin:0;padding:0;border:0;color:#000;font-size:13px;font-family:\'Trebuchet MS\',Arial,Helvetica,sans-serif"><div id=container><div id=mastheadx></div><div id=masthead style="background:url(logo.png) 0 0;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px><strong><font style=font-size:36px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px><strong><font style=font-size:12px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div></div><div id=page_content style=overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%;display:flex;align-items:center><div id=column_l style=padding:10px;width:100%><table style=width:100%><tr><td align=center><div id=loginpanel style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;display:none><form method=post><input type=hidden name=action value=login><div id=message1>{{{message}}}</div><div><b>Log In</b></div><table><tr><td id=loginusername align=right width=100>Nom d'utilisateur:<td><input id=username maxlength=64 name=username onchange=validateLogin(1) onkeyup=validateLogin(1,event)><tr><td align=right>Mot de passe:<td><input id=password type=password maxlength=256 name=password autocomplete=off onchange=validateLogin(2) onkeyup=validateLogin(2,event)><tr><td><div id=showPassHintLink style=display:none><a onclick=showPassHint() style=cursor:pointer>Dévoiler indice</a></div><td align=right><input id=loginButton type=submit value="Log In"disabled></table><div id=hrAccountDiv style=display:none><hr></div><div id=resetAccountDiv style=display:none;padding:2px><span id=resetAccountSpan>Forgot user/password?</span><a onclick=xgo(3) style=cursor:pointer>Réinitialiser le compte</a>.</div><div id=newAccountDiv style=display:none;padding:2px>Don't have an account?<a onclick=xgo(2) style=cursor:pointer>Create one</a>.</div><input id=loginformargs name=urlargs type=hidden></form></div><div id=createpanel style=display:none><div style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;position:relative><form method=post><input type=hidden name=action value=createaccount><div id=message2>{{{message}}}</div><div><b>Account Creation</b></div><div id=passwordPolicyCallout style="left:-5px;top:10px;width:100px;position:absolute;background-color:#ffc;border-radius:5px;padding:5px;box-shadow:0 0 15px #666;font-size:10px"></div><table><tr id=nuUserRow><td align=right width=100>Nom d'utilisateur:<td><input id=ausername name=username onchange=validateCreate(1) maxlength=64 onkeydown=haltReturn(event) onkeyup=validateCreate(1,event)><tr><td align=right width=100>Email:<td><input id=aemail name=email onchange=validateCreate(2) maxlength=256 onkeydown=haltReturn(event) onkeyup=validateCreate(2,event)><tr><td align=right>Mot de passe:<td><input id=apassword1 type=password name=password1 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(3) onkeyup=validateCreate(3,event)><tr><td align=right>Mot de passe:<td><input id=apassword2 type=password name=password2 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(4) onkeyup=validateCreate(4,event)><tr id=createPanelHint style=display:none><td align=right>Pass Hint:<td><input id=apasswordhint name=apasswordhint autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(5) onkeyup=validateCreate(5,event)><tr id=newAccountPass title="Enter the account creation token"><td align=right>Creation Token:<td><input id=anewaccountpass type=password name=anewaccountpass autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(6) onkeyup=validateCreate(6,event)><tr><td colspan=2><div style=float:right><input id=createButton type=submit value="Create Account"disabled></div><div id=passWarning style=padding-top:6px></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a><input id=createformargs name=urlargs type=hidden></form></div></div><div id=resetpanel style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both><form method=post><input type=hidden name=action value=resetaccount><div id=message3>{{{message}}}</div><div><b>Account Reset</b></div><table><tr><td align=right width=100>Email:<td><input id=remail name=email maxlength=256 onchange=validateReset() onkeyup=validateReset(event)><tr><td colspan=2><div style=float:right><input id=eresetButton type=submit value="Réinitialiser le Compte"disabled></div><div id=passWarning style=padding-top:6px></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a><input id=resetformargs name=urlargs type=hidden></form></div><div id=tokenpanel style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both><form method=post autocomplete=off><input type=hidden name=action value=tokenlogin> <input type=hidden name=hwstate value={{{hwstate}}}><div id=message4>{{{message}}}</div><table><tr><td align=right width=100>Login token:<td><input id=tokenInput name=token maxlength=50 onchange=checkToken(event) onkeyup=checkToken(event) onkeydown=checkToken(event) onfocus=checkTokenTimer(1) onblur=checkTokenTimer(0)> <input id=hwtokenInput name=hwtoken style=display:none><tr><td colspan=2><div style=float:right><input id=tokenOkButton type=submit value=Login disabled></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a><input id=tokenformargs name=urlargs type=hidden></form></div><div id=resettokenpanel style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both><form method=post autocomplete=off><input type=hidden name=action value=resetaccount><div id=message5>{{{message}}}</div><table><tr><td align=right width=100>Login token:<td><input id=resetTokenInput name=token maxlength=50 onchange=resetCheckToken(event) onpaste=resetCheckToken(event) onkeyup=resetCheckToken(event) onkeydown=resetCheckToken(event)> <input id=resetHwtokenInput name=hwtoken style=display:none><tr><td colspan=2><div style=float:right><input id=resetTokenOkButton type=submit value=Login disabled></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a><input id=resettokenformargs name=urlargs type=hidden></form></div><div id=resetpasswordpanel style=position:relative;background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;display:none><form method=post><input type=hidden name=action value=resetpassword><div id=message6>{{{message}}}</div><div id=rpasswordPolicyCallout style="left:-10px;width:100px;display:none;position:absolute;background-color:#ffc;border-radius:5px;padding:5px;box-shadow:0 0 15px #666;font-size:10px"></div><table><tr><td id=rnuPass1 width=100 align=right>Mot de passe:<td><input id=rapassword1 type=password name=rpassword1 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(3,event) onkeyup=validatePassReset(3,event)><tr><td id=rnuPass2 align=right>Mot de passe:<td><input id=rapassword2 type=password name=rpassword2 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(4,event) onkeyup=validatePassReset(4,event)><tr id=resetpasswordpanelHint style=display:none><td id=rnuHint align=right>Password Hint:<td><input id=rapasswordhint name=rpasswordhint autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(5,event) onkeyup=validatePassReset(5,event)><tr><td colspan=2><div style=float:right><input id=resetPassButton type=submit value="Réinitialiser le mot de passe"disabled></div><div id=rpassWarning style=padding-top:6px></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a><input id=resetpasswordformargs name=urlargs type=hidden></form></div></table></div></div><div id=footer style=height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0><table cellpadding=0 cellspacing=6 style=width:100%><tr><td style=text-align:left;color:#fff>{{{footer}}}<td style=text-align:right>{{{rootCertLink}}}&nbsp;<a href=terms>Terms &amp; Privacy</a></table></div></div><div id=dialog style="z-index:1000;background-color:#eee;box-shadow:0 0 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:180px;width:400px;display:none"><div style="width:100%;background-color:#036;color:#fff;border-radius:5px 5px 0 0"><div id=id_dialogclose style=float:right;padding:5px;cursor:pointer onclick=setDialogMode()><b>X</b></div><div id=id_dialogtitle style=padding:5px></div><div style=width:100%;margin:6px></div></div><div style=margin-right:16px;margin-left:8px><div id=dialog1 style=margin:auto;text-align:center;margin:3px><div id=id_dialogMessage style=padding:10px></div></div><div id=dialog2 style=margin:auto;margin:3px><div id=id_dialogOptions></div></div></div><div id=idx_dlgButtonBar style=padding:10px;margin-bottom:20px><input id=idx_dlgCancelButton type=button value=Annuler style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK style=float:right;width:80px onclick=dialogclose(1)></div></div><script>"use strict";var passhint="{{{passhint}}}",newAccountPass=parseInt("{{{newAccountPass}}}"),emailCheck=!1,features=parseInt("{{{features}}}"),passRequirements="{{{passRequirements}}}",passRequirementsEx=null!=(passRequirements=""!=passRequirements?JSON.parse(decodeURIComponent(passRequirements)):{}).min||null!=passRequirements.max||null!=passRequirements.upper||null!=passRequirements.lower||null!=passRequirements.numeric||null!=passRequirements.nonalpha,hardwareKeyChallenge=decodeURIComponent("{{{hkey}}}"),currentpanel=0;if(0<window.location.href.indexOf("?")){var urlargs=window.location.href.substring(window.location.href.indexOf("?"));Q("loginformargs").value=urlargs,Q("createformargs").value=urlargs,Q("resetformargs").value=urlargs,Q("tokenformargs").value=urlargs,Q("resettokenformargs").value=urlargs,Q("resetpasswordformargs").value=urlargs}function startup(){if(0==(32&features)){var e=null;try{e=top.location.toString().toLowerCase()}catch(e){}if(top!=self&&(null==e||0==top.active))return void(top.location=self.location)}2097152&features&&(QH("loginusername","Email:"),QH("resetAccountSpan","Forgot password?"),QV("nuUserRow",!1)),QV("createPanelHint",!0===passRequirements.hint),QV("resetpasswordpanelHint",!0===passRequirements.hint),(window.onresize=center)(),validateLogin(),validateCreate(),go(parseInt("{{loginmode}}")),QV("newAccountDiv",!1),!0===passRequirements.hint&&null!=passhint&&0<passhint.length&&QV("showPassHintLink",!0),QV("newAccountPass",1==newAccountPass),QV("resetAccountDiv",1==emailCheck),QV("hrAccountDiv",1==emailCheck||1==newAccountPass)}function showPassHint(){!0===passRequirements.hint&&messagebox("Password Hint",passhint)}function xgo(e){QV("message1",!1),QV("message2",!1),QV("message3",!1),QV("message4",!1),QV("message5",!1),QV("message6",!1),go(e)}function go(e){currentpanel=e,setDialogMode(0),QV("showPassHintLink",!1),QV("loginpanel",1==e),QV("createpanel",2==e),QV("resetpanel",3==e),QV("tokenpanel",4==e),QV("resettokenpanel",5==e),QV("resetpasswordpanel",6==e),1==e&&Q("username").focus(),2==e&&(2097152&features?Q("aemail").focus():Q("ausername").focus()),3==e&&Q("remail").focus(),4==e&&Q("tokenInput").focus(),5==e&&Q("resetTokenInput").focus(),6==e&&Q("rapassword1").focus()}function validateLogin(e,s){var a=0<Q("username").value.length&&-1==Q("username").value.indexOf(" ")&&0<Q("password").value.length;QE("loginButton",a),setDialogMode(0),null!=s&&13==s.keyCode&&(1==e?Q("password").focus():2==e&&Q("loginButton").click()),null!=s&&haltEvent(s)}function validateCreate(e,s){setDialogMode(0);var a=!1;if(a=!!(2097152&features)||0<Q("ausername").value.length&&-1==Q("ausername").value.indexOf(" ")&&-1==Q("ausername").value.indexOf('"')&&-1==Q("ausername").value.indexOf(","),a&=1==validateEmail(Q("aemail").value)&&0<Q("apassword1").value.length&&Q("apassword2").value==Q("apassword1").value,1==newAccountPass&&0==Q("anewaccountpass").value.length&&(a=!1),""==Q("apassword1").value)QH("passWarning",""),QV("passwordPolicyCallout",!1);else if(passRequirementsEx){0==checkPasswordRequirements(Q("apassword1").value,passRequirements)?(a=!1,QH("passWarning","<span style=color:red><b>Password Policy</b><span>"),QV("passwordPolicyCallout",!0),QH("passwordPolicyCallout",passwordPolicyText(Q("apassword1").value))):(QH("passWarning",""),QV("passwordPolicyCallout",!1))}else{var n=checkPasswordStrength(Q("apassword1").value);80<=n?QH("passWarning","<span style=color:green><b>Mot de passe fort</b><span>"):60<=n?QH("passWarning","<span style=color:blue><b>Bon mot de passe</b><span>"):QH("passWarning","<span style=color:red><b>Mot de passe faible</b><span>")}QE("createButton",a),null!=s&&13==s.keyCode&&(1==e&&Q("aemail").focus(),2==e&&Q("apassword1").focus(),3==e&&Q("apassword2").focus(),4==e&&Q("apasswordhint").focus(),5==e&&(1==newAccountPass?Q("anewaccountpass").focus():Q("createButton").click()),6==e&&Q("createButton").click()),null!=s&&haltEvent(s)}function validatePassReset(e,s){setDialogMode(0);var a=0<Q("rapassword1").value.length,n=0<Q("rapassword2").value.length&&Q("rapassword2").value==Q("rapassword1").value,t=a&&n;if(QS("rnuPass1").color=a?"black":"#7b241c",QS("rnuPass2").color=n?"black":"#7b241c",""==Q("rapassword1").value)QH("rpassWarning",""),QV("rpasswordPolicyCallout",!1);else if(passRequirementsEx){0==checkPasswordRequirements(Q("rapassword1").value,passRequirements)?(t=!1,QS("rnuPass1").color="#7b241c",QS("rnuPass2").color="#7b241c",QH("rpassWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>"),QV("rpasswordPolicyCallout",!0),QH("rpasswordPolicyCallout",passwordPolicyText(Q("rapassword1").value))):(QH("rpassWarning",""),QV("rpasswordPolicyCallout",!1))}else{var o=checkPasswordStrength(Q("rapassword1").value);80<=o?QH("rpassWarning","<span style=color:green><b>Mot de passe fort</b><span>"):60<=o?QH("rpassWarning","<span style=color:blue><b>Bon mot de passe</b><span>"):QH("rpassWarning","<span style=color:red><b>Mot de passe faible</b><span>")}null!=s&&13==s.keyCode&&(2==e&&Q("rapassword1").focus(),3==e&&Q("rapassword2").focus(),4==e&&Q("rapasswordhint").focus(),6==e&&Q("resetPassButton").click()),null!=s&&haltEvent(s),QE("resetPassButton",t)}function validateReset(e){setDialogMode(0);var s=validateEmail(Q("remail").value);QE("eresetButton",s),null!=e&&13==e.keyCode&&1==s&&Q("eresetButton").click(),null!=e&&haltEvent(e)}function passwordPolicyText(e){var s="<div style=text-align:left>",a=strCount(e);return passRequirements.min&&(null==e||e.length<passRequirements.min)&&(s+=format("Minimum length of {0}",passRequirements.min)+"<br />"),passRequirements.max&&(null==e||e.length>passRequirements.max)&&(s+=format("Maximum length of {0}",passRequirements.max)+"<br />"),passRequirements.upper&&(null==e||a.upper<passRequirements.upper)&&(s+=format("{0} upper case",passRequirements.upper)+"<br />"),passRequirements.lower&&(null==e||a.lower<passRequirements.lower)&&(s+=format("{0} lower case",passRequirements.lower)+"<br />"),passRequirements.numeric&&(null==e||a.numeric<passRequirements.numeric)&&(s+=format("{0} numeric",passRequirements.numeric)+"<br />"),passRequirements.nonalpha&&(null==e||a.nonalpha<passRequirements.nonalpha)&&(s+=format("{0} non-alphanumeric",passRequirements.nonalpha)+"<br />"),s+="</div>"}function checkPasswordStrength(e){var s=0,a={},n=0,t={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e)return 0;for(var o=0;o<e.length;o++)a[e[o]]=(a[e[o]]||0)+1,s+=5/a[e[o]];for(var r in t)n+=1==t[r]?1:0;return parseInt(s+10*(n-1))}function checkPasswordRequirements(e,s){if(null==s||""==s||"object"!=typeof s)return!0;if(s.min&&e.length<s.min)return!1;if(s.max&&e.length>s.max)return!1;var a=strCount(e);return!(s.numeric&&a.numeric<s.numeric)&&(!(s.lower&&a.lower<s.lower)&&(!(s.upper&&a.upper<s.upper)&&!(s.nonalpha&&a.nonalpha<s.nonalpha)))}function strCount(e){var s={numeric:0,lower:0,upper:0,nonalpha:0};if("string"!=typeof e)return s;for(var a=0;a<e.length;a++)/\d/.test(e[a])&&s.numeric++,/[a-z]/.test(e[a])&&s.lower++,/[A-Z]/.test(e[a])&&s.upper++,/\W/.test(e[a])&&s.nonalpha++;return s}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,xcheckTokenTimer=null;function checkTokenTimer(e){0==e&&null!=xcheckTokenTimer&&(clearInterval(xcheckTokenTimer),xcheckTokenTimer=null),1==e&&null==xcheckTokenTimer&&(xcheckTokenTimer=setInterval(checkToken,200))}function checkToken(){var e=Q("tokenInput").value,s=e.split(" ").join("");e!=s&&(Q("tokenInput").value=s),QE("tokenOkButton",6==Q("tokenInput").value.length||8==Q("tokenInput").value.length||44==Q("tokenInput").value.length)}function resetCheckToken(){var e=Q("resetTokenInput").value,s=e.split(" ").join("");e!=s&&(Q("resetTokenInput").value=s),QE("resetTokenOkButton",6==Q("resetTokenInput").value.length||8==Q("resetTokenInput").value.length||44==Q("resetTokenInput").value.length)}var xxcurrentView=0;function setDialogMode(e,s,a,n,t,o){xxdialogMode=e,xxdialogFunc=n,xxdialogButtons=a,xxdialogTag=o,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&a),QV("idx_dlgCancelButton",2&a),QV("id_dialogclose",2&a||8&a),QV("idx_dlgButtonBar",7&a),s&&QH("id_dialogtitle",s);for(var r=1;r<24;r++)QV("dialog"+r,r==e);QV("dialog",e),t&&(2==e?QH("id_dialogOptions",t):QH("id_dialogMessage",t))}function dialogclose(e){var s=xxdialogFunc,a=xxdialogButtons,n=xxdialogTag;setDialogMode(),(8&a||e)&&s&&s(e,n)}function center(){QS("dialog").left=(getDocWidth()-400)/2+"px"}function messagebox(e,s){QH("id_dialogMessage",s),setDialogMode(1,e,1)}function statusbox(e,s){QH("id_dialogMessage",s),setDialogMode(1,e)}function getDocWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement.clientWidth:document.getElementsByTagName("body")[0].clientWidth}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function haltReturn(e){13==e.keyCode&&haltEvent(e)}function validateEmail(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}function format(e){var a=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,s){return void 0!==a[s]?a[s]:e})}</script>
\ No newline at end of file
views/translations/message-min_fr.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=/styles/style.css media=screen rel=stylesheet title=CSS><title>MeshCentral - {{{title3}}}</title><div id=container style=max-height:100vh><div id=mastheadx></div><div id=masthead style="background:url(logo.png) 0 0;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px><strong><font style=font-size:46px;font-family:Arial,Helvetica,sans-serif>{{{title}}}</font></strong></div><div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px><strong><font style=font-size:14px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div></div><div id=page_content style=max-height:calc(100vh-138px)><div id=column_l><h1>{{{title3}}}</h1><p style=margin-left:20px>{{{message}}}</p><br></div><div id=footer><table cellpadding=0 cellspacing=10 style=width:100%><tr><td style=text-align:left><td style=text-align:right><a href=terms>Terms &amp; Privacy</a></table></div></div></div>
\ No newline at end of file
views/translations/messenger-min_fr.handlebars new
+1
@@ -0,0 +1 @@
1 +<!doctypehtml><html style=height:100%><title>MeshMessenger</title><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8"http-equiv=Content-Type><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><link type=text/css href=styles/messenger.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><script src=scripts/filesaver.js></script><body style=font-family:Arial,Helvetica,sans-serif><div id=xtop style="position:absolute;left:0;right:0;top:0;height:38px;background-color:#036;color:#c8c8c8;box-shadow:3px 3px 10px gray"><div id=notifyButton class="icon13 topButton"style=margin-right:4px;display:none title="Enable browser notification"onclick=enableNotificationsButtonClick()></div><div id=fileButton class="icon4 topButton"title="Share a file"style=display:none onclick=fileButtonClick()></div><div id=camButton class="icon2 topButton"title="Activer caméra et microphone"style=display:none onclick=camButtonClick()></div><div id=micButton class="icon6 topButton"title="Activer le microphone"style=display:none onclick=micButtonClick()></div><div id=hangupButton class="icon11 topRedButton"title="Hang up"style=display:none onclick=hangUpButtonClick(1)></div><div style=display:inline-block;width:2px></div><div style=padding-top:9px;padding-left:6px;font-size:20px;display:inline-block><b>MeshMessenger<span id=xtitle></span></b></div></div><div id=xmiddle style=position:absolute;left:0;right:0;top:38px;bottom:30px><div style=position:absolute;left:0;right:0;top:0;bottom:0;overflow-y:scroll><div id=xmsg style=position:absolute;left:0;right:0;bottom:0;padding:5px></div></div></div><div id=xbottom style=position:absolute;left:0;right:0;bottom:0;height:30px;background-color:#036><div style=position:absolute;left:5px;right:215px;bottom:4px;top:4px;background-color:#f0f8ff><input id=xouttext style="width:calc(100% - 5px)"onfocus=onUserInputFocus(1) onblur=onUserInputFocus(0)></div><input type=button id=sendButton value=Envoyer style=position:absolute;right:110px;width:100px;top:4px onclick=xsend(event)> <input type=button id=clearButton value=Clear style=position:absolute;right:5px;width:100px;top:4px onclick=displayClear()></div><div id=remoteVideo style="position:absolute;right:24px;top:45px;width:320px;height:calc(240px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"><div style=position:absolute;right:0;left:0;top:2.5px;text-align:center>Remote</div><video id=remoteVideoCanvas autoplay style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:#000"></video></div><div id=localVideo style="position:absolute;right:24px;top:320px;width:160px;height:calc(120px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"><div style=position:absolute;right:0;left:0;top:2.5px;text-align:center>Local</div><video id=localVideoCanvas autoplay muted style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:#000"></video></div><input id=uploadFileInput type=file multiple style=display:none><script onunload=onUnLoad()>var userInputFocus=0,args=parseUriArgs(),socket=null,state=0,random=Math.random(),webrtcSessions={},webchannel=null,localStream=null,remoteStream=null,multiWebRtc=!0,userMediaSupport=0,notification=null;getUserMediaSupport(function(e){userMediaSupport=e});var webrtcconfiguration="{{{webrtconfig}}}";if(""==webrtcconfiguration)webrtcconfiguration=null;else try{webrtcconfiguration=JSON.parse(decodeURIComponent(webrtcconfiguration))}catch(e){console.log('Invalid WebRTC config: "'+webrtcconfiguration+'".'),webrtcconfiguration=null}var fileUploads=[],fileDownloads={},currentFileUpload=null,currentFileDownload=null;function onUserInputFocus(e){userInputFocus=e}function displayClear(){QH("xmsg",""),cancelAllFileTransfers(),fileUploads=[],fileDownloads={}}function getUserMediaSupport(i){try{navigator.mediaDevices.enumerateDevices().then(function(e){try{var t=0,n=0;e.forEach(function(e){"audioinput"===e.kind&&(t=1),"videoinput"===e.kind&&(n=1)}),0==t&&i(0),i(t+n)}catch(e){}})}catch(e){}}function displayControl(e){QA("xmsg",'<div style="clear:both"><div style="color:gray;float:left;margin-bottom:2px">'+e+"</div><div></div></div>"),Q("xmsg").scrollTop=Q("xmsg").scrollHeight}function displayLocalVideo(e){QV("localVideo",e),adjustVideoWindows()}function displayRemoteVideo(e){QV("remoteVideo",e),adjustVideoWindows()}function adjustVideoWindows(){var e="none"!=QS("remoteVideo").display;QS("localVideo").top=e?"320px":"45px"}function displayRemote(e){QA("xmsg",'<div style="clear:both"><div class="remoteBubble">'+e+"</div><div></div></div>"),Q("xmsg").scrollTop=Q("xmsg").scrollHeight,Notification&&QV("notifyButton","granted"!=Notification.permission),Notification&&"granted"==Notification.permission&&(null!=notification&&(notification.close(),notification=null),notification=args.title?new Notification("MeshMessenger - "+args.title,{body:e}):new Notification("MeshMessenger",{body:e}))}function xsend(e){null!=notification&&(notification.close(),notification=null),Notification&&QV("notifyButton","granted"!=Notification.permission);var t=Q("xouttext").value;0<t.length&&(Q("xouttext").value="",QA("xmsg",'<div style="clear:both"><div class="localBubble">'+t+"</div><div></div></div>"),Q("xmsg").scrollTop=Q("xmsg").scrollHeight,send({action:"chat",msg:t}))}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function parseUriArgs(){var e,t={},n=window.document.location.href.split(/[\?&|\=]/);for(i in n.splice(0,1),n)switch(i%2){case 0:e=decodeURIComponent(n[i]);break;case 1:t[e]=decodeURIComponent(n[i]);var i=parseInt(t[e]);i==t[e]&&(t[e]=i)}return t}function updateControls(){QE("sendButton",2==state),QE("clearButton",2==state),QE("xouttext",2==state),QV("fileButton",2==state),QV("camButton",webchannel&&webchannel.ok&&!localStream&&2==userMediaSupport),QV("micButton",webchannel&&webchannel.ok&&!localStream&&0<userMediaSupport),QV("hangupButton",webchannel&&webchannel.ok&&localStream)}function startWebRTC(t,e){if(null!=webrtcSessions[0]&&0==multiWebRtc)return webrtcSessions[0];var n=null;return"undefined"!=typeof RTCPeerConnection?n=new RTCPeerConnection(webrtcconfiguration):"undefined"!=typeof webkitRTCPeerConnection&&(n=new webkitRTCPeerConnection(webrtcconfiguration)),null==n?null:(n.id=t,n.onicecandidate=function(e){try{null!=e.candidate&&sendws({action:"webRtcIce",ice:e.candidate,id:this.id})}catch(e){}},n.oniceconnectionstatechange=function(){n&&"failed"==n.iceConnectionState&&(n.close(),webrtcSessions[n.id]&&delete webrtcSessions[n.id])},n.ondatachannel=function(e){(webchannel=e.channel).onmessage=function(e){processMessage(e.data,2)},webchannel.onopen=function(){webchannel.ok=!0,updateControls(),sendws({action:"rtcSwitch",v:0})},webchannel.onclose=function(e){webchannel&&webchannel.ok?disconnect():hangUpButtonClick(0)}},n.onnegotiationneeded=function(e){null==n.holdTimer&&(n.holdTimer=setTimeout(function(){n.holdTimer=null,n.createOffer(function(e){n.setLocalDescription(e,function(){sendws({action:"webRtcSdp",sdp:e,id:t})},function(){hangUpButtonClick(t)})},function(){hangUpButtonClick(t)})},20))},n.ontrack=function(e){var t=Q("remoteVideoCanvas");t.srcObject=remoteStream=e.streams[0],t.onloadedmetadata=function(e){t.play()},displayRemoteVideo(!0)},1==e&&((webchannel=n.createDataChannel("DataChannel",{})).onmessage=function(e){processMessage(e.data,2)},webchannel.onopen=function(){webchannel.ok=!0,updateControls(),sendws({action:"rtcSwitch",v:0})},webchannel.onclose=function(e){webchannel&&webchannel.ok?disconnect():hangUpButtonClick(0)}),webrtcSessions[t]=n)}function webRtcHandleOffer(i,e){var t=webrtcSessions[i];t&&t.setRemoteDescription(new RTCSessionDescription(e),function(){"offer"==e.type&&t.createAnswer(function(n){t.setLocalDescription(n,function(e,t){try{sendws({action:"webRtcSdp",sdp:n,id:i})}catch(e){}},function(){hangUpButtonClick(i)})},function(){hangUpButtonClick(i)})},function(){hangUpButtonClick(i)})}function performWebRtcSwitch(){webchannel&&webchannel.ok&&(sendws({action:"rtcSwitch",v:1}),webchannel.xoutBuffer=[])}function disconnect(){0<state&&displayControl("Connection closed."),1<state&&setTimeout(start,500),cancelAllFileTransfers(),hangUpButtonClick(0,!0),hangUpButtonClick(1,!0),hangUpButtonClick(2,!0),null!=socket&&(socket.close(),socket=null),updateControls(),state=0}function send(e){if(2==state)if("object"==typeof e&&(e=JSON.stringify(e)),webchannel&&webchannel.ok)null!=webchannel.xoutBuffer?webchannel.xoutBuffer.push(e):webchannel.send(e);else if(null!=socket)try{socket.send(e)}catch(e){}}function sendws(e){2==state&&("object"==typeof e&&(e=JSON.stringify(e)),null!=socket&&socket.send(e))}function webRtcIdSwitch(e){return 0==e?0:3-e}function processMessage(t,e){if("string"==typeof t){try{t=JSON.parse(t)}catch(e){return void console.log("Unable to parse",t)}switch(t.action){case"chat":displayRemote(t.msg);break;case"random":random>t.random&&startWebRTC(0,!0);break;case"webRtcSdp":webrtcSessions[webRtcIdSwitch(t.id)]||startWebRTC(webRtcIdSwitch(t.id),!1),webRtcHandleOffer(webRtcIdSwitch(t.id),t.sdp);break;case"webRtcIce":var n=webrtcSessions[webRtcIdSwitch(t.id)];if(n)try{n.addIceCandidate(new RTCIceCandidate(t.ice))}catch(e){}break;case"videoStop":hangUpButtonClick(webRtcIdSwitch(t.id),!0);break;case"rtcSwitch":switch(t.v){case 0:performWebRtcSwitch();break;case 1:sendws({action:"rtcSwitch",v:2});break;case 2:for(var i in webchannel.xoutBuffer)webchannel.send(webchannel.xoutBuffer[i]);delete webchannel.xoutBuffer;break;default:console.log("Unknown rtcSwitch value: "+t.action)}break;case"file":startFileDownload(t);break;case"fileUploadCancel":cancelFileTransfer(t.id);break;case"fileUploadStart":fileDownloads[t.id]&&((currentFileDownload=fileDownloads[t.id]).data="",changeFileInfo(t.id,2,0),continueFileDownload(t),send({action:"fileUploadAck",id:t.id}));break;case"fileUploadEnd":currentFileDownload&&currentFileDownload.id==t.id&&(changeFileInfo(t.id,3,200),currentFileDownload.done=1,currentFileDownload=null,send({action:"fileUploadAck",id:t.id})),currentFileDownload=null;break;case"fileUploadAck":continueFileUpload();break;case"fileData":currentFileDownload&&currentFileDownload.id==t.id&&(currentFileDownload.data+=t.data,changeFileInfo(t.id,2,200*currentFileDownload.data.length/currentFileDownload.size),send({action:"fileUploadAck",id:t.id}));break;default:console.log("Unhandled object data",t)}}else console.log("Unhandled data",typeof t,t)}function fileButtonClick(){var e=Q("uploadFileInput");1!=e.getAttribute("eventset")&&(e.setAttribute("eventset","1"),e.addEventListener("change",fileSelect,!1)),e.value=null,e.click()}function fileSelect(){if(2==state){var e=Q("uploadFileInput");if(10<e.files.length)displayControl("Limit of 10 file uploads at the same time.");else for(var t=0;t<e.files.length;t++)if(0<e.files[t].size){var n=new FileReader;n.onload=function(e){this.xfile.data=e.target.result,startFileUpload(this.xfile)},n.xfile=e.files[t],n.readAsBinaryString(e.files[t])}}}function fileDrop(e){if(haltEvent(e),2==state&&null!=e.dataTransfer)if(10<e.dataTransfer.files.length)displayControl("Limit of 10 file uploads at the same time.");else for(var t=0;t<e.dataTransfer.files.length;t++)if(0<e.dataTransfer.files[t].size){var n=new FileReader;n.onload=function(e){this.xfile.data=e.target.result,startFileUpload(this.xfile)},n.xfile=e.dataTransfer.files[t],n.readAsBinaryString(e.dataTransfer.files[t])}}function startFileUpload(e){2==state&&(e.id=Math.random(),fileUploads.push(e),QA("xmsg",'<div style="clear:both"></div><div id="FILEUP-'+e.id+'" class="localBubble" style="width:240px;cursor:pointer" onclick="cancelFileTransfer(\''+e.id+'\')"><div id="FILEUP-ICON-'+e.id+'" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-'+e.id+'" style="height:16px;overflow:hidden;white-space:nowrap;" title="'+e.name+'">'+e.name+'</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-'+e.id+'" style="width:0px;background-color:green;border-radius:3px;height:11px">&nbsp;</div></div></div></div>'),Q("xmsg").scrollTop=Q("xmsg").scrollHeight,send({action:"file",size:e.size,id:e.id,type:e.type,name:e.name}),null==currentFileUpload&&continueFileUpload())}function startFileDownload(e){2==state&&(fileDownloads[e.id]=e,QA("xmsg",'<div style="clear:both"></div><div id="FILEUP-'+e.id+'" class="remoteBubble" style="width:240px;cursor:pointer" onclick="saveFileTransfer(\''+e.id+'\')"><div id="FILEUP-ICON-'+e.id+'" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-'+e.id+'" style="height:16px;overflow:hidden;white-space:nowrap;" title="'+e.name+'">'+e.name+'</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-'+e.id+'" style="width:0px;background-color:green;border-radius:3px;height:11px">&nbsp;</div></div></div></div>'),Q("xmsg").scrollTop=Q("xmsg").scrollHeight)}function changeFileInfo(e,t,n,i){t&&(Q("FILEUP-ICON-"+e).classList.remove("fileicon"),Q("FILEUP-ICON-"+e).classList.remove("fileiconx"),Q("FILEUP-ICON-"+e).classList.remove("fileicontransfer"),Q("FILEUP-ICON-"+e).classList.remove("fileicondone"),Q("FILEUP-ICON-"+e).classList.add(["fileicon","fileiconx","fileicontransfer","fileicondone"][t])),n&&(QS("FILEUP-PROGRESS-"+e).width=n+"px"),i&&(QS("FILEUP-PROGRESS-"+e)["background-color"]=i)}function data2blob(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return new Blob([new Uint8Array(t)])}function saveFileTransfer(e){var t=fileDownloads[e];t&&1==t.done&&saveAs(data2blob(t.data),t.name)}function cancelFileTransfer(e){null!=currentFileUpload&&currentFileUpload.id==e&&(currentFileUpload=null),null!=currentFileDownload&&currentFileDownload.id==e&&(currentFileDownload=null);var t=!1;if(fileDownloads[e]&&1!=fileDownloads[e].done)delete fileDownloads[e],t=!0;else for(var n in fileUploads)if(fileUploads[n].id==e){send({action:"fileUploadCancel",id:e}),fileUploads.splice(n,1),t=!0;break}t&&changeFileInfo(e,1,200,"gray")}function cancelAllFileTransfers(){for(var e in fileDownloads)cancelFileTransfer(fileDownloads[e].id);for(var e in fileUploads)cancelFileTransfer(fileUploads[e].id)}function continueFileUpload(){if(null==currentFileUpload){if(0==fileUploads.length)return;(currentFileUpload=fileUploads[0]).ptr=0,send({action:"fileUploadStart",size:currentFileUpload.size,id:currentFileUpload.id,type:currentFileUpload.type,name:currentFileUpload.name})}else if(currentFileUpload.size<=currentFileUpload.ptr)send({action:"fileUploadEnd",size:currentFileUpload.size,id:currentFileUpload.id,type:currentFileUpload.type,name:currentFileUpload.name}),changeFileInfo(currentFileUpload.id,3,200),fileUploads.splice(0,1),currentFileUpload=null,continueFileUpload();else{var e=Math.min(4e3,currentFileUpload.data.length-currentFileUpload.ptr),t=currentFileUpload.data.substring(currentFileUpload.ptr,currentFileUpload.ptr+e);send({action:"fileData",id:currentFileUpload.id,data:t}),currentFileUpload.ptr+=e,changeFileInfo(currentFileUpload.id,0,200*currentFileUpload.ptr/currentFileUpload.size)}}function continueFileDownload(e){send({action:"fileUploadAck",id:e.id})}function enableNotificationsButtonClick(){return Notification&&Notification.requestPermission().then(function(e){QV("notifyButton","granted"!=e)}),!1}function camButtonClick(){null==localStream&&startLocalStream({video:!0,audio:!0})}function micButtonClick(){null==localStream&&startLocalStream({video:!1,audio:!0})}function hangUpButtonClick(e,t){var n=Q("localVideoCanvas"),i=Q("remoteVideoCanvas"),o=webrtcSessions[1==multiWebRtc?e:0];if(0==e&&null!=webchannel){try{webchannel.close()}catch(e){}webchannel=null}if(o){if(1!=multiWebRtc&&0!=e||(o.ontrack=null,o.onremovetrack=null,o.onremovestream=null,o.onnicecandidate=null,o.oniceconnectionstatechange=null,o.onsignalingstatechange=null,o.onicegatheringstatechange=null,o.onnotificationneeded=null),1==e&&localStream){var a=localStream.getTracks();for(var l in a)a[l].stop();localStream=null}if(2==e&&remoteStream){a=remoteStream.getTracks();for(var l in a)a[l].stop();remoteStream=null}1!=multiWebRtc&&0!=e||(o.close(),delete webrtcSessions[e])}1==e?(n.removeAttribute("src"),n.removeAttribute("srcObject"),null!=localStream&&(localStream=null),displayLocalVideo(!1)):2==e&&(i.removeAttribute("src"),i.removeAttribute("srcObject"),displayRemoteVideo(!1)),1!=t&&send({action:"videoStop",id:e}),updateControls()}function startLocalStream(a){var l=1==multiWebRtc?1:0;null==localStream&&(1==multiWebRtc&&null!=webrtcSessions[1]||navigator.mediaDevices.getUserMedia&&(localStream=1,updateControls(),navigator.mediaDevices.getUserMedia(a).then(function(e){var t=(localStream=e).getTracks(),n=startWebRTC(l);if(1==a.video){var i=Q("localVideoCanvas");i.srcObject=e,i.onloadedmetadata=function(e){i.play()},displayLocalVideo(!0)}for(var o in t)n.addTrack(t[o],localStream)},function(e){displayControl(e.message+"."),hangUpButtonClick(1)})))}function start(){if(updateControls(),"string"==typeof args.id&&0<args.id.length){var e=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+args.id;null!=args.auth&&""!=args.auth&&(e+="&auth="+args.auth),(socket=new WebSocket(e)).onopen=function(){state=1,displayControl("Waiting for other user...")},socket.onerror=function(e){},socket.onclose=function(){disconnect()},socket.onmessage=function(e){if(state<2&&"string"==typeof e.data&&("c"==e.data||"cr"==e.data))return hangUpButtonClick(0,!0),hangUpButtonClick(1,!0),hangUpButtonClick(2,!0),displayControl("Connected."),state=2,updateControls(),void sendws({action:"random",random:random});2==state&&processMessage(e.data,1)}}else displayControl("Error: No connection key specified.")}function onUnLoad(){for(var e=0;e<3;e++)webrtcSessions[e]&&(webrtcSessions[e].close(),delete webrtcSessions[e]);if(null!=webchannel){try{webchannel.close()}catch(e){}webchannel=null}if(null!=socket){try{socket.close()}catch(e){}socket=null}}args.title&&(QH("xtitle"," - "+args.title),document.title=document.title+" - "+args.title),Notification&&QV("notifyButton","granted"!=Notification.permission),document.addEventListener("dragover",haltEvent,!1),document.addEventListener("dragleave",haltEvent,!1),document.addEventListener("drop",fileDrop,!1),document.onclick=function(e){Notification&&QV("notifyButton","granted"!=Notification.permission),null!=notification&&(notification.close(),notification=null)},document.onkeyup=function(e){if(Notification&&QV("notifyButton","granted"!=Notification.permission),null!=notification&&(notification.close(),notification=null),2==state&&8==e.keyCode&&0==userInputFocus){var t=Q("xouttext").value;0<t.length&&(Q("xouttext").value=t.substring(0,t.length-1))}if(0==userInputFocus)return haltEvent(e),!1},document.onkeypress=function(e){if(Notification&&QV("notifyButton","granted"!=Notification.permission),null!=notification&&(notification.close(),notification=null),2==state&&(13==e.keyCode?xsend(e):0==userInputFocus&&1==e.key.length&&(Q("xouttext").value=Q("xouttext").value+e.key)),0==userInputFocus)return haltEvent(e),!1},FileReader.prototype.readAsBinaryString||(FileReader.prototype.readAsBinaryString=function(e){var i="",o=this,a=new FileReader;a.onload=function(e){for(var t=new Uint8Array(a.result),n=0;n<t.byteLength;n++)i+=String.fromCharCode(t[n]);o.onload({target:{result:i}})},a.readAsArrayBuffer(e)}),start()</script>
\ No newline at end of file