version bump

This commit is contained in:
nek0 2016-07-12 18:48:31 +02:00
parent 9dd33e88ff
commit 456f774470
5 changed files with 72 additions and 88 deletions

View file

@ -101,8 +101,9 @@ putIndexES input = do
return () return ()
) ex) ) ex)
_ <- runBH' $ openIndex (IndexName "user") _ <- runBH' $ openIndex (IndexName "user")
runBH' $ indexDocument (IndexName "user") (MappingName "user") defaultIndexDocumentSettings user (DocId $ extractKey uId) _ <- runBH' $ indexDocument (IndexName "user") (MappingName "user")
_ <- runBH' $ refreshIndex $ IndexName "user" defaultIndexDocumentSettings user (DocId $ extractKey uId)
runBH' $ refreshIndex $ IndexName "user"
ESAlbum aId album -> do ESAlbum aId album -> do
ex <- runBH' $ indexExists (IndexName "album") ex <- runBH' $ indexExists (IndexName "album")
unless ex ((\ _ -> do unless ex ((\ _ -> do
@ -110,8 +111,9 @@ putIndexES input = do
return () return ()
) ex) ) ex)
_ <- runBH' $ openIndex (IndexName "album") _ <- runBH' $ openIndex (IndexName "album")
runBH' $ indexDocument (IndexName "album") (MappingName "album") defaultIndexDocumentSettings album (DocId $ extractKey aId) _ <- runBH' $ indexDocument (IndexName "album") (MappingName "album")
_ <- runBH' $ refreshIndex $ IndexName "album" defaultIndexDocumentSettings album (DocId $ extractKey aId)
runBH' $ refreshIndex $ IndexName "album"
ESMedium mId medium -> do ESMedium mId medium -> do
ex <- runBH' $ indexExists (IndexName "medium") ex <- runBH' $ indexExists (IndexName "medium")
unless ex ((\ _ -> do unless ex ((\ _ -> do
@ -119,8 +121,9 @@ putIndexES input = do
return () return ()
) ex) ) ex)
_ <- runBH' $ openIndex (IndexName "medium") _ <- runBH' $ openIndex (IndexName "medium")
runBH' $ indexDocument (IndexName "medium") (MappingName "medium") defaultIndexDocumentSettings medium (DocId $ extractKey mId) _ <- runBH' $ indexDocument (IndexName "medium") (MappingName "medium")
_ <- runBH' $ refreshIndex $ IndexName "medium" defaultIndexDocumentSettings medium (DocId $ extractKey mId)
runBH' $ refreshIndex $ IndexName "medium"
ESComment cId comment -> do ESComment cId comment -> do
ex <- runBH' $ indexExists (IndexName "comment") ex <- runBH' $ indexExists (IndexName "comment")
unless ex ((\ _ -> do unless ex ((\ _ -> do
@ -128,23 +131,21 @@ putIndexES input = do
return () return ()
) ex) ) ex)
_ <- runBH' $ openIndex (IndexName "comment") _ <- runBH' $ openIndex (IndexName "comment")
runBH' $ indexDocument (IndexName "comment") (MappingName "comment") defaultIndexDocumentSettings comment (DocId $ extractKey cId) _ <- runBH' $ indexDocument (IndexName "comment") (MappingName "comment")
_ <- runBH' $ refreshIndex $ IndexName "comment" defaultIndexDocumentSettings comment (DocId $ extractKey cId)
case statusCode (responseStatus resp) of runBH' $ refreshIndex $ IndexName "comment"
201 -> return () checkResponseES resp
200 -> return ()
code -> error $ (show code) ++ ": " ++ (C.unpack $ BL.toStrict $ responseBody resp)
deleteIndexES :: ESInput -> Handler () deleteIndexES :: ESInput -> Handler ()
deleteIndexES input = do deleteIndexES input = do
resp <- case input of resp <- case input of
ESUser uId user -> ESUser uId _ ->
runBH' $ deleteDocument (IndexName "user") (MappingName "user") (DocId $ extractKey uId) runBH' $ deleteDocument (IndexName "user") (MappingName "user") (DocId $ extractKey uId)
ESAlbum aId album -> ESAlbum aId _ ->
runBH' $ deleteDocument (IndexName "album") (MappingName "album") (DocId $ extractKey aId) runBH' $ deleteDocument (IndexName "album") (MappingName "album") (DocId $ extractKey aId)
ESMedium mId medium -> ESMedium mId _ ->
runBH' $ deleteDocument (IndexName "medium") (MappingName "medium") (DocId $ extractKey mId) runBH' $ deleteDocument (IndexName "medium") (MappingName "medium") (DocId $ extractKey mId)
ESComment cId comment -> ESComment cId _ ->
runBH' $ deleteDocument (IndexName "comment") (MappingName "comment") (DocId $ extractKey cId) runBH' $ deleteDocument (IndexName "comment") (MappingName "comment") (DocId $ extractKey cId)
checkResponseES resp checkResponseES resp
@ -170,7 +171,7 @@ checkResponseES resp =
case statusCode (responseStatus resp) of case statusCode (responseStatus resp) of
201 -> return () 201 -> return ()
200 -> 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' :: BH m a -> Handler resp
runBH' action = do runBH' action = do
@ -178,4 +179,4 @@ runBH' action = do
let s = appSearchHost $ appSettings master let s = appSearchHost $ appSettings master
let server = Server s let server = Server s
manager <- liftIO $ newManager defaultManagerSettings manager <- liftIO $ newManager defaultManagerSettings
runBH (BHEnv server manager) action runBH (mkBHEnv server manager) action

