mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
26 lines
592 B
Rust
26 lines
592 B
Rust
use axum::{Router, extract::State, response::IntoResponse, routing::get};
|
|
|
|
use crate::{WebError, template};
|
|
|
|
pub(crate) fn build() -> Router<crate::State> {
|
|
Router::new()
|
|
.route("/", get(index))
|
|
.route(&format!("{}/", crate::ROUTE_PREFIX), get(index))
|
|
}
|
|
|
|
async fn index(State(services): State<crate::State>) -> Result<impl IntoResponse, WebError> {
|
|
template! {
|
|
struct Index<'a> use "index.html.j2" {
|
|
server_name: &'a str,
|
|
first_run: bool
|
|
}
|
|
}
|
|
|
|
Ok(Index::new(
|
|
&services,
|
|
services.globals.server_name().as_str(),
|
|
services.firstrun.is_first_run(),
|
|
)
|
|
.into_response())
|
|
}
|