Some small updates
This commit is contained in:
parent
12d86cbfea
commit
dfb61b9fea
@ -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);
|
||||
|
||||
|
@ -139,6 +139,7 @@ std::shared_ptr<GeneralStatistics> StatisticManager::general_statistics() {
|
||||
|
||||
deque<unique_ptr<GeneralStatisticEntry>> 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<milliseconds>(system_clock::now().time_since_epoch() - hours(2) - minutes(10)).count()}) //10min as buffer
|
||||
.query(std::function<decltype(parse_general_entry)>{parse_general_entry}, entries, true);
|
||||
|
@ -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;
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user