From 492ba39739c869d3f2b9766112232d384a145e38 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 31 Mar 2020 17:50:07 -0700 Subject: Cleanup index and _ ns handling So now _ is the special namespace that only I can post to. Unfortunately I think the guardIP function is still broken. --- Run/Que/Website.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Run/Que/Website.hs') diff --git a/Run/Que/Website.hs b/Run/Que/Website.hs index e6b458c..8681678 100644 --- a/Run/Que/Website.hs +++ b/Run/Que/Website.hs @@ -1,4 +1,5 @@ {-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE LambdaCase #-} @@ -18,7 +19,7 @@ import qualified System.Exit as Exit main :: IO () main = do (src, ns) <- Environment.getArgs >>= \case - [src] -> return (src, "/") + [src] -> return (src, "_") -- default to _ ns which is special [src, ns] -> return (src, ns) _ -> Exit.die "usage: que-website [namespace]" @@ -42,14 +43,14 @@ loop ns pages@Sources {..} = do Async.runConcurrently $ (,,,) <$> Async.Concurrently - (toHtml style index >>= serve (https "que.run" /: ns /: "index.html")) + (toHtml style index >>= serve (https "que.run" /: ns /: "index")) <*> Async.Concurrently ( BS.readFile client - >>= serve (https "que.run" /: ns /: "_client" /: "python") + >>= serve (https "que.run" /: ns /: "client") ) <*> Async.Concurrently ( toHtml style quescripts - >>= serve (https "que.run" /: ns /: "_page" /: "quescripts") + >>= serve (https "que.run" /: ns /: "quescripts") ) loop ns pages @@ -71,6 +72,7 @@ toHtml style md = ] [] +-- TODO: recover from 502 errors serve :: Url scheme -> ByteString -> IO () serve path content = runReq defaultHttpConfig $ do _ <- req POST path (ReqBodyBs content) ignoreResponse mempty -- cgit v1.2.3