diff options
-rw-r--r-- | src/frontend.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/frontend.rs b/src/frontend.rs index 2981249..964367e 100644 --- a/src/frontend.rs +++ b/src/frontend.rs @@ -91,6 +91,20 @@ pub async fn calculate(req: HttpRequest) -> Result<maud::Markup> { let ls: Landscape = config.deserialize_str(&req.query_string()) .map_err(|e| actix_web::error::ErrorInternalServerError(format!("{}", e)))?; + // TODO: We should propably error with 500 here, I'm not sure. + // This is just "good enough" for now. + if ls.hours > 1000 { + return Ok(maud::html! { + html { + body { + h1 { "Landscape error" } + + p { "Not gonna do that. Calculating " (ls.hours) " is way too resource intensive, please use a value below 1000" } + } + } + }) + } + let calculated_landscape = crate::backend::landscape::Landscape::new(ls.levels.clone()).rain(ls.hours); Ok(maud::html! { html { |