Refactor excessive do notation. Complete oldschool and gibberish generators. Add frontend functionality for selecting from multiple generator styles. Add config requirement for admin email. Add admin email to header.
This commit is contained in:
@ -6,6 +6,7 @@ import Core.Templates (renderIndex, renderStyle)
|
||||
import Feature.Sharing.HTTP as Sharing
|
||||
import Feature.Generation.HTTP as Generation
|
||||
|
||||
import Control.Monad.Reader (ask, lift)
|
||||
import Data.Maybe (Maybe (Nothing))
|
||||
import Network.Wai.Middleware.RequestLogger (logStdoutDev)
|
||||
import Network.Wai.Middleware.Static
|
||||
@ -19,7 +20,8 @@ app = do
|
||||
|
||||
-- Core Routes
|
||||
get "/" $ do
|
||||
html $ renderIndex "/"
|
||||
conf <- lift ask
|
||||
html $ renderIndex "/" (adminEmail conf)
|
||||
|
||||
get "/style.css" $ do
|
||||
setHeader "Content-Type" "text/css"
|
||||
|
@ -22,11 +22,10 @@ main db = do
|
||||
close conn
|
||||
|
||||
dbPath :: PurrAction String
|
||||
dbPath = do
|
||||
conf <- lift ask
|
||||
return $ dbFile conf
|
||||
dbPath = lift ask >>= (\a -> return $ dbFile a)
|
||||
|
||||
encKey :: PurrAction String
|
||||
encKey = do
|
||||
conf <- lift ask
|
||||
return $ dbKey conf
|
||||
encKey = lift ask >>= (\a -> return $ dbKey a)
|
||||
|
||||
confLinkLength :: PurrAction Int
|
||||
confLinkLength = lift ask >>= (\a -> return $ linkLength a)
|
||||
|
@ -13,8 +13,8 @@ import qualified Data.Text.Lazy as LT
|
||||
|
||||
import Prelude
|
||||
|
||||
renderIndex :: String -> LT.Text
|
||||
renderIndex link = renderHtml ( $(shamletFile "./views/index.hamlet") )
|
||||
renderIndex :: String -> String -> LT.Text
|
||||
renderIndex link email = renderHtml ( $(shamletFile "./views/index.hamlet") )
|
||||
where
|
||||
hsUserLink = hxVals "userLink" link
|
||||
|
||||
|
@ -22,4 +22,5 @@ data DhallConfig = DhallConfig
|
||||
, dbFile :: String
|
||||
, dbKey :: String
|
||||
, linkLength :: Int
|
||||
, adminEmail :: String
|
||||
} deriving (Generic, Show)
|
||||
|
Reference in New Issue
Block a user