diff options
author | Joey Hess <joey@kitenet.net> | 2013-06-02 15:57:22 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-06-03 11:25:23 -0400 |
commit | 55276e3be82cb574d5bb5964cbfbbb6e37f5dff2 (patch) | |
tree | e3ea0d1067b0f0667d7dfc05e79b9f7732eaa10a | |
parent | 16ca22c60af39cc06db62215a1ac12cd5ae7a3c5 (diff) |
WIP yesod 1.2
-rw-r--r-- | Utility/WebApp.hs | 9 | ||||
-rw-r--r-- | git-annex.cabal | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs index 4c112bbe6..240d097b0 100644 --- a/Utility/WebApp.hs +++ b/Utility/WebApp.hs @@ -178,7 +178,7 @@ lookupRequestField k req = fromMaybe "" . lookup k $ Wai.requestHeaders req {- Rather than storing a session key on disk, use a random key - that will only be valid for this run of the webapp. -} -webAppSessionBackend :: Yesod.Yesod y => y -> IO (Maybe (Yesod.SessionBackend y)) +webAppSessionBackend :: Yesod.Yesod y => y -> IO (Maybe Yesod.SessionBackend) webAppSessionBackend _ = do g <- newGenIO :: IO SystemRandom case genBytes 96 g of @@ -189,6 +189,10 @@ webAppSessionBackend _ = do where timeout = 120 * 60 -- 120 minutes use key = +#if MIN_VERSION_yesod(1,2,0) + Just . Yesod.clientSessionBackend key . fst + <$> Yesod.clientSessionDateCacher timeout +#else #if MIN_VERSION_yesod(1,1,7) Just . Yesod.clientSessionBackend2 key . fst <$> Yesod.clientSessionDateCacher timeout @@ -196,6 +200,7 @@ webAppSessionBackend _ = do return $ Just $ Yesod.clientSessionBackend key timeout #endif +#endif {- Generates a random sha512 string, suitable to be used for an - authentication secret. -} @@ -213,7 +218,7 @@ genRandomToken = do - Note that the usual Yesod error page is bypassed on error, to avoid - possibly leaking the auth token in urls on that page! -} -checkAuthToken :: forall t sub. (t -> T.Text) -> Yesod.GHandler sub t Yesod.AuthResult +checkAuthToken :: (Monad m, Yesod.MonadHandler m) => (Yesod.HandlerSite m -> T.Text) -> m Yesod.AuthResult checkAuthToken extractToken = do webapp <- Yesod.getYesod req <- Yesod.getRequest diff --git a/git-annex.cabal b/git-annex.cabal index b01e13c8a..a97ee3894 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -133,7 +133,7 @@ Executable git-annex if flag(Webapp) Build-Depends: - yesod (< 1.2), yesod-default (< 1.2), yesod-static (< 1.2), yesod-form (< 1.3), + yesod, yesod-default, yesod-static, yesod-form, case-insensitive, http-types, transformers, wai, wai-logger, warp, blaze-builder, crypto-api, hamlet, clientsession, aeson, template-haskell, data-default |