mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
add prove and myoutpus shortcut links
This commit is contained in:
parent
4fee4e25c9
commit
f290c1db43
3 changed files with 51 additions and 5 deletions
38
main.cpp
38
main.cpp
|
@ -253,6 +253,12 @@ main(int ac, const char* av[])
|
|||
// crow instance
|
||||
crow::SimpleApp app;
|
||||
|
||||
// get domian url based on the request
|
||||
auto get_domain = [&use_ssl](crow::request const& req) {
|
||||
return (use_ssl ? "https://" : "http://")
|
||||
+ req.get_header_value("Host");
|
||||
};
|
||||
|
||||
CROW_ROUTE(app, "/")
|
||||
([&](const crow::request& req) {
|
||||
return crow::response(xmrblocks.index2());
|
||||
|
@ -304,8 +310,22 @@ main(int ac, const char* av[])
|
|||
// using tx pusher
|
||||
string raw_tx_data = post_body["raw_tx_data"];
|
||||
|
||||
string domain = get_domain(req);
|
||||
|
||||
return xmrblocks.show_my_outputs(tx_hash, xmr_address,
|
||||
viewkey, raw_tx_data);
|
||||
viewkey, raw_tx_data,
|
||||
domain);
|
||||
});
|
||||
|
||||
CROW_ROUTE(app, "/myoutputs/<string>/<string>/<string>")
|
||||
([&](const crow::request& req, string tx_hash,
|
||||
string xmr_address, string viewkey) {
|
||||
|
||||
string domain = get_domain(req);
|
||||
|
||||
return xmrblocks.show_my_outputs(tx_hash, xmr_address,
|
||||
viewkey, string {},
|
||||
domain);
|
||||
});
|
||||
|
||||
CROW_ROUTE(app, "/prove").methods("POST"_method)
|
||||
|
@ -326,7 +346,21 @@ main(int ac, const char* av[])
|
|||
string tx_prv_key = post_body["txprvkey"];;
|
||||
string xmr_address = post_body["xmraddress"];;
|
||||
|
||||
return xmrblocks.show_prove(tx_hash, xmr_address, tx_prv_key);
|
||||
string domain = get_domain(req);
|
||||
|
||||
return xmrblocks.show_prove(tx_hash, xmr_address,
|
||||
tx_prv_key, domain);
|
||||
});
|
||||
|
||||
|
||||
CROW_ROUTE(app, "/prove/<string>/<string>/<string>")
|
||||
([&](const crow::request& req, string tx_hash,
|
||||
string xmr_address, string tx_prv_key) {
|
||||
|
||||
string domain = get_domain(req);
|
||||
|
||||
return xmrblocks.show_prove(tx_hash, xmr_address,
|
||||
tx_prv_key, domain);
|
||||
});
|
||||
|
||||
if (enable_pusher)
|
||||
|
|
15
src/page.h
15
src/page.h
|
@ -1412,6 +1412,7 @@ namespace xmreg
|
|||
string xmr_address_str,
|
||||
string viewkey_str, /* or tx_prv_key_str when tx_prove == true */
|
||||
string raw_tx_data,
|
||||
string domain,
|
||||
bool tx_prove = false)
|
||||
{
|
||||
|
||||
|
@ -1595,6 +1596,11 @@ namespace xmreg
|
|||
string pid_str = pod_to_hex(txd.payment_id);
|
||||
string pid8_str = pod_to_hex(txd.payment_id8);
|
||||
|
||||
string shortcut_url = domain
|
||||
+ (tx_prove ? "/prove" : "/myoutputs")
|
||||
+ "/" + tx_hash_str
|
||||
+ "/" + xmr_address_str
|
||||
+ "/" + viewkey_str;
|
||||
|
||||
// initalise page tempate map with basic info about blockchain
|
||||
mstch::map context {
|
||||
|
@ -1616,7 +1622,8 @@ namespace xmreg
|
|||
{"payment_id" , pid_str},
|
||||
{"payment_id8" , pid8_str},
|
||||
{"decrypted_payment_id8", string{}},
|
||||
{"tx_prove" , tx_prove}
|
||||
{"tx_prove" , tx_prove},
|
||||
{"shortcut_url" , shortcut_url}
|
||||
};
|
||||
|
||||
string server_time_str = xmreg::timestamp_to_str_gm(server_timestamp, "%F");
|
||||
|
@ -2096,12 +2103,14 @@ namespace xmreg
|
|||
string
|
||||
show_prove(string tx_hash_str,
|
||||
string xmr_address_str,
|
||||
string tx_prv_key_str)
|
||||
string tx_prv_key_str,
|
||||
string domain)
|
||||
{
|
||||
string raw_tx_data {""}; // not using it in prove tx. only for outputs
|
||||
|
||||
return show_my_outputs(tx_hash_str, xmr_address_str,
|
||||
tx_prv_key_str, raw_tx_data, true);
|
||||
tx_prv_key_str, raw_tx_data,
|
||||
domain, true);
|
||||
}
|
||||
|
||||
string
|
||||
|
|
|
@ -76,6 +76,9 @@
|
|||
0.000000000000
|
||||
{{/found_our_outputs}}
|
||||
</h3>
|
||||
<h4>
|
||||
<a href="{{shortcut_url}}" target="_blank">link to this page</a>
|
||||
</h4>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue