diff options
author | Unknown <fireice2@o2.pl> | 2017-11-13 19:56:41 +0000 |
---|---|---|
committer | Unknown <fireice2@o2.pl> | 2017-11-13 19:56:41 +0000 |
commit | b48ca65c0bfd9b9ccda1083d2955c75ff9c10092 (patch) | |
tree | a40277d66ac896f15bd54c80eb9c4665bd793aa4 | |
parent | f0875b614c6fe77a70af443052cef07756e135b4 (diff) | |
download | xmr-stak-b48ca65c0bfd9b9ccda1083d2955c75ff9c10092.zip xmr-stak-b48ca65c0bfd9b9ccda1083d2955c75ff9c10092.tar.gz |
Add version to web and json
-rw-r--r-- | xmrstak/cli/cli-miner.cpp | 2 | ||||
-rw-r--r-- | xmrstak/http/webdesign.cpp | 13 | ||||
-rw-r--r-- | xmrstak/misc/executor.cpp | 12 | ||||
-rw-r--r-- | xmrstak/version.cpp | 2 | ||||
-rw-r--r-- | xmrstak/version.hpp | 1 |
5 files changed, 22 insertions, 8 deletions
diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp index 6e391d9..038b51b 100644 --- a/xmrstak/cli/cli-miner.cpp +++ b/xmrstak/cli/cli-miner.cpp @@ -299,7 +299,7 @@ int main(int argc, char *argv[]) } if(opName.compare("-v") == 0 || opName.compare("--version") == 0) { - std::cout<< "Version: " << get_version_str() << std::endl; + std::cout<< "Version: " << get_version_str_short() << std::endl; return 0; } else if(opName.compare("--noCPU") == 0) diff --git a/xmrstak/http/webdesign.cpp b/xmrstak/http/webdesign.cpp index c6fcea6..3b21ae0 100644 --- a/xmrstak/http/webdesign.cpp +++ b/xmrstak/http/webdesign.cpp @@ -1,6 +1,6 @@ #include <stdlib.h> -extern const char sHtmlCssEtag [] = "00000006"; +extern const char sHtmlCssEtag [] = "00000008"; extern const char sHtmlCssFile [] = "body {" "font-family: Tahoma, Arial, sans-serif;" @@ -38,7 +38,13 @@ extern const char sHtmlCssFile [] = "color: white;" "padding: 10px;" "font-weight: bold;" - "margin: 10px 0px;" + "margin: 0px;" + "margin-bottom: 10px;" + "}" + + ".version {" + "font-size: 75%;" + "text-align: right;" "}" ".links {" @@ -97,6 +103,7 @@ extern const char sHtmlCommonHeader [] = "<link rel='stylesheet' href='style.css' /><title>%s</title></head>" "<body>" "<div class='all'>" + "<div class='version'>%s</div>" "<div class='header'><span style='color: rgb(255, 160, 0)'>XMR</span>-Stak Monero Miner</div>" "<div class='flex-container'>" @@ -181,6 +188,8 @@ extern const char sJsonApiConnectionError[] = extern const char sJsonApiFormat [] = "{" + "\"version\":\"%s\"," + "\"hashrate\":{" "\"threads\":[%s]," "\"total\":%s," diff --git a/xmrstak/misc/executor.cpp b/xmrstak/misc/executor.cpp index 931e2aa..7d3a57d 100644 --- a/xmrstak/misc/executor.cpp +++ b/xmrstak/misc/executor.cpp @@ -33,6 +33,7 @@ #include "xmrstak/jconf.hpp" #include "xmrstak/misc/console.hpp" #include "xmrstak/donate-level.hpp" +#include "xmrstak/version.hpp" #include "xmrstak/http/webdesign.hpp" #include <thread> @@ -43,6 +44,7 @@ #include <assert.h> #include <time.h> + #ifdef _WIN32 #define strncasecmp _strnicmp #endif // _WIN32 @@ -814,7 +816,7 @@ void executor::http_hashrate_report(std::string& out) out.reserve(4096); - snprintf(buffer, sizeof(buffer), sHtmlCommonHeader, "Hashrate Report", "Hashrate Report"); + snprintf(buffer, sizeof(buffer), sHtmlCommonHeader, "Hashrate Report", ver_html, "Hashrate Report"); out.append(buffer); snprintf(buffer, sizeof(buffer), sHtmlHashrateBodyHigh, (unsigned int)nthd + 3); @@ -859,7 +861,7 @@ void executor::http_result_report(std::string& out) out.reserve(4096); - snprintf(buffer, sizeof(buffer), sHtmlCommonHeader, "Result Report", "Result Report"); + snprintf(buffer, sizeof(buffer), sHtmlCommonHeader, "Result Report", ver_html, "Result Report"); out.append(buffer); size_t iGoodRes = vMineResults[0].count, iTotalRes = iGoodRes; @@ -905,7 +907,7 @@ void executor::http_connection_report(std::string& out) out.reserve(4096); - snprintf(buffer, sizeof(buffer), sHtmlCommonHeader, "Connection Report", "Connection Report"); + snprintf(buffer, sizeof(buffer), sHtmlCommonHeader, "Connection Report", ver_html, "Connection Report"); out.append(buffer); jpsock* pool = pick_pool_by_id(current_pool_id); @@ -1045,11 +1047,11 @@ void executor::http_json_report(std::string& out) cn_error.append(buffer); } - size_t bb_size = 1024 + hr_thds.size() + res_error.size() + cn_error.size(); + size_t bb_size = 2048 + hr_thds.size() + res_error.size() + cn_error.size(); std::unique_ptr<char[]> bigbuf( new char[ bb_size ] ); int bb_len = snprintf(bigbuf.get(), bb_size, sJsonApiFormat, - hr_thds.c_str(), hr_buffer, a, + get_version_str().c_str(), hr_thds.c_str(), hr_buffer, a, int_port(iPoolDiff), int_port(iGoodRes), int_port(iTotalRes), fAvgResTime, int_port(iPoolHashes), int_port(iTopDiff[0]), int_port(iTopDiff[1]), int_port(iTopDiff[2]), int_port(iTopDiff[3]), int_port(iTopDiff[4]), int_port(iTopDiff[5]), int_port(iTopDiff[6]), int_port(iTopDiff[7]), int_port(iTopDiff[8]), int_port(iTopDiff[9]), diff --git a/xmrstak/version.cpp b/xmrstak/version.cpp index 3cecc8f..3b8a19d 100644 --- a/xmrstak/version.cpp +++ b/xmrstak/version.cpp @@ -45,6 +45,8 @@ #define VERSION_LONG XMR_STAK_NAME "/" XMR_STAK_VERSION "/" XMRSTAK_PP_TOSTRING(GIT_COMMIT_HASH) "/" XMRSTAK_PP_TOSTRING(GIT_BRANCH) "/" OS_TYPE "/" XMRSTAK_PP_TOSTRING(BACKEND_TYPE) "/" COIN_TYPE "/" #define VERSION_SHORT XMR_STAK_NAME " " XMR_STAK_VERSION " " XMRSTAK_PP_TOSTRING(GIT_COMMIT_HASH) +#define VERSION_HTML "v" XMR_STAK_VERSION "-" XMRSTAK_PP_TOSTRING(GIT_COMMIT_HASH) const char ver_long[] = VERSION_LONG; const char ver_short[] = VERSION_SHORT; +const char ver_html[] = VERSION_HTML; diff --git a/xmrstak/version.hpp b/xmrstak/version.hpp index 2bf38d5..cdf82f3 100644 --- a/xmrstak/version.hpp +++ b/xmrstak/version.hpp @@ -6,6 +6,7 @@ extern const char ver_long[]; extern const char ver_short[]; +extern const char ver_html[]; inline std::string get_version_str() { |