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 @@ -61,6 +61,7 @@ executable yesod , warp-tls >= 3.0.1 , yaml >= 0.8 && < 0.12 , zlib >= 0.5 + , aeson ghc-options: -Wall -threaded -rtsopts main-is: main.hs diff --git a/yesod/ChangeLog.md b/yesod/ChangeLog.md index 4929bf12..8915035f 100644 --- a/yesod/ChangeLog.md +++ b/yesod/ChangeLog.md @@ -1,5 +1,9 @@ # ChangeLog for yesod +## 1.6.2 + +* aeson 2 + ## 1.6.1.2 * Fix compatibility with template-haskell 2.17 [#1730](https://github.com/yesodweb/yesod/pull/1730) diff --git a/yesod/Yesod/Default/Config.hs b/yesod/Yesod/Default/Config.hs index 8cdbd3bc..65318c5a 100644 --- a/yesod/Yesod/Default/Config.hs +++ b/yesod/Yesod/Default/Config.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PatternGuards #-} module Yesod.Default.Config @@ -19,12 +20,17 @@ import Data.Text (Text) import qualified Data.Text as T import Data.Yaml import Data.Maybe (fromMaybe) -import qualified Data.HashMap.Strict as M import System.Environment (getArgs, getProgName, getEnvironment) import System.Exit (exitFailure) import Data.Streaming.Network (HostPreference) import Data.String (fromString) +#if MIN_VERSION_aeson(2, 0, 0) +import qualified Data.Aeson.KeyMap as M +#else +import qualified Data.HashMap.Strict as M +#endif + -- | A yesod-provided @'AppEnv'@, allows for Development, Testing, and -- Production environments data DefaultEnv = Development @@ -143,7 +149,7 @@ configSettings env0 = ConfigSettings Object obj -> return obj _ -> fail "Expected Object" let senv = show env - tenv = T.pack senv + tenv = fromString senv maybe (error $ "Could not find environment: " ++ senv) return @@ -237,5 +243,5 @@ withYamlEnvironment fp env f = do Left err -> fail $ "Invalid YAML file: " ++ show fp ++ " " ++ prettyPrintParseException err Right (Object obj) - | Just v <- M.lookup (T.pack $ show env) obj -> parseMonad f v + | Just v <- M.lookup (fromString $ show env) obj -> parseMonad f v _ -> fail $ "Could not find environment: " ++ show env diff --git a/yesod/Yesod/Default/Config2.hs b/yesod/Yesod/Default/Config2.hs index 08abe31b..5a2a8ed6 100644 --- a/yesod/Yesod/Default/Config2.hs +++ b/yesod/Yesod/Default/Config2.hs @@ -30,7 +30,6 @@ import Data.Yaml.Config import Data.Semigroup import Data.Aeson -import qualified Data.HashMap.Strict as H import System.Environment (getEnvironment) import Network.Wai (Application) import Network.Wai.Handler.Warp @@ -43,6 +42,12 @@ import Network.Wai.Logger (clockDateCacher) import Yesod.Core.Types (Logger (Logger)) import System.Log.FastLogger (LoggerSet) +#if MIN_VERSION_aeson(2, 0, 0) +import qualified Data.Aeson.KeyMap as H +#else +import qualified Data.HashMap.Strict as H +#endif + #ifndef mingw32_HOST_OS import System.Posix.Signals (installHandler, sigINT, Handler(Catch)) #endif diff --git a/yesod/yesod.cabal b/yesod/yesod.cabal index 4da584e1..46c6b239 100644 --- a/yesod/yesod.cabal +++ b/yesod/yesod.cabal @@ -1,5 +1,5 @@ name: yesod -version: 1.6.1.2 +version: 1.6.2 license: MIT license-file: LICENSE author: Michael Snoyman