|
|
@ -164,11 +164,11 @@ void RestServer::start()
|
|
|
|
httpServer.resource["/api/servers/info"]["GET"] = [this](auto response, auto /*request*/) {
|
|
|
|
httpServer.resource["/api/servers/info"]["GET"] = [this](auto response, auto /*request*/) {
|
|
|
|
stringstream ss;
|
|
|
|
stringstream ss;
|
|
|
|
ss << '{';
|
|
|
|
ss << '{';
|
|
|
|
ss << "servers: " << serverMap->size();
|
|
|
|
ss << "\"servers\": " << serverMap->size();
|
|
|
|
unsigned int players = 0;
|
|
|
|
unsigned int players = 0;
|
|
|
|
for (auto s : *serverMap)
|
|
|
|
for (auto s : *serverMap)
|
|
|
|
players += s.second.GetPlayers();
|
|
|
|
players += s.second.GetPlayers();
|
|
|
|
ss << ", players: " << players;
|
|
|
|
ss << ", \"players\": " << players;
|
|
|
|
ss << "}";
|
|
|
|
ss << "}";
|
|
|
|
|
|
|
|
|
|
|
|
ResponseStr(*response, ss.str(), "application/json");
|
|
|
|
ResponseStr(*response, ss.str(), "application/json");
|
|
|
|