From bc7d9833c378c4e9390cd750dbc71ca190ddd0ba Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 1 Jun 2020 17:26:27 -0700 Subject: [PATCH] Added support for custom ui buttons and dialogs. --- MeshCentralServer.njsproj | 2 - agents/MeshCmd-signed.exe | Bin 4757272 -> 4757520 bytes agents/MeshCmd64-signed.exe | Bin 4370712 -> 4370960 bytes agents/MeshService-signed.exe | Bin 3726496 -> 3726496 bytes agents/MeshService64-signed.exe | Bin 3339936 -> 3339936 bytes agents/modules_meshcmd/amt-mei.js | 12 ++--- meshuser.js | 9 ++++ public/commander.htm | 2 +- views/default.handlebars | 77 +++++++++++++++++++++++++++++- webserver.js | 13 ++++- 10 files changed, 100 insertions(+), 15 deletions(-) diff --git a/MeshCentralServer.njsproj b/MeshCentralServer.njsproj index 49c6058d..cbe289a6 100644 --- a/MeshCentralServer.njsproj +++ b/MeshCentralServer.njsproj @@ -61,9 +61,7 @@ - - diff --git a/agents/MeshCmd-signed.exe b/agents/MeshCmd-signed.exe index 93c57091ab6808918583ad6f398d1ef17a614279..de475d182497a682eb1d9a44ba691b9ed1c16678 100644 GIT binary patch delta 1275 zcmaLQYgE#A90qW%Dj7OW)N)e(Qv@XhH4#h~UMVkG>DGm1gnx=eB%stfhF7dPH#3FI zSw>pv@l?~Z>CA2AW*1rJCF@YBsof0qbn!U1w%WJO&g#`(eBOM2&+~hZoHgRg&Kq&( zv#_`t<>9^9FkEh4K|8j%9s3pz-~j;;ffcX@Hh=`?0b4L1kbxbr2Oj|k;0P7~CqMzt zzy-L1gStd_MMTjAY$SZgHVB_t?ySCwy9nZOSh{&_Sv;Oao zC3IzmO2c0wLVSh3B7`AAip@4Wzy~2<1qcOU;1jSC2tYW90FfXHM1z=CvyHGO6L&#s z$jTMwvFVpP(*|c=h`60w1T)m`1oU8dL)3|zCi@(nS()F`x7l_@Z{nDPvs0|so2({P zO)Dc$NOolZVB8=X?w(&3sQ+?hPsc{}{lSCX)M5xj4(F^DNW$mif)aKC8vaZ1>eH z>Lb_HGkUv{4%2py@fYtMQB}H=a+bwSVb0D7D7oTrQ+v9o$M137MytR9_BTZC7fX=@ z?`m_ZXNun+$0M$GwI13ldg&|ut;RCD7xc+`N5iLT zzHS@&sF%L-^;+Xr>do=Twb*#;Z@HVRmFMo}^9PzX&c@%q_jO@eN%L3CorV79!rtyAD+O zG$q*@fBrLx{E$ulFNDPsF@$_9=7=pvP!KtL(QZxHRB69gQS`mC*-hEyiL~-|lk~br zbdG6iMPq_5qOZDA5i)v!^7QfnrsejeO9QupjMv_O!}yNwLw5c(dFpwGVAZRN{x(i- z;cxm=k7~Qdq_2x6#-EV>=8y6N|H6KLiksg&dt; delta 1045 zcmX}iZBUX28~|{hhZjZVO%%g0(a;2wKyivCmW5#Ft+VEubGp1mIax@z3>sccO*Az_ zQL!AEAfCBqX1h?s%vmNi+dM67JDaw(8+P95-7KAJ?Y}Sk@cZ^N_FB=F9xK|bMbHj! z(-(*Yt@^Tj5UCtQ{(}N6zyUlU059MTh`QZ^B!0q|CV)$Kd*kqkDe}e6OF!=Vg=pz`TO|2N4HBCUG`Q~he7u)Ke?i=7ye4(U$9hje@>96 z@5&rI+kc-;ZZ~@6+*z~sb+tM01^Z@QZxT3Dc>7N-sXgB|dY;PfGGw1xPZvo-ZYnIT66pDq0%{yty})x-KKtt(k0 zY#bY3J*`xWFNHTJG@OxF_S-~fJ>>qlwAq$vD^nLaNf-IjoVKe@s;<+N#5$oUKHQXp zibl=zP4WeOd~9N@P!Ja@{7|r&K;#+ZhSwy7h!Zk!0a+8xkJ^1uj;E-%HOdy)c4NEH zDj@xz5Co6Gl_3~<=Xc|$&#QU=@bgwta|cJ+zV_a-up@~ap?y_U$xz-{^u0n(k@z&J z*2LCcb8GSE`axO^Q%0#FG=HF{O)R^(^(klGw3>$cs0Zal{P%|efUoXPfc zzc{Sz89<-mLjE?b=S`u`s-+?BT|~!~cxot;pxWBm(Q523wvx4t(Xt_zn<$)9-#w5< zQC!W{`dStU$5m4Lx9H;Kx4hMc>?5ZhAEHydrnlN#u0L?UF%1+_D^!}B%}c{8E3LuP Mqet-!HwJ_G7bmH@X#fBK diff --git a/agents/MeshCmd64-signed.exe b/agents/MeshCmd64-signed.exe index 0e73879c6ca779e94b2964119089fdf9b5f6caa3..6f5a9a0be77e6af90120e18f0a34f682245454da 100644 GIT binary patch delta 1251 zcmaLQeK6a190%|uq8{3KN)}4$;ipABB@qv4h?W(-PI{}|IV0LeB$bMUh^nUs8Cp|S zy2d=Mlv+>^LnEUP%(a>o)tepd=uK6%8?AGjhnnuAw_Equ{&@ZK`M%%Zclk^qrewAd z(|#I_iD#CjqYq=UD-~LFffl_519Siu=z?uP59k8}U-6dit4kG5Kh6S!z-nW(gPIRJr%7(75L!q+k-E15e-uynzp3fW3eTe1RWe0e`R$><0nrNhGj371JwFo~{VYp?+0% zzbxCMA|;3zn{k+;O3iU?rrUrboy+#QgNs(6?U5(yIpKT}zNBb5D z@{8uELs^~j*+KTVN9vX}34<#+g_a*PO+))9ma=k2Gfhldv+p@jh>cajT$F47V9=c= zjp8%kYf-5bL;oVYebjHv?j_@<>Lk-m`68)ab~U_5mX9BfA{HCqm=|A%o2I1JH=XGy zJ}R7v91Qa5d188A8>e4n{=Fo8t*gDf^yEU&mBeYe5mEB8<1zd2x~6$f<@eTjpf-4Q zUZg)vSw_D&N17FRCG9-(OV_+b=HdmshP}U;qM$_t#AH<-=nMO)<3U*4n5w1%(=AoL zYz=%R_omW3=$;-lS|rten}Kuw!Tc2*+5k%kjQqL3Wo7$_r zpWIfZo3EWxIZq8$ox}IpjmF5wnZ;#!pYM?5^=dqLj>~&G|EPJB$I!0SJ{$9=U>8L9 zRkx>$UW>%5Cm-y?zncxY^rZH2jX$j`jH$NJ@0{D5pBUX}x?@2k4UZb1rQ}p1m!cvW zr$)y9vc7A7UTpEAAM4W+P_Ysiyx!k3#jyE~YW8LHbGF|@YF@NTqizj}$up_sesixe zUEqS-6#vpj_YJK6vl6YfR!>3~n=APGDNQ}(u;iYzKs0mBk&gQw5 Q?p52N>ZBV#qfn^70d2n8|a=JFY9|ow1o9s&@B%pC4e($S@Bsus1SGH-kO2kwf-S%gPyr42gV#U+2n2Kx z1Q_6T5Db_g1cU+>2m@~bHrNWn!8WiRM1V-Z0Z||t#DG}91w0T3`1T1za5vb13l&^8 zEQSg+b`49w^wK)n0uT=pzz&cIgdhndgA|Yo(m*=c3El)5b|)J>SAiWoW>B`Er+D8V zS#ImMM5sSn*RE%83J&pokc!QBkL!o^UAdgnj^)40_0*|%-I0`?F3WKI`i4Esgp#Se z3)iCKd~cm*yMLM4bC8zaalyarj$v5 zwJ+(oR=nz@bq_5cUh?r?4xC(&Ts&{0D^x=#6yvFnovnSg%)`?0fG-#`QEI(mDK?d{ z)_zl0oF+f^^=L}=0_OIRV9SQMZY22`=NoHjR%@i>V$0FL^3&V9#-1um@HEeRW?i3c zMuGkr+;Y->MyB}0$FuQrvX}n(jNhQDwfyMSPp@~2qIY$ERdK4x)UZmHEEEnGX+M$w6!`EBh6!fS6^A1Den>Q_h1~& zV;09`9kHome(qrT?4_}KZHn!{$1&Tu4a&yTKii5;IX+_70q3GkarL()<6Rc^Mv>ux z4Sk|Y;0yV2JOMvGpU1`%IGR10H8MiL#RcH}?+rM5JBeP*Yjf80D#MkUo*a{eNB%z{ zh&KjTgJ9l?GABtG{V0j5IxqWnv3g`cnMKd#D$QOuge&2$HX^^Mm-0L|SKuC*`n8v; z*qoCrXT6}TOpCH?&sF`dphLRCsz+SSyuAh!>Tq2`{D6gted_6Lm77@vR+CUKMvZ@fml9U2kWGccR$^ zRh0hYmt$VJUHpQ%9syBPqDao0x?d1j-Ys>643->0OLt{3Ce4+M$Gv9~8v@o(@-Z09 Ezd;Sbs{jB1 diff --git a/agents/MeshService-signed.exe b/agents/MeshService-signed.exe index 65fdad66fa3957c4167405a975f33234b225aa42..880662129a7ef3eed5f5fb829bde19dec12c719c 100644 GIT binary patch delta 524 zcmXBDX-HE600(g2yx!8yrmpF1I@jiXyt%o(Mc^?+38ocjJVJbQp&!x=@puR;Z5c=! zOcX^>P}GTKC(|&PMpJC z#$p`CV*(~(5+-8`rXq!EOhXN7F&%ZNw{ryjZI!R1)M*;6T1|JbUuc8*dGR)B+pDpy zSPMfu*`tpi(rYs=;etf+IziMP*CTW1lg2FbrKNe(bWrrlqa5XI%|>LBo9PQ1p0=c} zSN!XgZt9t-^h9@Mr?ZH-qGdCvn@3#V=c3(vldNb^Gp5r=Kh(; znd)MiD{7zgtDNTB2F1w1o1cbiW8rrAZ>vl0a>QB$^6N78YV+2|XO8!dt=94jlibjQ zb=O~E+s58NL)C0PQ|Gy5qTH4VUi&^PU{!}t$1gMQoL<++x6->y?9R^7ulVz2!Q#w| oM!P@VZL|01HP*L%y8m*qYnhrW@l<^m7tGvfQGVc)K3*sO1GX;B>i_@% delta 524 zcmXBDTP#}v00v;^&{8vX*SSQG+x(Nv~TETTkWlfo&@*4ycBW3j@l*xlD4l^Jo0`1=hL#Ewn}&Hr^U(j ziB)G6hw)}=cYLaQZ`MPL2$ex8u&$S0em2T;7O#~rf1J&P3+1X7IotYH*U!BQ>tp1- zQ%SzllrB>5F)Dd7gKl2nJ@?Hq`fu4;v-WB;kvvsr$z1k`>B7s7o6)~@?|Vm9mKcY* zeyQd%4)bfLyTw;}SQhOXOw%81*(I&zulZ!bahrRiH0S0+g_`dAGN>MI?-}@*U(d2R jnG5XgE5cIWz`j`9-5fJpUr+_}jz+H|UI~kg_qz8V%(%+y diff --git a/agents/MeshService64-signed.exe b/agents/MeshService64-signed.exe index 1ebc3bc158c54b9ddbc4ee8b714f5c3ef5075122..44049143f0a8f8c2ab68370106761599fdaf8b05 100644 GIT binary patch delta 500 zcmZ4R_B7)HAl^{H$Yf&IT*cU4#R$SoK+FupEI`Z(#B4y!4#XTl%n8I?K+FxqJV49~ z#C$-^55xjMEC|FxKr9TzB0ww(#9}}!4#W~bED6L?Kr9W!GC(W~#Bx9^55x*UtO&$P zK&%YJDnP6X#A-mS4#XNjtO>+gK&%bKIzX%o#Ckxi55xvQY`DFO(dh1HPBQ~TBV!Xo zBg5$lUyUs5Z4H;MYAAoLw&CjE5*I(e8*_G3|Ep^A)y@GcrvKl5{{1u$)!l1c#+PsvdJt+xZ0oO~TB)lRgAJYD0 zKAY23`;^?{m-nupW?$@nBJ9G;^_PqC*mJd4y3ADg)p9lUBaE a*1ffVV}QVc3EtsN{~paq=Um0a0096`qQZ#) delta 500 zcmZ4R_B7)HAl^{H$i%v&xr(v9iV=jFfS4JGS%8=oh}nRc9f&!Am=lP(fS4PId4QM~ zi1~n+ABY8jSP+PXfLIuaMSxfoh{b?d9Ec@=SQ3b(fLI!cWq?=~h~FlqtV^ZoTf&G24*Hk zCYI9^z8YE9hyL%Gz4P&rqGuleH%(#*h`*Y1U{h_$(tBSo6z}`T6!-A?H{JzV^96g) z-#yX5?s#~j^}1;7S$n?e=vy1!Di!`bB`_#TcC*_3K6QquDh&ihS>GnWgpl)~6fRw#k1!sGpj7$$!#^9fdr< c{u@hcx80e(rY&JwYsI9@kmsBatQa5w03=b$?*IS* diff --git a/agents/modules_meshcmd/amt-mei.js b/agents/modules_meshcmd/amt-mei.js index 304ac35d..3a724e1c 100644 --- a/agents/modules_meshcmd/amt-mei.js +++ b/agents/modules_meshcmd/amt-mei.js @@ -27,7 +27,6 @@ function amt_heci() { this._setupPTHI = function _setupPTHI() { this._amt = heci.create(); - this._amt.descriptorMetadata = "amt-pthi"; this._amt.BiosVersionLen = 65; this._amt.UnicodeStringLen = 20; @@ -398,25 +397,20 @@ function amt_heci() { fn.apply(this, opt); }, callback, optional); } - this.getProtocolVersion = function getProtocolVersion(callback) - { + this.getProtocolVersion = function getProtocolVersion(callback) { var optional = []; for (var i = 1; i < arguments.length; ++i) { opt.push(arguments[i]); } - if (!this._tmpSession) { this._tmpSession = heci.create(); this._tmpSession.parent = this;} - this._tmpSession.doIoctl(heci.IOCTL.HECI_VERSION, Buffer.alloc(5), Buffer.alloc(5), function (status, buffer, self, fn, opt) - { + heci.doIoctl(heci.IOCTL.HECI_VERSION, Buffer.alloc(5), Buffer.alloc(5), function (status, buffer, self, fn, opt) { if (status == 0) { var result = buffer.readUInt8(0).toString() + '.' + buffer.readUInt8(1).toString() + '.' + buffer.readUInt8(2).toString() + '.' + buffer.readUInt16BE(3).toString(); opt.unshift(result); fn.apply(self, opt); } - else - { + else { opt.unshift(null); fn.apply(self, opt); } - }, this, callback, optional); } } diff --git a/meshuser.js b/meshuser.js index 1755c406..4d78156e 100644 --- a/meshuser.js +++ b/meshuser.js @@ -4323,6 +4323,15 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } break; } + case 'uicustomevent': { + // Event the change + var message = { etype: 'user', userid: user._id, username: user.name, action: 'uicustomevent', domain: domain.id, nolog: 1, uisection: command.section, element: command.element }; + if (command.selectedDevices != null) { message.selectedDevices = command.selectedDevices; } + if (command.src != null) { message.src = command.src; } + if (command.values != null) { message.values = command.values; } + parent.parent.DispatchEvent(['*', user._id], obj, message); + break; + } default: { // Unknown user action console.log('Unknown action from user ' + user.name + ': ' + command.action + '.'); diff --git a/public/commander.htm b/public/commander.htm index d55f573b..aa152a09 100644 --- a/public/commander.htm +++ b/public/commander.htm @@ -927,7 +927,7 @@ new FileReader;a.onloadend=function(){var b=a.result;G.location.href="data:attac function(b){G.location.href=a.toURL();h.readyState=h.DONE;n(h,"writeend",b);r(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&E()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(k);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),E)}),E)};a.getFile(m,{create:!1},A(function(a){a.remove();b()}),A(function(a){a.code===a.NOT_FOUND_ERR?b():E()}))}),E)}),E)):E()}},z=k.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a, b,c){c||(a=x(a));return navigator.msSaveOrOpenBlob(a,b||"download")};z.abort=function(){this.readyState=this.DONE;n(this,"abort")};z.readyState=z.INIT=0;z.WRITING=1;z.DONE=2;z.error=z.onwritestart=z.onprogress=z.onwrite=z.onabort=z.onerror=z.onwriteend=null;return function(a,b,c){return new k(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content); "undefined"!==typeof module&&module.exports?module.exports.saveAs=saveAs:"undefined"!==typeof define&&null!==define&&null!=define.amd&&define([],function(){return saveAs}); -var version="0.8.3",urlvars={},amtstack,wsstack=null,AllWsman="AMT_8021xCredentialContext AMT_8021XProfile AMT_ActiveFilterStatistics AMT_AgentPresenceCapabilities AMT_AgentPresenceInterfacePolicy AMT_AgentPresenceService AMT_AgentPresenceWatchdog AMT_AgentPresenceWatchdogAction AMT_AlarmClockService IPS_AlarmClockOccurrence AMT_AssetTable AMT_AssetTableService AMT_AuditLog AMT_AuditPolicyRule AMT_AuthorizationService AMT_BootCapabilities AMT_BootSettingData AMT_ComplexFilterEntryBase AMT_CRL AMT_CryptographicCapabilities AMT_EACCredentialContext AMT_EndpointAccessControlService AMT_EnvironmentDetectionInterfacePolicy AMT_EnvironmentDetectionSettingData AMT_EthernetPortSettings AMT_EventLogEntry AMT_EventManagerService AMT_EventSubscriber AMT_FilterEntryBase AMT_FilterInSystemDefensePolicy AMT_GeneralSettings AMT_GeneralSystemDefenseCapabilities AMT_Hdr8021Filter AMT_HeuristicPacketFilterInterfacePolicy AMT_HeuristicPacketFilterSettings AMT_HeuristicPacketFilterStatistics AMT_InterfacePolicy AMT_IPHeadersFilter AMT_KerberosSettingData AMT_ManagementPresenceRemoteSAP AMT_MessageLog AMT_MPSUsernamePassword AMT_NetworkFilter AMT_NetworkPortDefaultSystemDefensePolicy AMT_NetworkPortSystemDefenseCapabilities AMT_NetworkPortSystemDefensePolicy AMT_PCIDevice AMT_PETCapabilities AMT_PETFilterForTarget AMT_PETFilterSetting AMT_ProvisioningCertificateHash AMT_PublicKeyCertificate AMT_PublicKeyManagementCapabilities AMT_PublicKeyManagementService AMT_PublicPrivateKeyPair AMT_RedirectionService AMT_RemoteAccessCapabilities AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule AMT_RemoteAccessService AMT_SetupAndConfigurationService AMT_SNMPEventSubscriber AMT_StateTransitionCondition AMT_SystemDefensePolicy AMT_SystemDefensePolicyInService AMT_SystemDefenseService AMT_SystemPowerScheme AMT_ThirdPartyDataStorageAdministrationService AMT_ThirdPartyDataStorageService AMT_TimeSynchronizationService AMT_TLSCredentialContext AMT_TLSProtocolEndpoint AMT_TLSProtocolEndpointCollection AMT_TLSSettingData AMT_TrapTargetForService AMT_UserInitiatedConnectionService AMT_WebUIService AMT_WiFiPortConfigurationService CIM_AbstractIndicationSubscription CIM_Account CIM_AccountManagementCapabilities CIM_AccountManagementService CIM_AccountOnSystem CIM_AdminDomain CIM_AlertIndication CIM_AssignedIdentity CIM_AssociatedPowerManagementService CIM_AuthenticationService CIM_AuthorizationService CIM_BIOSElement CIM_BIOSFeature CIM_BIOSFeatureBIOSElements CIM_BootConfigSetting CIM_BootService CIM_BootSettingData CIM_BootSourceSetting CIM_Capabilities CIM_Card CIM_Chassis CIM_Chip CIM_Collection CIM_Component CIM_ComputerSystem CIM_ComputerSystemPackage CIM_ConcreteComponent CIM_ConcreteDependency CIM_Controller CIM_CoolingDevice CIM_Credential CIM_CredentialContext CIM_CredentialManagementService CIM_Dependency CIM_DeviceSAPImplementation CIM_ElementCapabilities CIM_ElementConformsToProfile CIM_ElementLocation CIM_ElementSettingData CIM_ElementSoftwareIdentity CIM_ElementStatisticalData CIM_EnabledLogicalElement CIM_EnabledLogicalElementCapabilities CIM_EthernetPort CIM_Fan CIM_FilterCollection CIM_FilterCollectionSubscription CIM_HostedAccessPoint CIM_HostedDependency CIM_HostedService CIM_Identity CIM_IEEE8021xCapabilities CIM_IEEE8021xSettings CIM_Indication CIM_IndicationService CIM_InstalledSoftwareIdentity CIM_KVMRedirectionSAP CIM_LANEndpoint CIM_ListenerDestination CIM_ListenerDestinationWSManagement CIM_Location CIM_Log CIM_LogEntry CIM_LogicalDevice CIM_LogicalElement CIM_LogicalPort CIM_LogicalPortCapabilities CIM_LogManagesRecord CIM_ManagedCredential CIM_ManagedElement CIM_ManagedSystemElement CIM_MediaAccessDevice CIM_MemberOfCollection CIM_Memory CIM_MessageLog CIM_NetworkPort CIM_NetworkPortCapabilities CIM_NetworkPortConfigurationService CIM_OrderedComponent CIM_OwningCollectionElement CIM_OwningJobElement CIM_PCIController CIM_PhysicalComponent CIM_PhysicalElement CIM_PhysicalElementLocation CIM_PhysicalFrame CIM_PhysicalMemory CIM_PhysicalPackage CIM_Policy CIM_PolicyAction CIM_PolicyCondition CIM_PolicyInSystem CIM_PolicyRule CIM_PolicyRuleInSystem CIM_PolicySet CIM_PolicySetAppliesToElement CIM_PolicySetInSystem CIM_PowerManagementCapabilities CIM_PowerManagementService CIM_PowerSupply CIM_Privilege CIM_PrivilegeManagementCapabilities CIM_PrivilegeManagementService CIM_ProcessIndication CIM_Processor CIM_ProtocolEndpoint CIM_ProvidesServiceToElement CIM_Realizes CIM_RecordForLog CIM_RecordLog CIM_RedirectionService CIM_ReferencedProfile CIM_RegisteredProfile CIM_RemoteAccessAvailableToElement CIM_RemoteIdentity CIM_RemotePort CIM_RemoteServiceAccessPoint CIM_Role CIM_RoleBasedAuthorizationService CIM_RoleBasedManagementCapabilities CIM_RoleLimitedToTarget CIM_SAPAvailableForElement CIM_SecurityService CIM_Sensor CIM_Service CIM_ServiceAccessBySAP CIM_ServiceAccessPoint CIM_ServiceAffectsElement CIM_ServiceAvailableToElement CIM_ServiceSAPDependency CIM_ServiceServiceDependency CIM_SettingData CIM_SharedCredential CIM_SoftwareElement CIM_SoftwareFeature CIM_SoftwareFeatureSoftwareElements CIM_SoftwareIdentity CIM_StatisticalData CIM_StorageExtent CIM_System CIM_SystemBIOS CIM_SystemComponent CIM_SystemDevice CIM_SystemPackaging CIM_UseOfLog CIM_Watchdog CIM_WiFiEndpoint CIM_WiFiEndpointCapabilities CIM_WiFiEndpointSettings CIM_WiFiPort CIM_WiFiPortCapabilities IPS_AdminProvisioningRecord IPS_ClientProvisioningRecord IPS_HostBasedSetupService IPS_HostIPSettings IPS_HTTPProxyService IPS_HTTPProxyAccessPoint IPS_IderSessionUsingPort IPS_IPv6PortSettings IPS_KVMRedirectionSettingData IPS_KvmSessionUsingPort IPS_ManualProvisioningRecord IPS_OptInService IPS_PowerManagementService IPS_ProvisioningAuditRecord IPS_ProvisioningRecordLog IPS_RasSessionUsingPort IPS_ScreenConfigurationService IPS_ScreenSettingData IPS_SecIOService IPS_SessionUsingPort IPS_SolSessionUsingPort IPS_TLSProvisioningRecord IPS_WatchDogAction".split(" "),disconnecturl= +var version="0.8.4",urlvars={},amtstack,wsstack=null,AllWsman="AMT_8021xCredentialContext AMT_8021XProfile AMT_ActiveFilterStatistics AMT_AgentPresenceCapabilities AMT_AgentPresenceInterfacePolicy AMT_AgentPresenceService AMT_AgentPresenceWatchdog AMT_AgentPresenceWatchdogAction AMT_AlarmClockService IPS_AlarmClockOccurrence AMT_AssetTable AMT_AssetTableService AMT_AuditLog AMT_AuditPolicyRule AMT_AuthorizationService AMT_BootCapabilities AMT_BootSettingData AMT_ComplexFilterEntryBase AMT_CRL AMT_CryptographicCapabilities AMT_EACCredentialContext AMT_EndpointAccessControlService AMT_EnvironmentDetectionInterfacePolicy AMT_EnvironmentDetectionSettingData AMT_EthernetPortSettings AMT_EventLogEntry AMT_EventManagerService AMT_EventSubscriber AMT_FilterEntryBase AMT_FilterInSystemDefensePolicy AMT_GeneralSettings AMT_GeneralSystemDefenseCapabilities AMT_Hdr8021Filter AMT_HeuristicPacketFilterInterfacePolicy AMT_HeuristicPacketFilterSettings AMT_HeuristicPacketFilterStatistics AMT_InterfacePolicy AMT_IPHeadersFilter AMT_KerberosSettingData AMT_ManagementPresenceRemoteSAP AMT_MessageLog AMT_MPSUsernamePassword AMT_NetworkFilter AMT_NetworkPortDefaultSystemDefensePolicy AMT_NetworkPortSystemDefenseCapabilities AMT_NetworkPortSystemDefensePolicy AMT_PCIDevice AMT_PETCapabilities AMT_PETFilterForTarget AMT_PETFilterSetting AMT_ProvisioningCertificateHash AMT_PublicKeyCertificate AMT_PublicKeyManagementCapabilities AMT_PublicKeyManagementService AMT_PublicPrivateKeyPair AMT_RedirectionService AMT_RemoteAccessCapabilities AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule AMT_RemoteAccessService AMT_SetupAndConfigurationService AMT_SNMPEventSubscriber AMT_StateTransitionCondition AMT_SystemDefensePolicy AMT_SystemDefensePolicyInService AMT_SystemDefenseService AMT_SystemPowerScheme AMT_ThirdPartyDataStorageAdministrationService AMT_ThirdPartyDataStorageService AMT_TimeSynchronizationService AMT_TLSCredentialContext AMT_TLSProtocolEndpoint AMT_TLSProtocolEndpointCollection AMT_TLSSettingData AMT_TrapTargetForService AMT_UserInitiatedConnectionService AMT_WebUIService AMT_WiFiPortConfigurationService CIM_AbstractIndicationSubscription CIM_Account CIM_AccountManagementCapabilities CIM_AccountManagementService CIM_AccountOnSystem CIM_AdminDomain CIM_AlertIndication CIM_AssignedIdentity CIM_AssociatedPowerManagementService CIM_AuthenticationService CIM_AuthorizationService CIM_BIOSElement CIM_BIOSFeature CIM_BIOSFeatureBIOSElements CIM_BootConfigSetting CIM_BootService CIM_BootSettingData CIM_BootSourceSetting CIM_Capabilities CIM_Card CIM_Chassis CIM_Chip CIM_Collection CIM_Component CIM_ComputerSystem CIM_ComputerSystemPackage CIM_ConcreteComponent CIM_ConcreteDependency CIM_Controller CIM_CoolingDevice CIM_Credential CIM_CredentialContext CIM_CredentialManagementService CIM_Dependency CIM_DeviceSAPImplementation CIM_ElementCapabilities CIM_ElementConformsToProfile CIM_ElementLocation CIM_ElementSettingData CIM_ElementSoftwareIdentity CIM_ElementStatisticalData CIM_EnabledLogicalElement CIM_EnabledLogicalElementCapabilities CIM_EthernetPort CIM_Fan CIM_FilterCollection CIM_FilterCollectionSubscription CIM_HostedAccessPoint CIM_HostedDependency CIM_HostedService CIM_Identity CIM_IEEE8021xCapabilities CIM_IEEE8021xSettings CIM_Indication CIM_IndicationService CIM_InstalledSoftwareIdentity CIM_KVMRedirectionSAP CIM_LANEndpoint CIM_ListenerDestination CIM_ListenerDestinationWSManagement CIM_Location CIM_Log CIM_LogEntry CIM_LogicalDevice CIM_LogicalElement CIM_LogicalPort CIM_LogicalPortCapabilities CIM_LogManagesRecord CIM_ManagedCredential CIM_ManagedElement CIM_ManagedSystemElement CIM_MediaAccessDevice CIM_MemberOfCollection CIM_Memory CIM_MessageLog CIM_NetworkPort CIM_NetworkPortCapabilities CIM_NetworkPortConfigurationService CIM_OrderedComponent CIM_OwningCollectionElement CIM_OwningJobElement CIM_PCIController CIM_PhysicalComponent CIM_PhysicalElement CIM_PhysicalElementLocation CIM_PhysicalFrame CIM_PhysicalMemory CIM_PhysicalPackage CIM_Policy CIM_PolicyAction CIM_PolicyCondition CIM_PolicyInSystem CIM_PolicyRule CIM_PolicyRuleInSystem CIM_PolicySet CIM_PolicySetAppliesToElement CIM_PolicySetInSystem CIM_PowerManagementCapabilities CIM_PowerManagementService CIM_PowerSupply CIM_Privilege CIM_PrivilegeManagementCapabilities CIM_PrivilegeManagementService CIM_ProcessIndication CIM_Processor CIM_ProtocolEndpoint CIM_ProvidesServiceToElement CIM_Realizes CIM_RecordForLog CIM_RecordLog CIM_RedirectionService CIM_ReferencedProfile CIM_RegisteredProfile CIM_RemoteAccessAvailableToElement CIM_RemoteIdentity CIM_RemotePort CIM_RemoteServiceAccessPoint CIM_Role CIM_RoleBasedAuthorizationService CIM_RoleBasedManagementCapabilities CIM_RoleLimitedToTarget CIM_SAPAvailableForElement CIM_SecurityService CIM_Sensor CIM_Service CIM_ServiceAccessBySAP CIM_ServiceAccessPoint CIM_ServiceAffectsElement CIM_ServiceAvailableToElement CIM_ServiceSAPDependency CIM_ServiceServiceDependency CIM_SettingData CIM_SharedCredential CIM_SoftwareElement CIM_SoftwareFeature CIM_SoftwareFeatureSoftwareElements CIM_SoftwareIdentity CIM_StatisticalData CIM_StorageExtent CIM_System CIM_SystemBIOS CIM_SystemComponent CIM_SystemDevice CIM_SystemPackaging CIM_UseOfLog CIM_Watchdog CIM_WiFiEndpoint CIM_WiFiEndpointCapabilities CIM_WiFiEndpointSettings CIM_WiFiPort CIM_WiFiPortCapabilities IPS_AdminProvisioningRecord IPS_ClientProvisioningRecord IPS_HostBasedSetupService IPS_HostIPSettings IPS_HTTPProxyService IPS_HTTPProxyAccessPoint IPS_IderSessionUsingPort IPS_IPv6PortSettings IPS_KVMRedirectionSettingData IPS_KvmSessionUsingPort IPS_ManualProvisioningRecord IPS_OptInService IPS_PowerManagementService IPS_ProvisioningAuditRecord IPS_ProvisioningRecordLog IPS_RasSessionUsingPort IPS_ScreenConfigurationService IPS_ScreenSettingData IPS_SecIOService IPS_SessionUsingPort IPS_SolSessionUsingPort IPS_TLSProvisioningRecord IPS_WatchDogAction".split(" "),disconnecturl= null,terminal,currentView=0,LoadingHtml="
Loading...
",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encoding:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1},currentMeshNode=null,webcompilerfeatures="AgentPresence Alarms AuditLog Certificates ComputerSelectorToolbar Desktop DesktopInband DesktopInbandFiles Desktop-Multi DesktopRotation Desktop-Settings DesktopType EventLog EventSubscriptions FileSaver HardwareInfo IDER IDERDebug IDERStats Inflate Look-MeshCentral Mode-MeshCentral2 NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Scripting Scripting-Editor Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "), StatusStrs=["Disconnected","Connecting...","Setup...","Connected"],scriptstate,t,t2,rsepass=null; function startup(){var b=document.getElementsByTagName("input");for(t=0;t  +     @@ -1230,6 +1231,8 @@ var attemptWebRTC = ((features & 128) != 0); var passRequirements = '{{{passRequirements}}}'; if (passRequirements != '') { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); } + var customui = '{{{customui}}}'; + if (customui != '') { customui = JSON.parse(decodeURIComponent(customui)); } else { customui = null; } var deskAspectRatio = 0; try { deskAspectRatio = parseInt(getstore('deskAspectRatio', '0')); } catch (ex) { } var uiMode = parseInt(getstore('uiMode', 1)); @@ -1401,6 +1404,68 @@ if ((['en','ko','ja','zh-chs'].indexOf('{{{lang}}}') == -1) && ('{{{lang}}}'.toLowerCase() != '')) { QC('body').add('nonenglish'); } var elements = document.getElementsByClassName('topbar_td'); for (var i in elements) { if (elements[i].innerHTML) { elements[i].innerHTML = elements[i].innerHTML.split(' ').join(' '); } } + + // Custom UI + if (customui != null) { + if (customui.devicesbarbuttons) { + var x = ''; + for (var i in customui.devicesbarbuttons) { + var disabled = ((customui.devicesbarbuttons[i].selection == 'one') || (customui.devicesbarbuttons[i].selection == 'many'))?'disabled':''; + x += ''; + } + QH('devCustomUIBar', x); + } + } + } + + // Generic handling of custom actions + function customUIAction(e, section) { + var id = e.srcElement.id; + if (id.startsWith('cui:') == false) return; + var info = customui[section][id.substring(4)]; + if (info == null) return; + if (section == 'devicesbarbuttons') { + var elements = document.getElementsByClassName('DeviceCheckbox'), selectedDevices = []; + for (var i = 0; i < elements.length; i++) { if (elements[i].checked === true) { selectedDevices.push(elements[i].defaultValue.substring(6)); } } + if (typeof info.action == 'string') { + if (info.action == 'event') { meshserver.send({ action: 'uicustomevent', section: section, element: id.substring(4), selectedDevices: selectedDevices }); } + if (info.action.startsWith('dialog:')) { showCustomUiDialog(info.action.substring(7), { section: section, element: id.substring(4), selectedDevices: selectedDevices }); } + } + } + } + + // Display a generic custom UI dialog + function showCustomUiDialog(name, tag) { + if ((customui == null) || (customui.dialogs == null) || (typeof customui.dialogs[name] != 'object')) return; + var x = '', dialog = customui.dialogs[name], buttons = 3; + if (typeof dialog.text == 'string') { x += '
' + dialog.text + '
'; } + if (typeof dialog.buttons == 'number') { buttons = dialog.buttons; } + if (typeof dialog.elements == 'object') { + for (var i in dialog.elements) { + var elem = dialog.elements[i]; + if (elem.type == 'text') { x += addHtmlValue(elem.name, ''); } + if (elem.type == 'droplist') { + var y = ''; + for (var j in elem.options) { y += ''; } + x += addHtmlValue(elem.name, ''); + } + } + } + setDialogMode(2, dialog.title, buttons, showCustomUiDialogEx, x, { action: 'uicustomevent', section: 'dialogs', element: name, src: tag, values: {} }); + } + + // Handle a generic custom UI dialog event + function showCustomUiDialogEx(b, t) { + if (b != 1) return; + var dialog = customui.dialogs[t.element]; + if (typeof dialog.elements == 'object') { + for (var i in dialog.elements) { + var elem = dialog.elements[i]; + if (elem.type == 'text') { t.values[i] = Q('cui:' + i).value; } + if (elem.type == 'droplist') { t.values[i] = Q('cui:' + i).value; } + } + } + meshserver.send(t); } function adjustPanels() { @@ -4033,6 +4098,16 @@ QV('cxmgroupsplit', false); QV('cxmdesktop', false); } + + // Custom UI + if (customui != null) { + if (customui.devicesbarbuttons) { + for (var i in customui.devicesbarbuttons) { + if (customui.devicesbarbuttons[i].selection == 'one') { QE('cui:' + i, checkcount == 1); } + if (customui.devicesbarbuttons[i].selection == 'many') { QE('cui:' + i, checkcount >= 1); } + } + } + } } function groupActionFunction() { @@ -7316,7 +7391,7 @@ h = '
 ' + right + '
