From 782ca6bc6ab4ff81c14beca7e0438f3a72af8be1 Mon Sep 17 00:00:00 2001 From: Norman Moeschter Date: Wed, 21 Aug 2019 21:40:14 +0200 Subject: [PATCH 1/2] Add autorefresh on /tx page. --- main.cpp | 19 +++++++++++++++++++ src/page.h | 6 ++++-- src/templates/tx.html | 11 +++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 8e969b9..854a5a8 100644 --- a/main.cpp +++ b/main.cpp @@ -326,6 +326,16 @@ main(int ac, const char* av[]) return myxmr::htmlresponse( xmrblocks.show_tx(remove_bad_chars(tx_hash))); }); + if (enable_autorefresh_option) + { + CROW_ROUTE(app, "/tx//autorefresh") + ([&](string tx_hash) { + bool refresh_page {true}; + uint16_t with_ring_signatures {0}; + return myxmr::htmlresponse( + xmrblocks.show_tx(remove_bad_chars(tx_hash), with_ring_signatures, refresh_page)); + }); + } if (enable_as_hex) { @@ -375,6 +385,15 @@ main(int ac, const char* av[]) xmrblocks.show_tx(remove_bad_chars(tx_hash), with_ring_signatures)); }); + if (enable_autorefresh_option) + { + CROW_ROUTE(app, "/tx///autorefresh") + ([&](string tx_hash, uint16_t with_ring_signature) { + bool refresh_page {true}; + return myxmr::htmlresponse( + xmrblocks.show_tx(remove_bad_chars(tx_hash), with_ring_signature, refresh_page)); + }); + } CROW_ROUTE(app, "/myoutputs").methods("POST"_method) ([&](const crow::request& req) -> myxmr::htmlresponse diff --git a/src/page.h b/src/page.h index df7f245..f885276 100644 --- a/src/page.h +++ b/src/page.h @@ -1414,7 +1414,7 @@ show_block(string _blk_hash) } string -show_tx(string tx_hash_str, uint16_t with_ring_signatures = 0) +show_tx(string tx_hash_str, uint16_t with_ring_signatures = 0, bool refresh_page = false) { // parse tx hash string to hash object @@ -1629,7 +1629,9 @@ show_tx(string tx_hash_str, uint16_t with_ring_signatures = 0) {"testnet" , this->testnet}, {"stagenet" , this->stagenet}, {"show_cache_times" , show_cache_times}, - {"txs" , mstch::array{}} + {"txs" , mstch::array{}}, + {"refresh" , refresh_page}, + {"tx_hash" , tx_hash_str} }; boost::get(context["txs"]).push_back(tx_context); diff --git a/src/templates/tx.html b/src/templates/tx.html index 8f7e88f..a52cb6e 100644 --- a/src/templates/tx.html +++ b/src/templates/tx.html @@ -1,4 +1,15 @@ +
+

+ {{#refresh}} + Autorefresh is ON (10 s) + {{/refresh}} + {{^refresh}} + Autorefresh is OFF + {{/refresh}} +

+
+
{{#has_error}} From e0b47695c02fe2b3aaebf9719db96c5f5dc3c616 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Thu, 5 Sep 2019 15:02:23 +0800 Subject: [PATCH 2/2] update cmake to check for other monero path --- CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2833d93..16c85ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,18 @@ if (NOT MONERO_BUILD_DIR) # set location of monero build tree set(MONERO_BUILD_DIR ${MONERO_SOURCE_DIR}/build/release/ CACHE PATH "Path to the build directory for Monero") + + if (NOT EXISTS ${MONERO_BUILD_DIR}) + # try different location + message(STATUS "Trying different folder for monero libraries") + set(MONERO_BUILD_DIR ${MONERO_SOURCE_DIR}/build/Linux/master/release/ + CACHE PATH "Path to the build directory for Monero" FORCE) + endif() + +endif() + +if (NOT EXISTS ${MONERO_BUILD_DIR}) + message(FATAL_ERROR "Monero libraries not found in: ${MONERO_BUILD_DIR}") endif() set(MY_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake"