Added updating blockchains button

This commit is contained in:
2024-07-14 19:21:41 +01:00
parent cc7678ec18
commit eb08b348b1
3 changed files with 17 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
#[macro_use] extern crate rocket;
use rocket_dyn_templates::{context, Template};
use blockchain_time::{BlockchainInfo, BlockchainSupported};
use blockchain_time::{BlockchainInfo, BlockchainSupported, update_all_blockheights};
#[get("/")]
fn index() -> Template {
@@ -16,8 +16,15 @@ fn index() -> Template {
Template::render("index", context)
}
#[get("/update_blockchains")]
fn update_blockchains() -> Template {
update_all_blockheights();
Template::render("update_complete", context!{})
}
#[launch]
fn rocket() -> _ {
rocket::build().mount("/", routes![index])
rocket::build().mount("/", routes![index, update_blockchains])
// .mount("/update_blockchains", routes![update_blockchains])
.attach(Template::fairing())
}

View File

@@ -41,9 +41,7 @@
{% endfor %}
</div>
<form action="update_blockchains">
<input type="submit" value="Update Blockchain Information" />
</form>
<a href="update_blockchains">Update Blockchain Information</a>
<p>Pressing the above button might take some time... or it might crash the appliaction...
or it'll do what you want... you won't know till you press it.</p>

View File

@@ -0,0 +1,7 @@
<html>
<head>
</head>
<body>
If you're seeing this, it probably worked. Go back <a href="/">here</a> to check.
</body>
</html>