View file

@ -53,7 +53,7 @@ postMediumSettingsR mediumId = do
, MediumDescription =. mediumDescription temp , MediumDescription =. mediumDescription temp
, MediumTags =. mediumTags temp , MediumTags =. mediumTags temp
] ]
putIndexES (ESMedium mediumId temp) updateIndexES (ESMedium mediumId temp)
setMessage "Medium settings changed succesfully" setMessage "Medium settings changed succesfully"
redirect $ MediumR mediumId redirect $ MediumR mediumId
_ -> do _ -> do

View file

@ -21,7 +21,7 @@
-- declared in the Foundation.hs file. -- declared in the Foundation.hs file.
module Settings where module Settings where
import ClassyPrelude.Yesod import ClassyPrelude.Yesod hiding (throw)
import Control.Exception (throw) import Control.Exception (throw)
import Data.Aeson (Result (..), fromJSON, withObject, (.!=), import Data.Aeson (Result (..), fromJSON, withObject, (.!=),
(.:?)) (.:?))

View file

@ -1,5 +1,5 @@
name: eidolon name: eidolon
version: 0.0.6 version: 0.0.7
synopsis: Image gallery in Yesod synopsis: Image gallery in Yesod
homepage: https://eidolon.nek0.eu homepage: https://eidolon.nek0.eu
license: AGPL-3 license: AGPL-3
@ -115,11 +115,12 @@ library
, wai >= 3.0 , wai >= 3.0
, yesod-newsfeed >= 1.6 , yesod-newsfeed >= 1.6
, unix >= 2.7 , unix >= 2.7
, bloodhound >= 0.8 , bloodhound >= 0.11
, http-types , http-types
, image-type , image-type
, JuicyPixels >= 3.2.7 , JuicyPixels >= 3.2.7
, JuicyPixels-scale-dct , JuicyPixels-scale-dct
, classy-prelude-yesod >= 1.0
-- for Migrations -- for Migrations
, HDBC , HDBC
, HDBC-postgresql , HDBC-postgresql
@ -129,7 +130,7 @@ library
, system-filepath , system-filepath
, bytestring , bytestring
, http-client , http-client
, yesod-form , yesod-form >= 1.4.7
executable eidolon executable eidolon
if flag(library-only) if flag(library-only)

View file

