Minor refactoring
This commit is contained in:
parent
865b69e799
commit
5c6b39a44e
|
@ -1,2 +1,3 @@
|
|||
.stack-work/
|
||||
*~
|
||||
dist-newstyle
|
||||
|
|
|
@ -25,9 +25,25 @@ source-repository head
|
|||
|
||||
library
|
||||
exposed-modules:
|
||||
BroadcastUserData
|
||||
Lib
|
||||
RoomDataHandler
|
||||
State.ConnectedClientsState
|
||||
State.RoomDataState
|
||||
Types.AppTypes
|
||||
Types.ConnectionState
|
||||
Types.Participant
|
||||
Types.RoomData
|
||||
Types.RoomsState
|
||||
Types.UsersData
|
||||
Types.WebEnv
|
||||
Types.WebSocketMessages.WebSocketMessages
|
||||
WebServer
|
||||
WebSocket
|
||||
WebSocket.Messages
|
||||
WebSocket.MonadWebSocketSession
|
||||
WebSocket.Server
|
||||
WebSocket.WSApp
|
||||
WebSocket.WSReaderTApp
|
||||
other-modules:
|
||||
Paths_jitsi_rooms
|
||||
hs-source-dirs:
|
||||
|
@ -36,9 +52,15 @@ library
|
|||
NoImplicitPrelude,OverloadedStrings,ImportQualifiedPost
|
||||
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints
|
||||
build-depends:
|
||||
base >=4.7 && <5
|
||||
aeson
|
||||
, base >=4.7 && <5
|
||||
, bytestring
|
||||
, classy-prelude
|
||||
, http-types
|
||||
, lifted-base
|
||||
, mtl
|
||||
, text
|
||||
, uuid
|
||||
, wai
|
||||
, warp
|
||||
, websockets
|
||||
|
@ -54,10 +76,16 @@ executable jitsi-rooms-exe
|
|||
NoImplicitPrelude,OverloadedStrings,ImportQualifiedPost
|
||||
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
|
||||
build-depends:
|
||||
base >=4.7 && <5
|
||||
aeson
|
||||
, base >=4.7 && <5
|
||||
, bytestring
|
||||
, classy-prelude
|
||||
, http-types
|
||||
, jitsi-rooms
|
||||
, lifted-base
|
||||
, mtl
|
||||
, text
|
||||
, uuid
|
||||
, wai
|
||||
, warp
|
||||
, websockets
|
||||
|
@ -74,10 +102,16 @@ test-suite jitsi-rooms-test
|
|||
NoImplicitPrelude,OverloadedStrings,ImportQualifiedPost
|
||||
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
|
||||
build-depends:
|
||||
base >=4.7 && <5
|
||||
aeson
|
||||
, base >=4.7 && <5
|
||||
, bytestring
|
||||
, classy-prelude
|
||||
, http-types
|
||||
, jitsi-rooms
|
||||
, lifted-base
|
||||
, mtl
|
||||
, text
|
||||
, uuid
|
||||
, wai
|
||||
, warp
|
||||
, websockets
|
||||
|
|
|
@ -44,6 +44,7 @@ roomDataHandler ::
|
|||
m ResponseReceived
|
||||
roomDataHandler = do
|
||||
newRoomData <- parseBodyOrBadRequest
|
||||
liftIO $ putStrLn "Got triggered form prosody"
|
||||
whenM (roomStateDiffers newRoomData) $ do
|
||||
setRoomDataState newRoomData
|
||||
broadcastUserData
|
||||
|
|
|
@ -10,8 +10,7 @@ import ClassyPrelude
|
|||
import Data.UUID.V4 (nextRandom)
|
||||
import Network.WebSockets qualified as WS
|
||||
import Types.AppTypes
|
||||
import WebSocket
|
||||
import WebSocket (WSApp (..))
|
||||
import WebSocket.WSApp (WSApp (..), WSEnv (..), wsApp)
|
||||
|
||||
runWebSocketServer ::
|
||||
( MonadIO m,
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
{-# LANGUAGE DerivingVia #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
module WebSocket (WSEnv (..), wsApp, WSApp (..)) where
|
||||
module WebSocket.WSApp (WSEnv (..), wsApp, WSApp (..)) where
|
||||
|
||||
import BroadcastUserData
|
||||
( MonadBroadcast (..),
|
||||
|
@ -30,8 +25,8 @@ wsApp ::
|
|||
) =>
|
||||
m ()
|
||||
wsApp = do
|
||||
msg <- getTypedWSMessage
|
||||
client <- newClient msg
|
||||
clientInfo <- getTypedWSMessage
|
||||
client <- newClient clientInfo
|
||||
addWSClient client
|
||||
broadcastUserData
|
||||
withCleanUp $ forever $ do
|
|
@ -14,8 +14,9 @@
|
|||
# Use the latest resolver that uses the same ghc version
|
||||
# as build for nixos
|
||||
# this way we can use prebuild binaries for hls
|
||||
resolver: nightly-2022-11-12
|
||||
#resolver: nightly-2022-11-12
|
||||
#resolver: ghc-9.2.4
|
||||
resolver: lts-20.16
|
||||
#
|
||||
# The location of a snapshot can be provided as a file or url. Stack assumes
|
||||
# a snapshot provided as a file might change, whereas a url resource does not.
|
||||
|
@ -70,3 +71,7 @@ packages:
|
|||
#
|
||||
# Allow a newer minor version of GHC than the snapshot specifies
|
||||
# compiler-check: newer-minor
|
||||
ghc-options:
|
||||
"$everything": -haddock
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
packages: []
|
||||
snapshots:
|
||||
- completed:
|
||||
sha256: 5cacb39a2c21842535dc0a31e2005d3b1eb18e451a89d58c28381e1efdb9520f
|
||||
size: 647983
|
||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2022/11/12.yaml
|
||||
original: nightly-2022-11-12
|
||||
sha256: dad15e2ec0c09280a5c2e07190fb18710fc54472f029f34f861f686540824d81
|
||||
size: 649592
|
||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/16.yaml
|
||||
original: lts-20.16
|
||||
|
|
Loading…
Reference in New Issue