mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-18 17:57:11 +03:00
web: Put session file in $XDG_DATA_DIR. (#1344)
* web: Put session file in $XDG_DATA_DIR. * web: Use $XDG_CACHE_HOME instead of $XDG_DATA_HOME. * web: Force minimum version of directory (needed for xdg utilities). * web: Cancel changes to hledger-web.cabal Co-authored-by: Félix Sipma <felix.sipma@no-log.org>
This commit is contained in:
parent
8e1b5e784b
commit
1dfc7e1116
@ -31,7 +31,9 @@ import Data.Time.Calendar (Day)
|
||||
import Network.HTTP.Conduit (Manager)
|
||||
import Network.HTTP.Types (status403)
|
||||
import Network.Wai (requestHeaders)
|
||||
import System.FilePath (takeFileName)
|
||||
import System.Directory (XdgDirectory (..), createDirectoryIfMissing,
|
||||
getXdgDirectory)
|
||||
import System.FilePath (takeFileName, (</>))
|
||||
import Text.Blaze (Markup)
|
||||
import Text.Hamlet (hamletFile)
|
||||
import Yesod
|
||||
@ -100,9 +102,11 @@ type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget)
|
||||
instance Yesod App where
|
||||
approot = ApprootMaster $ appRoot . settings
|
||||
|
||||
makeSessionBackend _ =
|
||||
makeSessionBackend _ = do
|
||||
hledgerdata <- getXdgDirectory XdgCache "hledger"
|
||||
createDirectoryIfMissing True hledgerdata
|
||||
let sessionexpirysecs = 120
|
||||
in Just <$> defaultClientSessionBackend sessionexpirysecs ".hledger-web_client_session_key.aes"
|
||||
Just <$> defaultClientSessionBackend sessionexpirysecs (hledgerdata </> "hledger-web_client_session_key.aes")
|
||||
|
||||
-- defaultLayout :: WidgetFor site () -> HandlerFor site Html
|
||||
defaultLayout widget = do
|
||||
|
@ -115,7 +115,7 @@ library:
|
||||
- containers
|
||||
- data-default
|
||||
- Decimal >=0.5.1
|
||||
- directory
|
||||
- directory >=1.2.3.0
|
||||
- extra >=1.6.3
|
||||
- filepath
|
||||
- hjsmin
|
||||
|
Loading…
Reference in New Issue
Block a user