From eaa4e2b9245bdcf0477bacfbe7a786ab25f2e796 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Tue, 27 Sep 2016 08:41:44 +0800 Subject: [PATCH] Development of transaction pusher started --- main.cpp | 5 +- src/page.h | 19 ++++ src/templates/my_outputs.html | 4 +- src/templates/rawtx.html | 158 ++++++++++++++++++++++++++++++++++ 4 files changed, 183 insertions(+), 3 deletions(-) create mode 100644 src/templates/rawtx.html diff --git a/main.cpp b/main.cpp index c85b43a..39cb03b 100644 --- a/main.cpp +++ b/main.cpp @@ -209,7 +209,10 @@ int main(int ac, const char* av[]) { return xmrblocks.show_prove(tx_hash, xmr_address, tx_prv_key); }); - + CROW_ROUTE(app, "/rawtx") + ([&](const crow::request& req) { + return xmrblocks.show_rawtx(); + }); CROW_ROUTE(app, "/search").methods("GET"_method) ([&](const crow::request& req) { diff --git a/src/page.h b/src/page.h index c35eda4..1289c4e 100644 --- a/src/page.h +++ b/src/page.h @@ -37,6 +37,8 @@ #define TMPL_ADDRESS TMPL_DIR "/address.html" #define TMPL_MY_OUTPUTS TMPL_DIR "/my_outputs.html" #define TMPL_SEARCH_RESULTS TMPL_DIR "/search_results.html" +#define TMPL_MY_RAWTX TMPL_DIR "/rawtx.html" + namespace xmreg { @@ -1507,7 +1509,24 @@ namespace xmreg { return show_my_outputs(tx_hash_str, xmr_address_str, tx_prv_key_str, true); } + string + show_rawtx() + { + // initalise page tempate map with basic info about blockchain + mstch::map context { + {"testnet" , testnet} + }; + + // read rawtx.html + string rawtx_html = xmreg::read(TMPL_MY_RAWTX); + + // add header and footer + string full_page = rawtx_html + xmreg::read(TMPL_FOOTER); + + // render the page + return mstch::render(full_page, context); + } string diff --git a/src/templates/my_outputs.html b/src/templates/my_outputs.html index dfab537..5cf95d1 100644 --- a/src/templates/my_outputs.html +++ b/src/templates/my_outputs.html @@ -6,11 +6,11 @@ {{#has_payment_id}} -
Payment id: {{payment_id}}
+
Payment id: {{payment_id}}
{{/has_payment_id}} {{#has_payment_id8}} -
Payment id (encrypted): {{payment_id8}}
+
Payment id (encrypted): {{payment_id8}}
{{/has_payment_id8}} diff --git a/src/templates/rawtx.html b/src/templates/rawtx.html new file mode 100644 index 0000000..a8d2ccc --- /dev/null +++ b/src/templates/rawtx.html @@ -0,0 +1,158 @@ + + + + + + {{#refresh}} + + {{/refresh}} + Onion Monero Blockchain Explorer + + + + + +
+ +
+

Onion Monero Transaction Pusher

+

(no javascript - no cookies - no web analytics trackers - no images - open sourced)

+
+ + + {{^testnet}} +
+
+ Paste base64 encoded, signed transaction data here
+ +
+ +                     +                     + +
+
+ {{/testnet}} + {{#testnet}} + + {{/testnet}} + +
\ No newline at end of file