Avoid tmp file creation for static resources Fixes #45

This commit is contained in:
Jon Schoning 2022-09-11 14:44:40 -05:00 committed by Yann Esposito (Yogsototh)
parent 84e0260396
commit f27d4af0d4
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
5 changed files with 5 additions and 21 deletions

View file

@ -31,7 +31,6 @@ serve:
_ESPIAL_PS_ID = $$($(_DOCKER_COMPOSE) ps -q espial) _ESPIAL_PS_ID = $$($(_DOCKER_COMPOSE) ps -q espial)
_LOCAL_INSTALL_PATH = $$(stack path | grep local-install-root | awk -e '{print $$2}') _LOCAL_INSTALL_PATH = $$(stack path | grep local-install-root | awk -e '{print $$2}')
_EKG_ASSETS_PATH = $$(find ~/.stack -type d | grep ekg.*assets)
docker-compose-build: build docker-compose-build: build
@rm -Rf dist && mkdir -p dist @rm -Rf dist && mkdir -p dist
@ -39,8 +38,6 @@ docker-compose-build: build
@cp -R static dist @cp -R static dist
@rm -Rf dist/static/tmp @rm -Rf dist/static/tmp
@cp -R config dist @cp -R config dist
@mkdir -p dist/ekg/assets
@cp -R $(_EKG_ASSETS_PATH) dist/ekg
@$(_DOCKER_COMPOSE) build espial @$(_DOCKER_COMPOSE) build espial
docker-compose-up: docker-compose-up:
@$(_DOCKER_COMPOSE) up --no-deps --no-build espial @$(_DOCKER_COMPOSE) up --no-deps --no-build espial

View file

@ -1,3 +1,6 @@
__v0.0.15__
Avoid using external static/tmp folder for generated static files
__v0.0.14__ __v0.0.14__
upgrade to purescript v0.15 upgrade to purescript v0.15
increase bookmarklet window height increase bookmarklet window height

View file

@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
name: espial name: espial
version: 0.0.14 version: 0.0.15
synopsis: Espial is an open-source, web-based bookmarking server. synopsis: Espial is an open-source, web-based bookmarking server.
description: . description: .
Espial is an open-source, web-based bookmarking server. Espial is an open-source, web-based bookmarking server.

View file

@ -1,6 +1,6 @@
name: espial name: espial
synopsis: Espial is an open-source, web-based bookmarking server. synopsis: Espial is an open-source, web-based bookmarking server.
version: "0.0.14" version: "0.0.15"
description: ! ' description: ! '
Espial is an open-source, web-based bookmarking server. Espial is an open-source, web-based bookmarking server.

View file

@ -8,10 +8,8 @@ module Foundation where
import Import.NoFoundation import Import.NoFoundation
import Database.Persist.Sql (ConnectionPool, runSqlPool) import Database.Persist.Sql (ConnectionPool, runSqlPool)
import Text.Hamlet (hamletFile) import Text.Hamlet (hamletFile)
import Text.Jasmine (minifym)
import PathPiece() import PathPiece()
import Yesod.Default.Util (addStaticContentExternal)
import Yesod.Core.Types import Yesod.Core.Types
import Yesod.Auth.Message import Yesod.Auth.Message
import qualified Data.CaseInsensitive as CI import qualified Data.CaseInsensitive as CI
@ -105,20 +103,6 @@ instance Yesod App where
$(widgetFile "default-layout") $(widgetFile "default-layout")
withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet") withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")
addStaticContent ext mime content = do
master <- getYesod
let staticDir = appStaticDir (appSettings master)
addStaticContentExternal
minifym
genFileName
staticDir
(StaticR . flip StaticRoute [])
ext
mime
content
where
genFileName lbs = "autogen-" ++ base64md5 lbs
shouldLogIO app _source level = shouldLogIO app _source level =
pure $ appShouldLogAll (appSettings app) || level == LevelWarn || level == LevelError pure $ appShouldLogAll (appSettings app) || level == LevelWarn || level == LevelError
makeLogger = return . appLogger makeLogger = return . appLogger