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 93c57091..de475d18 100644 Binary files a/agents/MeshCmd-signed.exe and b/agents/MeshCmd-signed.exe differ diff --git a/agents/MeshCmd64-signed.exe b/agents/MeshCmd64-signed.exe index 0e73879c..6f5a9a0b 100644 Binary files a/agents/MeshCmd64-signed.exe and b/agents/MeshCmd64-signed.exe differ diff --git a/agents/MeshService-signed.exe b/agents/MeshService-signed.exe index 65fdad66..88066212 100644 Binary files a/agents/MeshService-signed.exe and b/agents/MeshService-signed.exe differ diff --git a/agents/MeshService64-signed.exe b/agents/MeshService64-signed.exe index 1ebc3bc1..44049143 100644 Binary files a/agents/MeshService64-signed.exe and b/agents/MeshService64-signed.exe differ 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