git.iko.soy/typeable/octopod
on master help sign in
fix config convesion
commit93f9eaac229ed2f05b46f3bfd03dc7f84b1b0a58 authorAnisimov Nikita <anisimoff.nikita@gmail.com> dateWed 8 Jul 2020, 12:20 (6 years ago) parente2af2c4
5 files changed+14−4
dm-backend/src/API.hs+3−1 dm-common/src/Common/API.hs+2 dm-frontend/dm-frontend.cabal+1 dm-frontend/src/Frontend/API.hs+6−2 dm-frontend/src/Main.hs+2−1
dm-backend/src/API.hs+3−1
@@ -4,4 +4,6 @@ import Data.Aeson (Value (..))
44import Servant.API
55import Servant.API.WebSocketConduit
66
7−type WebSocketAPI = "event" :> WebSocketSource Value
7+import Common.API (ApiWSPath)
8+
9+type WebSocketAPI = ApiWSPath :> WebSocketSource Value
dm-common/src/Common/API.hs+2
@@ -55,3 +55,5 @@ type DeploymentAPI' c =
5555 )
5656
5757type API = DeploymentAPI' CaptureName
58+
59+type ApiWSPath = "event"
dm-frontend/dm-frontend.cabal+1
@@ -71,6 +71,7 @@ executable frontend
7171 , ghcjs-dom
7272 , jsaddle
7373 , lens
74+ , network-uri
7475 , obelisk-route
7576 , reflex-dom
7677 , reflex-dom-helpers
dm-frontend/src/Frontend/API.hs+6−2
@@ -8,6 +8,7 @@ import Control.Lens
88import Data.Aeson
99import Data.Proxy
1010import Data.Text as T
11+import GHC.TypeLits
1112import Reflex.Dom as R
1213import Servant.API as S
1314import Servant.Reflex as SR
@@ -35,8 +36,8 @@ apiClients =
3536 & xhrRequest_config
3637 . xhrRequestConfig_headers
3738 . at "Authorization" ?~ auth
38− & xhrRequest_url %~ (T.replace "#PLACEHOLDER#" url)
39− host = SR.BaseFullUrl SR.Https "#PLACEHOLDER#" 443 "/"
39+ & xhrRequest_url %~ (T.append url)
40+ host = SR.BasePath "/"
4041
4142
4243listEndpoint
@@ -134,3 +135,6 @@ commandResponse = \case
134135 getArrayBufferBody = \case
135136 XhrResponseBody_ArrayBuffer x -> Just x
136137 _ -> Nothing
138+
139+wsPath :: Text
140+wsPath = T.pack $ symbolVal (Proxy @ApiWSPath)
dm-frontend/src/Main.hs+2−1
@@ -45,7 +45,8 @@ wsUpdate = do
4545 , _webSocketConfig_reconnect = True
4646 , _webSocketConfig_protocols = []
4747 }
48− wsUrl <- getWsUrl
48+ wsHost <- getWsUrl
49+ let wsUrl = wsHost <> "/" <> wsPath
4950 ws <- webSocket wsUrl wsConfig
5051 pure $ () <$ _webSocket_recv ws
5152