";if((v.latest.indexOf(".")==-1)||(v.current==v.latest)||((features&2048)==0)){setDialogMode(2,"MeshCentral Version",1,null,ae)}else{setDialogMode(2,"MeshCentral Version",3,server_showVersionDlgEx,ae+" ");server_showVersionDlgUpdate()}}break;case"servererrors":if((xxdialogMode==2)&&(xxdialogTag=="MeshCentralServerErrors")){if(v.data==null){setDialogMode(2,"MeshCentral Server Errors",1,null,"Server has no error log.")}else{var ae='
Install Google Authenticator or a compatible application and scan the barcode, use this link or enter the secret. Then, enter the current 6 digit token below to activate 2-Step login.
Secret '+T+'
Enter the token here for 2-step login:
');new QRCode(Q("qrcode"),{text:v.url,width:128,height:128,colorDark:"#000000",colorLight:"#EEE",correctLevel:QRCode.CorrectLevel.H});QV("idx_dlgOkButton",true);QE("idx_dlgOkButton",false);Q("d2otpauthinput").focus()}break;case"otpauth-setup":if(xxdialogMode){return}setDialogMode(2,"Authenticator App",1,null,v.success?"Authenticator app activation successful. You will now need a valid token to login again.":"2-step login activation failed. 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,v.success?"Authenticator application removed. You can reactivate this feature at any time.":"2-step login activation removal failed. Try again.");break;case"otpauth-getpasswords":if(xxdialogMode){return}var ae="One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place.";ae+="
";if(v.passwords){var l=0,b="";for(var g in v.passwords){if(++l%2){ae+="
";setDialogMode(2,"Manage Security Keys",8,null,ae,"otpauth-hardware-manage");if(u2fSupported()==false){QE("d2addkey1",false)}break;case"otp-hkey-yubikey-add":if(v.result){meshserver.send({action:"otp-hkey-get"})}else{setDialogMode(2,"Add Security Key",1,null," Error, Unable to add key.
")}break;case"otp-hkey-setup-response":if(xxdialogMode&&(xxdialogTag!="otpauth-hardware-manage")){return}if(v.result==true){meshserver.send({action:"otp-hkey-get"})}else{setDialogMode(2,"Add Security Key",1,null," ERROR: Unable to add key.
","otpauth-hardware-manage")}break;case"webauthn-startregister":if(xxdialogMode&&(xxdialogTag!="otpauth-hardware-manage")){return}var ae="Press the key button now.
";setDialogMode(2,"Add Security Key",2,null,ae);var N=v.request;v.request.challenge=Uint8Array.from(atob(v.request.challenge),function(j){return j.charCodeAt(0)});v.request.user.id=Uint8Array.from(atob(v.request.user.id),function(j){return j.charCodeAt(0)});navigator.credentials.create({publicKey:N}).then(function(j){var m={rawId:btoa(String.fromCharCode.apply(null,new Uint8Array(j.rawId))),response:{attestationObject:btoa(String.fromCharCode.apply(null,new Uint8Array(j.response.attestationObject))),clientDataJSON:btoa(String.fromCharCode.apply(null,new Uint8Array(j.response.clientDataJSON)))},type:j.type};meshserver.send({action:"webauthn-endregister",response:m});setDialogMode(0)},function(j){setDialogMode(2,"Add Security Key",1,null,"ERROR: "+j)});break;case"event":if(!v.event.nolog){if(currentNode&&(v.event.nodeid==currentNode._id)){currentDeviceEvents.unshift(v.event);var e=parseInt(p16limitdropdown.value);while(currentDeviceEvents.length>e){currentDeviceEvents.pop()}masterUpdate(1024)}if(currentUser&&(v.event.userid==currentUser._id)){currentUserEvents.unshift(v.event);var e=parseInt(p31limitdropdown.value);while(currentUserEvents.length>e){currentUserEvents.pop()}masterUpdate(2048)}events.unshift(v.event);var e=parseInt(p3limitdropdown.value);while(events.length>e){events.pop()}masterUpdate(32)}if(v.event.noact){break}switch(v.event.action){case"userWebState":if(localStorage!=null){var H=localStorage.getItem("showRealNames");var K=localStorage.getItem("uiMode");var J=localStorage.getItem("sort");var G=localStorage.getItem("loctag");var ad=JSON.parse(v.event.state);for(var g in ad){localStorage.setItem(g,ad[g])}if((ad.deskAspectRatio!=null)&&(ad.deskAspectRatio!=deskAspectRatio)){deskAspectRatio=ad.deskAspectRatio;deskAdjust()}if((ad.showRealNames!=null)&&(ad.showRealNames!=H)){showRealNames=Q("RealNameCheckBox").checked=(ad.showRealNames=="1");masterUpdate(6)}if((ad.uiMode!=null)&&(ad.uiMode!=K)){userInterfaceSelectMenu(parseInt(ad.uiMode))}if((ad.sort!=null)&&(ad.sort!=J)){document.getElementById("sortselect").selectedIndex=sort=parseInt(ad.sort);masterUpdate(6)}if((ad.loctag!=null)&&(ad.loctag!=G)){if(ad.loctag!=null){args.locale=ad.loctag}else{delete args.locale}masterUpdate(4294967295)}}break;case"servertimelinestats":addServerTimelineStats(v.event.data);break;case"accountcreate":case"accountchange":if(userinfo.name==v.event.account.name){var A=v.event.account.siteadmin?v.event.account.siteadmin:0;var I=userinfo.siteadmin?userinfo.siteadmin:0;if((v.event.account.quota!=userinfo.quota)||(((userinfo.siteadmin&8)==0)&&((v.event.account.siteadmin&8)!=0))){meshserver.send({action:"files"})}var F=userinfo.groups;userinfo=v.event.account;if(I!=A){updateSiteAdmin()}updateSelf();if((userinfo.siteadmin&2)!=0){var E=F?F:[];var C=userinfo.groups?userinfo.groups:[];if(E.join(",")!=C.join(",")){users=wssessions=null;meshserver.send({action:"users"});meshserver.send({action:"wssessioncount"})}}}if(users==null){break}if((userinfo.groups==null)||(userinfo.groups.length==0)||(findOne(v.event.account.groups,userinfo.groups)==true)){users[v.event.account._id]=v.event.account}else{delete users[v.event.account._id]}updateUsers();break;case"accountremove":if(users==null){break}delete users["user/"+domain+"/"+v.event.username.toLowerCase()];updateUsers();break;case"createmesh":if((meshes[v.event.meshid]==null)&&(v.event.links[userinfo._id]!=null)){meshes[v.event.meshid]={_id:v.event.meshid,name:v.event.name,mtype:v.event.mtype,desc:v.event.desc,links:v.event.links};masterUpdate(4+128);meshserver.send({action:"files"})}break;case"meshchange":if(meshes[v.event.meshid]==null){meshes[v.event.meshid]={_id:v.event.meshid,name:v.event.name,mtype:v.event.mtype,desc:v.event.desc,links:v.event.links};meshserver.send({action:"nodes"})}else{if(v.event.name!=null){meshes[v.event.meshid].name=v.event.name}if(v.event.desc!=null){meshes[v.event.meshid].desc=v.event.desc}if(v.event.flags!=null){meshes[v.event.meshid].flags=v.event.flags}if(v.event.consent!=null){meshes[v.event.meshid].consent=v.event.consent}if(v.event.links){meshes[v.event.meshid].links=v.event.links}if(v.event.amt){meshes[v.event.meshid].amt=v.event.amt}if(meshes[v.event.meshid].links[userinfo._id]==null){if((xxcurrentView==20)&&(currentMesh==meshes[v.event.meshid])){go(2)}delete meshes[v.event.meshid];var z=[];for(var g in nodes){if(nodes[g].meshid!=v.event.meshid){z.push(nodes[g])}}nodes=z;if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==v.event.meshid){setDialogMode(0);go(1)}}}masterUpdate(4+128);if(currentNode&&(currentNode.meshid==v.event.meshid)){currentNode=null;if((xxcurrentView>=10)&&(xxcurrentView<20)){go(1)}}if(xxcurrentView==20&¤tMesh._id==v.event.meshid){masterUpdate(4096)}break;case"deletemesh":if(meshes[v.event.meshid]){delete meshes[v.event.meshid];masterUpdate(128);meshserver.send({action:"files"})}var z=[];if(nodes!=null){for(var g in nodes){if(nodes[g].meshid!=v.event.meshid){z.push(nodes[g])}}}nodes=z;masterUpdate(4);if(xxcurrentView>=20&&xxcurrentView<30&¤tMesh._id==v.event.meshid){setDialogMode(0);go(2)}if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==v.event.meshid){setDialogMode(0);go(1)}break;case"addnode":var D=v.event.node;if(!meshes[D.meshid]){break}if(getNodeFromId(D._id)!=null){break}D.namel=D.name.toLowerCase();if(D.rname){D.rnamel=D.rname.toLowerCase()}else{D.rnamel=D.namel}D.meshnamel=meshes[D.meshid].name.toLowerCase();D.state=0;if(!D.icon){D.icon=1}D.ident=++nodeShortIdent;if(nodes==null){}nodes.push(D);masterUpdate(1|2|4|16);break;case"removenode":var k=-1;for(var g in nodes){if(nodes[g]._id==v.event.nodeid){k=g;break}}if(k!=-1){var D=nodes[k];if(currentNode==D){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(1)}currentNode=null}nodes.splice(k,1);masterUpdate(4|16)}break;case"changenode":var k=-1;for(var g in nodes){if(nodes[g]._id==v.event.nodeid){k=g;break}}if(k!=-1){var D=nodes[k];D.name=v.event.node.name;D.rname=v.event.node.rname;D.users=v.event.node.users;D.host=v.event.node.host;D.desc=v.event.node.desc;D.ip=v.event.node.ip;D.osdesc=v.event.node.osdesc;D.publicip=v.event.node.publicip;D.iploc=v.event.node.iploc;D.wifiloc=v.event.node.wifiloc;D.gpsloc=v.event.node.gpsloc;D.tags=v.event.node.tags;D.userloc=v.event.node.userloc;if(v.event.node.agent!=null){if(D.agent==null){D.agent={}}if(v.event.node.agent.ver!=null){D.agent.ver=v.event.node.agent.ver}if(v.event.node.agent.id!=null){D.agent.id=v.event.node.agent.id}if(v.event.node.agent.caps!=null){D.agent.caps=v.event.node.agent.caps}if(v.event.node.agent.core!=null){D.agent.core=v.event.node.agent.core}else{if(D.agent.core){delete D.agent.core}}D.agent.tag=v.event.node.agent.tag}if(v.event.node.intelamt!=null){if(D.intelamt==null){D.intelamt={}}if(v.event.node.intelamt.state!=null){D.intelamt.state=v.event.node.intelamt.state}if(v.event.node.intelamt.host!=null){D.intelamt.user=v.event.node.intelamt.host}if(v.event.node.intelamt.user!=null){D.intelamt.user=v.event.node.intelamt.user}if(v.event.node.intelamt.tls!=null){D.intelamt.tls=v.event.node.intelamt.tls}if(v.event.node.intelamt.ver!=null){D.intelamt.ver=v.event.node.intelamt.ver}if(v.event.node.intelamt.tag!=null){D.intelamt.tag=v.event.node.intelamt.tag}if(v.event.node.intelamt.uuid!=null){D.intelamt.uuid=v.event.node.intelamt.uuid}if(v.event.node.intelamt.realm!=null){D.intelamt.realm=v.event.node.intelamt.realm}}if(v.event.node.av!=null){D.av=v.event.node.av}D.namel=D.name.toLowerCase();if(D.rname){D.rnamel=D.rname.toLowerCase()}else{D.rnamel=D.namel}if(v.event.node.icon){D.icon=v.event.node.icon}masterUpdate(2|4|8|16);refreshDevice(D._id);if((currentNode==D)&&(xxdialogMode!=null)&&(xxdialogTag=="@xxmap")){p10showNodeLocationDialog()}}break;case"nodemeshchange":var k=-1;for(var g in nodes){if(nodes[g]._id==v.event.nodeid){k=g;break}}if(k!=-1){var D=nodes[k];if(meshes[v.event.newMeshId]==null){if(currentNode==D){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(1)}currentNode=null}nodes.splice(k,1);masterUpdate(4|16)}else{D.meshid=v.event.newMeshId;D.meshnamel=meshes[v.event.newMeshId].name.toLowerCase();masterUpdate(1|2|4)}refreshDevice(v.event.nodeid)}else{var D=v.event.node;if(!meshes[D.meshid]){break}D.namel=D.name.toLowerCase();if(D.rname){D.rnamel=D.rname.toLowerCase()}else{D.rnamel=D.namel}D.meshnamel=meshes[D.meshid].name.toLowerCase();D.state=0;if(!D.icon){D.icon=1}D.ident=++nodeShortIdent;if(nodes==null){}nodes.push(D);masterUpdate(1|2|4|16)}break;case"nodeconnect":var k=-1;for(var g in nodes){if(nodes[g]._id==v.event.nodeid){k=g;break}}if(k!=-1){var D=nodes[k];var w=getstore("notifications",0);if(v.event.meshid&&userinfo.links&&userinfo.links[v.event.meshid]&&userinfo.links[v.event.meshid].notify){w&=userinfo.links[v.event.meshid].notify}else{w=0}if(w&2){if(((D.conn&1)==0)&&((v.event.conn&1)!=0)){addNotification({text:"Agent connected",title:D.name,icon:D.icon,nodeid:D._id})}if(((D.conn&2)==0)&&((v.event.conn&2)!=0)){addNotification({text:"Intel AMT detected",title:D.name,icon:D.icon,nodeid:D._id})}if(((D.conn&4)==0)&&((v.event.conn&4)!=0)){addNotification({text:"Intel AMT CIRA connected",title:D.name,icon:D.icon,nodeid:D._id})}if(((D.conn&16)==0)&&((v.event.conn&16)!=0)){addNotification({text:"MQTT connected",title:D.name,icon:D.icon,nodeid:D._id})}}if(w&4){if(((D.conn&1)!=0)&&((v.event.conn&1)==0)){addNotification({text:"Agent disconnected",title:D.name,icon:D.icon,nodeid:D._id})}if(((D.conn&2)!=0)&&((v.event.conn&2)==0)){addNotification({text:"Intel AMT not detected",title:D.name,icon:D.icon,nodeid:D._id})}if(((D.conn&4)!=0)&&((v.event.conn&4)==0)){addNotification({text:"Intel AMT CIRA disconnected",title:D.name,icon:D.icon,nodeid:D._id})}if(((D.conn&16)!=0)&&((v.event.conn&16)==0)){addNotification({text:"MQTT disconnected",title:D.name,icon:D.icon,nodeid:D._id})}}D.conn=v.event.conn;D.pwr=v.event.pwr;masterUpdate(4|16);refreshDevice(D._id)}break;case"wssessioncount":if(wssessions!=null){if(v.event.count==0&&wssessions["user/"+domain+"/"+v.event.username.toLowerCase()]){delete wssessions["user/"+domain+"/"+v.event.username.toLowerCase()]}else{wssessions["user/"+domain+"/"+v.event.username.toLowerCase()]=v.event.count}updateUsers()}break;case"login":if(users!=null&&users["user/"+domain+"/"+v.event.username.toLowerCase()]){users["user/"+domain+"/"+v.event.username.toLowerCase()].login=Math.floor(new Date(v.event.time).getTime()/1000)}break;case"scanamtdevice":if((xxdialogMode==null)||(!Q("dp1range"))||(Q("dp1range").value!=v.event.range)){return}var ae="";if(v.event.results==null){ae="
Unable to scan this address range.
Sample IP range values 192.168.0.100 192.168.1.0/24 192.167.0.1-192.168.0.100
"}else{amtScanResults=v.event.results;for(var g in v.event.results){var O=v.event.results[g],W=O.hostname;if(W.length>20){W=W.substring(0,20)+"..."}var Z=''+EscapeHtml(W)+" - v"+O.ver;if(O.state==2){if(O.tls==1){Z+=" with TLS."}else{Z+=" without TLS."}}else{Z+=" not activated."}ae+='
'+Z+"
"}if(ae==""){ae="
Scan returned no results.
Sample IP range values 192.168.0.100 192.168.1.0/24 192.167.0.1-192.168.0.100
"}}QH("dp1results",ae);QE("dp1range",true);QE("dp1rangebutton",true);break;case"notify":var w={text:v.event.value,title:v.event.title,icon:v.event.icon};if(v.event.tag!=null){w.tag=v.event.tag}addNotification(w);break;case"traceinfo":if(typeof v.event.traceSources=="object"){if((v.event.traceSources!=null)&&(v.event.traceSources.length>0)){serverTraceSources=v.event.traceSources;QH("p41traceStatus",EscapeHtml(v.event.traceSources.join(", ")))}else{serverTraceSources=[];QH("p41traceStatus","None")}}break;case"sysinfohash":if((currentNode!=null)&&(v.event.nodeid==powerTimelineReq)){meshserver.send({action:"getsysinfo",nodeid:v.event.nodeid})}break;case"stopped":break;default:break}break;case"createInviteLink":if(xxdialogTag!=v.meshid){break}var V=serverinfo.name;if((V.indexOf(".")==-1)||((features&2)!=0)){V=window.location.hostname}var c=domainUrl.substring(0,domainUrl.length-1);var ac;if(serverinfo.https==true){var M=(serverinfo.port==443)?"":(":"+serverinfo.port);ac="https://"+V+M+domainUrl+"agentinvite?c="+v.cookie}else{var M=(serverinfo.port==80)?"":(":"+serverinfo.port);ac="http://"+V+M+domainUrl+"agentinvite?c="+v.cookie}Q("agentInvitationLink").href=ac;var aa=v.expire+" hour"+addLetterS(v.expire);if(v.expire==24){aa="1 day"}if(v.expire==168){aa="1 week"}if(v.expire==5040){aa="1 month"}if(v.expire==0){aa="Unlimited"}QH("agentInvitationLink","Invitation Link ("+aa+")");QV("agentInvitationLinkDiv",true);break;case"getmqttlogin":if((currentNode==null)||(currentNode._id!=v.nodeid)||(xxdialogMode!=null)){return}var ae="These settings can be used to connect MQTT for this device.
Connectivity"}for(var t in nodes){var E=nodes[t];if(E.v==false){continue}var z=meshes[E.meshid],B=z.links[userinfo._id];if(B==null){continue}var C=B.rights;if((O==3)&&(z.mtype==1)){continue}if(sort==0){if(E.meshid!=g){deviceHeaderSet();var o="";if(O==2){G+="
"}if(meshes[E.meshid].mtype==1){o=", Intel® AMT only"}if((O==1)&&(g!=null)){if(a==2){G+="
";x.push(E._id)}}}}if((sort==3)&&(G!="")){if(E.tags){for(var w in E.tags){var K=E.tags[w];if(s[K]==null){s[K]=G;p[K]=1}else{s[K]+=G;p[K]+=1}if(O==3){break}}}G=""}deviceHeaderTotal++;if(typeof deviceHeaderCount[E.state]=="undefined"){deviceHeaderCount[E.state]=1}else{deviceHeaderCount[E.state]++}}if(sort==3){if(O==2){G="
User
Address
Connectivity"}var q=[];for(var t in s){q.push(t)}q.sort(function(c,j){return c.toLowerCase().localeCompare(j.toLowerCase())});for(var w in q){var t=q[w];if(O==2){G+="
No devices are included in any groups, click on a device\'s "Groups" to add to a group.
'}else{G='
No devices matching this search.
'}}if((O==1)&&(a==2)){G+="
"}if((sort==0)&&(Q("SearchInput").value=="")&&(O<3)){for(var t in meshes){var y=meshes[t],A=y.links[userinfo._id];if(A!=null){var C=A.rights;if(l[y._id]==null){if((g!="")&&(G!="")){G+="
";QH("xdevices",G);deviceHeaderSet();var m=document.getElementsByClassName("DeviceCheckbox"),b=0;if(d){for(var t=0;t=0)}}for(var t in deviceHeaders){QH(t,deviceHeaders[t])}for(var t in deviceHeadersTitles){Q(t).title=deviceHeadersTitles[t]}p1updateInfo();if(O==3){var P=[{x:180,y:101},{x:302,y:169},{x:454,y:255}][Q("sizeselect").selectedIndex];var H=P.x+2,N=M-5,R=Math.floor(N/H);R=H+Math.floor((N-(R*H))/R);P.y=P.y*(R/P.x);P.x=R;for(var t in multiDesktop){multiDesktop[t].xxdelete=true}for(var t in x){var v=x[t],I=v.split("/")[2],h=multiDesktop[v];if(h!=null){h.m.CanvasId.setAttribute("style","background-color:black;width:"+P.x+"px;height:"+P.y+"px");Q("xkvmid_"+I).appendChild(h.m.CanvasId);delete h.xxdelete;QH("skvmid_"+I,["Disconnected","Connecting...","Setup...","",""][((h.m.State==null)?h.m.state:h.m.State)])}else{var E=getNodeFromId(v);if((desktopNode==E)&&(desktop!=null)){var a=desktop.m.CanvasId;a.setAttribute("id","kvmid_"+I);a.setAttribute("style","background-color:black;width:"+P.x+"px;height:"+P.y+"px");a.setAttribute("onclick","toggleKvmDevice('"+v+"')");a.removeAttribute("onmousedown");a.removeAttribute("onmouseup");a.removeAttribute("onmousemove");Q("xkvmid_"+I).appendChild(a);QH("skvmid_"+I,["Disconnected","Connecting...","Setup...","",""][((desktop.m.State==null)?desktop.m.state:desktop.m.State)]);if(desktop.m.SendCompressionLevel){desktop.m.SendCompressionLevel(1,multidesktopsettings.quality,multidesktopsettings.scaling,multidesktopsettings.framerate)}desktop.shortid=I;desktop.onStateChanged=onMultiDesktopStateChange;multiDesktop[v]=desktop;desktop=desktopNode=currentNode=null;QH("DeskParent",'')}else{var a=document.createElement("canvas");a.setAttribute("id","kvmid_"+I);a.setAttribute("width",640);a.setAttribute("height",480);a.setAttribute("oncontextmenu","return false");a.setAttribute("style","background-color:black;width:"+P.x+"px;height:"+P.y+"px");a.setAttribute("onclick","toggleKvmDevice('"+v+"')");try{Q("xkvmid_"+I).appendChild(a)}catch(n){}if(Q("autoConnectDesktopCheckbox").checked==true){setTimeout(function(){connectMultiDesktop(E,1)},100)}}}}for(var t in multiDesktop){if(multiDesktop[t].xxdelete==true){multiDesktop[t].Stop();delete multiDesktop[t]}else{if(debugmode&&multiDesktop[t].m&&multiDesktop[t].m.onScreenSizeChange){mdeskAdjust(multiDesktop[t].m,multiDesktop[t].m.ScreenWidth,multiDesktop[t].m.ScreenHeight,multiDesktop[t].m.CanvasId)}}}deskAdjust()}else{disconnectAllKvmFunction();Q("autoConnectDesktopCheckbox").checked=false}}oldviewmode=O}function toggleKvmDevice(d){var c=getNodeFromId(d),a=meshes[c.meshid],b=a.links[userinfo._id].rights;if((b&8)||(b&256)){if(c.conn&1){connectMultiDesktop(c,1)}}}function getUserShortStr(b){if(b==null||b.users==null||b.users.length==0){return""}if(b.users.length>1){return''+b.users.length+" users"}var d=b.users[0],c=d,a=d.indexOf("\\");if(a>0){c=d.substring(a+1)}c=EscapeHtml(c);if(c.length>15){c=c.substring(0,14)+"…"}return''+c+""}function autoConnectDesktops(){if(Q("autoConnectDesktopCheckbox").checked==true){connectAllKvmFunction()}}function connectAllKvmFunction(){for(var a in nodes){if(multiDesktop[nodes[a]._id]==null){toggleKvmDevice(nodes[a]._id)}}}function disconnectAllKvmFunction(){for(var a in multiDesktop){multiDesktop[a].Stop()}multiDesktop={}}function onMultiDesktopStateChange(a,c){try{QH("skvmid_"+a.shortid,["Disconnected","Connecting...","Setup...","",""][c])}catch(b){}}function showMultiDesktopSettings(){QV("d7amtkvm",false);QV("d7meshkvm",true);d7bitmapquality.value=multidesktopsettings.quality;d7bitmapscaling.value=multidesktopsettings.scaling;if(multidesktopsettings.framerate){d7framelimiter.value=multidesktopsettings.framerate}else{d7framelimiter.value=1000}setDialogMode(7,"Remote Desktop Settings",3,showMultiDesktopSettingsChanged)}function showMultiDesktopSettingsChanged(){multidesktopsettings.quality=d7bitmapquality.value;multidesktopsettings.scaling=d7bitmapscaling.value;multidesktopsettings.framerate=d7framelimiter.value;localStorage.setItem("multidesktopsettings",JSON.stringify(multidesktopsettings));for(var a in multiDesktop){multiDesktop[a].m.SendCompressionLevel(1,multidesktopsettings.quality,multidesktopsettings.scaling,multidesktopsettings.framerate)}}function connectMultiDesktop(c,a){var d=c._id,e=d.split("/")[2];var b=multiDesktop[d];if(b==null){if(Q("kvmid_"+e)==null){return}if(a==2){if((c.intelamt.user==null)||(c.intelamt.user=="")){return}b=CreateAmtRedirect(CreateAmtRemoteDesktop("kvmid_"+e),authCookie);b.shortid=e;b.onStateChanged=onMultiDesktopStateChange;b.m.bpp=1;b.m.useZRLE=true;b.m.showmouse=true;b.m.onKvmData=function(g){console.log("KVM Data received in multi-desktop mode, this is not supported.")};if(debugmode>0){b.m.onScreenSizeChange=mdeskAdjust}b.Start(d,16994,"*","*",0);b.contype=2;multiDesktop[d]=b}else{if(a==1){b=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("kvmid_"+e),serverPublicNamePort,authCookie,domainUrl);b.shortid=e;b.attemptWebRTC=attemptWebRTC;b.onStateChanged=onMultiDesktopStateChange;b.m.CompressionLevel=multidesktopsettings.quality;b.m.ScalingLevel=multidesktopsettings.scaling;b.m.FrameRateTimer=multidesktopsettings.framerate;if(debugmode>0){b.m.onScreenSizeChange=mdeskAdjust}b.Start(d);b.contype=1;multiDesktop[d]=b}}}else{b.Stop();delete multiDesktop[d]}}function getMeshActions(a,b){if((b&4)==0){return""}var c="";if((features&1024)==0){c+=' Add CIRA"}if(a.mtype==1){if((features&1)==0){c+=' Add Local";c+=' Scan Network"}if(a.amt&&(a.amt.type==2)){c+=' Activation"}else{if(a.amt&&(a.amt.type==3)&&((features&1048576)!=0)){c+=' Activation"}}}if(a.mtype==2){c+=' Add Agent";if((features&2)==0){c+=' Invite"}}return c}function addDeviceToMesh(b){if(xxdialogMode){return false}var a=meshes[b];var c='Add a new Intel® AMT device to device group "'+EscapeHtml(a.name)+'".
';c+=addHtmlValue("Device Name","");c+=addHtmlValue("Hostname",'');c+=addHtmlValue("Username",'');c+=addHtmlValue("Password","");c+=addHtmlValue("Security","");setDialogMode(2,"Add Intel® AMT device",3,addDeviceToMeshEx,c,b);validateDeviceToMesh();Q("dp1devicename").focus();return false}function showCcmActivation(c){if(xxdialogMode){return false}var e=serverinfo.name,b=meshes[c];if((e.indexOf(".")==-1)||((features&2)!=0)){e=window.location.hostname}var g,a=domainUrl.substring(0,domainUrl.length-1);if(serverinfo.https==true){var d=(serverinfo.port==443)?"":(":"+serverinfo.port);g="wss://"+e+d+domainUrl}else{var d=(serverinfo.port==80)?"":(":"+serverinfo.port);g="ws://"+e+d+domainUrl}var h='Perform Intel AMT client control mode (CCM) activation to group "'+EscapeHtml(b.name)+'" by downloading the MeshCMD tool and running it like this:
';h+="";setDialogMode(2,"Intel® AMT activation",9,null,h);Q("idx_dlgOkButton").focus();return false}function showAcmActivation(c){if(xxdialogMode){return false}var e=serverinfo.name,b=meshes[c];if((e.indexOf(".")==-1)||((features&2)!=0)){e=window.location.hostname}var g,a=domainUrl.substring(0,domainUrl.length-1);if(serverinfo.https==true){var d=(serverinfo.port==443)?"":(":"+serverinfo.port);g="wss://"+e+d+domainUrl}else{var d=(serverinfo.port==80)?"":(":"+serverinfo.port);g="ws://"+e+d+domainUrl}var h='Perform Intel AMT admin control mode (ACM) activation to group "'+EscapeHtml(b.name)+'" by downloading the MeshCMD tool and running it like this:
';h+="";if(serverinfo.amtAcmFqdn!=null){h+="
Intel AMT will need to be set with a Trusted FQDN in MEBx or have a wired LAN on the network: "+serverinfo.amtAcmFqdn.join(", ")+"
"}setDialogMode(2,"Intel® AMT activation",9,null,h);Q("idx_dlgOkButton").focus();return false}function addAmtScanToMesh(a){if(xxdialogMode){return false}var b="Enter a range of IP addresses to scan for Intel AMT devices.
";b+=addHtmlValue("IP Range",'');b+='';setDialogMode(2,"Scan for Intel® AMT devices",3,addAmtScanToMeshEx,b,a);QE("idx_dlgOkButton",false);QH("dp1results","
Sample IP range values 192.168.0.100 192.168.1.0/24 192.167.0.1-192.168.0.100
To add a new Intel® AMT device to device group "'+EscapeHtml(a.name)+"\" with CIRA, download the following script files and use MeshCommander to run the script to configure computers.
To add a new Intel® AMT device to device group "'+EscapeHtml(a.name)+'" with CIRA, load the following certificate as trusted root within Intel AMT';if(serverinfo.mpspass){d+=" and authenticate to the server using this username and password.
"}else{d+=" and authenticate to the server using this username and any password.
To add a new Intel® AMT device to device group "'+EscapeHtml(a.name)+'" 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.
"}setDialogMode(2,"Add Intel® AMT CIRA device",2,null,d,"fileDownload");Q("dlgAddCiraSel").focus();return false}function dlgAddCiraSelClick(){var a=Q("dlgAddCiraSel").value;QV("dlgAddCira0",a==0);QV("dlgAddCira1",a==1);QV("dlgAddCira2",a==2)}function checkEmail(c){var d=c.split("@");var b=((d.length==2)&&(d[0].length>0)&&(d[1].split(".").length>1)&&(d[1].length>2));if(b==true){var e=d[1].split(".");for(var a in e){if(e[a].length==0){b=false}}}return b}function inviteAgentToMesh(b){if(xxdialogMode){return false}var c="",a=meshes[b];if(features&64){c+=addHtmlValue("Invitation Type","")+"";c+='
Invite someone to install the mesh agent. An email with be sent with the link to the mesh agent installation for the "'+EscapeHtml(a.name)+'" device group.
Invite someone to install the mesh agent by sharing an invitation link. This link points the user to installation instructions for the "'+EscapeHtml(a.name)+'" device group. The link is public and no account for this server is needed.
To add a new computer to device group "'+EscapeHtml(c.name)+'", download the mesh agent and install it the computer to manage. This agent has server and device group information embedded within it.
To add a computer to "+EscapeHtml(c.name)+" run the following command. Root credentials will be needed. ";j+="";j+="
* For BSD, run \"pkg install wget sudo bash\" first.
";j+='
To add a new computer to device group "'+EscapeHtml(c.name)+'", download the mesh agent and install it the computer to manage. This agent installer has server and device group information embedded within it.
"}QV("xmapSearchResultsDlg",true)}QH("xmapSearchResults",k)}catch(d){}}function mapGotoSelectedLocation(c){var d=c.children;var a=d[1].innerHTML.split("!#!");var b=[parseFloat(a[2]),parseFloat(a[0]),parseFloat(a[3]),parseFloat(a[1])];zoomToExtent(b);mapCloseSearchWindow()}function mapCloseSearchWindow(){QH("xmapSearchResults","");QV("xmapSearchResultsDlg",false)}function zoomToLocation(a,c){var b=xxmap.map.getView();b.setCenter(a);b.setZoom(c)}function zoomToFitExtent(){var b=xxmap.markersSource.getFeatures();if(b.length>0){var a=xxmap.markersSource.getExtent();xxmap.map.getView().fit(a,xxmap.map.getSize())}}function zoomToExtent(b){var a=ol.proj.transformExtent(b,ol.proj.get("EPSG:4326"),ol.proj.get("EPSG:3857"));xxmap.map.getView().fit(a,xxmap.map.getSize())}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 currentNode;var powerTimelineNode=null;var powerTimelineReq=null;var powerTimelineUpdate=null;var powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(t,v,A,k){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" tab 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" tab and look at the "Account Security" section.');return}if(k&&(k.shiftKey==true)){window.open(window.location.origin+"?node="+t.split("/")[2]+"&viewmode=10&hide=16","meshcentral:"+t);return}var s=getNodeFromId(t);var p=meshes[s.meshid];var q=p.links[userinfo._id].rights;if(!currentNode||currentNode._id!=s._id||A==true){currentNode=s;var r=EscapeHtml(s.name);if(r.length==0){r="None"}if(((q&4)!=0)&&((!p.flags)||((p.flags&2)==0))){r=''+r+' '}r+=" - "+EscapeHtml(p.name)+"";QH("p10deviceName",r);QH("p11deviceName",r);QH("p12deviceName",r);QH("p13deviceName",r);QH("p14deviceName",r);QH("p15deviceName","Console - "+r);QH("p16deviceName",r);QH("p17deviceName",r);var E="
";E+=addDeviceAttribute('Group',''+EscapeHtml(meshes[s.meshid].name)+"");if((s.rname!=null)&&(s.name!=s.rname)){E+=addDeviceAttribute('Name',''+EscapeHtml(s.rname)+"")}if((features&1)==0){if((q&4)!=0){if(s.host){E+=addDeviceAttribute("Hostname",""+EscapeHtml(s.host)+"")}else{E+=addDeviceAttribute("Hostname","None")}}else{E+=addDeviceAttribute("Hostname",EscapeHtml(s.host))}}var j=s.desc?EscapeHtml(s.desc):"None";if((q&4)!=0){E+=addDeviceAttribute("Description",""+j+' ')}else{E+=addDeviceAttribute("Description",j)}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((s.agent!=null)&&(s.agent.id!=null)&&(s.agent.ver!=null)){var B="";if(s.agent.id<=a.length){B=a[s.agent.id]}else{B=a[0]}if(s.agent.ver!=0){B+=" v"+s.agent.ver}E+=addDeviceAttribute("Mesh Agent",B)}if(s.intelamt!=null){var B="";var z={0:"Not Activated (Pre)",1:"Not Activated (In)",2:"Activated"};if(s.intelamt.ver!=null&&s.intelamt.state==null){B+="Unknown State, v"+s.intelamt.ver}else{if((s.intelamt.ver==null)&&(s.intelamt.state==2)){B+="Activated"}else{if((s.intelamt.ver==null)||(s.intelamt.state==null)){B+="Unknown Version & State"}else{B+=z[s.intelamt.state];if((s.intelamt.state==2)&&s.intelamt.flags){if(s.intelamt.flags&2){B+=' CCM'}else{if(s.intelamt.flags&4){B+=' ACM'}}}B+=(", v"+s.intelamt.ver)}}}if(s.intelamt.tls==1){B+=', TLS'}if(s.intelamt.state==2){if(s.intelamt.user==null||s.intelamt.user==""){if((q&4)!=0){B+=', No Credentials'}else{B+=", No Credentials"}}B+=" ";if((q&4)!=0){B+=''}}var o='Intel® ME';if(typeof s.intelamt.sku=="number"){if((s.intelamt.sku&8)!=0){o='Intel® AMT'}else{if((s.intelamt.sku&16)!=0){o='Intel® SM'}}}E+=addDeviceAttribute(o,B)}if(p.mtype==2){if((s.agent!=null)&&(s.agent.tag!=null)){var C=EscapeHtml(s.agent.tag);if(C.startsWith("mailto:")){C=''+C.substring(7)+""}E+=addDeviceAttribute("Agent Tag",C)}}else{if((s.intelamt!=null)&&(s.intelamt.tag!=null)){var C=EscapeHtml(s.intelamt.tag);if(C.startsWith("mailto:")){C=''+C.substring(7)+""}E+=addDeviceAttribute("Intel® AMT Tag",C)}}if(s.osdesc){E+=addDeviceAttribute("Operating System",s.osdesc)}if(s.av&&s.av.length>0){var F=[];for(var n in s.av){if(s.av[n].product){var d=EscapeHtml(s.av[n].product);if(s.av[n].enabled!==true){d+=" - Disabled"}if(s.av[n].updated!==true){d+=" - Out of date"}if((s.av[n].enabled==true)&&(s.av[n].updated==true)){d+=" - OK"}F.push(d)}}E+=addDeviceAttribute("Antivirus",F.join(" "))}if(s.users&&s.conn&&(s.users.length>0)&&(s.conn&1)){E+=addDeviceAttribute("Active User"+((s.users.length>1)?"s":""),s.users.join(", "))}var e=s.conn;if(e&&e>1){var h=[];if((s.conn&1)!=0){h.push('Mesh Agent')}if((s.conn&2)!=0){h.push('Intel® AMT CIRA')}else{if((s.conn&4)!=0){h.push('Intel® AMT')}}if((s.conn&8)!=0){h.push('Mesh Relay')}if((s.conn&16)!=0){h.push('MQTT')}E+=addDeviceAttribute("Connectivity",h.join(", "))}var m="None";if(s.tags!=null){m="";for(var n in s.tags){m+=''+s.tags[n]+""}}if((q&4)!=0){E+=addDeviceAttribute("Tags",""+m+' ')}else{E+=addDeviceAttribute("Tags",m)}E+="
";QH("p10html3",E);var w=PowerStateStr(s.state);if((e&1)!=0){if(w.length>0){w+=" "}w+='Agent connected'}if((e&2)!=0){if(w.length>0){w+=" "}w+='Intel® AMT connected'}else{if((e&4)!=0){if(w.length>0){w+=" "}w+='Intel® AMT detected'}}if((e&16)!=0){if(w.length>0){w+=" "}w+='MQTT channel connected'}if((w=="")&&s.lastconnect){w="Last seen: "+printDateTime(new Date(s.lastconnect))+""}QH("MainComputerState",w);Q("MainComputerImage").setAttribute("src","images/icons256-"+s.icon+"-1.png");Q("MainComputerImage").className=((!s.conn)||(s.conn==0)?"gray":"");var D=((q==4294967295)||((q&512)==0));var l=((q==4294967295)||((q&1024)==0));var b=((q==4294967295)||((q&2048)==0));if(D){setupTerminal()}if(l){setupFiles()}var g=((q&16)!=0);if(g){setupConsole()}else{if(v==15){v=10}}QV("MainDevDesktop",(((p.mtype==1)&&((typeof s.intelamt.sku!=="number")||((s.intelamt.sku&8)!=0)))||((p.mtype==2)&&((s.agent==null)||(s.agent.caps==null)||((s.agent.caps&1)!=0)||(s.intelamt&&(s.intelamt.state==2)))))&&((q&8)||(q&256)));QV("MainDevTerminal",((p.mtype==1)||(s.agent==null)||(s.agent.caps==null)||((s.agent.caps&2)!=0)||(s.intelamt&&(s.intelamt.state==2)))&&(q&8)&&D);QV("MainDevFiles",((p.mtype==2)&&((s.agent==null)||(s.agent.caps==null)||((s.agent.caps&4)!=0)))&&(q&8)&&l);QV("MainDevAmt",(s.intelamt!=null)&&((s.intelamt.state==2)||(s.conn&2))&&(q&8)&&b);QV("MainDevConsole",(g&&(p.mtype==2)&&((s.agent==null)||(s.agent.caps==null)||((s.agent.caps&8)!=0)))&&(q&8));QV("p15uploadCore",(s.agent!=null)&&(s.agent.caps!=null)&&((s.agent.caps&16)!=0));QH("p15coreName",((s.agent!=null)&&(s.agent.core!=null))?s.agent.core:"");var c=Q("p14iframe").contentWindow.getCurrentMeshNode();if((c!=null)&&(c._id!=currentNode._id)){Q("p14iframe").contentWindow.disconnect()}var u=((s.conn&6)!=0)?true:false;Q("p14iframe").contentWindow.setConnectionState(u);Q("p14iframe").contentWindow.setFrameHeight("650px");Q("p14iframe").contentWindow.setAuthCallback(updateAmtCredentials);QV("deskActionsBtn",(q&72)!=0);QV("termActionsBtn",(q&72)!=0);QV("filesActionsBtn",(q&72)!=0);if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id});meshserver.send({action:"lastconnect",nodeid:currentNode._id});meshserver.send({action:"getsysinfo",nodeid:currentNode._id});QH("p17info","")}QV("DeskTools",false);showDeskToolsProcesses();refreshDeviceEvents();if((currentNode)&&(xxcurrentView>=10)&&(xxcurrentView<20)){document.title=decodeURIComponent("{{{extitle}}}")+" - "+currentNode.name+" - "+p.name}else{document.title=decodeURIComponent("{{{extitle}}}")}p11clearConsoleMsg();p12clearConsoleMsg();p13clearConsoleMsg()}setupDesktop();if(!v){v=10}go(v)}function showNotes(b,a){if(xxdialogMode){return}setDialogMode(2,"Notes",2,showNotesEx,"Device group notes can be viewed and changed by other device group administrators.",a);meshserver.send({action:"getNotes",id:decodeURIComponent(a)})}function showNotesEx(a,b){meshserver.send({action:"setNotes",id:decodeURIComponent(b),notes:encodeURIComponent(Q("d2devNotes").value)})}function deviceChat(){if(xxdialogMode){return}var a="/messenger?id=meshmessenger/"+encodeURIComponent(currentNode._id)+"/"+encodeURIComponent(userinfo._id)+"&title="+currentNode.name;if((authCookie!=null)&&(authCookie!="")){a+="&auth="+authCookie}window.open(a,"meshmessenger:"+currentNode._id);meshserver.send({action:"meshmessenger",nodeid:decodeURIComponent(currentNode._id)})}function deviceUrlFunction(){if(xxdialogMode){return}setDialogMode(2,"Open Page on Device",3,deviceUrlFunctionEx,'');Q("d2devurl").focus()}function deviceUrlFunctionEx(){meshserver.send({action:"msg",type:"openUrl",nodeid:currentNode._id,url:Q("d2devurl").value})}function deviceToastFunction(){if(xxdialogMode){return}setDialogMode(2,"Device Notification",3,deviceToastFunctionEx,"");Q("d2devToast").focus()}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links[userinfo._id].rights;var b="Select an operation to perform on this device.
";var c="";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{if(a==103){p10showSendMqttMsgDialog([currentNode._id])}else{meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:parseInt(a)})}}}function updateAmtCredentials(a){var b=getNodeFromId(currentNode._id);if((a==true)||(b.intelamt.user==null)||(b.intelamt.user=="")){editDeviceAmtSettings(currentNode._id,updateAmtCredentialsEx)}else{Q("p14iframe").contentWindow.connectButtonfunctionEx()}}function updateAmtCredentialsEx(a,b){Q("p14iframe").contentWindow.connectButtonfunctionEx()}function updateDeviceTimeline(){if((meshserver.State!=2)||(powerTimelineNode==null)||(powerTimelineUpdate==null)||(currentNode==null)){return}if((powerTimelineNode==powerTimelineReq)&&(currentNode._id==powerTimelineNode)&&(powerTimelineUpdate19)){return}var s=null,o=Date.now();if(currentNode._id==powerTimelineNode){s=powerTimeline}var e=new Date();e.setHours(0,0,0,0);e=new Date(e.getTime()-(1000*60*60*24*6));var u=e.getTime();var t=[];if(s!=null&&s.length>1){t.push([0,s[1],s[0]]);var c=s[1];for(var m=2;m(m+1)){k=s[m+1]}t.push([c,c+k,p]);c=c+k}}var A="",b=1,h=new Date();var w=Q("masthead").offsetWidth-(160+9+9+14);h.setHours(0,0,0,0);for(var m=0;m<7;m++){var g="",q=h.getTime(),l=q+(1000*60*60*24);for(var n in t){var a=t[n];if(isTimeBlockInside(q,l,a[0],a[1])==true){var y=Math.max(q,a[0]);var r=Math.min(Math.min(l,a[1]),o);var z=Math.round(((r-y)*w)/86400000);if(z>0){var v=powerStateStrings2[a[2]]+" from "+printTime(new Date(y))+" to "+printTime(new Date(r))+".";g+=''}}}A+="
"}function editDeviceAmtSettings(g,c,a){if(xxdialogMode){return}var h="",e=getNodeFromId(g),b=3,d=getNodeRights(g);if((d&4)==0){return}h+=addHtmlValue("Username",'');h+=addHtmlValue("Password","");h+=addHtmlValue("Security","");if((e.intelamt.user!=null)&&(e.intelamt.user!="")){b=7}setDialogMode(2,"Edit Intel® AMT credentials",b,editDeviceAmtSettingsEx,h,{node:e,func:c,arg:a});if((e.intelamt.user!=null)&&(e.intelamt.user!="")){Q("dp10username").value=e.intelamt.user}else{Q("dp10username").value="admin"}Q("dp10tls").value=e.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(function(){d.func(null,d.arg)},300)}}}function p10showSendMqttMsgDialog(a){if(xxdialogMode){return false}var b=addHtmlValue("Topic","");b+=addHtmlValue("Message","");setDialogMode(2,"Send MQTT message",3,p10showSendMqttMsgDialogEx,b,a);p10validateSendMqttMsgDialog();Q("dp2topic").focus();return false}function p10validateSendMqttMsgDialog(){QE("idx_dlgOkButton",(Q("dp2topic").value.length>0)&&(Q("dp2msg").value.length>0))}function p10showSendMqttMsgDialogEx(a,c){meshserver.send({action:"sendmqttmsg",nodeids:c,topic:Q("dp2topic").value,msg:Q("dp2msg").value})}function p10showChangeGroupDialog(e){if(xxdialogMode){return false}var g=null;if(e.length==1){try{g=meshes[getNodeFromId(e[0])]._id}catch(b){}}var j="";if(a>0){var h=(e.length==1)?"Select a new group for this device
":"Select a new group for selected devices
";h+=addHtmlValue("New Device Group",j);setDialogMode(2,"Change Group",3,p10showChangeGroupDialogEx,h,e)}else{setDialogMode(2,"Change Group",1,null,"No other device group of same type exists.")}return false}function p10showChangeGroupDialogEx(a,c){meshserver.send({action:"changeDeviceMesh",nodeids:c,meshid:Q("p10newGroup").value})}function p10showDeleteNodeDialog(a){if(xxdialogMode){return false}var b='Are you sure you want to delete node "'+EscapeHtml(currentNode.name)+'"?
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.
"}if(a==1){c+='
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.
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.
";a+='';setDialogMode(2,"Remote Keyboard Entry",3,showDeskTypeEx,a);Q("d2typeText").focus()}var AmtDeskTypeTimer=null;var AmtDeskTypeContent=null;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};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};function showDeskTypeEx(){var j=Q("d2typeText").value,g=Q("d2typeText").value.toUpperCase(),k=[],h=false;if(desktop.contype==2){for(var e in j){var c=j.charCodeAt(e);k.push([c,1],[c,0])}AmtDeskTypeContent=k;AmtDeskTypeTimer=setInterval(function(){var a=AmtDeskTypeContent.shift();if(desktop){desktop.m.sendkey(a[0],a[1])}if((desktop==null)||(AmtDeskTypeContent.length==0)){clearInterval(AmtDeskTypeTimer);AmtDeskTypeContent=null}},10)}else{for(var e in j){var c=j.charCodeAt(e),d=g.charCodeAt(e);if(((c>=65)&&(c<=90))||((c>=97)&&(c<=122))){if((c==d)&&(h==false)){k.push([desktop.m.KeyAction.DOWN,16]);h=true}if((c!=d)&&(h==true)){k.push([desktop.m.KeyAction.UP,16]);h=false}}else{if((c>=48)&&(c<=57)){if(h==true){k.push([desktop.m.KeyAction.UP,16]);h=false}}else{if(DeskTypeTranslate[c]){if(h==true){k.push([desktop.m.KeyAction.UP,16]);h=false}d=DeskTypeTranslate[c]}else{if(DeskTypeShiftTranslate[c]){if(h==false){k.push([desktop.m.KeyAction.DOWN,16]);h=true}d=DeskTypeShiftTranslate[c]}}}}k.push([desktop.m.KeyAction.DOWN,d],[desktop.m.KeyAction.UP,d])}if(h==true){k.push([desktop.m.KeyAction.UP,16]);h=false}desktop.m.SendKeyMsgKC(k)}}function showDeskClip(){if(xxdialogMode||desktop==null||desktop.State!=3){return}Q("DeskClip").blur();var a="";a+='';a+='';a+='';a+='';a+='
"}}QH("DeskToolsProcesses",l)}}function showDeskToolsServices(g){deskTools.smsg=g;if(g==null){QH("DeskToolsProcesses","");return}if(Q("DeskTools").nodeid!=g.nodeid){return}QV("deskToolsTopTabService",true);var h=[],j=null;try{j=JSON.parse(g.value)}catch(b){}deskTools.services=j;if(j!=null){for(var d in j){if(j[d].status){h.push({p:capitalizeFirstLetter(j[d].status.state.toLowerCase()),d:j[d].displayName,i:d})}else{if(j[d].serviceType){h.push({p:j[d].serviceType,d:j[d].name,i:d})}}}if(deskTools.ssort==0){h.sort(sortProcessPid)}else{if(deskTools.ssort==1){h.sort(sortProcessName)}}var k="";for(var d in h){if(h[d].p!=0){var a=h[d].d;if(a.length>30){a=''+a.substring(0,30)+"..."}k+="
"}QH("p16events",h)}function refreshDeviceEvents(){meshserver.send({action:"events",nodeid:currentNode._id,limit:parseInt(p16limitdropdown.value)})}function showEventDetails(b,d){var a,g;if(d==1){a=currentDeviceEvents}if(d==2){a=events}if(d==3){a=currentUserEvents}for(var c in a){if(a[c].h==b){g=a[c];break}}if(g){if(xxdialogMode){return false}var e="
";for(var c in g){if((c=="h")||(c=="_id")||(c=="ids")||(c=="domain")||(g[c]==null)||(typeof g[c]=="object")){continue}e+=addHtmlValue3(EscapeHtml(c),EscapeHtml(g[c]))}e+="
";setDialogMode(2,"Event Details",9,null,e)}}function agentConsoleHandleKeys(b){if((b.ctrlKey)||(b.altKey)){return true}var d=0,a=Q("p15consoleText");if(b.key){if(b.keyCode==13&&consoleFocus==0){p15consoleSend(b);d=1}else{if(b.keyCode==8&&consoleFocus==0){var g=a.value;a.value=g.substring(0,g.length-1);d=1}else{if(b.keyCode==27){a.value="";d=1}else{if((b.keyCode==38)||(b.keyCode==40)){var c=consoleHistory.indexOf(a.value);if((b.keyCode==38)&&((consoleHistory.length-1)>c)){a.value=consoleHistory[c+1]}else{if((b.keyCode==40)&&(c>0)){a.value=consoleHistory[c-1]}else{if((b.keyCode==40)&&(c==0)){a.value=""}}}d=1}else{if(b.key.length===1){insertTextAtCursor(a,b.key);d=1}}}}}}else{if(b.charCode!=0&&consoleFocus==0){a.value=((a.value+String.fromCharCode(b.charCode)));d=1}}if(d>0){return haltEvent(b)}}function insertTextAtCursor(a,d){if(document.selection){a.focus();sel=document.selection.createRange();sel.text=d}else{if(a.selectionStart||a.selectionStart=="0"){var c=a.selectionStart,b=a.selectionEnd;a.value=a.value.substring(0,c)+d+a.value.substring(b,a.value.length);a.setSelectionRange(b+1,b+1)}else{a.value+=myValue}}}var consoleNode;var consoleServerText="";function setupConsole(){if(xxcurrentView==115){var e=(consoleNode=="server");consoleNode="server";QH("p15deviceName","My Server Console");QE("p15consoleText",true);QH("p15statetext","");QH("p15coreName","");QV("p15outputselecttd",false);if(e==false){QH("p15agentConsoleText",consoleServerText);Q("p15agentConsoleText").scrollTop=Q("p15agentConsoleText").scrollHeight}}else{var e=(consoleNode==currentNode);consoleNode=currentNode;var a=meshes[consoleNode.meshid];var b=a.links[userinfo._id].rights;if((b&16)!=0){if(consoleNode.consoleText==null){consoleNode.consoleText=""}if(e==false){QH("p15agentConsoleText",consoleNode.consoleText);Q("p15agentConsoleText").scrollTop=Q("p15agentConsoleText").scrollHeight}var c=(((consoleNode.conn&1)!=0)||((consoleNode.conn&16)!=0))?true:false;var d=((consoleNode.conn&1)!=0)?"Agent is online":"Agent is offline";if((consoleNode.conn&16)!=0){d+=", MQTT is online"}QH("p15statetext",d);QE("p15consoleText",c);QE("p15uploadCore",c);QV("p15outputselecttd",(consoleNode.conn&17)==17)}else{QH("p15statetext","Access Denied");QE("p15consoleText",false);QE("p15uploadCore",false);QV("p15outputselecttd",false)}}}function p15consoleClear(){QH("p15agentConsoleText","");Q("id_p15consoleClear").blur();if(xxcurrentView==115){consoleServerText=""}else{consoleNode.consoleText=""}}var consoleHistory=[];function p15consoleSend(a){if(a&&a.keyCode!=13){return}var d=Q("p15consoleText").value,c="
","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||((features&4096)==0)){return false}if((userinfo.otpsecret==1)||(userinfo.otphkeys>0)){meshserver.send({action:"otpauth-getpasswords",subaction:a})}return false}function account_manageHardwareOtp(){if((xxdialogMode==2)&&(xxdialogTag=="otpauth-hardware-manage")){dialogclose(0)}if(xxdialogMode||((features&4096)==0)){return false}meshserver.send({action:"otp-hkey-get"});return false}function account_addhkey(a){if(a==3){var b="Type in the name of the key to add.
";b+=addHtmlValue("Key Name",'')}else{if(a==2){var b="Type in a key name, select the OTP box and press the button on the YubiKey™.
Please wait a few minute to receive the verification.";setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,a);return false}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){if(xxdialogMode){return false}var a="Change your account email address here.
";a+=addHtmlValue("Email","");setDialogMode(2,"Email Address Change",3,account_changeEmail,a);if(userinfo.email!=null){Q("dp2email").value=userinfo.email}account_validateEmail();Q("dp2email").focus();return false}function account_validateEmail(a,b){QE("idx_dlgOkButton",validateEmail(Q("dp2email").value)&&(Q("dp2email").value!=userinfo.email));if((a!=null)&&(a.keyCode==13)){dialogclose(1)}}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp2email").value})}function account_showDeleteAccount(){if(xxdialogMode){return false}var a="To delete this account, type in the account password in both boxes below and hit ok.
";a+="";setDialogMode(2,"Delete Account",0,null,a);account_validateDeleteAccount();Q("apassword1").focus();return false}function account_showChangePassword(){if(xxdialogMode){return false}var d="Change your account password by entering the old password and new password twice in the boxes below.";if(features&65536){" Password hint can be used but is not recommanded."}d+="
";d+="
";d+="
Old password:
";d+="
New password:
";d+="
New password:
";if(features&65536){d+="
Password hint:
"}d+="
";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+=" Requirements: "+b.join(", ")+"."}}d+=" ";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 false}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 false}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" tab to change and verify an email address.');return false}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" tab and look at the "Account Security" section.');return false}var a="Create a new device group using the options below.
"}meshcount=b;QH("p2meshes",e);QV("p2noMeshFound",b==0)}function gotoMesh(a){currentMesh=meshes[a];p20updateMesh();go(20);return false}function server_showRestoreDlg(){if(xxdialogMode){return false}var a="Restore the server using a backup, this will delete the existing server data. Only do this if you know what you are doing.
';var b=1,p=[];for(var e in currentMesh.links){var s=e.split("/")[2];if(currentMesh.links[e].name){s=currentMesh.links[e].name}if(e==userinfo._id){s=userinfo.name}p.push({id:e,name:s,rights:currentMesh.links[e].rights})}p.sort(function(r,u){if(r.name>u.name){return 1}if(r.name'}t+='
"}QH("p20info",t)}function p20editMeshAmt(){if(xxdialogMode){return}var b="",a="";if((features&1048576)!=0){a=""}if(currentMesh.mtype==1){b+=addHtmlValue("Type","")}else{b+=addHtmlValue("Type","")}b+="";setDialogMode(2,"Intel® AMT Policy",3,p20editMeshAmtEx,b);if(currentMesh.amt){Q("dp20amtpolicy").value=currentMesh.amt.type}p20editMeshAmtChange();if(currentMesh.amt&&(currentMesh.amt.type==2)||(currentMesh.amt.type==3)){Q("dp20amtpolicypass").value=currentMesh.amt.password;if((currentMesh.amt.type==2)&&(currentMesh.amt.badpass!=null)){Q("dp20amtbadpass").value=currentMesh.amt.badpass}if((features&1024)==0){Q("dp20amtcira").value=currentMesh.amt.cirasetup}}dp20amtValidatePolicy()}function p20editMeshAmtChange(){var a=Q("dp20amtpolicy").value,b="";if(a>=2){b=addHtmlValue("Password*","");b+=addHtmlValue("Password*","");if((a==2)&&(currentMesh.mtype==2)){b+=addHtmlValue("Password mismatch","")}if((features&1024)==0){if(a==2){b+=addHtmlValue('CIRA',"")}else{b+=addHtmlValue('CIRA',"")}}b+=' * Leave blank to assign a random password to each device. ';if(currentMesh.mtype==2){if(a==2){b+='This policy will not impact devices with Intel® AMT in ACM mode. ';b+='This is not a secure policy as agents will be performing activation.'}else{b+='During activation, the agent will have access to admin password infomation.'}}}QH("dp20amtpolicydiv",b);setTimeout(dp20amtValidatePolicy,1)}function dp20amtValidatePolicy(){var a=true,d=Q("dp20amtpolicy").value;if((d==2)||(d==3)){var b=Q("dp20amtpolicypass").value,c=Q("dp20amtpolicypass2").value;a=((b===c)&&((b==="")?true:passwordcheck(b)))}QE("idx_dlgOkButton",a)}function p20editMeshAmtEx(){var b=parseInt(Q("dp20amtpolicy").value),a={type:b};if(b==2){a={type:b,password:Q("dp20amtpolicypass").value};if(currentMesh.mtype==2){a.badpass=parseInt(Q("dp20amtbadpass").value)}if((features&1024)==0){a.cirasetup=parseInt(Q("dp20amtcira").value)}else{a.cirasetup=1}}else{if(b==3){a={type:b,password:Q("dp20amtpolicypass").value};if((features&1024)==0){a.cirasetup=parseInt(Q("dp20amtcira").value)}else{a.cirasetup=1}}}meshserver.send({action:"meshamtpolicy",meshid:currentMesh._id,amtpolicy:a})}function p20showDeleteMeshDialog(){if(xxdialogMode){return false}var a='Are you sure you want to delete group "'+EscapeHtml(currentMesh.name)+'"? Deleting the device group will also delete all information about devices within this group.
';b+="";b+="";setDialogMode(2,"Edit Device Group User Consent",3,p20editmeshconsentEx,b);if(serverinfo.consent){if(serverinfo.consent&1){Q("d20flag1").checked=true}if(serverinfo.consent&8){Q("d20flag2").checked=true}if(serverinfo.consent&2){Q("d20flag3").checked=true}if(serverinfo.consent&16){Q("d20flag4").checked=true}if(serverinfo.consent&4){Q("d20flag5").checked=true}if(serverinfo.consent&32){Q("d20flag6").checked=true}if(debugmode){if(serverinfo.consent&64){Q("d20flag7").checked=true}}QE("d20flag1",!(serverinfo.consent&1));QE("d20flag2",!(serverinfo.consent&8));QE("d20flag3",!(serverinfo.consent&2));QE("d20flag4",!(serverinfo.consent&16));QE("d20flag5",!(serverinfo.consent&4));QE("d20flag6",!(serverinfo.consent&32));if(debugmode){QE("d20flag7",!(serverinfo.consent&64))}}}function p20editmeshconsentEx(){var a=0;if(Q("d20flag1").checked){a+=1}if(Q("d20flag2").checked){a+=8}if(Q("d20flag3").checked){a+=2}if(Q("d20flag4").checked){a+=16}if(Q("d20flag5").checked){a+=4}if(Q("d20flag6").checked){a+=32}if(debugmode){if(Q("d20flag7").checked){a+=64}}meshserver.send({action:"editmesh",meshid:currentMesh._id,consent:a})}function p20editmeshfeatures(){if(xxdialogMode){return}var a=(currentMesh.flags)?currentMesh.flags:0;var b="
";b+="
";setDialogMode(2,"Edit Device Group Features",3,p20editmeshfeaturesEx,b)}function p20editmeshfeaturesEx(){var a=0;if(Q("d20flag1").checked){a+=1}if(Q("d20flag2").checked){a+=2}meshserver.send({action:"editmesh",meshid:currentMesh._id,flags:a})}function p20showAddMeshUserDialog(d){if(xxdialogMode){return false}var e="";if(d==null){e+="Allow users to manage this device group and devices in this group.";if(features&524288){e+=" Users need to login to this server once before they can be added to a device group."}e+="
";e+=addHtmlValue("User Names",'');e+="";e+="
"}else{d=decodeURIComponent(d);var c=d.split("/")[2];if(users&&users[d]){c=users[d].name}if(userinfo._id==d){c=userinfo.name}e+="Group permissions for user "+c+".
";if(d==null){setDialogMode(2,"Add Users to Device Group",3,p20showAddMeshUserDialogEx,e);Q("dp20username").focus()}else{setDialogMode(2,"Edit User Device Group Permissions",7,p20showAddMeshUserDialogEx,e,d);var a=currentMesh.links[userinfo._id].rights,b=currentMesh.links[d].rights;if(b==4294967295){Q("p20fulladmin").checked=true}else{if(b&1){Q("p20editmesh").checked=true}if(b&2){Q("p20manageusers").checked=true}if(b&4){Q("p20managecomputers").checked=true}if(b&8){Q("p20remotecontrol").checked=true;if(b&256){Q("p20remoteview").checked=true}if(b&512){Q("p20remotelimitedinput").checked=true}if(b&1024){Q("p20noterminal").checked=true}if(b&2048){Q("p20nofiles").checked=true}if(b&4096){Q("p20noamt").checked=true}}if(b&16){Q("p20meshagentconsole").checked=true}if(b&32){Q("p20meshserverfiles").checked=true}if(b&64){Q("p20wakedevices").checked=true}if(b&128){Q("p20editnotes").checked=true}if(b&8192){Q("p20limitevents").checked=true}}}p20validateAddMeshUserDialog();return false}function p20setname(b){b=decodeURIComponent(b);var c=Q("dp20username").value.split(",");for(var a in c){c[a]=c[a].trim()}c[c.length-1]=b;Q("dp20username").value=c.join(", ");p20validateAddMeshUserDialog();return false}function p20validateAddMeshUserDialog(){var g=currentMesh.links[userinfo._id].rights;var h=true;if(Q("dp20username")){var m=Q("dp20username").value.split(",");for(var b in m){var l=m[b]=m[b].trim();if(l.length==0){h=false}else{if(l.indexOf('"')>=0){h=false}}}var j=false,a=false;if(users!=null){var c=m[m.length-1].trim(),d=c.toLowerCase(),e=[];if(c.length>0){for(var b in users){if(users[b].name===c){a=true;break}if(users[b].name.toLowerCase().indexOf(d)>=0){e.push(users[b].name);if(e.length>=8){break}}}if((a==false)&&(e.length>0)){var k="";for(var b in e){k+=""+e[b]+" "}QH("dp20usersuggest",k);j=true}}}QV("dp20usersuggest",j)}QE("idx_dlgOkButton",h);QE("p20fulladmin",g==4294967295);QE("p20editmesh",(!Q("p20fulladmin").checked)&&(g==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("p20limitevents",!Q("p20fulladmin").checked);QE("p20remoteview",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked);QE("p20remotelimitedinput",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked&&!Q("p20remoteview").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(a,e){if(a==2){p20viewuserEx(a,e)}else{var d=0;if(Q("p20fulladmin").checked==true){d=4294967295}else{if(Q("p20editmesh").checked==true){d+=1}if(Q("p20manageusers").checked==true){d+=2}if(Q("p20managecomputers").checked==true){d+=4}if(Q("p20remotecontrol").checked==true){d+=8}if(Q("p20meshagentconsole").checked==true){d+=16}if(Q("p20meshserverfiles").checked==true){d+=32}if(Q("p20wakedevices").checked==true){d+=64}if(Q("p20editnotes").checked==true){d+=128}if(Q("p20remoteview").checked==true){d+=256}if(Q("p20noterminal").checked==true){d+=512}if(Q("p20nofiles").checked==true){d+=1024}if(Q("p20noamt").checked==true){d+=2048}if(Q("p20remotelimitedinput").checked==true){d+=4096}if(Q("p20limitevents").checked==true){d+=8192}}if(e==null){var g=Q("dp20username").value.split(","),h=[];for(var c in g){h.push(g[c].trim())}meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,usernames:h,meshadmin:d})}else{meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,usernames:[e.split("/")[2]],meshadmin:d})}}}function p20viewuser(g){if(xxdialogMode){return}var j=decodeURIComponent(g);var b=currentMesh.links[userinfo._id].rights,c=currentMesh.links[j].rights;if(((userinfo._id)!=j)&&(b==4294967295||(((b&2)!=0)&&(c!=4294967295)))){p20showAddMeshUserDialog(g)}else{var d="";if(c==4294967295){d=", Full Administrator (all rights)"}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&8)!=0)&&(c&256)!=0){d+=", Remote View Only"}if(((c&8)!=0)&&(c&512)!=0){d+=", No Terminal"}if(((c&8)!=0)&&(c&1024)!=0){d+=", No Files"}if(((c&8)!=0)&&(c&2048)!=0){d+=", No Intel® AMT"}if(((c&8)!=0)&&((c&4096)!=0)&&((c&256)==0)){d+=", Limited Input"}if((c&8192)!=0){d+=", Self Events Only"}}d=d.substring(2);if(d==""){d="No Rights"}var e=j.split("/")[2];if(users&&users[j]){e=users[j].name}if(userinfo._id==j){e=userinfo.name}var a=1,h=addHtmlValue("User Name",EscapeHtml(decodeURIComponent(e)));if(j.split("/")[2]!=e){h+=addHtmlValue("User Identifier",EscapeHtml(j.split("/")[2]))}h+=addHtmlValue("Permissions",d);if(((userinfo._id)!=j)&&(b==4294967295||(((b&2)!=0)&&(c!=4294967295)))){a+=4}setDialogMode(2,"Device Group User",a,p20viewuserEx,h,j)}}function p20viewuserEx(a,c){if(a!=2){return}var b=c.split("/")[2];if(users&&users[c]){b=users[c].name}if(userinfo._id==c){b=userinfo.name}setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,"Confirm removal of user "+EscapeHtml(decodeURIComponent(b))+"?",c)}function p20deleteUser(a,b){haltEvent(a);p20viewuserEx(2,decodeURIComponent(b));return false}function p20viewuserEx2(a,b){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:b})}function p20editMeshNotify(){if(xxdialogMode){return false}var a=0;if(userinfo.links&&userinfo.links[currentMesh._id]&&userinfo.links[currentMesh._id].notify){a=userinfo.links[currentMesh._id].notify}var b="Notification settings must also be turned on in account settings.