Make generated CSS files group-readable so that nginx can actually serve them without me manually chmodding
This commit is contained in:
parent
c517baac1c
commit
035cc1de3b
2 changed files with 11 additions and 1 deletions
|
@ -53,6 +53,7 @@ dependencies:
|
||||||
- foreign-store >=0.2 && <0.3
|
- foreign-store >=0.2 && <0.3
|
||||||
- slug >=0.1 && <0.2
|
- slug >=0.1 && <0.2
|
||||||
- split >=0.2 && <0.3
|
- split >=0.2 && <0.3
|
||||||
|
- unix >=2.7 && <2.8
|
||||||
- yesod-auth-hashdb >=1.6.2 && <1.7
|
- yesod-auth-hashdb >=1.6.2 && <1.7
|
||||||
- yesod-newsfeed >=1.6 && <1.7
|
- yesod-newsfeed >=1.6 && <1.7
|
||||||
- yesod-sitemap >=1.4 && <1.5
|
- yesod-sitemap >=1.4 && <1.5
|
||||||
|
|
|
@ -25,7 +25,9 @@ import Entry.Kind ( EntryKind, allEntryKinds, pluralise )
|
||||||
|
|
||||||
import Data.Aeson ( encode, object )
|
import Data.Aeson ( encode, object )
|
||||||
import qualified Text.Blaze.Internal as B
|
import qualified Text.Blaze.Internal as B
|
||||||
|
import qualified Data.Text as T
|
||||||
import qualified Data.Text.Lazy.Encoding as E
|
import qualified Data.Text.Lazy.Encoding as E
|
||||||
|
import qualified System.Posix.Files as F
|
||||||
|
|
||||||
-- | The foundation datatype for your application. This can be a good place to
|
-- | The foundation datatype for your application. This can be a good place to
|
||||||
-- keep settings and values requiring initialization before your application
|
-- keep settings and values requiring initialization before your application
|
||||||
|
@ -130,7 +132,7 @@ instance Yesod App where
|
||||||
addStaticContent ext mime content = do
|
addStaticContent ext mime content = do
|
||||||
master <- getYesod
|
master <- getYesod
|
||||||
let staticDir = appStaticDir $ appSettings master
|
let staticDir = appStaticDir $ appSettings master
|
||||||
addStaticContentExternal
|
external <- addStaticContentExternal
|
||||||
minifym
|
minifym
|
||||||
genFileName
|
genFileName
|
||||||
staticDir
|
staticDir
|
||||||
|
@ -138,6 +140,13 @@ instance Yesod App where
|
||||||
ext
|
ext
|
||||||
mime
|
mime
|
||||||
content
|
content
|
||||||
|
case external of
|
||||||
|
(Just (Right (StaticR (StaticRoute filePath _), _))) -> liftIO $ do
|
||||||
|
let staticPath = ((staticDir ++ "/") ++) . T.unpack . T.intercalate "/" $ filePath
|
||||||
|
mode <- F.fileMode <$> F.getFileStatus staticPath
|
||||||
|
F.setFileMode staticPath $ mode `F.unionFileModes` F.groupReadMode
|
||||||
|
_ -> return ()
|
||||||
|
return external
|
||||||
where
|
where
|
||||||
-- Generate a unique filename based on the content itself
|
-- Generate a unique filename based on the content itself
|
||||||
genFileName lbs = "autogen-" ++ base64md5 lbs
|
genFileName lbs = "autogen-" ++ base64md5 lbs
|
||||||
|
|
Loading…
Reference in a new issue