conduit 0.3
This commit is contained in:
parent
b5f2e4863d
commit
cbd0719f37
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -12,7 +12,7 @@
|
||||
url = https://github.com/snoyberg/xml
|
||||
[submodule "crypto-conduit"]
|
||||
path = crypto-conduit
|
||||
url = https://github.com/snoyberg/crypto-conduit
|
||||
url = https://github.com/snoyberg/crypto-conduit.git
|
||||
[submodule "yaml"]
|
||||
path = yaml
|
||||
url = https://github.com/snoyberg/yaml
|
||||
|
||||
1
authenticate
Submodule
1
authenticate
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit c61c883be061b86d38b87f4da302a76074c21956
|
||||
1
crypto-conduit
Submodule
1
crypto-conduit
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 26697093384afe848b834270c58229dac822f70d
|
||||
@ -3,6 +3,8 @@
|
||||
pkgs=( ./yesod-routes
|
||||
./yesod-core
|
||||
./yesod-json
|
||||
./crypto-conduit
|
||||
./authenticate/authenticate
|
||||
./yesod-static
|
||||
./yesod-persistent
|
||||
./yesod-newsfeed
|
||||
|
||||
@ -27,8 +27,6 @@ module Yesod.Auth
|
||||
, AuthException (..)
|
||||
) where
|
||||
|
||||
#include "qq.h"
|
||||
|
||||
import Control.Monad (when)
|
||||
import Control.Monad.Trans.Maybe
|
||||
|
||||
@ -132,7 +130,7 @@ mkYesodSub "Auth"
|
||||
[ ClassP ''YesodAuth [VarT $ mkName "master"]
|
||||
]
|
||||
#define STRINGS *Texts
|
||||
[QQ(parseRoutes)|
|
||||
[parseRoutes|
|
||||
/check CheckR GET
|
||||
/login LoginR GET
|
||||
/logout LogoutR GET POST
|
||||
@ -151,7 +149,7 @@ setCreds doRedirects creds = do
|
||||
Nothing ->
|
||||
when doRedirects $ do
|
||||
case authRoute y of
|
||||
Nothing -> do rh <- defaultLayout $ addHtml [QQ(shamlet)| <h1>Invalid login |]
|
||||
Nothing -> do rh <- defaultLayout $ addHtml [shamlet| <h1>Invalid login |]
|
||||
sendResponse rh
|
||||
Just ar -> do setMessageI Msg.InvalidLogin
|
||||
redirect ar
|
||||
@ -169,7 +167,7 @@ getCheckR = do
|
||||
addHtml $ html' creds) (jsonCreds creds)
|
||||
where
|
||||
html' creds =
|
||||
[QQ(shamlet)|
|
||||
[shamlet|
|
||||
<h1>Authentication Status
|
||||
$maybe _ <- creds
|
||||
<p>Logged in.
|
||||
|
||||
@ -16,8 +16,6 @@ import Data.Maybe (fromMaybe)
|
||||
import Control.Monad.IO.Class (liftIO)
|
||||
import Control.Exception (throwIO)
|
||||
|
||||
#include "qq.h"
|
||||
|
||||
pid :: Text
|
||||
pid = "browserid"
|
||||
|
||||
@ -64,7 +62,7 @@ helper maudience = AuthPlugin
|
||||
_ -> notFound
|
||||
, apLogin = \toMaster -> do
|
||||
addScriptRemote browserIdJs
|
||||
addHamlet [QQ(hamlet)|
|
||||
addHamlet [hamlet|
|
||||
<p>
|
||||
<a href="javascript:navigator.id.getVerifiedEmail(function(a){if(a)document.location='@{toMaster complete}/'+a});">
|
||||
<img src="https://browserid.org/i/sign_in_green.png">
|
||||
|
||||
@ -8,8 +8,6 @@ module Yesod.Auth.Dummy
|
||||
( authDummy
|
||||
) where
|
||||
|
||||
#include "qq.h"
|
||||
|
||||
import Yesod.Auth
|
||||
import Yesod.Form (runInputPost, textField, ireq)
|
||||
import Yesod.Handler (notFound)
|
||||
@ -26,9 +24,9 @@ authDummy =
|
||||
dispatch _ _ = notFound
|
||||
url = PluginR "dummy" []
|
||||
login authToMaster =
|
||||
addHamlet [QQ(hamlet)|
|
||||
addHamlet [hamlet|
|
||||
<form method="post" action="@{authToMaster url}">
|
||||
\Your new identifier is:
|
||||
Your new identifier is: #
|
||||
<input type="text" name="ident">
|
||||
<input type="submit" value="Dummy Login">
|
||||
|]
|
||||
|
||||
@ -15,8 +15,6 @@ module Yesod.Auth.Email
|
||||
, isValidPass
|
||||
) where
|
||||
|
||||
#include "qq.h"
|
||||
|
||||
import Network.Mail.Mime (randomString)
|
||||
import Yesod.Auth
|
||||
import System.Random
|
||||
@ -82,7 +80,7 @@ class (YesodAuth m, PathPiece (AuthEmailId m)) => YesodAuthEmail m where
|
||||
authEmail :: YesodAuthEmail m => AuthPlugin m
|
||||
authEmail =
|
||||
AuthPlugin "email" dispatch $ \tm ->
|
||||
[QQ(whamlet)|
|
||||
[whamlet|
|
||||
<form method="post" action="@{tm loginR}">
|
||||
<table>
|
||||
<tr>
|
||||
@ -116,7 +114,7 @@ getRegisterR = do
|
||||
defaultLayout $ do
|
||||
setTitleI Msg.RegisterLong
|
||||
addWidget
|
||||
[QQ(whamlet)|
|
||||
[whamlet|
|
||||
<p>_{Msg.EnterEmail}
|
||||
<form method="post" action="@{toMaster registerR}">
|
||||
<label for="email">_{Msg.Email}
|
||||
@ -147,7 +145,7 @@ postRegisterR = do
|
||||
defaultLayout $ do
|
||||
setTitleI Msg.ConfirmationEmailSentTitle
|
||||
addWidget
|
||||
[QQ(whamlet)| <p>_{Msg.ConfirmationEmailSent email} |]
|
||||
[whamlet| <p>_{Msg.ConfirmationEmailSent email} |]
|
||||
|
||||
getVerifyR :: YesodAuthEmail m
|
||||
=> AuthEmailId m -> Text -> GHandler Auth m RepHtml
|
||||
@ -168,7 +166,7 @@ getVerifyR lid key = do
|
||||
defaultLayout $ do
|
||||
setTitleI Msg.InvalidKey
|
||||
addWidget
|
||||
[QQ(whamlet)| <p>_{Msg.InvalidKey} |]
|
||||
[whamlet| <p>_{Msg.InvalidKey} |]
|
||||
|
||||
postLoginR :: YesodAuthEmail master => GHandler Auth master ()
|
||||
postLoginR = do
|
||||
@ -207,7 +205,7 @@ getPasswordR = do
|
||||
defaultLayout $ do
|
||||
setTitleI Msg.SetPassTitle
|
||||
addWidget
|
||||
[QQ(whamlet)|
|
||||
[whamlet|
|
||||
<h3>_{Msg.SetPass}
|
||||
<form method="post" action="@{toMaster setpassR}">
|
||||
<table>
|
||||
|
||||
@ -72,8 +72,6 @@ module Yesod.Auth.HashDB
|
||||
, migrateUsers
|
||||
) where
|
||||
|
||||
#include "qq.h"
|
||||
|
||||
import Yesod.Persist
|
||||
import Yesod.Handler
|
||||
import Yesod.Form
|
||||
@ -179,7 +177,7 @@ postLoginR uniq = do
|
||||
(validateUser <$> (uniq =<< mu) <*> mp)
|
||||
if isValid
|
||||
then setCreds True $ Creds "hashdb" (fromMaybe "" mu) []
|
||||
else do setMessage [QQ(shamlet)| Invalid username/password |]
|
||||
else do setMessage [shamlet| Invalid username/password |]
|
||||
toMaster <- getRouteToMaster
|
||||
redirect $ toMaster LoginR
|
||||
|
||||
@ -210,7 +208,7 @@ getAuthIdHashDB authR uniq creds = do
|
||||
-- user exists
|
||||
Just (Entity uid _) -> return $ Just uid
|
||||
Nothing -> do
|
||||
setMessage [QQ(shamlet)| User not found |]
|
||||
setMessage [shamlet| User not found |]
|
||||
redirect $ authR LoginR
|
||||
|
||||
-- | Prompt for username and password, validate that against a database
|
||||
@ -224,7 +222,7 @@ authHashDB :: ( YesodAuth m, YesodPersist m
|
||||
, PersistUnique b (GHandler Auth m))
|
||||
=> (Text -> Maybe (Unique user b)) -> AuthPlugin m
|
||||
authHashDB uniq = AuthPlugin "hashdb" dispatch $ \tm -> addHamlet
|
||||
[QQ(hamlet)|
|
||||
[hamlet|
|
||||
<div id="header">
|
||||
<h1>Login
|
||||
|
||||
@ -261,7 +259,7 @@ authHashDB uniq = AuthPlugin "hashdb" dispatch $ \tm -> addHamlet
|
||||
|
||||
-- | Generate data base instances for a valid user
|
||||
share [mkPersist sqlSettings, mkMigrate "migrateUsers"]
|
||||
[QQ(persistUpperCase)|
|
||||
[persistUpperCase|
|
||||
User
|
||||
username Text Eq
|
||||
password Text
|
||||
|
||||
@ -7,8 +7,6 @@ module Yesod.Auth.OpenId
|
||||
, forwardUrl
|
||||
) where
|
||||
|
||||
#include "qq.h"
|
||||
|
||||
import Yesod.Auth
|
||||
import qualified Web.Authenticate.OpenId as OpenId
|
||||
|
||||
@ -37,11 +35,11 @@ authOpenIdExtended extensionFields =
|
||||
login tm = do
|
||||
ident <- lift newIdent
|
||||
addCassius
|
||||
[QQ(cassius)|##{ident}
|
||||
[cassius|##{ident}
|
||||
background: #fff url(http://www.myopenid.com/static/openid-icon-small.gif) no-repeat scroll 0pt 50%;
|
||||
padding-left: 18px;
|
||||
|]
|
||||
[QQ(whamlet)|
|
||||
[whamlet|
|
||||
<form method="get" action="@{tm forwardUrl}">
|
||||
<input type="hidden" name="openid_identifier" value="https://www.google.com/accounts/o8/id">
|
||||
<button .openid-google>_{Msg.LoginGoogle}
|
||||
|
||||
@ -5,8 +5,6 @@ module Yesod.Auth.Rpxnow
|
||||
( authRpxnow
|
||||
) where
|
||||
|
||||
#include "qq.h"
|
||||
|
||||
import Yesod.Auth
|
||||
import qualified Web.Authenticate.Rpxnow as Rpxnow
|
||||
import Control.Monad (mplus)
|
||||
@ -28,7 +26,7 @@ authRpxnow app apiKey =
|
||||
login tm = do
|
||||
let url = {- FIXME urlEncode $ -} tm $ PluginR "rpxnow" []
|
||||
addHamlet
|
||||
[QQ(hamlet)|
|
||||
[hamlet|
|
||||
<iframe src="http://#{app}.rpxnow.com/openid/embed?token_url=@{url}" scrolling="no" frameBorder="no" allowtransparency="true" style="width:400px;height:240px">
|
||||
|]
|
||||
dispatch _ [] = do
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
|
||||
-- CPP macro which choses which quasyquotes syntax to use depending
|
||||
-- on GHC version.
|
||||
--
|
||||
-- QQ stands for quasyquote.
|
||||
#if GHC7
|
||||
# define QQ(x) x
|
||||
#else
|
||||
# define QQ(x) $x
|
||||
#endif
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-auth
|
||||
version: 0.8.1.1
|
||||
version: 1.0.0
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman, Patrick Brisbin
|
||||
@ -10,39 +10,34 @@ stability: Stable
|
||||
cabal-version: >= 1.6.0
|
||||
build-type: Simple
|
||||
homepage: http://www.yesodweb.com/
|
||||
extra-source-files: include/qq.h
|
||||
description: Authentication for Yesod.
|
||||
|
||||
flag ghc7
|
||||
|
||||
library
|
||||
if flag(ghc7)
|
||||
build-depends: base >= 4.3 && < 5
|
||||
cpp-options: -DGHC7
|
||||
else
|
||||
build-depends: base >= 4 && < 4.3
|
||||
build-depends: authenticate >= 1.0 && < 1.1
|
||||
build-depends: base >= 4 && < 5
|
||||
, authenticate >= 1.1 && < 1.2
|
||||
, bytestring >= 0.9.1.4 && < 0.10
|
||||
, yesod-core >= 0.10.1 && < 0.11
|
||||
, wai >= 1.1 && < 1.2
|
||||
, yesod-core >= 1.0 && < 1.1
|
||||
, wai >= 1.2 && < 1.3
|
||||
, template-haskell
|
||||
, pureMD5 >= 2.0 && < 2.2
|
||||
, random >= 1.0.0.2 && < 1.1
|
||||
, text >= 0.7 && < 0.12
|
||||
, mime-mail >= 0.3 && < 0.5
|
||||
, blaze-html >= 0.4.1.3 && < 0.5
|
||||
, yesod-persistent >= 0.3.1 && < 0.4
|
||||
, yesod-persistent >= 1.0 && < 1.1
|
||||
, hamlet >= 0.10 && < 0.11
|
||||
, shakespeare-css >= 0.10 && < 0.11
|
||||
, yesod-json >= 0.3.1 && < 0.4
|
||||
, yesod-json >= 1.0 && < 1.1
|
||||
, containers
|
||||
, unordered-containers
|
||||
, yesod-form >= 0.4.1 && < 0.5
|
||||
, yesod-form >= 1.0 && < 1.1
|
||||
, transformers >= 0.2.2 && < 0.3
|
||||
, persistent >= 0.8 && < 0.9
|
||||
, persistent-template >= 0.8 && < 0.9
|
||||
, persistent >= 0.9 && < 0.10
|
||||
, persistent-template >= 0.9 && < 0.10
|
||||
, SHA >= 1.4.1.3 && < 1.6
|
||||
, http-conduit >= 1.2.5 && < 1.3
|
||||
, http-conduit >= 1.3 && < 1.4
|
||||
, aeson >= 0.5
|
||||
, pwstore-fast >= 2.2 && < 3
|
||||
, lifted-base >= 0.1 && < 0.2
|
||||
@ -57,7 +52,6 @@ library
|
||||
Yesod.Auth.Message
|
||||
Yesod.Auth.GoogleEmail
|
||||
ghc-options: -Wall
|
||||
include-dirs: include
|
||||
|
||||
source-repository head
|
||||
type: git
|
||||
|
||||
@ -62,10 +62,10 @@ import Text.Hamlet (Html)
|
||||
import Text.Blaze.Renderer.Utf8 (renderHtmlBuilder)
|
||||
import Data.String (IsString (fromString))
|
||||
import Network.Wai (FilePart)
|
||||
import Data.Conduit (Source, Flush)
|
||||
import Data.Conduit (Source, ResourceT, Flush)
|
||||
|
||||
data Content = ContentBuilder Builder (Maybe Int) -- ^ The content and optional content length.
|
||||
| ContentSource (Source IO (Flush Builder))
|
||||
| ContentSource (Source (ResourceT IO) (Flush Builder))
|
||||
| ContentFile FilePath (Maybe FilePart)
|
||||
|
||||
-- | Zero-length enumerator.
|
||||
|
||||
@ -166,9 +166,9 @@ import qualified Yesod.Internal.Cache as Cache
|
||||
import Yesod.Internal.Cache (mkCacheKey, CacheKey)
|
||||
import Data.Typeable (Typeable)
|
||||
import qualified Data.IORef as I
|
||||
import Control.Monad.Trans.Resource
|
||||
import Control.Exception.Lifted (catch)
|
||||
import Control.Monad.Trans.Control
|
||||
import Control.Monad.Trans.Resource
|
||||
import Control.Monad.Base
|
||||
import Yesod.Routes.Class
|
||||
|
||||
@ -831,13 +831,8 @@ newIdent = do
|
||||
redirectToPost :: RedirectUrl master url => url -> GHandler sub master a
|
||||
redirectToPost url = do
|
||||
urlText <- toTextUrl url
|
||||
hamletToRepHtml
|
||||
#if GHC7
|
||||
[hamlet|
|
||||
#else
|
||||
[$hamlet|
|
||||
#endif
|
||||
\<!DOCTYPE html>
|
||||
hamletToRepHtml [hamlet|
|
||||
$doctype 5
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@ -922,12 +917,12 @@ instance MonadBaseControl IO (GHandler sub master) where
|
||||
f $ liftM StH . runInBase . (\(GHandler r) -> r reader)
|
||||
restoreM (StH base) = GHandler $ const $ restoreM base
|
||||
|
||||
instance Resource (GHandler sub master) where
|
||||
type Base (GHandler sub master) = IO
|
||||
resourceLiftBase = liftIO
|
||||
resourceBracket_ a b c = control $ \run -> resourceBracket_ a b (run c)
|
||||
instance ResourceUnsafeIO (GHandler sub master) where
|
||||
unsafeFromIO = liftIO
|
||||
instance ResourceThrow (GHandler sub master) where
|
||||
resourceThrow = liftIO . throwIO
|
||||
instance ResourceIO (GHandler sub master)
|
||||
instance MonadUnsafeIO (GHandler sub master) where
|
||||
unsafeLiftIO = liftIO
|
||||
instance MonadThrow (GHandler sub master) where
|
||||
monadThrow = liftIO . throwIO
|
||||
instance MonadResource (GHandler sub master) where
|
||||
allocate a = lift . allocate a
|
||||
register = lift . register
|
||||
release = lift . release
|
||||
resourceMask = lift . resourceMask
|
||||
|
||||
@ -45,12 +45,6 @@ import Data.Text.Lazy.Builder (Builder)
|
||||
import Network.HTTP.Types (Ascii)
|
||||
import Web.Cookie (SetCookie (..))
|
||||
|
||||
#if GHC7
|
||||
#define HAMLET hamlet
|
||||
#else
|
||||
#define HAMLET $hamlet
|
||||
#endif
|
||||
|
||||
-- | Responses to indicate some form of an error occurred. These are different
|
||||
-- from 'SpecialResponse' in that they allow for custom error pages.
|
||||
data ErrorResponse =
|
||||
@ -76,9 +70,9 @@ langKey = "_LANG"
|
||||
data Location url = Local url | Remote Text
|
||||
deriving (Show, Eq)
|
||||
locationToHtmlUrl :: Location url -> HtmlUrl url
|
||||
locationToHtmlUrl (Local url) = [HAMLET|\@{url}
|
||||
locationToHtmlUrl (Local url) = [hamlet|\@{url}
|
||||
|]
|
||||
locationToHtmlUrl (Remote s) = [HAMLET|\#{s}
|
||||
locationToHtmlUrl (Remote s) = [hamlet|\#{s}
|
||||
|]
|
||||
|
||||
newtype UniqueList x = UniqueList ([x] -> [x])
|
||||
|
||||
@ -84,23 +84,11 @@ import Data.Aeson (Value (Array, String))
|
||||
import Data.Aeson.Encode (encode)
|
||||
import qualified Data.Vector as Vector
|
||||
import Network.Wai.Middleware.Gzip (GzipSettings, def)
|
||||
|
||||
-- mega repo can't access this
|
||||
#ifndef MEGA
|
||||
import qualified Paths_yesod_core
|
||||
import Data.Version (showVersion)
|
||||
|
||||
yesodVersion :: String
|
||||
yesodVersion = showVersion Paths_yesod_core.version
|
||||
#else
|
||||
yesodVersion :: String
|
||||
yesodVersion = "0.9.4"
|
||||
#endif
|
||||
|
||||
#if GHC7
|
||||
#define HAMLET hamlet
|
||||
#else
|
||||
#define HAMLET $hamlet
|
||||
#endif
|
||||
|
||||
-- | This class is automatically instantiated when you use the template haskell
|
||||
-- mkYesod function. You should never need to deal with it directly.
|
||||
@ -177,7 +165,7 @@ class RenderRoute a => Yesod a where
|
||||
defaultLayout w = do
|
||||
p <- widgetToPageContent w
|
||||
mmsg <- getMessage
|
||||
hamletToRepHtml [HAMLET|
|
||||
hamletToRepHtml [hamlet|
|
||||
!!!
|
||||
|
||||
<html>
|
||||
@ -505,19 +493,19 @@ defaultErrorHandler NotFound = do
|
||||
r <- waiRequest
|
||||
let path' = TE.decodeUtf8With TEE.lenientDecode $ W.rawPathInfo r
|
||||
applyLayout' "Not Found"
|
||||
[HAMLET|
|
||||
[hamlet|
|
||||
<h1>Not Found
|
||||
<p>#{path'}
|
||||
|]
|
||||
defaultErrorHandler (PermissionDenied msg) =
|
||||
applyLayout' "Permission Denied"
|
||||
[HAMLET|
|
||||
[hamlet|
|
||||
<h1>Permission denied
|
||||
<p>#{msg}
|
||||
|]
|
||||
defaultErrorHandler (InvalidArgs ia) =
|
||||
applyLayout' "Invalid Arguments"
|
||||
[HAMLET|
|
||||
[hamlet|
|
||||
<h1>Invalid Arguments
|
||||
<ul>
|
||||
$forall msg <- ia
|
||||
@ -525,13 +513,13 @@ defaultErrorHandler (InvalidArgs ia) =
|
||||
|]
|
||||
defaultErrorHandler (InternalError e) =
|
||||
applyLayout' "Internal Server Error"
|
||||
[HAMLET|
|
||||
[hamlet|
|
||||
<h1>Internal Server Error
|
||||
<p>#{e}
|
||||
|]
|
||||
defaultErrorHandler (BadMethod m) =
|
||||
applyLayout' "Bad Method"
|
||||
[HAMLET|
|
||||
[hamlet|
|
||||
<h1>Method Not Supported
|
||||
<p>Method "#{S8.unpack m}" not supported
|
||||
|]
|
||||
@ -590,7 +578,7 @@ widgetToPageContent w = do
|
||||
-- modernizr should be at the end of the <head> http://www.modernizr.com/docs/#installing
|
||||
-- the asynchronous loader means your page doesn't have to wait for all the js to load
|
||||
let (mcomplete, asyncScripts) = asyncHelper render scripts jscript jsLoc
|
||||
regularScriptLoad = [HAMLET|
|
||||
regularScriptLoad = [hamlet|
|
||||
$forall s <- scripts
|
||||
^{mkScriptTag s}
|
||||
$maybe j <- jscript
|
||||
@ -600,7 +588,7 @@ $maybe j <- jscript
|
||||
<script>^{jelper j}
|
||||
|]
|
||||
|
||||
headAll = [HAMLET|
|
||||
headAll = [hamlet|
|
||||
\^{head'}
|
||||
$forall s <- stylesheets
|
||||
^{mkLinkTag s}
|
||||
@ -622,7 +610,7 @@ $case jsLoader master
|
||||
$of BottomOfHeadBlocking
|
||||
^{regularScriptLoad}
|
||||
|]
|
||||
let bodyScript = [HAMLET|
|
||||
let bodyScript = [hamlet|
|
||||
^{body}
|
||||
^{regularScriptLoad}
|
||||
|]
|
||||
@ -668,7 +656,7 @@ jsonArray = unsafeLazyByteString . encode . Array . Vector.fromList . map String
|
||||
-- | For use with setting 'jsLoader' to 'BottomOfHeadAsync'
|
||||
loadJsYepnope :: Yesod master => Either Text (Route master) -> [Text] -> Maybe (HtmlUrl (Route master)) -> (HtmlUrl (Route master))
|
||||
loadJsYepnope eyn scripts mcomplete =
|
||||
[HAMLET|
|
||||
[hamlet|
|
||||
$maybe yn <- left eyn
|
||||
<script src=#{yn}>
|
||||
$maybe yn <- right eyn
|
||||
|
||||
@ -76,14 +76,14 @@ import qualified Data.Map as Map
|
||||
import Language.Haskell.TH.Quote (QuasiQuoter)
|
||||
import Language.Haskell.TH.Syntax (Q, Exp (InfixE, VarE, LamE), Pat (VarP), newName)
|
||||
|
||||
import Control.Monad.Trans.Control (MonadBaseControl (..), control)
|
||||
import Control.Monad.Trans.Resource
|
||||
import Control.Monad.Trans.Control (MonadBaseControl (..))
|
||||
import Control.Exception (throwIO)
|
||||
import qualified Text.Hamlet as NP
|
||||
import Data.Text.Lazy.Builder (fromLazyText)
|
||||
import Text.Blaze (toHtml, preEscapedLazyText)
|
||||
import Control.Monad.Base (MonadBase (liftBase))
|
||||
import Control.Arrow (first)
|
||||
import Control.Monad.Trans.Resource
|
||||
|
||||
-- | A generic widget, allowing specification of both the subsite and master
|
||||
-- site datatypes. While this is simply a @WriterT@, we define a newtype for
|
||||
@ -321,12 +321,12 @@ instance MonadBaseControl IO (GWidget sub master) where
|
||||
(f $ liftM StW . runInBase . unGWidget)
|
||||
restoreM (StW base) = GWidget $ restoreM base
|
||||
|
||||
instance Resource (GWidget sub master) where
|
||||
type Base (GWidget sub master) = IO
|
||||
resourceLiftBase = liftIO
|
||||
resourceBracket_ a b c = control $ \run -> resourceBracket_ a b (run c)
|
||||
instance ResourceUnsafeIO (GWidget sub master) where
|
||||
unsafeFromIO = liftIO
|
||||
instance ResourceThrow (GWidget sub master) where
|
||||
resourceThrow = liftIO . throwIO
|
||||
instance ResourceIO (GWidget sub master)
|
||||
instance MonadUnsafeIO (GWidget sub master) where
|
||||
unsafeLiftIO = liftIO
|
||||
instance MonadThrow (GWidget sub master) where
|
||||
monadThrow = liftIO . throwIO
|
||||
instance MonadResource (GWidget sub master) where
|
||||
allocate a = lift . allocate a
|
||||
register = lift . register
|
||||
release = lift . release
|
||||
resourceMask = lift . resourceMask
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-core
|
||||
version: 0.10.2.2
|
||||
version: 1.0.0
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
@ -47,9 +47,9 @@ library
|
||||
build-depends: wai-test
|
||||
|
||||
build-depends: time >= 1.1.4
|
||||
, yesod-routes >= 0.0.1 && < 0.1
|
||||
, wai >= 1.1 && < 1.2
|
||||
, wai-extra >= 1.1 && < 1.3
|
||||
, yesod-routes >= 1.0 && < 1.1
|
||||
, wai >= 1.2 && < 1.3
|
||||
, wai-extra >= 1.2 && < 1.3
|
||||
, bytestring >= 0.9.1.4 && < 0.10
|
||||
, text >= 0.7 && < 0.12
|
||||
, template-haskell
|
||||
@ -79,7 +79,8 @@ library
|
||||
, aeson >= 0.5
|
||||
, fast-logger >= 0.0.2
|
||||
, wai-logger >= 0.0.1
|
||||
, conduit >= 0.2 && < 0.3
|
||||
, conduit >= 0.3 && < 0.4
|
||||
, resourcet >= 0.3 && < 0.4
|
||||
, lifted-base >= 0.1 && < 0.2
|
||||
|
||||
exposed-modules: Yesod.Content
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-default
|
||||
version: 0.6.1
|
||||
version: 1.0.0
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Patrick Brisbin
|
||||
@ -18,10 +18,10 @@ library
|
||||
cpp-options: -DWINDOWS
|
||||
|
||||
build-depends: base >= 4 && < 5
|
||||
, yesod-core >= 0.10.1&& < 0.11
|
||||
, warp >= 1.1 && < 1.2
|
||||
, wai >= 1.1 && < 1.2
|
||||
, wai-extra >= 1.1 && < 1.3
|
||||
, yesod-core >= 1.0 && < 1.1
|
||||
, warp >= 1.2 && < 1.3
|
||||
, wai >= 1.2 && < 1.3
|
||||
, wai-extra >= 1.2 && < 1.3
|
||||
, bytestring >= 0.9.1.4
|
||||
, transformers >= 0.2.2 && < 0.3
|
||||
, text >= 0.9
|
||||
@ -29,7 +29,7 @@ library
|
||||
, shakespeare-css >= 0.10.5 && < 0.11
|
||||
, shakespeare-js >= 0.11 && < 0.12
|
||||
, template-haskell
|
||||
, yaml >= 0.5.1.2 && < 0.6
|
||||
, yaml >= 0.6 && < 0.7
|
||||
, unordered-containers
|
||||
|
||||
if !os(windows)
|
||||
|
||||
@ -273,9 +273,8 @@ searchField autoFocus = Field
|
||||
|]
|
||||
when autoFocus $ do
|
||||
-- we want this javascript to be placed immediately after the field
|
||||
[whamlet|\<script>if (!('autofocus' in document.createElement('input'))) {document.getElementById('#{theId}').focus();}</script>
|
||||
|]
|
||||
addCassius [CASSIUS|
|
||||
[whamlet|<script>if (!('autofocus' in document.createElement('input'))) {document.getElementById('#{theId}').focus();}|]
|
||||
addCassius [cassius|
|
||||
#{theId}
|
||||
-webkit-appearance: textfield
|
||||
|]
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-form
|
||||
version: 0.4.2.1
|
||||
version: 1.0.0
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
@ -14,13 +14,13 @@ description: Form handling support for Yesod Web Framework
|
||||
|
||||
library
|
||||
build-depends: base >= 4 && < 5
|
||||
, yesod-core >= 0.10.2 && < 0.11
|
||||
, yesod-persistent >= 0.3.1 && < 0.4
|
||||
, yesod-core >= 1.0 && < 1.1
|
||||
, yesod-persistent >= 1.0 && < 1.1
|
||||
, time >= 1.1.4
|
||||
, hamlet >= 0.10 && < 0.11
|
||||
, shakespeare-css >= 0.10 && < 0.11
|
||||
, shakespeare-js >= 0.11 && < 0.12
|
||||
, persistent >= 0.8 && < 0.9
|
||||
, persistent >= 0.9 && < 0.10
|
||||
, template-haskell
|
||||
, transformers >= 0.2.2 && < 0.3
|
||||
, data-default >= 0.3 && < 0.4
|
||||
@ -31,7 +31,7 @@ library
|
||||
, blaze-html >= 0.4.1.3 && < 0.5
|
||||
, bytestring >= 0.9.1.4 && < 0.10
|
||||
, text >= 0.9 && < 1.0
|
||||
, wai >= 1.1 && < 1.2
|
||||
, wai >= 1.2 && < 1.3
|
||||
, containers >= 0.2 && < 0.5
|
||||
exposed-modules: Yesod.Form
|
||||
Yesod.Form.Class
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-json
|
||||
version: 0.3.1
|
||||
version: 1.0.0
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
@ -14,19 +14,19 @@ description: Generate content for Yesod using the aeson package.
|
||||
|
||||
library
|
||||
build-depends: base >= 4 && < 5
|
||||
, yesod-core >= 0.10.1 && < 0.11
|
||||
, yesod-routes < 0.1
|
||||
, yesod-core >= 1.0 && < 1.1
|
||||
, yesod-routes >= 1.0 && < 1.1
|
||||
, aeson >= 0.5
|
||||
, text >= 0.8 && < 1.0
|
||||
, shakespeare-js >= 0.11 && < 0.12
|
||||
, vector >= 0.9
|
||||
, containers >= 0.2
|
||||
, blaze-builder
|
||||
, attoparsec-conduit >= 0.2 && < 0.3
|
||||
, conduit >= 0.2 && < 0.3
|
||||
, attoparsec-conduit >= 0.3 && < 0.4
|
||||
, conduit >= 0.3 && < 0.4
|
||||
, transformers >= 0.2.2 && < 0.3
|
||||
, wai >= 1.1 && < 1.2
|
||||
, wai-extra >= 1.1 && < 1.3
|
||||
, wai >= 1.2 && < 1.3
|
||||
, wai-extra >= 1.2 && < 1.3
|
||||
, bytestring >= 0.9 && < 0.10
|
||||
, safe >= 0.2 && < 0.4
|
||||
exposed-modules: Yesod.Json
|
||||
|
||||
@ -14,7 +14,7 @@ description: Helper functions and data types for producing News feeds.
|
||||
|
||||
library
|
||||
build-depends: base >= 4 && < 5
|
||||
, yesod-core >= 0.10.1 && < 0.11
|
||||
, yesod-core >= 1.0 && < 1.1
|
||||
, time >= 1.1.4
|
||||
, hamlet >= 0.10 && < 0.11
|
||||
, bytestring >= 0.9.1.4 && < 0.10
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-persistent
|
||||
version: 0.3.1
|
||||
version: 1.0.0
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
@ -14,9 +14,9 @@ description: Some helpers for using Persistent from Yesod.
|
||||
|
||||
library
|
||||
build-depends: base >= 4 && < 5
|
||||
, yesod-core >= 0.10.1 && < 0.11
|
||||
, persistent >= 0.8 && < 0.9
|
||||
, persistent-template >= 0.8 && < 0.9
|
||||
, yesod-core >= 1.0 && < 1.1
|
||||
, persistent >= 0.9 && < 0.10
|
||||
, persistent-template >= 0.9 && < 0.10
|
||||
, transformers >= 0.2.2 && < 0.3
|
||||
exposed-modules: Yesod.Persist
|
||||
ghc-options: -Wall
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-routes
|
||||
version: 0.0.1
|
||||
version: 1.0.0
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-sitemap
|
||||
version: 0.3.0
|
||||
version: 1.0.0
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
@ -14,7 +14,7 @@ description: Generate XML sitemaps.
|
||||
|
||||
library
|
||||
build-depends: base >= 4 && < 5
|
||||
, yesod-core >= 0.10 && < 0.11
|
||||
, yesod-core >= 1.0 && < 1.1
|
||||
, time >= 1.1.4
|
||||
, hamlet >= 0.10 && < 0.11
|
||||
exposed-modules: Yesod.Sitemap
|
||||
|
||||
@ -76,9 +76,9 @@ import qualified Data.ByteString as S
|
||||
import Network.HTTP.Types (status301)
|
||||
import System.PosixCompat.Files (getFileStatus, modificationTime)
|
||||
import System.Posix.Types (EpochTime)
|
||||
import Data.Conduit (($$), runResourceT)
|
||||
import Data.Conduit (($$))
|
||||
import Data.Conduit.List (sourceList)
|
||||
import Control.Monad.ST (runST)
|
||||
import Data.Functor.Identity (runIdentity)
|
||||
|
||||
import Network.Wai.Application.Static
|
||||
( StaticSettings (..)
|
||||
@ -323,7 +323,7 @@ base64md5File = fmap (base64 . encode) . hashFile
|
||||
base64md5 :: L.ByteString -> String
|
||||
base64md5 lbs =
|
||||
base64 $ encode
|
||||
$ runST $ runResourceT
|
||||
$ runIdentity
|
||||
$ sourceList (L.toChunks lbs) $$ sinkHash
|
||||
where
|
||||
encode d = Data.Serialize.encode (d :: MD5)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-static
|
||||
version: 0.10.1
|
||||
version: 1.0.0
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
@ -19,21 +19,21 @@ library
|
||||
build-depends: base >= 4 && < 5
|
||||
, containers >= 0.2 && < 0.5
|
||||
, old-time >= 1.0
|
||||
, yesod-core >= 0.10.1 && < 0.11
|
||||
, yesod-core >= 1.0 && < 1.1
|
||||
, base64-bytestring >= 0.1.0.1 && < 0.2
|
||||
, cereal >= 0.3 && < 0.4
|
||||
, bytestring >= 0.9.1.4 && < 0.10
|
||||
, template-haskell
|
||||
, directory >= 1.0 && < 1.2
|
||||
, transformers >= 0.2.2 && < 0.3
|
||||
, wai-app-static >= 1.1 && < 1.2
|
||||
, wai >= 1.1 && < 1.2
|
||||
, wai-app-static >= 1.2 && < 1.3
|
||||
, wai >= 1.2 && < 1.3
|
||||
, text >= 0.9 && < 1.0
|
||||
, file-embed >= 0.0.4.1 && < 0.5
|
||||
, http-types >= 0.6.5 && < 0.7
|
||||
, unix-compat >= 0.2
|
||||
, conduit >= 0.2
|
||||
, crypto-conduit >= 0.1.1.2 && < 0.2
|
||||
, crypto-conduit >= 0.2 && < 0.3
|
||||
, cryptohash >= 0.6.1
|
||||
exposed-modules: Yesod.Static
|
||||
ghc-options: -Wall
|
||||
@ -49,21 +49,21 @@ test-suite tests
|
||||
-- copy from above
|
||||
, containers >= 0.2 && < 0.5
|
||||
, old-time >= 1.0
|
||||
, yesod-core >= 0.10 && < 0.11
|
||||
, yesod-core
|
||||
, base64-bytestring >= 0.1.0.1 && < 0.2
|
||||
, cereal >= 0.3 && < 0.4
|
||||
, bytestring >= 0.9.1.4 && < 0.10
|
||||
, template-haskell
|
||||
, directory >= 1.0 && < 1.2
|
||||
, transformers >= 0.2.2 && < 0.3
|
||||
, wai-app-static >= 1.1 && < 1.2
|
||||
, wai >= 1.1 && < 1.2
|
||||
, wai-app-static
|
||||
, wai
|
||||
, text >= 0.9 && < 1.0
|
||||
, file-embed >= 0.0.4.1 && < 0.5
|
||||
, http-types >= 0.6.5 && < 0.7
|
||||
, unix-compat >= 0.2
|
||||
, conduit >= 0.2
|
||||
, crypto-conduit >= 0.1.1.2 && < 0.2
|
||||
, crypto-conduit >= 0.2 && < 0.3
|
||||
, cryptohash >= 0.6.1
|
||||
|
||||
ghc-options: -Wall
|
||||
|
||||
@ -46,7 +46,7 @@ staticDir = "static"
|
||||
--
|
||||
-- To see how this value is used, see urlRenderOverride in Foundation.hs
|
||||
staticRoot :: AppConfig DefaultEnv x -> Text
|
||||
staticRoot conf = [~qq~st|#{appRoot conf}/static|]
|
||||
staticRoot conf = [st|#{appRoot conf}/static|]
|
||||
|
||||
|
||||
-- The rest of this file contains settings which rarely need changing by a
|
||||
|
||||
@ -39,7 +39,7 @@ staticDir = "static"
|
||||
--
|
||||
-- To see how this value is used, see urlRenderOverride in ~project~.hs
|
||||
staticRoot :: AppConfig DefaultEnv a -> Text
|
||||
staticRoot conf = [~qq~st|#{appRoot conf}/static|]
|
||||
staticRoot conf = [st|#{appRoot conf}/static|]
|
||||
|
||||
widgetFile :: String -> Q Exp
|
||||
#if DEVELOPMENT
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod
|
||||
version: 0.10.1.4
|
||||
version: 1.0.0
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
@ -73,20 +73,20 @@ library
|
||||
cpp-options: -DGHC7
|
||||
else
|
||||
build-depends: base >= 4 && < 4.3
|
||||
build-depends: yesod-core >= 0.10.1 && < 0.11
|
||||
, yesod-auth >= 0.8.1 && < 0.9
|
||||
, yesod-json >= 0.3.1 && < 0.4
|
||||
, yesod-persistent >= 0.3.1 && < 0.4
|
||||
, yesod-form >= 0.4.1 && < 0.5
|
||||
build-depends: yesod-core >= 1.0 && < 1.1
|
||||
, yesod-auth >= 1.0 && < 1.1
|
||||
, yesod-json >= 1.0 && < 1.1
|
||||
, yesod-persistent >= 1.0 && < 1.1
|
||||
, yesod-form >= 1.0 && < 1.1
|
||||
, monad-control >= 0.3 && < 0.4
|
||||
, transformers >= 0.2.2 && < 0.3
|
||||
, wai >= 1.1 && < 1.2
|
||||
, wai-extra >= 1.1 && < 1.3
|
||||
, wai >= 1.2 && < 1.3
|
||||
, wai-extra >= 1.2 && < 1.3
|
||||
, wai-logger >= 0.1.2
|
||||
, hamlet >= 0.10 && < 0.11
|
||||
, shakespeare-js >= 0.11 && < 0.12
|
||||
, shakespeare-css >= 0.10 && < 0.11
|
||||
, warp >= 1.1 && < 1.2
|
||||
, warp >= 1.2 && < 1.3
|
||||
, blaze-html >= 0.4.1.3 && < 0.5
|
||||
exposed-modules: Yesod
|
||||
ghc-options: -Wall
|
||||
|
||||
Loading…
Reference in New Issue
Block a user