aboutsummaryrefslogtreecommitdiff
path: root/src/ImageHoster
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2022-04-08 14:16:26 +0200
committerDaniel Schadt <kingdread@gmx.de>2022-04-08 14:16:26 +0200
commit196bbc9cb713cefc77e97dcbad028967fa68ddee (patch)
treea6d50b3206c97997ec84475d893adfc5d85ad8cf /src/ImageHoster
parenta440dcbb89f74b607720bb5805390749861f9fe5 (diff)
downloadsimghost-196bbc9cb713cefc77e97dcbad028967fa68ddee.tar.gz
simghost-196bbc9cb713cefc77e97dcbad028967fa68ddee.tar.bz2
simghost-196bbc9cb713cefc77e97dcbad028967fa68ddee.zip
update stack snapshotHEADmaster
This gives us the fixes versions of cgi and multipart, as well as aeson 2 (which required some code adjustments).
Diffstat (limited to 'src/ImageHoster')
-rw-r--r--src/ImageHoster/Data.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ImageHoster/Data.hs b/src/ImageHoster/Data.hs
index 39f14e0..1d67c35 100644
--- a/src/ImageHoster/Data.hs
+++ b/src/ImageHoster/Data.hs
@@ -11,15 +11,14 @@ module ImageHoster.Data
, defaultSettings
) where
+import Control.Arrow ((***))
import Data.Aeson
import Data.Aeson.Types
+import Data.Aeson.KeyMap (toList, fromList)
+import Data.Aeson.Key (toString, fromString)
import Data.Traversable
import GHC.Generics
-import qualified Data.HashMap.Strict as HM
-import qualified Data.Text as T
-
-
-- | We are dealing with seconds when talking about durations, hence the type
-- alias.
type Seconds = Integer
@@ -65,9 +64,9 @@ instance FromJSON Settings where
parseUserDict :: Value -> Parser [(String, String)]
parseUserDict =
withObject "users" $ \o ->
- for (HM.toList o) $ \(user, pw) -> do
+ for (toList $ o) $ \(user, pw) -> do
password <- parseJSON pw
- return (T.unpack user, password)
+ return (toString user, password)
instance ToJSON Settings where
@@ -78,7 +77,7 @@ instance ToJSON Settings where
]
where
formatUsers :: [(String, String)] -> Object
- formatUsers = HM.fromList . map (\(user, pw) -> (T.pack user, toJSON pw))
+ formatUsers = fromList . map (fromString *** toJSON)
-- | Return the default settings.