aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/home.rs
blob: b9e928994872bdf85c9f604ec71a42db0aa33e58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use super::account::session::Session;
use super::layout::LayoutPage;
use crate::routes::ui::layout::DynLayoutPage;
use crate::CONF;
use crate::{library::Library, routes::ui::node::NodePage};
use rocket::{get, State};

#[get("/")]
pub async fn r_home(_sess: Session, library: &State<Library>) -> DynLayoutPage {
    LayoutPage {
        title: "Home".to_string(),
        content: markup::new! {
            p { "Welcome to " @CONF.brand  }
            @NodePage { node: library.root.clone() }
        },
    }
}

#[get("/", rank = 2)]
pub async fn r_home_unpriv() -> DynLayoutPage<'static> {
    LayoutPage {
        title: "Home".to_string(),
        content: markup::new! {
            h1 { @CONF.brand }
        },
    }
}