yesod-core 1.4.4.5 → 1.4.5
raw patch · 6 files changed
+67/−22 lines, 6 filesdep ~clientsession
Dependency ranges changed: clientsession
Files
- ChangeLog.md +23/−0
- Yesod/Core.hs +1/−0
- Yesod/Core/Class/Yesod.hs +27/−0
- Yesod/Core/Types.hs +13/−0
- changelog.md +0/−19
- yesod-core.cabal +3/−3
+ ChangeLog.md view
@@ -0,0 +1,23 @@+## 1.4.5++* `envClientSessionBackend`++## 1.4.4.5++Support time 1.5++## 1.4.4.2++`neverExpires` uses dates one year in the future (instead of in 2037).++## 1.4.4.1++Improvements to etag/if-none-match support #868 #869++## 1.4.4++Add the `notModified` and `setEtag` functions.++## 1.4.3++Switch to mwc-random for token generation.
Yesod/Core.hs view
@@ -45,6 +45,7 @@ , SessionBackend (..) , customizeSessionCookies , defaultClientSessionBackend+ , envClientSessionBackend , clientSessionBackend , clientSessionDateCacher , loadClientSession
Yesod/Core/Class/Yesod.hs view
@@ -598,6 +598,33 @@ (getCachedDate, _closeDateCacher) <- clientSessionDateCacher timeout return $ clientSessionBackend key getCachedDate +-- | Create a @SessionBackend@ which reads the session key from the named+-- environment variable.+--+-- This can be useful if:+--+-- 1. You can't rely on a persistent file system (e.g. Heroku)+-- 2. Your application is open source (e.g. you can't commit the key)+--+-- By keeping a consistent value in the environment variable, your users will+-- have consistent sessions without relying on the file system.+--+-- Note: A suitable value should only be obtained in one of two ways:+--+-- 1. Run this code without the variable set, a value will be generated and+-- printed on @/dev/stdout/@+-- 2. Use @clientsession-generate@+--+-- Since 1.4.5+envClientSessionBackend :: Int -- ^ minutes+ -> String -- ^ environment variable name+ -> IO SessionBackend+envClientSessionBackend minutes name = do+ key <- CS.getKeyEnv name+ let timeout = fromIntegral (minutes * 60)+ (getCachedDate, _closeDateCacher) <- clientSessionDateCacher timeout+ return $ clientSessionBackend key getCachedDate+ jsToHtml :: Javascript -> Html jsToHtml (Javascript b) = preEscapedToMarkup $ toLazyText b
Yesod/Core/Types.hs view
@@ -62,6 +62,9 @@ import Control.DeepSeq (NFData (rnf)) import Data.Conduit.Lazy (MonadActive, monadActive) import Yesod.Core.TypeCache (TypeMap, KeyedTypeMap)+#if MIN_VERSION_monad_logger(0, 3, 10)+import Control.Monad.Logger (MonadLoggerIO (..))+#endif -- Sessions type SessionMap = Map Text ByteString@@ -436,6 +439,11 @@ monadLoggerLog a b c d = WidgetT $ \hd -> liftIO $ fmap (, mempty) $ rheLog (handlerEnv hd) a b c (toLogStr d) +#if MIN_VERSION_monad_logger(0, 3, 10)+instance MonadIO m => MonadLoggerIO (WidgetT site m) where+ askLoggerIO = WidgetT $ \hd -> return (rheLog (handlerEnv hd), mempty)+#endif+ instance MonadActive m => MonadActive (WidgetT site m) where monadActive = lift monadActive instance MonadActive m => MonadActive (HandlerT site m) where@@ -488,6 +496,11 @@ instance MonadIO m => MonadLogger (HandlerT site m) where monadLoggerLog a b c d = HandlerT $ \hd -> liftIO $ rheLog (handlerEnv hd) a b c (toLogStr d)++#if MIN_VERSION_monad_logger(0, 3, 10)+instance MonadIO m => MonadLoggerIO (HandlerT site m) where+ askLoggerIO = HandlerT $ \hd -> return (rheLog (handlerEnv hd))+#endif instance Monoid (UniqueList x) where mempty = UniqueList id
− changelog.md
@@ -1,19 +0,0 @@-## 1.4.4.5--Support time 1.5--## 1.4.4.2--`neverExpires` uses dates one year in the future (instead of in 2037).--## 1.4.4.1--Improvements to etag/if-none-match support #868 #869--## 1.4.4--Add the `notModified` and `setEtag` functions.--## 1.4.3--Switch to mwc-random for token generation.
yesod-core.cabal view
@@ -1,5 +1,5 @@ name: yesod-core-version: 1.4.4.5+version: 1.4.5 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -18,7 +18,7 @@ test/YesodCoreTest/JsLoaderSites/Bottom.hs test/en.msg test/test.hs- changelog.md+ ChangeLog.md README.md library@@ -34,7 +34,7 @@ , blaze-builder >= 0.2.1.4 && < 0.4 , transformers >= 0.2.2 , mtl- , clientsession >= 0.9 && < 0.10+ , clientsession >= 0.9.1 && < 0.10 , random >= 1.0.0.2 && < 1.2 , cereal >= 0.3 , old-locale >= 1.0.0.2 && < 1.1