aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-07-26 21:58:50 +0000
committerFuwn <[email protected]>2024-07-26 21:58:50 +0000
commitd00b65f83442cf7c03169d1ff26ef279e6f3dc30 (patch)
tree1f005983d0af7c88b7cea820a2f6ff955f1d8c94 /src
parentfix(gemini): remove assertions (diff)
downloadmomoka-d00b65f83442cf7c03169d1ff26ef279e6f3dc30.tar.xz
momoka-d00b65f83442cf7c03169d1ff26ef279e6f3dc30.zip
feat(momoka): logger
Diffstat (limited to 'src')
-rw-r--r--src/momoka.gleam17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/momoka.gleam b/src/momoka.gleam
index 6b49c87..1f67663 100644
--- a/src/momoka.gleam
+++ b/src/momoka.gleam
@@ -1,9 +1,12 @@
import envoy
import gemini
+import gleam/bit_array
import gleam/erlang/process
import gleam/int
+import gleam/io
import gleam/option.{None}
import gleam/otp/actor
+import gleam/string
import glisten.{Packet}
import tcp
@@ -17,6 +20,20 @@ pub fn main() {
glisten.send(connection, gemini.get_gemtext_from_capsule(message))
let assert Ok(_) = tcp.close_connection(connection)
+ io.println(
+ "request: "
+ <> {
+ case bit_array.to_string(message) {
+ Ok(path) ->
+ case path |> string.replace("\r\n", "") {
+ "" -> "/"
+ path -> path
+ }
+ _ -> "unknown"
+ }
+ },
+ )
+
actor.continue(state)
},
)