2026-02-28 20:32:46 -05:00
|
|
|
use askama::Template;
|
2026-03-18 10:26:43 -04:00
|
|
|
use axum::{Router, extract::State, response::IntoResponse, routing::get};
|
2026-02-28 20:32:46 -05:00
|
|
|
|
2026-03-18 10:26:43 -04:00
|
|
|
use crate::{WebError, template};
|
2026-02-28 20:32:46 -05:00
|
|
|
|
2026-03-04 11:18:07 -05:00
|
|
|
pub(crate) fn build() -> Router<crate::State> { Router::new().route("/", get(index_handler)) }
|
2026-02-28 20:32:46 -05:00
|
|
|
|
|
|
|
|
async fn index_handler(
|
2026-03-03 13:20:16 -05:00
|
|
|
State(services): State<crate::State>,
|
2026-02-28 20:32:46 -05:00
|
|
|
) -> Result<impl IntoResponse, WebError> {
|
2026-03-18 10:26:43 -04:00
|
|
|
template! {
|
|
|
|
|
struct Index<'a> use "index.html.j2" {
|
|
|
|
|
server_name: &'a str,
|
|
|
|
|
first_run: bool
|
|
|
|
|
}
|
2026-02-28 20:32:46 -05:00
|
|
|
}
|
|
|
|
|
|
2026-03-18 10:26:43 -04:00
|
|
|
Ok(Index::new(
|
|
|
|
|
&services,
|
|
|
|
|
services.globals.server_name().as_str(),
|
|
|
|
|
services.firstrun.is_first_run(),
|
|
|
|
|
)
|
|
|
|
|
.into_response())
|
2026-02-28 20:32:46 -05:00
|
|
|
}
|