gzip changes
This commit is contained in:
parent
0e1feefa09
commit
858b4cc4c2
@ -149,7 +149,7 @@ mkYesodGeneral name args clazzes isSub resS = do
|
||||
toWaiApp :: ( Yesod master
|
||||
, YesodDispatch master master
|
||||
) => master -> IO W.Application
|
||||
toWaiApp y = gzip (gzipCompressFiles y) . autohead <$> toWaiAppPlain y
|
||||
toWaiApp y = gzip (gzipSettings y) . autohead <$> toWaiAppPlain y
|
||||
|
||||
-- | Convert the given argument into a WAI application, executable with any WAI
|
||||
-- handler. This differs from 'toWaiApp' in that it uses no middlewares.
|
||||
|
||||
@ -76,6 +76,7 @@ import Text.Blaze (preEscapedLazyText)
|
||||
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
|
||||
@ -275,9 +276,9 @@ class RenderRoute a => Yesod a where
|
||||
formatLogMessage loc level msg >>=
|
||||
Data.Text.Lazy.IO.putStrLn
|
||||
|
||||
-- | Apply gzip compression to files. Default is false.
|
||||
gzipCompressFiles :: a -> Bool
|
||||
gzipCompressFiles _ = False
|
||||
-- | GZIP settings.
|
||||
gzipSettings :: a -> GzipSettings
|
||||
gzipSettings _ = def
|
||||
|
||||
-- | Location of yepnope.js, if any. If one is provided, then all
|
||||
-- Javascript files will be loaded asynchronously.
|
||||
|
||||
@ -14,7 +14,7 @@ import Network.Wai (Application)
|
||||
import Network.Wai.Handler.Warp
|
||||
(runSettings, defaultSettings, settingsPort, settingsHost)
|
||||
import System.Directory (doesDirectoryExist, removeDirectoryRecursive)
|
||||
import Network.Wai.Middleware.Gzip (gzip', GzipFiles (GzipCacheFolder), gzipFiles, def)
|
||||
import Network.Wai.Middleware.Gzip (gzip, GzipFiles (GzipCacheFolder), gzipFiles, def)
|
||||
import Network.Wai.Middleware.Autohead (autohead)
|
||||
import Network.Wai.Middleware.Jsonp (jsonp)
|
||||
import Control.Monad (when)
|
||||
@ -79,7 +79,7 @@ defaultRunner f h = do
|
||||
takeMVar flag
|
||||
#endif
|
||||
where
|
||||
middlewares = gzip' gset . jsonp . autohead
|
||||
middlewares = gzip gset . jsonp . autohead
|
||||
|
||||
gset = def { gzipFiles = GzipCacheFolder staticCache }
|
||||
staticCache = ".static-cache"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user