remove hardcoded channel uid, sseClient field

This commit is contained in:
Ben Sima 2020-10-20 17:12:52 -04:00
parent f952351191
commit 6732cffcbc
2 changed files with 6 additions and 9 deletions

View File

@ -20,6 +20,7 @@ import qualified Data.ByteString.Char8 as Char8
import qualified Data.ByteString.Lazy as L
import Data.Text (Text)
import qualified Data.Text as Text
import Data.UUID.V4 as UUID
import Network.Http.Client as Client
import Network.Wreq (FormParam ((:=)))
import qualified Network.Wreq as Wreq
@ -36,17 +37,16 @@ data Ship = Ship
name :: ShipName,
-- | Track the latest event we saw (needed for poking).
lastEventId :: Int,
-- | Internet-facing access point, like 'http://sampel-palnet.arvo.network'
-- | Network access point, with port if necessary. Like
-- 'https://sampel-palnet.arvo.network', or 'http://localhost:8080'.
url :: Url,
-- | Login code, `+code` in the dojo. Don't share this publically.
code :: Text,
-- | Not implemented yet...
sseClient :: Bool
code :: Text
}
deriving (Show)
channelUrl :: Ship -> String
channelUrl Ship {url} = url <> "/~/channel/1234567890abcdef"
channelUrl Ship {url, uid} = url <> "/~/channel/" <> Text.unpack uid
type Url = String

View File

@ -57,7 +57,6 @@ main = do
r <- ack sess ship 1
return $ r ^? Wreq.responseBody
fakezod :: String -> Ship
fakezod port =
Ship
@ -65,11 +64,9 @@ fakezod port =
name = "zod",
lastEventId = 1,
url = "http://localhost:" ++ port,
code = "lidlut-tabwed-pillex-ridrup",
sseClient = False
code = "lidlut-tabwed-pillex-ridrup"
}
-- | Poor man's testing framework
testing :: Text -> IO Bool -> IO ()
testing description f =