aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.yaml2
-rw-r--r--src/Main.hs24
2 files changed, 12 insertions, 14 deletions
diff --git a/package.yaml b/package.yaml
index 2b13bf1..d142b42 100644
--- a/package.yaml
+++ b/package.yaml
@@ -1,5 +1,5 @@
name: fastbangs
-version: 0.1.0.1
+version: 0.1.0.2
#synopsis:
#description:
homepage: https://codeberg.org/lialenck/fastbangs
diff --git a/src/Main.hs b/src/Main.hs
index a59b38a..7d3a331 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -57,27 +57,25 @@ instance YesodPersist Search where
getHomeR :: Handler TypedContent
getHomeR = do
cacheSeconds $ 60 * 60 * 24 * 7
- return $ TypedContent typeHtml $ toContent ($(embedFile "build/index.html"))
+ respond typeHtml ($(embedFile "build/index.html"))
getBundleR :: Handler TypedContent
getBundleR = do
cacheSeconds $ 60 * 60 * 24 * 7
noEmbed <- confNoEmbed . config <$> getYesod
- bundle <- liftIO $ bool
- (pure $ toContent ($(embedFile "build/bundle.js")))
- (toContent <$> readFile "../build/bundle.js")
- noEmbed
- return $ TypedContent typeJavascript bundle
+
+ respond typeJavascript =<< if noEmbed
+ then liftIO $ BS.readFile "../build/bundle.js"
+ else pure ($(embedFile "build/bundle.js"))
getStyleR :: Handler TypedContent
getStyleR = do
cacheSeconds $ 60 * 60 * 24 * 7
noEmbed <- confNoEmbed . config <$> getYesod
- stylesheet <- liftIO $ bool
- (pure $ toContent ($(embedFile "build/style.css")))
- (toContent <$> readFile "../build/style.css")
- noEmbed
- return $ TypedContent typeCss stylesheet
+
+ respond typeCss =<< if noEmbed
+ then liftIO $ BS.readFile "../build/style.css"
+ else pure ($(embedFile "build/style.css"))
getBangsR :: Handler TypedContent
getBangsR = do
@@ -95,7 +93,7 @@ getBangsR = do
_ -> do
liftIO $ getBangsJSON st
- return $ TypedContent typeJson $ toContent bs
+ respond typeJson bs
postSubmitR :: Handler ()
postSubmitR = do
@@ -111,7 +109,7 @@ getOpenSearchR = do
cfg <- config <$> getYesod
resXml <- makeOpenSearch cfg <$> lookupGetParam "default"
- return $ TypedContent "application/opensearchdescription+xml" $ toContent resXml
+ respond "application/opensearchdescription+xml" resXml
postVerdictR :: Bool -> Handler ()
postVerdictR b = do