diff --git a/Handler/Commons.hs b/Handler/Commons.hs index 013f840..a271079 100755 --- a/Handler/Commons.hs +++ b/Handler/Commons.hs @@ -101,8 +101,9 @@ putIndexES input = do return () ) ex) _ <- runBH' $ openIndex (IndexName "user") - runBH' $ indexDocument (IndexName "user") (MappingName "user") defaultIndexDocumentSettings user (DocId $ extractKey uId) - _ <- runBH' $ refreshIndex $ IndexName "user" + _ <- runBH' $ indexDocument (IndexName "user") (MappingName "user") + defaultIndexDocumentSettings user (DocId $ extractKey uId) + runBH' $ refreshIndex $ IndexName "user" ESAlbum aId album -> do ex <- runBH' $ indexExists (IndexName "album") unless ex ((\ _ -> do @@ -110,8 +111,9 @@ putIndexES input = do return () ) ex) _ <- runBH' $ openIndex (IndexName "album") - runBH' $ indexDocument (IndexName "album") (MappingName "album") defaultIndexDocumentSettings album (DocId $ extractKey aId) - _ <- runBH' $ refreshIndex $ IndexName "album" + _ <- runBH' $ indexDocument (IndexName "album") (MappingName "album") + defaultIndexDocumentSettings album (DocId $ extractKey aId) + runBH' $ refreshIndex $ IndexName "album" ESMedium mId medium -> do ex <- runBH' $ indexExists (IndexName "medium") unless ex ((\ _ -> do @@ -119,8 +121,9 @@ putIndexES input = do return () ) ex) _ <- runBH' $ openIndex (IndexName "medium") - runBH' $ indexDocument (IndexName "medium") (MappingName "medium") defaultIndexDocumentSettings medium (DocId $ extractKey mId) - _ <- runBH' $ refreshIndex $ IndexName "medium" + _ <- runBH' $ indexDocument (IndexName "medium") (MappingName "medium") + defaultIndexDocumentSettings medium (DocId $ extractKey mId) + runBH' $ refreshIndex $ IndexName "medium" ESComment cId comment -> do ex <- runBH' $ indexExists (IndexName "comment") unless ex ((\ _ -> do @@ -128,23 +131,21 @@ putIndexES input = do return () ) ex) _ <- runBH' $ openIndex (IndexName "comment") - runBH' $ indexDocument (IndexName "comment") (MappingName "comment") defaultIndexDocumentSettings comment (DocId $ extractKey cId) - _ <- runBH' $ refreshIndex $ IndexName "comment" - case statusCode (responseStatus resp) of - 201 -> return () - 200 -> return () - code -> error $ (show code) ++ ": " ++ (C.unpack $ BL.toStrict $ responseBody resp) + _ <- runBH' $ indexDocument (IndexName "comment") (MappingName "comment") + defaultIndexDocumentSettings comment (DocId $ extractKey cId) + runBH' $ refreshIndex $ IndexName "comment" + checkResponseES resp deleteIndexES :: ESInput -> Handler () deleteIndexES input = do resp <- case input of - ESUser uId user -> + ESUser uId _ -> runBH' $ deleteDocument (IndexName "user") (MappingName "user") (DocId $ extractKey uId) - ESAlbum aId album -> + ESAlbum aId _ -> runBH' $ deleteDocument (IndexName "album") (MappingName "album") (DocId $ extractKey aId) - ESMedium mId medium -> + ESMedium mId _ -> runBH' $ deleteDocument (IndexName "medium") (MappingName "medium") (DocId $ extractKey mId) - ESComment cId comment -> + ESComment cId _ -> runBH' $ deleteDocument (IndexName "comment") (MappingName "comment") (DocId $ extractKey cId) checkResponseES resp @@ -170,7 +171,7 @@ checkResponseES resp = case statusCode (responseStatus resp) of 201 -> return () 200 -> return () - _ -> error $ C.unpack $ BL.toStrict $ responseBody resp + code -> error $ (show code) ++ ": " ++ (C.unpack $ BL.toStrict $ responseBody resp) -- runBH' :: BH m a -> Handler resp runBH' action = do @@ -178,4 +179,4 @@ runBH' action = do let s = appSearchHost $ appSettings master let server = Server s manager <- liftIO $ newManager defaultManagerSettings - runBH (BHEnv server manager) action + runBH (mkBHEnv server manager) action diff --git a/Handler/MediumSettings.hs b/Handler/MediumSettings.hs index d398b8b..32f5f03 100755 --- a/Handler/MediumSettings.hs +++ b/Handler/MediumSettings.hs @@ -53,7 +53,7 @@ postMediumSettingsR mediumId = do , MediumDescription =. mediumDescription temp , MediumTags =. mediumTags temp ] - putIndexES (ESMedium mediumId temp) + updateIndexES (ESMedium mediumId temp) setMessage "Medium settings changed succesfully" redirect $ MediumR mediumId _ -> do diff --git a/Settings.hs b/Settings.hs index 03dcddd..60af5d8 100755 --- a/Settings.hs +++ b/Settings.hs @@ -21,7 +21,7 @@ -- declared in the Foundation.hs file. module Settings where -import ClassyPrelude.Yesod +import ClassyPrelude.Yesod hiding (throw) import Control.Exception (throw) import Data.Aeson (Result (..), fromJSON, withObject, (.!=), (.:?)) diff --git a/eidolon.cabal b/eidolon.cabal index 0650afc..d2137d6 100755 --- a/eidolon.cabal +++ b/eidolon.cabal @@ -1,5 +1,5 @@ name: eidolon -version: 0.0.6 +version: 0.0.7 synopsis: Image gallery in Yesod homepage: https://eidolon.nek0.eu license: AGPL-3 @@ -115,11 +115,12 @@ library , wai >= 3.0 , yesod-newsfeed >= 1.6 , unix >= 2.7 - , bloodhound >= 0.8 + , bloodhound >= 0.11 , http-types , image-type , JuicyPixels >= 3.2.7 , JuicyPixels-scale-dct + , classy-prelude-yesod >= 1.0 -- for Migrations , HDBC , HDBC-postgresql @@ -129,7 +130,7 @@ library , system-filepath , bytestring , http-client - , yesod-form + , yesod-form >= 1.4.7 executable eidolon if flag(library-only) diff --git a/stack.yaml b/stack.yaml index 97754a6..3f17d7a 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,6 @@ flags: + pandoc: + https: false time-locale-compat: old-locale: false packages: @@ -6,18 +8,15 @@ packages: extra-deps: - HDBC-2.4.0.1 - HDBC-postgresql-2.3.2.3 -- HTTP-4000.2.23 - HUnit-1.3.1.1 - JuicyPixels-3.2.7 - JuicyPixels-scale-dct-0.1.1.0 -- MonadCatchIO-transformers-0.3.1.3 - QuickCheck-2.8.2 - ReadArgs-1.2.2 - SHA-1.6.4.2 -- StateVar-1.1.0.2 - adjunctions-4.2.2 -- aeson-0.10.0.0 -- aeson-compat-0.3.0.0 +- aeson-0.11.2.0 +- aeson-compat-0.3.4.0 - aeson-pretty-0.7.2 - ansi-terminal-0.6.2.3 - ansi-wl-pprint-0.6.7.3 @@ -25,12 +24,10 @@ extra-deps: - asn1-encoding-0.9.3 - asn1-parse-0.9.4 - asn1-types-0.3.2 -- async-2.0.2 -- attoparsec-0.13.0.1 -- authenticate-1.3.2.11 +- authenticate-1.3.3.2 - auto-update-0.1.3 -- base-compat-0.9.0 -- base-orphans-0.5.3 +- base-compat-0.9.1 +- base-orphans-0.5.4 - base16-bytestring-0.1.1.6 - base64-bytestring-1.0.0.1 - basic-prelude-0.5.0 @@ -38,26 +35,26 @@ extra-deps: - blaze-builder-0.4.0.1 - blaze-html-0.8.1.1 - blaze-markup-0.7.0.3 -- bloodhound-0.10.0.0 +- bloodhound-0.11.1.0 - byteable-0.1.1 - byteorder-1.0.4 - bytestring-builder-0.10.6.0.0 - carray-0.1.6.3 -- case-insensitive-1.2.0.5 - cereal-0.5.1.0 -- chunked-data-0.2.0 +- chunked-data-0.3.0 - cipher-aes-0.2.11 -- classy-prelude-0.12.5 -- classy-prelude-conduit-0.12.5 -- classy-prelude-yesod-0.12.5 +- classy-prelude-1.0.0 +- classy-prelude-conduit-1.0.0 +- classy-prelude-yesod-1.0.0 - clientsession-0.9.1.1 -- cmark-0.4.1 +- cmark-0.5.2.1 - cmdargs-0.10.13 - comonad-4.2.7.2 - conduit-1.2.6.1 -- conduit-combinators-1.0.3 -- conduit-extra-1.1.13.1 +- conduit-combinators-1.0.4 +- conduit-extra-1.1.13.2 - connection-0.2.5 +- constraints-0.8 - contravariant-1.3.3 - convertible-1.1.1.0 - cookie-0.4.1.6 @@ -76,7 +73,6 @@ extra-deps: - data-default-instances-containers-0.0.1 - data-default-instances-dlist-0.0.1 - data-default-instances-old-locale-0.0.1 -- deepseq-generics-0.1.1.2 - digest-0.0.1.2 - distributive-0.4.4 - dlist-0.7.1.2 @@ -87,15 +83,15 @@ extra-deps: - entropy-0.3.7 - exceptions-0.8.0.2 - extensible-exceptions-0.1.1.4 -- fast-logger-2.4.1 +- fail-4.9.0.0 +- fast-logger-2.4.6 - fft-0.1.8.3 - file-embed-0.0.9 - filemanip-0.3.6.3 - free-4.12.1 - haddock-library-1.2.1 -- hashable-1.2.3.3 - hex-0.1.2 -- highlighting-kate-0.6.1 +- highlighting-kate-0.6.2 - hjsmin-0.1.5.1 - hourglass-0.2.9 - hslua-0.4.1 @@ -105,19 +101,20 @@ extra-deps: - hspec-expectations-0.7.2 - html-conduit-1.2.1 - http-api-data-0.2.2 -- http-client-0.4.26.2 -- http-client-tls-0.2.2 -- http-conduit-2.1.8 +- http-client-0.5.1 +- http-client-tls-0.3.0 +- http-conduit-2.2.0 - http-date-0.0.6.1 - http-types-0.9 - http2-1.3.1 - image-type-0.1.0.0 -- imagemagick-0.0.4.1 +- imagemagick-0.0.4.2 - iproute-1.7.0 - ix-shapable-0.1.0 - kan-extensions-4.2.3 - keys-3.10.2 - language-javascript-0.5.14.2 +- lifted-async-0.9.0 - lifted-base-0.2.3.6 - memory-0.10 - mime-mail-0.4.11 @@ -126,42 +123,35 @@ extra-deps: - monad-control-1.0.0.4 - monad-logger-0.3.16 - monad-loops-0.4.3 -- monads-tf-0.1.0.2 -- mono-traversable-0.10.1.1 -- mtl-2.2.1 +- monad-unlift-0.2.0 +- mono-traversable-1.0.0.1 +- mono-traversable-instances-0.1.0.0 - mtl-compat-0.2.1.3 - mutable-containers-0.3.2 - mwc-random-0.13.3.2 -- network-2.6.2.1 -- network-uri-2.6.0.3 +- nats-1.1.1 - nonce-1.0.2 -- old-locale-1.0.0.7 -- old-time-1.1.0.3 - optparse-applicative-0.12.0.0 -- pandoc-1.15.2.1 -- pandoc-types-1.12.4.7 -- parsec-3.1.9 +- pandoc-1.17.1 +- pandoc-types-1.16.1 - path-pieces-0.2.1 - pem-0.2.2 -- persistent-2.2.4.1 -- persistent-postgresql-2.2.2 -- persistent-sqlite-2.2.1 -- persistent-template-2.1.6 +- persistent-2.5 +- persistent-postgresql-2.5 +- persistent-sqlite-2.5.0.2 +- persistent-template-2.5.1.3 - pointed-4.2.0.2 - postgresql-libpq-0.9.1.1 -- postgresql-simple-0.5.1.2 +- postgresql-simple-0.5.2.1 - prelude-extras-0.4.0.2 -- primitive-0.6.1.0 - profunctors-5.1.2 - psqueues-0.2.0.3 - quickcheck-io-0.1.2 -- random-1.1 -- regex-base-0.93.2 - regex-pcre-builtin-0.94.4.8.8.35 - resource-pool-0.2.3.2 - resourcet-1.1.7 - safe-0.3.9 -- scientific-0.3.4.4 +- safe-exceptions-0.1.2.0 - securemem-0.1.9 - semigroupoids-5.0.1 - semigroups-0.18.0.1 @@ -171,39 +161,32 @@ extra-deps: - simple-sendfile-0.2.21 - skein-1.0.9.4 - socks-0.5.4 -- split-0.2.2 -- stm-2.4.4.1 - stm-chans-3.0.0.4 - storable-complex-0.2.2 - streaming-commons-0.1.15 - stringsearch-0.3.6.6 -- syb-0.6 - system-filepath-0.4.13.4 -- tagged-0.8.2 -- tagsoup-0.13.6 +- tagged-0.8.4 +- tagsoup-0.14 - tagstream-conduit-0.5.5.3 - temporary-1.2.0.3 -- texmath-0.8.6.1 -- text-1.2.2.0 -- tf-random-0.5 +- texmath-0.8.6.4 - time-locale-compat-0.1.1.1 - tls-1.3.4 - transformers-base-0.4.4 - transformers-compat-0.4.0.4 - unix-compat-0.4.1.4 - unix-time-0.3.6 -- unordered-containers-0.2.5.1 - utf8-string-1.0.1.1 - uuid-types-1.0.2 - vault-0.3.0.5 -- vector-0.11.0.0 - vector-algorithms-0.7.0.1 - vector-instances-3.3.1 - void-0.7.1 - wai-3.0.5.0 - wai-app-static-3.1.4.1 -- wai-extra-3.0.15 -- wai-logger-2.2.4.1 +- wai-extra-3.0.16.1 +- wai-logger-2.2.7 - warp-3.1.12 - word8-0.1.2 - x509-1.6.3 @@ -216,14 +199,13 @@ extra-deps: - xss-sanitize-0.3.5.6 - yaml-0.8.15.2 - yesod-1.4.2 -- yesod-auth-1.4.11 -- yesod-core-1.4.18.1 -- yesod-form-1.4.6 -- yesod-markdown-0.10.0 +- yesod-auth-1.4.13.2 +- yesod-core-1.4.20.2 +- yesod-form-1.4.7.1 +- yesod-markdown-0.11.1 - yesod-newsfeed-1.6 -- yesod-persistent-1.4.0.3 +- yesod-persistent-1.4.0.5 - yesod-static-1.5.0.3 - yesod-test-1.5.0.1 -- zip-archive-0.2.3.7 -- zlib-0.6.1.1 +- zip-archive-0.3.0.2 resolver: ghc-7.10