@ -1,4 +1,6 @@
flags: flags:
pandoc:
https: false
time-locale-compat: time-locale-compat:
old-locale: false old-locale: false
packages: packages:
@ -6,18 +8,15 @@ packages:
extra-deps: extra-deps:
- HDBC-2.4.0.1 - HDBC-2.4.0.1
- HDBC-postgresql-2.3.2.3 - HDBC-postgresql-2.3.2.3
- HTTP-4000.2.23
- HUnit-1.3.1.1 - HUnit-1.3.1.1
- JuicyPixels-3.2.7 - JuicyPixels-3.2.7
- JuicyPixels-scale-dct-0.1.1.0 - JuicyPixels-scale-dct-0.1.1.0
- MonadCatchIO-transformers-0.3.1.3
- QuickCheck-2.8.2 - QuickCheck-2.8.2
- ReadArgs-1.2.2 - ReadArgs-1.2.2
- SHA-1.6.4.2 - SHA-1.6.4.2
- StateVar-1.1.0.2
- adjunctions-4.2.2 - adjunctions-4.2.2
- aeson-0.10.0.0 - aeson-0.11.2.0
- aeson-compat-0.3.0.0 - aeson-compat-0.3.4.0
- aeson-pretty-0.7.2 - aeson-pretty-0.7.2
- ansi-terminal-0.6.2.3 - ansi-terminal-0.6.2.3
- ansi-wl-pprint-0.6.7.3 - ansi-wl-pprint-0.6.7.3
@ -25,12 +24,10 @@ extra-deps:
- asn1-encoding-0.9.3 - asn1-encoding-0.9.3
- asn1-parse-0.9.4 - asn1-parse-0.9.4
- asn1-types-0.3.2 - asn1-types-0.3.2
- async-2.0.2 - authenticate-1.3.3.2
- attoparsec-0.13.0.1
- authenticate-1.3.2.11
- auto-update-0.1.3 - auto-update-0.1.3
- base-compat-0.9.0 - base-compat-0.9.1
- base-orphans-0.5.3 - base-orphans-0.5.4
- base16-bytestring-0.1.1.6 - base16-bytestring-0.1.1.6
- base64-bytestring-1.0.0.1 - base64-bytestring-1.0.0.1
- basic-prelude-0.5.0 - basic-prelude-0.5.0
@ -38,26 +35,26 @@ extra-deps:
- blaze-builder-0.4.0.1 - blaze-builder-0.4.0.1
- blaze-html-0.8.1.1 - blaze-html-0.8.1.1
- blaze-markup-0.7.0.3 - blaze-markup-0.7.0.3
- bloodhound-0.10.0.0 - bloodhound-0.11.1.0
- byteable-0.1.1 - byteable-0.1.1
- byteorder-1.0.4 - byteorder-1.0.4
- bytestring-builder-0.10.6.0.0 - bytestring-builder-0.10.6.0.0
- carray-0.1.6.3 - carray-0.1.6.3
- case-insensitive-1.2.0.5
- cereal-0.5.1.0 - cereal-0.5.1.0
- chunked-data-0.2.0 - chunked-data-0.3.0
- cipher-aes-0.2.11 - cipher-aes-0.2.11
- classy-prelude-0.12.5 - classy-prelude-1.0.0
- classy-prelude-conduit-0.12.5 - classy-prelude-conduit-1.0.0
- classy-prelude-yesod-0.12.5 - classy-prelude-yesod-1.0.0
- clientsession-0.9.1.1 - clientsession-0.9.1.1
- cmark-0.4.1 - cmark-0.5.2.1
- cmdargs-0.10.13 - cmdargs-0.10.13
- comonad-4.2.7.2 - comonad-4.2.7.2
- conduit-1.2.6.1 - conduit-1.2.6.1
- conduit-combinators-1.0.3 - conduit-combinators-1.0.4
- conduit-extra-1.1.13.1 - conduit-extra-1.1.13.2
- connection-0.2.5 - connection-0.2.5
- constraints-0.8
- contravariant-1.3.3 - contravariant-1.3.3
- convertible-1.1.1.0 - convertible-1.1.1.0
- cookie-0.4.1.6 - cookie-0.4.1.6
@ -76,7 +73,6 @@ extra-deps:
- data-default-instances-containers-0.0.1 - data-default-instances-containers-0.0.1
- data-default-instances-dlist-0.0.1 - data-default-instances-dlist-0.0.1
- data-default-instances-old-locale-0.0.1 - data-default-instances-old-locale-0.0.1
- deepseq-generics-0.1.1.2
- digest-0.0.1.2 - digest-0.0.1.2
- distributive-0.4.4 - distributive-0.4.4
- dlist-0.7.1.2 - dlist-0.7.1.2
@ -87,15 +83,15 @@ extra-deps:
- entropy-0.3.7 - entropy-0.3.7
- exceptions-0.8.0.2 - exceptions-0.8.0.2
- extensible-exceptions-0.1.1.4 - 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 - fft-0.1.8.3
- file-embed-0.0.9 - file-embed-0.0.9
- filemanip-0.3.6.3 - filemanip-0.3.6.3
- free-4.12.1 - free-4.12.1
- haddock-library-1.2.1 - haddock-library-1.2.1
- hashable-1.2.3.3
- hex-0.1.2 - hex-0.1.2
- highlighting-kate-0.6.1 - highlighting-kate-0.6.2
- hjsmin-0.1.5.1 - hjsmin-0.1.5.1
- hourglass-0.2.9 - hourglass-0.2.9
- hslua-0.4.1 - hslua-0.4.1
@ -105,19 +101,20 @@ extra-deps:
- hspec-expectations-0.7.2 - hspec-expectations-0.7.2
- html-conduit-1.2.1 - html-conduit-1.2.1
- http-api-data-0.2.2 - http-api-data-0.2.2
- http-client-0.4.26.2 - http-client-0.5.1
- http-client-tls-0.2.2 - http-client-tls-0.3.0
- http-conduit-2.1.8 - http-conduit-2.2.0
- http-date-0.0.6.1 - http-date-0.0.6.1
- http-types-0.9 - http-types-0.9
- http2-1.3.1 - http2-1.3.1
- image-type-0.1.0.0 - image-type-0.1.0.0
- imagemagick-0.0.4.1 - imagemagick-0.0.4.2
- iproute-1.7.0 - iproute-1.7.0
- ix-shapable-0.1.0 - ix-shapable-0.1.0
- kan-extensions-4.2.3 - kan-extensions-4.2.3
- keys-3.10.2 - keys-3.10.2
- language-javascript-0.5.14.2 - language-javascript-0.5.14.2
- lifted-async-0.9.0
- lifted-base-0.2.3.6 - lifted-base-0.2.3.6
- memory-0.10 - memory-0.10
- mime-mail-0.4.11 - mime-mail-0.4.11
@ -126,42 +123,35 @@ extra-deps:
- monad-control-1.0.0.4 - monad-control-1.0.0.4
- monad-logger-0.3.16 - monad-logger-0.3.16
- monad-loops-0.4.3 - monad-loops-0.4.3
- monads-tf-0.1.0.2 - monad-unlift-0.2.0
- mono-traversable-0.10.1.1 - mono-traversable-1.0.0.1
- mtl-2.2.1 - mono-traversable-instances-0.1.0.0
- mtl-compat-0.2.1.3 - mtl-compat-0.2.1.3
- mutable-containers-0.3.2 - mutable-containers-0.3.2
- mwc-random-0.13.3.2 - mwc-random-0.13.3.2
- network-2.6.2.1 - nats-1.1.1
- network-uri-2.6.0.3
- nonce-1.0.2 - nonce-1.0.2
- old-locale-1.0.0.7
- old-time-1.1.0.3
- optparse-applicative-0.12.0.0 - optparse-applicative-0.12.0.0
- pandoc-1.15.2.1 - pandoc-1.17.1
- pandoc-types-1.12.4.7 - pandoc-types-1.16.1
- parsec-3.1.9
- path-pieces-0.2.1 - path-pieces-0.2.1
- pem-0.2.2 - pem-0.2.2
- persistent-2.2.4.1 - persistent-2.5
- persistent-postgresql-2.2.2 - persistent-postgresql-2.5
- persistent-sqlite-2.2.1 - persistent-sqlite-2.5.0.2
- persistent-template-2.1.6 - persistent-template-2.5.1.3
- pointed-4.2.0.2 - pointed-4.2.0.2
- postgresql-libpq-0.9.1.1 - postgresql-libpq-0.9.1.1
- postgresql-simple-0.5.1.2 - postgresql-simple-0.5.2.1
- prelude-extras-0.4.0.2 - prelude-extras-0.4.0.2
- primitive-0.6.1.0
- profunctors-5.1.2 - profunctors-5.1.2
- psqueues-0.2.0.3 - psqueues-0.2.0.3
- quickcheck-io-0.1.2 - quickcheck-io-0.1.2
- random-1.1
- regex-base-0.93.2
- regex-pcre-builtin-0.94.4.8.8.35 - regex-pcre-builtin-0.94.4.8.8.35
- resource-pool-0.2.3.2 - resource-pool-0.2.3.2
- resourcet-1.1.7 - resourcet-1.1.7
- safe-0.3.9 - safe-0.3.9
- scientific-0.3.4.4 - safe-exceptions-0.1.2.0
- securemem-0.1.9 - securemem-0.1.9
- semigroupoids-5.0.1 - semigroupoids-5.0.1
- semigroups-0.18.0.1 - semigroups-0.18.0.1
@ -171,39 +161,32 @@ extra-deps:
- simple-sendfile-0.2.21 - simple-sendfile-0.2.21
- skein-1.0.9.4 - skein-1.0.9.4
- socks-0.5.4 - socks-0.5.4
- split-0.2.2
- stm-2.4.4.1
- stm-chans-3.0.0.4 - stm-chans-3.0.0.4
- storable-complex-0.2.2 - storable-complex-0.2.2
- streaming-commons-0.1.15 - streaming-commons-0.1.15
- stringsearch-0.3.6.6 - stringsearch-0.3.6.6
- syb-0.6
- system-filepath-0.4.13.4 - system-filepath-0.4.13.4
- tagged-0.8.2 - tagged-0.8.4
- tagsoup-0.13.6 - tagsoup-0.14
- tagstream-conduit-0.5.5.3 - tagstream-conduit-0.5.5.3
- temporary-1.2.0.3 - temporary-1.2.0.3
- texmath-0.8.6.1 - texmath-0.8.6.4
- text-1.2.2.0
- tf-random-0.5
- time-locale-compat-0.1.1.1 - time-locale-compat-0.1.1.1
- tls-1.3.4 - tls-1.3.4
- transformers-base-0.4.4 - transformers-base-0.4.4
- transformers-compat-0.4.0.4 - transformers-compat-0.4.0.4
- unix-compat-0.4.1.4 - unix-compat-0.4.1.4
- unix-time-0.3.6 - unix-time-0.3.6
- unordered-containers-0.2.5.1
- utf8-string-1.0.1.1 - utf8-string-1.0.1.1
- uuid-types-1.0.2 - uuid-types-1.0.2
- vault-0.3.0.5 - vault-0.3.0.5
- vector-0.11.0.0
- vector-algorithms-0.7.0.1 - vector-algorithms-0.7.0.1
- vector-instances-3.3.1 - vector-instances-3.3.1
- void-0.7.1 - void-0.7.1
- wai-3.0.5.0 - wai-3.0.5.0
- wai-app-static-3.1.4.1 - wai-app-static-3.1.4.1
- wai-extra-3.0.15 - wai-extra-3.0.16.1
- wai-logger-2.2.4.1 - wai-logger-2.2.7
- warp-3.1.12 - warp-3.1.12
- word8-0.1.2 - word8-0.1.2
- x509-1.6.3 - x509-1.6.3
@ -216,14 +199,13 @@ extra-deps:
- xss-sanitize-0.3.5.6 - xss-sanitize-0.3.5.6
- yaml-0.8.15.2 - yaml-0.8.15.2
- yesod-1.4.2 - yesod-1.4.2
- yesod-auth-1.4.11 - yesod-auth-1.4.13.2
- yesod-core-1.4.18.1 - yesod-core-1.4.20.2
- yesod-form-1.4.6 - yesod-form-1.4.7.1
- yesod-markdown-0.10.0 - yesod-markdown-0.11.1
- yesod-newsfeed-1.6 - yesod-newsfeed-1.6
- yesod-persistent-1.4.0.3 - yesod-persistent-1.4.0.5
- yesod-static-1.5.0.3 - yesod-static-1.5.0.3
- yesod-test-1.5.0.1 - yesod-test-1.5.0.1
- zip-archive-0.2.3.7 - zip-archive-0.3.0.2
- zlib-0.6.1.1
resolver: ghc-7.10 resolver: ghc-7.10