changed get to post requests in decoding outputs and prove sending

master
moneroexamples 8 years ago
parent 9d671da4eb
commit 9f98a70fcf

@ -181,27 +181,45 @@ int main(int ac, const char* av[]) {
return xmrblocks.show_tx(tx_hash, with_ring_signatures);
});
CROW_ROUTE(app, "/myoutputs").methods("GET"_method)
CROW_ROUTE(app, "/myoutputs").methods("POST"_method)
([&](const crow::request& req) {
string tx_hash = string(req.url_params.get("tx_hash"));
string xmr_address = string(req.url_params.get("xmr_address"));
string viewkey = string(req.url_params.get("viewkey"));
map<std::string, std::string> post_body = xmreg::parse_crow_post_data(req.body);
if (post_body.count("xmr_address") == 0
|| post_body.count("viewkey") == 0
|| post_body.count("tx_hash") == 0)
{
return string("xmr_address, viewkey or tx_hash not provided");
}
string tx_hash = post_body["tx_hash"];
string xmr_address = post_body["xmr_address"];
string viewkey = post_body["viewkey"];
return xmrblocks.show_my_outputs(tx_hash, xmr_address, viewkey);
});
CROW_ROUTE(app, "/prove").methods("POST"_method)
([&](const crow::request& req) {
CROW_ROUTE(app, "/prove").methods("GET"_method)
([&](const crow::request& req) {
map<std::string, std::string> post_body = xmreg::parse_crow_post_data(req.body);
string tx_hash = string(req.url_params.get("txhash"));
string tx_prv_key = string(req.url_params.get("txprvkey"));
string xmr_address = string(req.url_params.get("xmraddress"));
if (post_body.count("xmr_address") == 0
|| post_body.count("txprvkey") == 0
|| post_body.count("tx_hash") == 0)
{
return string("xmr_address, txprvkey or tx_hash not provided");
}
return xmrblocks.show_prove(tx_hash, xmr_address, tx_prv_key);
string tx_hash = post_body["tx_hash"];;
string tx_prv_key = post_body["txprvkey"];;
string xmr_address = post_body["xmr_address"];;
return xmrblocks.show_prove(tx_hash, xmr_address, tx_prv_key);
});
CROW_ROUTE(app, "/rawtx")
([&](const crow::request& req) {
return xmrblocks.show_rawtx();

@ -88,7 +88,7 @@
<br/>
Note: these calculations are done on the server side, because there is no javascript
</h5>
<form action="/myoutputs" method="get" style="width:100%; margin-top:2px" class="style-1">
<form action="/myoutputs" method="post" style="width:100%; margin-top:2px" class="style-1">
<input type="hidden" name="tx_hash" value="{{tx_hash}}"><br/>
<input type="text" name="xmr_address" size="90" placeholder="Monero address"><br/>
<input type="text" name="viewkey" size="90" placeholder="viewkey" style="margin-top:5px"><br/>
@ -109,10 +109,10 @@
<br/>
Note: these calculations are done on the server side, because there is no javascript
</h5>
<form action="/prove" method="get" style="width:100%;margin-top:2px" class="style-1">
<input type="hidden" name="txhash" value="{{tx_hash}}"><br/>
<form action="/prove" method="post" style="width:100%;margin-top:2px" class="style-1">
<input type="hidden" name="tx_hash" value="{{tx_hash}}"><br/>
<input type="text" name="txprvkey" size="90" placeholder="Tx private key"><br/>
<input type="text" name="xmraddress" size="90" placeholder="Recipient's Monero Address" style="margin-top:5px"><br/>
<input type="text" name="xmr_address" size="90" placeholder="Recipient's Monero Address" style="margin-top:5px"><br/>
<input type="submit" value="Prove" style="margin-top:5px">
</form>
</div>

Loading…
Cancel
Save