' + shortname + '
'; } else { var link = shortname; - if (f.s > 0) { link = '' + shortname + ''; } + if (f.s > 0) { link = '' + shortname + ''; } h = '
 ' + fdatestr + '' + fsize + '
' + link + '
'; } diff --git a/webserver.js b/webserver.js index c4e66ed5..1cecc3e5 100644 --- a/webserver.js +++ b/webserver.js @@ -2180,7 +2180,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { for (var i in domain.forceduserwebstate) { webstate2[i] = domain.forceduserwebstate[i]; } webstate = JSON.stringify(webstate2); } - render(req, res, getRenderPage('default', req, domain), getRenderArgs({ authCookie: authCookie, authRelayCookie: authRelayCookie, viewmode: viewmode, currentNode: currentNode, logoutControls: encodeURIComponent(JSON.stringify(logoutcontrols)).replace(/'/g, '%27'), domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, passRequirements: passRequirements, webcerthash: Buffer.from(obj.webCertificateFullHashs[domain.id], 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'), footer: (domain.footer == null) ? '' : domain.footer, webstate: encodeURIComponent(webstate), pluginHandler: (parent.pluginHandler == null) ? 'null' : parent.pluginHandler.prepExports() }, req, domain)); + + // Custom user interface + var customui = ''; + if (domain.customui != null) { customui = encodeURIComponent(JSON.stringify(domain.customui)); } + + render(req, res, getRenderPage('default', req, domain), getRenderArgs({ authCookie: authCookie, authRelayCookie: authRelayCookie, viewmode: viewmode, currentNode: currentNode, logoutControls: encodeURIComponent(JSON.stringify(logoutcontrols)).replace(/'/g, '%27'), domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, passRequirements: passRequirements, customui: customui, webcerthash: Buffer.from(obj.webCertificateFullHashs[domain.id], 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'), footer: (domain.footer == null) ? '' : domain.footer, webstate: encodeURIComponent(webstate), pluginHandler: (parent.pluginHandler == null) ? 'null' : parent.pluginHandler.prepExports() }, req, domain)); }); } else { // Send back the login application @@ -2269,8 +2274,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { if (typeof domain.authstrategies.saml == 'object') { authStrategies.push('saml'); } } + // Custom user interface + var customui = ''; + if (domain.customui != null) { customui = encodeURIComponent(JSON.stringify(domain.customui)); } + // Render the login page - render(req, res, getRenderPage('login', req, domain), getRenderArgs({ loginmode: loginmode, rootCertLink: getRootCertLink(), newAccount: newAccountsAllowed, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: obj.getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: emailcheck, features: features, sessiontime: args.sessiontime, passRequirements: passRequirements, footer: (domain.footer == null) ? '' : domain.footer, hkey: encodeURIComponent(hardwareKeyChallenge), messageid: msgid, passhint: passhint, welcometext: domain.welcometext ? encodeURIComponent(domain.welcometext).split('\'').join('\\\'') : null, hwstate: hwstate, otpemail: otpemail, otpsms: otpsms, twoFactorCookieDays: twoFactorCookieDays, authStrategies: authStrategies.join(',') }, req, domain)); + render(req, res, getRenderPage('login', req, domain), getRenderArgs({ loginmode: loginmode, rootCertLink: getRootCertLink(), newAccount: newAccountsAllowed, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: obj.getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: emailcheck, features: features, sessiontime: args.sessiontime, passRequirements: passRequirements, customui: customui, footer: (domain.footer == null) ? '' : domain.footer, hkey: encodeURIComponent(hardwareKeyChallenge), messageid: msgid, passhint: passhint, welcometext: domain.welcometext ? encodeURIComponent(domain.welcometext).split('\'').join('\\\'') : null, hwstate: hwstate, otpemail: otpemail, otpsms: otpsms, twoFactorCookieDays: twoFactorCookieDays, authStrategies: authStrategies.join(',') }, req, domain)); } // Handle a post request on the root