aboutsummaryrefslogtreecommitdiff
path: root/src/request.gleam
diff options
context:
space:
mode:
Diffstat (limited to 'src/request.gleam')
-rw-r--r--src/request.gleam19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/request.gleam b/src/request.gleam
index 5ef74c1..a56780b 100644
--- a/src/request.gleam
+++ b/src/request.gleam
@@ -1,9 +1,7 @@
import database
-import envoy
import gleam/int
import gleam/json
import gleam/list
-import gleam/string
import gleam/string_builder
import svg
import wisp
@@ -25,20 +23,7 @@ pub fn handle(request, connection, image_cache, index_html) {
[] ->
case index_html {
"" -> wisp.not_found()
- content ->
- wisp.html_response(
- string_builder.from_string(
- string.replace(
- content,
- "{{ MAYU_VERSION }}",
- case envoy.get("MAYU_VERSION") {
- Ok(version) -> "(v" <> version <> ")"
- Error(_) -> ""
- },
- ),
- ),
- 200,
- )
+ content -> wisp.html_response(string_builder.from_string(content), 200)
}
["heart-beat"] ->
wisp.html_response(string_builder.from_string("alive"), 200)
@@ -60,7 +45,7 @@ pub fn handle(request, connection, image_cache, index_html) {
case list.key_find(query, "padding") {
Ok(padding) ->
case int.parse(padding) {
- Ok(n) -> n
+ Ok(n) -> int.clamp(n, min: 0, max: 32)
Error(_) -> 6
}
_ -> 6