diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 239c9732..9833daa2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,6 +16,7 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] args: #- "--resolver nightly" + - "--resolver nightly-2022-02-11" - "--resolver lts-18" - "--resolver lts-16" - "--resolver lts-14" diff --git a/yesod-auth-oauth/ChangeLog.md b/yesod-auth-oauth/ChangeLog.md index 9d5d5dbb..280564e2 100644 --- a/yesod-auth-oauth/ChangeLog.md +++ b/yesod-auth-oauth/ChangeLog.md @@ -1,5 +1,9 @@ # ChangeLog for yesod-auth-oauth +## 1.6.1 + +* Allow newer GHC + ## 1.6.0.3 * Allow yesod-form 1.7 diff --git a/yesod-auth-oauth/Yesod/Auth/OAuth.hs b/yesod-auth-oauth/Yesod/Auth/OAuth.hs index f2ccae1b..96ea8029 100644 --- a/yesod-auth-oauth/Yesod/Auth/OAuth.hs +++ b/yesod-auth-oauth/Yesod/Auth/OAuth.hs @@ -18,7 +18,6 @@ import Control.Applicative as A ((<$>), (<*>)) import Control.Arrow ((***)) import UnliftIO.Exception import Control.Monad.IO.Class -import UnliftIO (MonadUnliftIO) import Data.ByteString (ByteString) import Data.Maybe import Data.Text (Text) @@ -53,14 +52,9 @@ authOAuth oauth mkCreds = AuthPlugin name dispatch login oauthSessionName = "__oauth_token_secret" dispatch - :: ( MonadHandler m - , master ~ HandlerSite m - , Auth ~ SubHandlerSite m - , MonadUnliftIO m - ) - => Text + :: Text -> [Text] - -> m TypedContent + -> AuthHandler master TypedContent dispatch "GET" ["forward"] = do render <- getUrlRender tm <- getRouteToParent diff --git a/yesod-auth-oauth/yesod-auth-oauth.cabal b/yesod-auth-oauth/yesod-auth-oauth.cabal index 4d0faa5e..3e91ff69 100644 --- a/yesod-auth-oauth/yesod-auth-oauth.cabal +++ b/yesod-auth-oauth/yesod-auth-oauth.cabal @@ -1,6 +1,6 @@ cabal-version: >= 1.10 name: yesod-auth-oauth -version: 1.6.0.3 +version: 1.6.1 license: BSD3 license-file: LICENSE author: Hiromi Ishii @@ -15,7 +15,7 @@ extra-source-files: README.md ChangeLog.md library default-language: Haskell2010 - build-depends: authenticate-oauth >= 1.5 && < 1.7 + build-depends: authenticate-oauth >= 1.5 && < 1.8 , base >= 4.10 && < 5 , bytestring >= 0.9.1.4 , text >= 0.7 diff --git a/yesod-auth/ChangeLog.md b/yesod-auth/ChangeLog.md index 782e12c1..c354c31f 100644 --- a/yesod-auth/ChangeLog.md +++ b/yesod-auth/ChangeLog.md @@ -1,5 +1,13 @@ # ChangeLog for yesod-auth +## 1.6.11 + +* Add support for aeson 2 + +## 1.6.10.5 + +* Fix German translations of AuthMessage [#1741](https://github.com/yesodweb/yesod/pull/1741) + ## 1.6.10.4 * Add support for GHC 9 [#1737](https://github.com/yesodweb/yesod/pull/1737) diff --git a/yesod-auth/Yesod/Auth.hs b/yesod-auth/Yesod/Auth.hs index dd69812f..933e76f8 100644 --- a/yesod-auth/Yesod/Auth.hs +++ b/yesod-auth/Yesod/Auth.hs @@ -52,7 +52,6 @@ import Control.Monad.Trans.Maybe import UnliftIO (withRunInIO, MonadUnliftIO) import Yesod.Auth.Routes -import Data.Aeson hiding (json) import Data.Text.Encoding (decodeUtf8With) import Data.Text.Encoding.Error (lenientDecode) import Data.Text (Text) @@ -452,7 +451,7 @@ $nothing
Not logged in.
|]
jsonCreds creds =
- Object $ Map.fromList
+ toJSON $ Map.fromList
[ (T.pack "logged_in", Bool $ maybe False (const True) creds)
]
diff --git a/yesod-auth/Yesod/Auth/GoogleEmail2.hs b/yesod-auth/Yesod/Auth/GoogleEmail2.hs
index cf79a57f..fbe17d2c 100644
--- a/yesod-auth/Yesod/Auth/GoogleEmail2.hs
+++ b/yesod-auth/Yesod/Auth/GoogleEmail2.hs
@@ -87,7 +87,6 @@ import Data.Aeson.Types (FromJSON (parseJSON), parseEither,
parseMaybe, withObject, withText)
import Data.Conduit
import Data.Conduit.Attoparsec (sinkParser)
-import qualified Data.HashMap.Strict as M
import Data.Maybe (fromMaybe)
import Data.Monoid (mappend)
import Data.Text (Text)
@@ -103,6 +102,13 @@ import Network.HTTP.Conduit (http)
import Network.HTTP.Types (renderQueryText)
import System.IO.Unsafe (unsafePerformIO)
+#if MIN_VERSION_aeson(2, 0, 0)
+import qualified Data.Aeson.Key
+import qualified Data.Aeson.KeyMap
+#else
+import qualified Data.HashMap.Strict as M
+#endif
+
-- | Plugin identifier. This is used to identify the plugin used for
-- authentication. The 'credsPlugin' will contain this value when this
@@ -587,9 +593,19 @@ instance FromJSON EmailType where
_ -> EmailType t
allPersonInfo :: A.Value -> [(Text, Text)]
-allPersonInfo (A.Object o) = map enc $ M.toList o
- where enc (key, A.String s) = (key, s)
- enc (key, v) = (key, TL.toStrict $ TL.toLazyText $ A.encodeToTextBuilder v)
+allPersonInfo (A.Object o) = map enc $ mapToList o
+ where
+ enc (key, A.String s) = (keyToText key, s)
+ enc (key, v) = (keyToText key, TL.toStrict $ TL.toLazyText $ A.encodeToTextBuilder v)
+
+#if MIN_VERSION_aeson(2, 0, 0)
+ keyToText = Data.Aeson.Key.toText
+ mapToList = Data.Aeson.KeyMap.toList
+#else
+ keyToText = id
+ mapToList = M.toList
+#endif
+
allPersonInfo _ = []
diff --git a/yesod-auth/yesod-auth.cabal b/yesod-auth/yesod-auth.cabal
index f5aa0bce..8ee16554 100644
--- a/yesod-auth/yesod-auth.cabal
+++ b/yesod-auth/yesod-auth.cabal
@@ -1,6 +1,6 @@
cabal-version: >=1.10
name: yesod-auth
-version: 1.6.10.4
+version: 1.6.11
license: MIT
license-file: LICENSE
author: Michael Snoyman, Patrick Brisbin
diff --git a/yesod-bin/ChangeLog.md b/yesod-bin/ChangeLog.md
index a7780c0a..9f05e13d 100644
--- a/yesod-bin/ChangeLog.md
+++ b/yesod-bin/ChangeLog.md
@@ -1,5 +1,9 @@
# ChangeLog for yesod-bin
+## 1.6.2
+
+* aeson 2.0
+
## 1.6.1
Added command line options `cert` and `key` to allow TLS certificate and key files to be passed to `yesod devel` [#1717](https://github.com/yesodweb/yesod/pull/1717)
diff --git a/yesod-bin/Keter.hs b/yesod-bin/Keter.hs
index 07810ea8..94024e18 100644
--- a/yesod-bin/Keter.hs
+++ b/yesod-bin/Keter.hs
@@ -1,10 +1,16 @@
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE CPP #-}
module Keter
( keter
) where
import Data.Yaml
+
+#if MIN_VERSION_aeson(2, 0, 0)
+import qualified Data.Aeson.KeyMap as Map
+#else
import qualified Data.HashMap.Strict as Map
+#endif
import qualified Data.Text as T
import System.Environment (getEnvironment)
import System.Exit
diff --git a/yesod-bin/yesod-bin.cabal b/yesod-bin/yesod-bin.cabal
index 20da5ef8..1296d7ff 100644
--- a/yesod-bin/yesod-bin.cabal
+++ b/yesod-bin/yesod-bin.cabal
@@ -1,5 +1,5 @@
name: yesod-bin
-version: 1.6.1
+version: 1.6.2
license: MIT
license-file: LICENSE
author: Michael Snoyman