Restore index page

This commit is contained in:
Bat 2018-04-29 18:50:46 +01:00
parent 4666cd3ee3
commit e592e692ff
2 changed files with 13 additions and 12 deletions

View file

@ -46,24 +46,13 @@ fn init_pool() -> PgPool {
Pool::new(manager).expect("db pool") Pool::new(manager).expect("db pool")
} }
#[get("/")]
fn index(conn: DbConn) -> String {
match Instance::get_local(&*conn) {
Some(inst) => {
format!("Welcome on {}", inst.name)
}
None => {
String::from("Not initialized")
}
}
}
fn main() { fn main() {
rocket::ignite() rocket::ignite()
.mount("/", routes![ .mount("/", routes![
routes::well_known::host_meta, routes::well_known::host_meta,
routes::well_known::webfinger, routes::well_known::webfinger,
routes::instance::index,
routes::instance::configure, routes::instance::configure,
routes::instance::post_config, routes::instance::post_config,

View file

@ -6,6 +6,18 @@ use std::collections::HashMap;
use db_conn::DbConn; use db_conn::DbConn;
use models::instance::*; use models::instance::*;
#[get("/")]
fn index(conn: DbConn) -> String {
match Instance::get_local(&*conn) {
Some(inst) => {
format!("Welcome on {}", inst.name)
}
None => {
String::from("Not initialized")
}
}
}
#[get("/configure")] #[get("/configure")]
fn configure() -> Template { fn configure() -> Template {
Template::render("instance/configure", HashMap::<String, i32>::new()) Template::render("instance/configure", HashMap::<String, i32>::new())