<%
function findInArray(key, value, array){
let indexes = [];
for(let i in array){
if(array[i][key] && array[i][key].includes(value)) indexes.push(i);
}
return indexes;
}
let html = ""
for(let id in slaves){
let slave = slaves[id];
html += `
- ID: ${id}
- Last seen: ${moment(Number(slave.time)).format("DD.MM.YY, hh:mm")}
- Online players: ${slave.playerCount}
- IP: ${slave.publicIP}:${slave.serverPort}
- Host: ${slave.mac}
${findInArray("modName", "remoteMap", slave.mods).length ? "
Remote map" : ""}
`
for(let o in masterPlugins){
let plug = masterPlugins[o];
if(plug.main
&& plug.main.ui
&& typeof plug.main.ui.slaveListing == "object"
&& Array.isArray(plug.main.ui.slaveListing)){
let slaveListingEntries = plug.main.ui.slaveListing;
for(let i in slaveListingEntries){
let button = slaveListingEntries[i];
if(button.getHtml && typeof button.getHtml == "function"){
html += "
"
html += button.getHtml({slave});
html += "
"
}
}
}
}
html += `
`
}
%>
<%- html %>