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())
}