1
0
Fork 0
mirror of https://gitlab.com/Shinobi-Systems/ShinobiCE.git synced 2025-03-09 15:40:15 +00:00
This commit is contained in:
Moe 2019-10-26 13:34:02 -07:00
parent ef40f3f231
commit 167603dfb0
118 changed files with 16152 additions and 5441 deletions

View file

@ -634,4 +634,42 @@ module.exports = function(s,config,lang,app){
res.end(s.prettyPrint(endData))
},res,req)
})
/**
* API : Superuser : Get Child Nodes
*/
app.all(config.webPaths.superApiPrefix+':auth/getChildNodes', function (req,res){
s.superAuth(req.params,function(resp){
var childNodesJson = {}
Object.values(s.childNodes).forEach(function(activeNode){
var activeCamerasCount = 0
var activeCameras = {}
Object.values(activeNode.activeCameras).forEach(function(monitor){
++activeCamerasCount
if(!activeCameras[monitor.ke])activeCameras[monitor.ke] = {}
activeCameras[monitor.ke][monitor.mid] = {
name: monitor.name,
mid: monitor.mid,
ke: monitor.ke,
details: {
accelerator: monitor.details.accelerator,
auto_host: monitor.details.auto_host,
}
}
})
childNodesJson[activeNode.ip] = {
ip: activeNode.ip,
cpu: activeNode.cpu,
dead: activeNode.dead,
countCount: activeNode.countCount,
activeMonitorsCount: activeCamerasCount,
activeMonitors: activeCameras,
}
})
var endData = {
ok : true,
childNodes: childNodesJson,
}
res.end(s.prettyPrint(endData))
},res,req)
})
}