1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Switched to new style network information from agent.

This commit is contained in:
Ylian Saint-Hilaire 2020-06-26 14:43:58 -07:00
parent 364ab8af56
commit ae1f36de68
9 changed files with 1902 additions and 1784 deletions

View file

@ -3045,15 +3045,10 @@ function createMeshCore(agent) {
break;
}
case 'netinfo': { // Show network interface information
//response = objToString(mesh.NetInfo, 0, ' ');
var interfaces = require('os').networkInterfaces();
response = objToString(interfaces, 0, ' ', true);
break;
}
case 'netinfo2': { // Show network interface information
response = objToString(mesh.NetInfo, 0, ' ', true);
break;
}
case 'wakeonlan': { // Send wake-on-lan
if ((args['_'].length != 1) || (args['_'][0].length != 12)) {
response = 'Proper usage: wakeonlan [mac], for example "wakeonlan 010203040506".';
@ -3280,8 +3275,8 @@ function createMeshCore(agent) {
sendNetworkUpdateNagleTimer = null;
// Update the network interfaces information data
var netInfo = mesh.NetInfo;
if (netInfo) {
var netInfo = { netif2: require('os').networkInterfaces() };
if (netInfo.netif2) {
netInfo.action = 'netinfo';
var netInfoStr = JSON.stringify(netInfo);
if ((force == true) || (clearGatewayMac(netInfoStr) != clearGatewayMac(lastNetworkInfo))) { mesh.SendCommand(netInfo); lastNetworkInfo = netInfoStr; }