feat: add basic website

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2026-03-07 19:46:13 +01:00
commit b439762877
71 changed files with 16576 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
mod auth;
mod pages;
mod platform;
use axum::Router;
use axum::http::StatusCode;
use axum::response::{Html, IntoResponse, Response};
use minijinja::context;
use crate::state::AppState;
pub fn router() -> Router<AppState> {
Router::new()
.merge(pages::router())
.merge(auth::router())
.merge(platform::router())
}
/// Render an error page with the given status code, heading, and message.
fn error_page(state: &AppState, status: StatusCode, heading: &str, message: &str) -> Response {
let html = state.templates.render(
"pages/error.html.jinja",
context! {
title => format!("{} - Forage", heading),
description => message,
status => status.as_u16(),
heading => heading,
message => message,
},
);
match html {
Ok(body) => (status, Html(body)).into_response(),
Err(_) => status.into_response(),
}
}