packages feed

gemini-router 0.1.1.0 → 0.1.2.0

raw patch · 3 files changed

+26/−4 lines, 3 filesdep ~basedep ~transformersPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, transformers

API changes (from Hackage documentation)

+ Network.Gemini.Router: domain :: Applicative f => String -> RouteT f a -> RouteT f a

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for gemini-router +## 0.1.2.0 -- 2023-07-24++* Add domain combinator+ ## 0.1.1.0 -- 2021-02-22  * SSL/TLS support
Network/Gemini/Router.hs view
@@ -10,6 +10,7 @@ , runRouteT' -- * Building Routes , end+, domain , dir , capture , input@@ -31,7 +32,8 @@ import Control.Monad.Trans.Class (MonadTrans(..)) import Control.Monad.IO.Class (MonadIO(..)) -import Network.URI (uriQuery, pathSegments, unEscapeString)+import Network.URI+  ( uriQuery, pathSegments, unEscapeString, uriAuthority, uriRegName ) import OpenSSL.X509 (X509)  #if __GLASGOW_HASKELL__ < 808@@ -106,6 +108,17 @@ end r = RouteT $ \req path -> case path of   [] -> runRouteT r req path   _ -> pure Nothing++-- | Match on a specified domain+-- @since 0.1.2.0+domain :: Applicative f+       => String -- ^ What the domain must match+       -> RouteT f a -- ^ route to run on match+       -> RouteT f a+domain d r = RouteT $ \req path ->+  if Just d == fmap uriRegName (uriAuthority $ requestURI req)+  then runRouteT r req path+  else pure Nothing  -- | Match on a specific path segment dir :: Applicative f
gemini-router.cabal view
@@ -1,7 +1,7 @@ cabal-version:       2.2  name:                gemini-router-version:             0.1.1.0+version:             0.1.2.0 synopsis:            A simple Happstack-style Gemini router description:   This package contains a 'Router' monad transformer that works on top of the@@ -26,8 +26,13 @@   exposed-modules:     Network.Gemini.Router   -- other-modules:   other-extensions:    FlexibleInstances, CPP-  build-depends:       base ^>=4.12.0.0 || ^>=4.13.0.0 || ^>=4.14.0.0-                     , gemini-server ^>=0.2.0.0+  build-depends:       base ^>=4.12+                         || ^>=4.13+                         || ^>=4.14+                         || ^>=4.15+                         || ^>=4.16+                         || ^>=4.17+                     , gemini-server ^>=0.2.0.0 || ^>=0.3.0.0                      , transformers ^>=0.5.6.2                      , network-uri ^>=2.6.3.0 || ^>=2.7.0.0                      , HsOpenSSL ^>=0.11.5.1