summaryrefslogtreecommitdiff
path: root/fig-web/src/Fig
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-01-13 19:31:40 -0500
committerLLLL Colonq <llll@colonq>2025-01-13 19:31:40 -0500
commit2097ed375db2dda1406043720ec366fdfc7be0fc (patch)
treebe2dffff83af505a21f0ebc506149d66fc691b6a /fig-web/src/Fig
parenta55a65a2da8e0d0a8350d9e672a5beaa013bd7b1 (diff)
Add /api/info endpoint
Diffstat (limited to 'fig-web/src/Fig')
-rw-r--r--fig-web/src/Fig/Web/Secure.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/fig-web/src/Fig/Web/Secure.hs b/fig-web/src/Fig/Web/Secure.hs
index cac0376..2f416da 100644
--- a/fig-web/src/Fig/Web/Secure.hs
+++ b/fig-web/src/Fig/Web/Secure.hs
@@ -61,6 +61,15 @@ app cfg cmds = do
Sc.text "this is the secure endpoint"
Sc.get "/api/status" do
Sc.text "this is the secure endpoint"
+ Sc.get "/api/info" do
+ muser <- Sc.header "Remote-User"
+ memail <- Sc.header "Remote-Email"
+ case (muser, memail) of
+ (Just user, Just email) -> do
+ Sc.text $ user <> " " <> email
+ _else -> do
+ Sc.status status401
+ Sc.text "you're not logged in buddy"
Sc.post "/api/redeem" do
muser <- Sc.header "Remote-User"
memail <- Sc.header "Remote-Email"