diff --git a/src/main.rs b/src/main.rs index 4ff00c1..c282413 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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()) } diff --git a/templates/index.html.tera b/templates/index.html.tera index 265c673..a6236a7 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -41,9 +41,7 @@ {% endfor %} -
+ Update Blockchain InformationPressing 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.
diff --git a/templates/update_complete.html.tera b/templates/update_complete.html.tera new file mode 100644 index 0000000..cb8e650 --- /dev/null +++ b/templates/update_complete.html.tera @@ -0,0 +1,7 @@ + + + + + If you're seeing this, it probably worked. Go back here to check. + +