mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-03-09 15:40:18 +00:00 
			
		
		
		
	Click once work, UI fixes.
This commit is contained in:
		
							parent
							
								
									1c47f13090
								
							
						
					
					
						commit
						d750077f45
					
				
					 5 changed files with 31 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -295,6 +295,11 @@ module.exports.CreateAmtManager = function (parent) {
 | 
			
		|||
                if (Array.isArray(event.nodeids)) { for (var i in event.nodeids) { performPowerAction(event.nodeids[i], 2); } }
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
            case 'clickoncerecovery': { // React to Intel AMT Click Once Recovery command
 | 
			
		||||
                if (event.noact == 1) return; // Take no action on these events. We are likely in peering mode and need to only act when the database signals the change in state.
 | 
			
		||||
                if (Array.isArray(event.nodeids)) { for (var i in event.nodeids) { performClickOnceRecoveryAction(event.nodeids[i], event.file); } }
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
            case 'changenode': { // React to changes in a device
 | 
			
		||||
                var devices = obj.amtDevices[event.nodeid], rescan = false;
 | 
			
		||||
                if (devices != null) {
 | 
			
		||||
| 
						 | 
				
			
			@ -805,6 +810,23 @@ module.exports.CreateAmtManager = function (parent) {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // Perform Intel AMT Click Once Recovery on a device
 | 
			
		||||
    function performClickOnceRecoveryAction(nodeid, file) {
 | 
			
		||||
        var devices = obj.amtDevices[nodeid];
 | 
			
		||||
        if (devices == null) return;
 | 
			
		||||
        for (var i in devices) {
 | 
			
		||||
            var dev = devices[i];
 | 
			
		||||
            // If not LMS, has a AMT stack present and is in connected state, perform operation.
 | 
			
		||||
            if ((dev.connType != 2) && (dev.state == 1) && (dev.amtstack != null)) {
 | 
			
		||||
                console.log('Perform Click Once Recovery', nodeid, file);
 | 
			
		||||
 | 
			
		||||
                // TODO: Make sure the MPS server root certificate is present.
 | 
			
		||||
                // TODO: Generate the one-time URL.
 | 
			
		||||
                // TODO: Issue the WSMAN command.
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //
 | 
			
		||||
    // Intel AMT Clock Syncronization
 | 
			
		||||
    //
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5510,8 +5510,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
 | 
			
		|||
                        // Check if we found this device and if we have full rights
 | 
			
		||||
                        if ((node == null) || (rights != 0xFFFFFFFF)) return;
 | 
			
		||||
 | 
			
		||||
                        // Perform Intel AMT Click Once Recovery
 | 
			
		||||
                        console.log('ClickOnceRecovery', node._id, file.fullpath);
 | 
			
		||||
                        // Event Intel AMT Click Once Recovery, this will cause Intel AMT wake operations on this and other servers.
 | 
			
		||||
                        parent.parent.DispatchEvent('*', obj, { action: 'clickoncerecovery', userid: user._id, username: user.name, nodeids: [node._id], domain: domain.id, nolog: 1, file: file.fullpath });
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2385,6 +2385,7 @@ a {
 | 
			
		|||
    grid-area: deskarea1;
 | 
			
		||||
    -ms-grid-column: 1;
 | 
			
		||||
    -ms-grid-row: 1;
 | 
			
		||||
    height: 20px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -582,7 +582,7 @@
 | 
			
		|||
                            <span id=connectbutton1span><input type=button id=connectbutton1 cmenu="deskConnectButton" value="Connect" onclick=connectDesktop(event,3) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
 | 
			
		||||
                            <span id=connectbutton1hspan> <input type=button id=connectbutton1h value="HW Connect" title="Connect using Intel® AMT hardware KVM" onclick=connectDesktop(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
 | 
			
		||||
                            <span id=disconnectbutton1span> <input type=button id=disconnectbutton1 value="Disconnect" onclick=connectDesktop(event,0) onkeypress="return false" onkeydown="return false" /></span>
 | 
			
		||||
                             <span id="deskstatus">Disconnected</span><span id="deskmetadata"></span>
 | 
			
		||||
                             <span id="deskstatus" style="line-height:22px">Disconnected</span><span id="deskmetadata"></span>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div id=deskarea2 style="">
 | 
			
		||||
| 
						 | 
				
			
			@ -676,7 +676,7 @@
 | 
			
		|||
                                    <span id="connectbutton2span"><input type="button" id="connectbutton2" cmenu="termConnectButton" value="Connect" onclick=connectTerminal(event,1) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
 | 
			
		||||
                                    <span id="connectbutton2hspan"> <input type="button" id="connectbutton2h" value="HW Connect" title="Connect using Intel® AMT hardware KVM" onclick=connectTerminal(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
 | 
			
		||||
                                    <span id="disconnectbutton2span"> <input type="button" id="disconnectbutton2" value="Disconnect" onclick=connectTerminal(event,0) onkeypress="return false" onkeydown="return false" /></span>
 | 
			
		||||
                                     <span id="termstatus">Disconnected</span><span id="termtitle"></span>
 | 
			
		||||
                                     <span id="termstatus" style="line-height:22px">Disconnected</span><span id="termtitle"></span>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </td>
 | 
			
		||||
                        </tr>
 | 
			
		||||
| 
						 | 
				
			
			@ -6613,7 +6613,7 @@
 | 
			
		|||
            if (((currentNode.conn & 1) != 0) && ((rights & 131072) != 0)) { count++; y += '<option value=106>' + "Run Commands" + '</option>'; } // Remote command permission
 | 
			
		||||
            if ((currentNode.conn != 0) && ((rights & 262144) != 0)) { count++; y += '<option value=4>' + "Sleep" + '</option><option value=3>' + "Reset" + '</option><option value=2>' + "Power off" + '</option>'; }
 | 
			
		||||
            if ((currentNode.conn & 16) != 0) { count++; y += '<option value=103>' + "Send MQTT Message" + '</option>'; }
 | 
			
		||||
            if ((getNodeAmtVersion(currentNode) >= 15) && ((currentNode.conn & 6) != 0) && (rights == 0xFFFFFFFF) && ((features & 0x00000400) == 0)) { count++; y += '<option value=107>' + "Intel® AMT Click Once Recovery" + '</option>'; } // CIRA (2) or AMT (4) connected
 | 
			
		||||
            if ((getNodeAmtVersion(currentNode) >= 15) && (currentNode.intelamt.state == 2) && ((currentNode.conn & 6) != 0) && (rights == 0xFFFFFFFF) && ((features & 0x00000400) == 0)) { count++; y += '<option value=107>' + "Intel® AMT Click Once Recovery" + '</option>'; } // CIRA (2) or AMT (4) connected
 | 
			
		||||
            if (((currentNode.conn & 1) != 0) && ((rights & 32768) != 0)) { count++; y += '<option value=104>' + "Uninstall Agent" + '</option>'; }
 | 
			
		||||
            y += '</select>';
 | 
			
		||||
            x += addHtmlValue("Operation", y);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3439,10 +3439,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
 | 
			
		|||
                for (var i in files.files) {
 | 
			
		||||
                    var file = files.files[i];
 | 
			
		||||
 | 
			
		||||
                    // Perform Intel AMT Click Once Recovery
 | 
			
		||||
                    console.log('ClickOnceRecovery', node._id, file.path);
 | 
			
		||||
                    // Event Intel AMT Click Once Recovery, this will cause Intel AMT wake operations on this and other servers.
 | 
			
		||||
                    parent.DispatchEvent('*', obj, { action: 'clickoncerecovery', userid: user._id, username: user.name, nodeids: [node._id], domain: domain.id, nolog: 1, file: file.path });
 | 
			
		||||
 | 
			
		||||
                    try { obj.fs.unlinkSync(file.path); } catch (e) { }
 | 
			
		||||
                    try { obj.fs.unlinkSync(file.path); } catch (e) { } // TODO: Remove this file after 30 minutes.
 | 
			
		||||
                }
 | 
			
		||||
                res.send('');
 | 
			
		||||
            });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue