Merge branch 'devel' into randomx

This commit is contained in:
moneroexamples 2019-09-26 10:09:42 +08:00
commit dc642db809
4 changed files with 46 additions and 3 deletions

View File

@ -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"

View File

@ -328,6 +328,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/<string>/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)
{
@ -377,6 +387,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/<string>/<uint>/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

View File

@ -1482,8 +1482,7 @@ show_randomx(uint64_t _blk_height)
}
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
@ -1698,7 +1697,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<mstch::array>(context["txs"]).push_back(tx_context);

View File

@ -1,4 +1,15 @@
<div class="center">
<h3 style="font-size: 12px; margin-top: 20px">
{{#refresh}}
<a href="/tx/{{tx_hash}}">Autorefresh is ON (10 s)</a>
{{/refresh}}
{{^refresh}}
<a href="/tx/{{tx_hash}}/autorefresh">Autorefresh is OFF</a>
{{/refresh}}
</h3>
</div>
<div>
{{#has_error}}