add cache rules to haskell, alphabetize soem types, remove Cookies type

This commit is contained in:
mtgmonkey 2025-05-09 17:44:18 -04:00
parent 9ec9c55912
commit 870d8ec257
7 changed files with 209 additions and 239 deletions

View file

@ -32,7 +32,6 @@ index compiledElmApp = renderHtml $ do
port :: Port
port = 8080
adminContact :: String
adminContact = "[Matrix] @mtgmonkey:calitabby.net"
@ -69,18 +68,20 @@ main = do
-- GET requests
get "/" $ do
shortCache
status ok200
S.html $ index $ do
compiledElmApp
"\n"
boilerplateJs
get "/favicon.ico/" $ do
shortCache
status notFound404
S.html $ "you want a favi-<i>what</i>now!?"
-- ERR
notFound $ do
noCache
status methodNotAllowed405
S.text "Verb disallowed; OR, route doesn't exist :("
@ -93,6 +94,12 @@ serverErrorReadFile e = H.toHtml $ "document.getElementById('body').innerHTML='S
++ adminContact
++ "';"
shortCache :: ActionM ()
shortCache = addHeader "Cache-Control" "private, must-understand, stale-if-error=43200, max-age=43200"
noCache :: ActionM ()
noCache = addHeader "Cache-Control" "no-cache"
embedJs :: Js -> H.Html
embedJs js = H.script $ js