Some small updates
This commit is contained in:
+15
-11
@@ -473,6 +473,7 @@ bool WebStatistics::handle_message(const std::shared_ptr<license::web::WebStatis
|
||||
auto& history_data = response["history"]["data"];
|
||||
for(index = 0; index < stats->record_count; index++) {
|
||||
auto& indexed_data = history_data[index];
|
||||
indexed_data["instances_empty"] = stats->history[index].instance_empty;
|
||||
indexed_data["instances"] = stats->history[index].instance_online;
|
||||
indexed_data["servers"] = stats->history[index].servers_online;
|
||||
indexed_data["clients"] = stats->history[index].clients_online;
|
||||
@@ -557,17 +558,20 @@ bool WebStatistics::handle_request(const std::shared_ptr<license::web::WebStatis
|
||||
auto type = request.parameters.at("type");
|
||||
logMessage(LOG_LICENSE_WEB, "[{}] Received HTTP status request of type {}", client->client_prefix(), type);
|
||||
|
||||
if(type == "request" && request.parameters.at("request_type") == "general") {
|
||||
Json::Value json;
|
||||
json["type"] = "response";
|
||||
auto stats = this->statistics_manager->general_statistics();
|
||||
json["statistics"]["instances_empty"] = to_string(stats->empty_instances);
|
||||
json["statistics"]["instances"] = to_string(stats->instances);
|
||||
json["statistics"]["servers"] = to_string(stats->servers);
|
||||
json["statistics"]["clients"] = to_string(stats->clients);
|
||||
json["statistics"]["music"] = to_string(stats->bots);
|
||||
response.setHeader("data", {json_dump(json).string()});
|
||||
response.code = http::code::_200;
|
||||
if(type == "request" && request.parameters.count("request_type") > 0) {
|
||||
const auto& type = request.parameters.at("request_type");
|
||||
if(type == "general") {
|
||||
Json::Value json;
|
||||
json["type"] = "response";
|
||||
auto stats = this->statistics_manager->general_statistics();
|
||||
json["statistics"]["instances_empty"] = to_string(stats->empty_instances);
|
||||
json["statistics"]["instances"] = to_string(stats->instances);
|
||||
json["statistics"]["servers"] = to_string(stats->servers);
|
||||
json["statistics"]["clients"] = to_string(stats->clients);
|
||||
json["statistics"]["music"] = to_string(stats->bots);
|
||||
response.setHeader("data", {json_dump(json).string()});
|
||||
response.code = http::code::_200;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user