Development of transaction pusher started

This commit is contained in:
moneroexamples 2016-09-27 08:41:44 +08:00
parent aacce05208
commit eaa4e2b924
4 changed files with 183 additions and 3 deletions

View File

@ -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) {

View File

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

View File

@ -6,11 +6,11 @@
{{#has_payment_id}}
<H5 style="margin:5px">Payment id: {{payment_id}}</H5>
<H5 style="margin:5px">Payment id: {{payment_id}}</H5>
{{/has_payment_id}}
{{#has_payment_id8}}
<H5 style="margin:5px">Payment id (encrypted): {{payment_id8}}</H5>
<H5 style="margin:5px">Payment id (encrypted): {{payment_id8}}</H5>
{{/has_payment_id8}}

158
src/templates/rawtx.html Normal file
View File

@ -0,0 +1,158 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
{{#refresh}}
<meta http-equiv="refresh" content="10">
{{/refresh}}
<title>Onion Monero Blockchain Explorer</title>
<!--<link rel="stylesheet" type="text/css" href="/css/style.css">-->
<style type="text/css">
body {
margin: 0;
padding: 0;
color: white;
background-color: black;
}
h1, h2, h3, h4, h5, h6 {
text-align: center;
}
.center {
margin: auto;
width: 96%;
/*border: 1px solid #73AD21;
padding: 10px;*/
}
tr, li, #pages {
font-family: "Lucida Console", Monaco, monospace;
font-size : 12px;
height: 22px;
}
#pages
{
margin-top: 15px;
}
td {
text-align: center;
}
a:link {
text-decoration: none;
color: white;
}
a:visited {
text-decoration: none;
color: white;
}
a:hover {
text-decoration: underline;
color: white;
}
a:active {
text-decoration: none;
color: white;
}
form {
display: inline-block;
text-align: center;
}
.style-1 input[type="text"] {
padding: 2px;
border: solid 1px #dcdcdc;
transition: box-shadow 0.3s, border 0.3s;
}
.style-1 input[type="text"]:focus,
.style-1 input[type="text"].focus {
border: solid 1px #707070;
box-shadow: 0 0 5px 1px #969696;
}
.tabs {
position: relative;
min-height: 200px; /* This part sucks */
clear: both;
margin: 25px 0;
}
.tab {
float: left;
}
.tab label {
background: black;
padding: 10px;
border: 1px solid #ccc;
margin-left: -1px;
position: relative;
left: 1px;
}
.tab [type=radio] {
display: none;
}
.content {
position: absolute;
top: 28px;
left: 0;
background: black;
right: 0;
bottom: 0;
padding: 20px;
border: 1px solid #ccc;
}
[type=radio]:checked ~ label {
background: #505050 ;
border-bottom: 1px solid white;
z-index: 2;
}
[type=radio]:checked ~ label ~ .content {
z-index: 1;
}
</style>
</head>
<body>
<div>
<div class="center">
<h1 class="center"><a href="/">Onion Monero Transaction Pusher</a></h1>
<h4 style="font-size: 15px; margin: 0px">(no javascript - no cookies - no web analytics trackers - no images - open sourced)</h4>
</div>
{{^testnet}}
<div class="center">
<form action="/checkandpush" method="post" style="width:100%; margin-top:15px" class="style-1">
Paste base64 encoded, signed transaction data here<br/>
<textarea name="rawtxdata" rows="20" cols="80">
</textarea>
<br/>
<input type="submit" value="check">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<input type="submit" value="push">
</form>
</div>
{{/testnet}}
{{#testnet}}
{{/testnet}}
</div>