diff --git a/license/LicenseServerMain.cpp b/license/LicenseServerMain.cpp index 099bddf..13b4bf9 100644 --- a/license/LicenseServerMain.cpp +++ b/license/LicenseServerMain.cpp @@ -31,6 +31,8 @@ using namespace license; * Online clients: SELECT SUM(`clients`) FROM (SELECT DISTINCT(`ip`), `clients` FROM `history_online` WHERE `timestamp` > (UNIX_TIMESTAMP() - 60 * 60 * 2) * 1000) AS `a` * Online bots: SELECT SUM(`clients`) FROM (SELECT DISTINCT(`ip`), `clients` FROM `history_online` WHERE `timestamp` > (UNIX_TIMESTAMP() - 60 * 60 * 2) * 1000) AS `a` * Online VS Server: SELECT SUM(`music`) FROM (SELECT DISTINCT(`ip`), `music` FROM `history_online` WHERE `timestamp` > (UNIX_TIMESTAMP() - 60 * 60 * 2) * 1000) AS `a` + * + * Empty instances: curl -ik "https://stats.teaspeak.de:27788?type=request&request_type=general" -X GET 2>&1 | grep "data:" */ bool handle_command(string& line); diff --git a/license/server/StatisticManager.cpp b/license/server/StatisticManager.cpp index 732b529..e590a46 100644 --- a/license/server/StatisticManager.cpp +++ b/license/server/StatisticManager.cpp @@ -139,6 +139,7 @@ std::shared_ptr StatisticManager::general_statistics() { deque> entries; + //TODO: Calculate web clients! auto result = sql::command(this->license_manager->sql(), "SELECT `keyId`, `unique_id`, `timestamp`,`server`,`clients`,`music` FROM `history_online` WHERE `timestamp` > :time ORDER BY `timestamp` ASC", variable{":time", duration_cast(system_clock::now().time_since_epoch() - hours(2) - minutes(10)).count()}) //10min as buffer .query(std::function{parse_general_entry}, entries, true); diff --git a/license/server/WebAPI.cpp b/license/server/WebAPI.cpp index db7719f..c300edc 100644 --- a/license/server/WebAPI.cpp +++ b/license/server/WebAPI.cpp @@ -473,6 +473,7 @@ bool WebStatistics::handle_message(const std::shared_ptrrecord_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_ptrclient_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; diff --git a/server/repro/generate_libraries.sh b/server/repro/generate_libraries.sh index d6e8668..f71d142 100755 --- a/server/repro/generate_libraries.sh +++ b/server/repro/generate_libraries.sh @@ -42,12 +42,12 @@ cd libs || { echo "failed to enter lib directory"; exit 1; } library_base=$(realpath ../../../../../libraries) # Setting up ssl -library_path=$(realpath "${library_base}/boringssl/${build_path}/ssl/libssl.so") -cp "$library_path" . || { echo "failed to copy libssl.so"; exit 1; } +query_system_link "libssl.so.1.1" +cp "${library_path}" . || { echo "failed to copy libssl.so.1.1"; exit 1; } # Setting up crypto -library_path=$(realpath "${library_base}/boringssl/${build_path}/crypto/libcrypto.so") -cp "$library_path" . || { echo "failed to copy libcrypto.so"; exit 1; } +query_system_link "libcrypto.so.1.1" +cp "${library_path}" . || { echo "failed to copy libcrypto.so.1.1"; exit 1; } # Setting up DataPipes library_path=$(realpath "${library_base}/DataPipes/${build_path}/lib/libDataPipes-RTC.so")