mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
Merge pull request #188 from normoes/autorefresh_tx_page
Add autorefresh on /tx page.
This commit is contained in:
commit
5e7e90b9f6
3 changed files with 34 additions and 2 deletions
19
main.cpp
19
main.cpp
|
@ -326,6 +326,16 @@ main(int ac, const char* av[])
|
||||||
return myxmr::htmlresponse(
|
return myxmr::htmlresponse(
|
||||||
xmrblocks.show_tx(remove_bad_chars(tx_hash)));
|
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)
|
if (enable_as_hex)
|
||||||
{
|
{
|
||||||
|
@ -375,6 +385,15 @@ main(int ac, const char* av[])
|
||||||
xmrblocks.show_tx(remove_bad_chars(tx_hash),
|
xmrblocks.show_tx(remove_bad_chars(tx_hash),
|
||||||
with_ring_signatures));
|
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)
|
CROW_ROUTE(app, "/myoutputs").methods("POST"_method)
|
||||||
([&](const crow::request& req) -> myxmr::htmlresponse
|
([&](const crow::request& req) -> myxmr::htmlresponse
|
||||||
|
|
|
@ -1414,7 +1414,7 @@ show_block(string _blk_hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
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
|
// 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},
|
{"testnet" , this->testnet},
|
||||||
{"stagenet" , this->stagenet},
|
{"stagenet" , this->stagenet},
|
||||||
{"show_cache_times" , show_cache_times},
|
{"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);
|
boost::get<mstch::array>(context["txs"]).push_back(tx_context);
|
||||||
|
|
|
@ -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>
|
<div>
|
||||||
|
|
||||||
{{#has_error}}
|
{{#has_error}}
|
||||||
|
|
Loading…
Reference in a new issue