Minor refactoring

This commit is contained in:
qvalentin 2023-04-01 17:43:09 +02:00
parent 865b69e799
commit 5c6b39a44e
7 changed files with 55 additions and 20 deletions

1
backend/.gitignore vendored
View File

@ -1,2 +1,3 @@
.stack-work/ .stack-work/
*~ *~
dist-newstyle

View File

@ -25,9 +25,25 @@ source-repository head
library library
exposed-modules: exposed-modules:
BroadcastUserData
Lib Lib
RoomDataHandler
State.ConnectedClientsState
State.RoomDataState
Types.AppTypes
Types.ConnectionState
Types.Participant
Types.RoomData
Types.RoomsState
Types.UsersData
Types.WebEnv
Types.WebSocketMessages.WebSocketMessages
WebServer WebServer
WebSocket WebSocket.Messages
WebSocket.MonadWebSocketSession
WebSocket.Server
WebSocket.WSApp
WebSocket.WSReaderTApp
other-modules: other-modules:
Paths_jitsi_rooms Paths_jitsi_rooms
hs-source-dirs: hs-source-dirs:
@ -36,9 +52,15 @@ library
NoImplicitPrelude,OverloadedStrings,ImportQualifiedPost NoImplicitPrelude,OverloadedStrings,ImportQualifiedPost
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints
build-depends: build-depends:
base >=4.7 && <5 aeson
, base >=4.7 && <5
, bytestring
, classy-prelude , classy-prelude
, http-types , http-types
, lifted-base
, mtl
, text
, uuid
, wai , wai
, warp , warp
, websockets , websockets
@ -54,10 +76,16 @@ executable jitsi-rooms-exe
NoImplicitPrelude,OverloadedStrings,ImportQualifiedPost 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 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: build-depends:
base >=4.7 && <5 aeson
, base >=4.7 && <5
, bytestring
, classy-prelude , classy-prelude
, http-types , http-types
, jitsi-rooms , jitsi-rooms
, lifted-base
, mtl
, text
, uuid
, wai , wai
, warp , warp
, websockets , websockets
@ -74,10 +102,16 @@ test-suite jitsi-rooms-test
NoImplicitPrelude,OverloadedStrings,ImportQualifiedPost 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 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: build-depends:
base >=4.7 && <5 aeson
, base >=4.7 && <5
, bytestring
, classy-prelude , classy-prelude
, http-types , http-types
, jitsi-rooms , jitsi-rooms
, lifted-base
, mtl
, text
, uuid
, wai , wai
, warp , warp
, websockets , websockets

View File

@ -44,6 +44,7 @@ roomDataHandler ::
m ResponseReceived m ResponseReceived
roomDataHandler = do roomDataHandler = do
newRoomData <- parseBodyOrBadRequest newRoomData <- parseBodyOrBadRequest
liftIO $ putStrLn "Got triggered form prosody"
whenM (roomStateDiffers newRoomData) $ do whenM (roomStateDiffers newRoomData) $ do
setRoomDataState newRoomData setRoomDataState newRoomData
broadcastUserData broadcastUserData

View File

@ -10,8 +10,7 @@ import ClassyPrelude
import Data.UUID.V4 (nextRandom) import Data.UUID.V4 (nextRandom)
import Network.WebSockets qualified as WS import Network.WebSockets qualified as WS
import Types.AppTypes import Types.AppTypes
import WebSocket import WebSocket.WSApp (WSApp (..), WSEnv (..), wsApp)
import WebSocket (WSApp (..))
runWebSocketServer :: runWebSocketServer ::
( MonadIO m, ( MonadIO m,

View File

@ -1,9 +1,4 @@
{-# LANGUAGE DerivingVia #-} module WebSocket.WSApp (WSEnv (..), wsApp, WSApp (..)) where
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
module WebSocket (WSEnv (..), wsApp, WSApp (..)) where
import BroadcastUserData import BroadcastUserData
( MonadBroadcast (..), ( MonadBroadcast (..),
@ -30,8 +25,8 @@ wsApp ::
) => ) =>
m () m ()
wsApp = do wsApp = do
msg <- getTypedWSMessage clientInfo <- getTypedWSMessage
client <- newClient msg client <- newClient clientInfo
addWSClient client addWSClient client
broadcastUserData broadcastUserData
withCleanUp $ forever $ do withCleanUp $ forever $ do

View File

@ -14,8 +14,9 @@
# Use the latest resolver that uses the same ghc version # Use the latest resolver that uses the same ghc version
# as build for nixos # as build for nixos
# this way we can use prebuild binaries for hls # 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: ghc-9.2.4
resolver: lts-20.16
# #
# The location of a snapshot can be provided as a file or url. Stack assumes # 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. # 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 # Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor # compiler-check: newer-minor
ghc-options:
"$everything": -haddock

View File

@ -6,7 +6,7 @@
packages: [] packages: []
snapshots: snapshots:
- completed: - completed:
sha256: 5cacb39a2c21842535dc0a31e2005d3b1eb18e451a89d58c28381e1efdb9520f sha256: dad15e2ec0c09280a5c2e07190fb18710fc54472f029f34f861f686540824d81
size: 647983 size: 649592
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2022/11/12.yaml url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/16.yaml
original: nightly-2022-11-12 original: lts-20.16