adding new post method and starting a search

master
lalanza808 5 years ago
parent 3186695906
commit aaf6325c23

@ -65,11 +65,17 @@ fn get_daemon_info() -> Json<GetInfoResult> {
Json(res.result) Json(res.result)
} }
#[post("/", format = "application/x-www-form-urlencoded")]
fn something() -> Template {
let res: GetInfo = issue_rpc(&"get_info", None)
.send().unwrap().json().unwrap();
Template::render("search", &res.result)
}
#[get("/")] #[get("/")]
fn index() -> Template { fn index() -> Template {
let res: GetInfo = issue_rpc(&"get_info", None) let res: GetInfo = issue_rpc(&"get_info", None)
.send().unwrap().json().unwrap(); .send().unwrap().json().unwrap();
// let res_json = serde_json::to_string(&res.result).unwrap();
Template::render("index", &res.result) Template::render("index", &res.result)
} }
@ -87,7 +93,7 @@ fn main() {
Ok(_) => { Ok(_) => {
rocket::ignite() rocket::ignite()
.mount("/", routes![ .mount("/", routes![
index, index, something,
get_daemon_info get_daemon_info
]) ])
.mount("/block", routes![ .mount("/block", routes![

@ -1,38 +1,37 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Monero Block Explorer</title> <title>Monero Block Explorer</title>
<link rel="stylesheet" href="/static/css/main.css"/> <link rel="stylesheet" href="/static/css/main.css"/>
<link rel="stylesheet" href="/static/css/normalize.css"/> <link rel="stylesheet" href="/static/css/normalize.css"/>
</head> </head>
<body> <body>
<div class="title">
<div class="title"> <h1>Monero Block Explorer</h1>
<h1>Monero Block Explorer</h1> </div>
</div> <div class="search">
<div class="search"> <h2>Search</h2>
<h2>Search</h2> <form action="/" method="post">
<form action="/" method="post"> <input type="text" name="search_value" placeholder="Enter a transaction hash, block hash, or block height.">
<input type="text" name="search_value" placeholder="Enter a transaction hash, block hash, or block height."> <input type="submit" value="Search">
<input type="submit" value="Search"> </form>
</form> </div>
</div> <div class="server-info">
<div class="server-info"> <h2>Server Info</h2>
<h2>Server Info</h2> </div>
</div> <div class="network-stats">
<div class="network-stats"> <h2>Network Stats</h2>
<h2>Network Stats</h2> </div>
</div> <div class="tx-pool">
<div class="tx-pool"> <h2>Transaction Pool</h2>
<h2>Transaction Pool</h2> </div>
</div> <div class="">
<div class=""> <h2>Top Block</h2>
<h2>Top Block</h2> </div>
</div> <div class="">
<div class=""> <h2>Previous Block</h2>
<h2>Previous Block</h2> </div>
</div>
<!-- <!--
<p>alt_blocks_count: {{ alt_blocks_count }}</p> <p>alt_blocks_count: {{ alt_blocks_count }}</p>
<p>block_size_limit: {{ block_size_limit }}</p> <p>block_size_limit: {{ block_size_limit }}</p>

Loading…
Cancel
Save