diff options
| author | Fuwn <[email protected]> | 2024-06-16 10:00:56 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-06-16 10:08:13 +0000 |
| commit | 78f50f24b3ff87f5f1e0227e2cdd2599a39add82 (patch) | |
| tree | ff611bf63ab09832508f2964ef3324f4d70ca45f /src | |
| parent | docs(readme): add nix runner information (diff) | |
| download | mayu-0.1.9.tar.xz mayu-0.1.9.zip | |
feat(index.html): show version if availablev0.1.9
Diffstat (limited to 'src')
| -rw-r--r-- | src/request.gleam | 14 |
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"] -> |