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 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 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`
|
* 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);
|
bool handle_command(string& line);
|
||||||
|
|
||||||
|
@ -139,6 +139,7 @@ std::shared_ptr<GeneralStatistics> StatisticManager::general_statistics() {
|
|||||||
|
|
||||||
deque<unique_ptr<GeneralStatisticEntry>> entries;
|
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",
|
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
|
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);
|
.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"];
|
auto& history_data = response["history"]["data"];
|
||||||
for(index = 0; index < stats->record_count; index++) {
|
for(index = 0; index < stats->record_count; index++) {
|
||||||
auto& indexed_data = history_data[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["instances"] = stats->history[index].instance_online;
|
||||||
indexed_data["servers"] = stats->history[index].servers_online;
|
indexed_data["servers"] = stats->history[index].servers_online;
|
||||||
indexed_data["clients"] = stats->history[index].clients_online;
|
indexed_data["clients"] = stats->history[index].clients_online;
|
||||||
@ -557,7 +558,9 @@ bool WebStatistics::handle_request(const std::shared_ptr<license::web::WebStatis
|
|||||||
auto type = request.parameters.at("type");
|
auto type = request.parameters.at("type");
|
||||||
logMessage(LOG_LICENSE_WEB, "[{}] Received HTTP status request of type {}", client->client_prefix(), type);
|
logMessage(LOG_LICENSE_WEB, "[{}] Received HTTP status request of type {}", client->client_prefix(), type);
|
||||||
|
|
||||||
if(type == "request" && request.parameters.at("request_type") == "general") {
|
if(type == "request" && request.parameters.count("request_type") > 0) {
|
||||||
|
const auto& type = request.parameters.at("request_type");
|
||||||
|
if(type == "general") {
|
||||||
Json::Value json;
|
Json::Value json;
|
||||||
json["type"] = "response";
|
json["type"] = "response";
|
||||||
auto stats = this->statistics_manager->general_statistics();
|
auto stats = this->statistics_manager->general_statistics();
|
||||||
@ -569,6 +572,7 @@ bool WebStatistics::handle_request(const std::shared_ptr<license::web::WebStatis
|
|||||||
response.setHeader("data", {json_dump(json).string()});
|
response.setHeader("data", {json_dump(json).string()});
|
||||||
response.code = http::code::_200;
|
response.code = http::code::_200;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -42,12 +42,12 @@ cd libs || { echo "failed to enter lib directory"; exit 1; }
|
|||||||
library_base=$(realpath ../../../../../libraries)
|
library_base=$(realpath ../../../../../libraries)
|
||||||
|
|
||||||
# Setting up ssl
|
# Setting up ssl
|
||||||
library_path=$(realpath "${library_base}/boringssl/${build_path}/ssl/libssl.so")
|
query_system_link "libssl.so.1.1"
|
||||||
cp "$library_path" . || { echo "failed to copy libssl.so"; exit 1; }
|
cp "${library_path}" . || { echo "failed to copy libssl.so.1.1"; exit 1; }
|
||||||
|
|
||||||
# Setting up crypto
|
# Setting up crypto
|
||||||
library_path=$(realpath "${library_base}/boringssl/${build_path}/crypto/libcrypto.so")
|
query_system_link "libcrypto.so.1.1"
|
||||||
cp "$library_path" . || { echo "failed to copy libcrypto.so"; exit 1; }
|
cp "${library_path}" . || { echo "failed to copy libcrypto.so.1.1"; exit 1; }
|
||||||
|
|
||||||
# Setting up DataPipes
|
# Setting up DataPipes
|
||||||
library_path=$(realpath "${library_base}/DataPipes/${build_path}/lib/libDataPipes-RTC.so")
|
library_path=$(realpath "${library_base}/DataPipes/${build_path}/lib/libDataPipes-RTC.so")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user