Add base status bar

This commit is contained in:
2025-01-22 21:09:45 +01:00
parent 3b208c0103
commit d133513daf
3 changed files with 29 additions and 4 deletions

View File

@ -31,7 +31,7 @@ async fn main() -> std::io::Result<()> {
.build(),
)
// Web configuration routes
.route("/static/{tail:.*}", web::get().to(web_ui::static_file))
.route("/assets/{tail:.*}", web::get().to(web_ui::static_file))
.route("/", web::get().to(web_ui::home))
.route("/oidc_cb", web::get().to(web_ui::oidc_cb))
.route("/sign_out", web::get().to(web_ui::sign_out))

View File

@ -29,7 +29,9 @@ pub async fn static_file(path: web::Path<String>) -> HttpResult {
#[derive(askama::Template)]
#[template(path = "index.html")]
struct HomeTemplate {}
struct HomeTemplate {
name: String,
}
/// Main route
pub async fn home(session: Session) -> HttpResult {
@ -53,7 +55,7 @@ pub async fn home(session: Session) -> HttpResult {
Ok(HttpResponse::Ok()
.insert_header(("content-type", "text/html"))
.body(HomeTemplate {}.render().unwrap()))
.body(HomeTemplate { name: user.name }.render().unwrap()))
}
#[derive(serde::Deserialize)]