summaryrefslogtreecommitdiff
path: root/Run/Que/Website.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-03-31 17:50:07 -0700
committerBen Sima <ben@bsima.me>2020-03-31 17:50:07 -0700
commit492ba39739c869d3f2b9766112232d384a145e38 (patch)
treedf725f32c7ac155db31d39888a497ff71427e8a8 /Run/Que/Website.hs
parent9493e2dbf9671d55fea2a96aa057589670e9673a (diff)
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.
Diffstat (limited to 'Run/Que/Website.hs')
-rw-r--r--Run/Que/Website.hs10
1 files changed, 6 insertions, 4 deletions
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 <srcdir> [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