aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-06-16 03:00:56 -0700
committerFuwn <[email protected]>2024-06-16 03:08:13 -0700
commitec3eb50f213aa40f1dc9c1fe4dfce0d74a987284 (patch)
treeff611bf63ab09832508f2964ef3324f4d70ca45f /src
parent1e357dbef1a0adf53e3b492e31cdb51fdf4add2e (diff)
downloadmayu-ec3eb50f213aa40f1dc9c1fe4dfce0d74a987284.tar.xz
mayu-ec3eb50f213aa40f1dc9c1fe4dfce0d74a987284.zip
feat(index.html): show version if availablev0.1.9
Diffstat (limited to 'src')
-rw-r--r--src/request.gleam14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/request.gleam b/src/request.gleam
index d9abccf..6e23caf 100644
--- a/src/request.gleam
+++ b/src/request.gleam
@@ -1,5 +1,7 @@
import database
+import envoy
import gleam/json
+import gleam/string
import gleam/string_builder
import simplifile
import svg
@@ -22,7 +24,17 @@ pub fn handle(request, connection) {
[] ->
case simplifile.read("index.html") {
Ok(content) ->
- wisp.html_response(string_builder.from_string(content), 200)
+ wisp.html_response(
+ string_builder.from_string(
+ string.replace(content, "{{ MAYU_VERSION }}", case
+ envoy.get("MAYU_VERSION")
+ {
+ Ok(version) -> "(v" <> version <> ")"
+ Error(_) -> ""
+ }),
+ ),
+ 200,
+ )
Error(_) -> wisp.not_found()
}
["heart-beat"] ->