Compare commits
5 Commits
a1cb1a30d9
...
b01b637a22
Author | SHA1 | Date |
---|---|---|
qvalentin | b01b637a22 | |
qvalentin | 30bfc6e763 | |
qvalentin | 247b99d571 | |
qvalentin | f40582cff1 | |
qvalentin | f117e4cb65 |
|
@ -1,3 +1,4 @@
|
||||||
.stack-work/
|
.stack-work/
|
||||||
*~
|
*~
|
||||||
dist-newstyle
|
dist-newstyle
|
||||||
|
result
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
{ mkDerivation
|
||||||
|
, aeson
|
||||||
|
, base
|
||||||
|
, bytestring
|
||||||
|
, classy-prelude
|
||||||
|
, http-types
|
||||||
|
, lib
|
||||||
|
, lifted-base
|
||||||
|
, mtl
|
||||||
|
, text
|
||||||
|
, uuid
|
||||||
|
, wai
|
||||||
|
, warp
|
||||||
|
, websockets
|
||||||
|
}:
|
||||||
|
mkDerivation {
|
||||||
|
pname = "jitsi-rooms";
|
||||||
|
version = "0.1.0.0";
|
||||||
|
src = ./.;
|
||||||
|
isLibrary = true;
|
||||||
|
isExecutable = true;
|
||||||
|
libraryHaskellDepends = [
|
||||||
|
aeson
|
||||||
|
base
|
||||||
|
bytestring
|
||||||
|
classy-prelude
|
||||||
|
http-types
|
||||||
|
lifted-base
|
||||||
|
mtl
|
||||||
|
text
|
||||||
|
uuid
|
||||||
|
wai
|
||||||
|
warp
|
||||||
|
websockets
|
||||||
|
];
|
||||||
|
executableHaskellDepends = [
|
||||||
|
aeson
|
||||||
|
base
|
||||||
|
bytestring
|
||||||
|
classy-prelude
|
||||||
|
http-types
|
||||||
|
lifted-base
|
||||||
|
mtl
|
||||||
|
text
|
||||||
|
uuid
|
||||||
|
wai
|
||||||
|
warp
|
||||||
|
websockets
|
||||||
|
];
|
||||||
|
homepage = "https://github.com/githubuser/jitsi-rooms#readme";
|
||||||
|
license = lib.licenses.bsd3;
|
||||||
|
mainProgram = "jitsi-rooms-exe";
|
||||||
|
enableSharedExecutables = false;
|
||||||
|
postFixup = "rm -rf $out/lib $out/nix-support $out/share/doc";
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
let
|
||||||
|
config = {
|
||||||
|
packageOverrides = pkgs: rec {
|
||||||
|
haskellPackages = pkgs.haskellPackages.override {
|
||||||
|
overrides = haskellPackagesNew: haskellPackagesOld: rec {
|
||||||
|
jitsi-rooms =
|
||||||
|
haskellPackagesNew.callPackage ./converted.nix { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
pkgs = import <nixpkgs> { inherit config; };
|
||||||
|
|
||||||
|
|
||||||
|
in
|
||||||
|
pkgs.dockerTools.buildImage {
|
||||||
|
name = "jitsi-rooms";
|
||||||
|
tag = "latest";
|
||||||
|
copyToRoot = pkgs.buildEnv {
|
||||||
|
name = "image-root";
|
||||||
|
paths = [
|
||||||
|
pkgs.bash
|
||||||
|
pkgs.coreutils
|
||||||
|
];
|
||||||
|
pathsToLink = [ "/bin" ];
|
||||||
|
};
|
||||||
|
config = {
|
||||||
|
Cmd = [ "${pkgs.haskellPackages.jitsi-rooms}/bin/jitsi-rooms-exe" ];
|
||||||
|
ExposedPorts = {
|
||||||
|
"9160/tcp" = { };
|
||||||
|
"8081/tcp" = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
nix-build
|
||||||
|
|
||||||
|
scp ./result ffs:/home/ffsys/jitsi-rooms-docker-image
|
|
@ -91,28 +91,3 @@ executable jitsi-rooms-exe
|
||||||
, websockets
|
, websockets
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
||||||
test-suite jitsi-rooms-test
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Spec.hs
|
|
||||||
other-modules:
|
|
||||||
Paths_jitsi_rooms
|
|
||||||
hs-source-dirs:
|
|
||||||
test
|
|
||||||
default-extensions:
|
|
||||||
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:
|
|
||||||
aeson
|
|
||||||
, base >=4.7 && <5
|
|
||||||
, bytestring
|
|
||||||
, classy-prelude
|
|
||||||
, http-types
|
|
||||||
, jitsi-rooms
|
|
||||||
, lifted-base
|
|
||||||
, mtl
|
|
||||||
, text
|
|
||||||
, uuid
|
|
||||||
, wai
|
|
||||||
, warp
|
|
||||||
, websockets
|
|
||||||
default-language: Haskell2010
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ module WebSocket.MonadWebSocketSession
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
|
import BroadcastUserData (MonadBroadcast, broadcastUserData)
|
||||||
import ClassyPrelude
|
import ClassyPrelude
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
( FromJSON,
|
( FromJSON,
|
||||||
|
@ -16,6 +17,7 @@ import State.ConnectedClientsState
|
||||||
( MonadConnectedClientsModify,
|
( MonadConnectedClientsModify,
|
||||||
removeWSClient,
|
removeWSClient,
|
||||||
)
|
)
|
||||||
|
import State.RoomDataState (MonadRoomDataStateRead)
|
||||||
import Types.ConnectionState (Client (..))
|
import Types.ConnectionState (Client (..))
|
||||||
import Types.WebSocketMessages.WebSocketMessages (SetClientInfo (..))
|
import Types.WebSocketMessages.WebSocketMessages (SetClientInfo (..))
|
||||||
import WebSocket.Messages
|
import WebSocket.Messages
|
||||||
|
@ -56,9 +58,12 @@ newClientGeneric clientInfo = do
|
||||||
|
|
||||||
disconnectWsClient ::
|
disconnectWsClient ::
|
||||||
( MonadConnectedClientsModify m,
|
( MonadConnectedClientsModify m,
|
||||||
|
MonadRoomDataStateRead m,
|
||||||
|
MonadBroadcast m,
|
||||||
MonadWebSocketSession m
|
MonadWebSocketSession m
|
||||||
) =>
|
) =>
|
||||||
m ()
|
m ()
|
||||||
disconnectWsClient = do
|
disconnectWsClient = do
|
||||||
clientId <- getSesssionId
|
clientId <- getSesssionId
|
||||||
removeWSClient clientId
|
removeWSClient clientId
|
||||||
|
broadcastUserData
|
||||||
|
|
|
@ -18,9 +18,9 @@ runWebSocketServer ::
|
||||||
) =>
|
) =>
|
||||||
m ()
|
m ()
|
||||||
runWebSocketServer = do
|
runWebSocketServer = do
|
||||||
putStrLn "Websocket up at 127.0.0.1:9160"
|
putStrLn "Websocket up at 0.0.0.0:9160"
|
||||||
wsApp' <- runWSApp
|
wsApp' <- runWSApp
|
||||||
liftIO $ WS.runServer "127.0.0.1" 9160 wsApp'
|
liftIO $ WS.runServer "0.0.0.0" 9160 wsApp'
|
||||||
|
|
||||||
runWSApp ::
|
runWSApp ::
|
||||||
( MonadIO m,
|
( MonadIO m,
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
|
||||||
|
yarn build
|
||||||
|
scp -r dist/* ffs:/home/ffsys/apps/static/jitsi-rooms
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
|
||||||
|
ssh -L 9160:localhost:9160 ffs
|
|
@ -1,28 +1,42 @@
|
||||||
|
import { useState } from "react";
|
||||||
import "./App.css";
|
import "./App.css";
|
||||||
import Meeting from "./components/meeting/Meeting";
|
import Meeting from "./components/meeting/Meeting";
|
||||||
import Sidebar from "./components/sidebar/Sidebar";
|
import Sidebar from "./components/sidebar/Sidebar";
|
||||||
import useBackendData from "./hooks/useBackendData";
|
import useBackendData from "./hooks/useBackendData";
|
||||||
import useConferenceData from "./hooks/useConferenceData";
|
import useConferenceData from "./hooks/useConferenceData";
|
||||||
import useLocalUser from "./hooks/useLocalUser";
|
import useLocalUser from "./hooks/useLocalUser";
|
||||||
|
import { useRoomName } from "./hooks/useRoomName";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const { userInfo, setUserInfo } = useLocalUser();
|
const { userInfo, setUserInfo } = useLocalUser();
|
||||||
|
const { roomName, updateRoomName, updateAndSubmitRoomName, submitRoomName } = useRoomName();
|
||||||
const { roomData, sendMessage } = useBackendData(userInfo);
|
const { roomData, sendMessage } = useBackendData(userInfo);
|
||||||
const { conferenceData, setConferenceData } = useConferenceData(
|
const { conferenceData, setConferenceData } = useConferenceData(
|
||||||
sendMessage,
|
sendMessage,
|
||||||
setUserInfo
|
setUserInfo
|
||||||
);
|
);
|
||||||
|
const [meetingStarted, setMeetingStarted] = useState(false);
|
||||||
|
|
||||||
console.log(roomData);
|
console.log(roomData);
|
||||||
|
|
||||||
if (roomData && userInfo) {
|
if (roomData && userInfo) {
|
||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<Sidebar usersData={roomData} />
|
<Sidebar usersData={roomData}
|
||||||
|
updateAndSubmitRoomName={(roomName: string) => {
|
||||||
|
updateAndSubmitRoomName(roomName)
|
||||||
|
setMeetingStarted(true)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<Meeting
|
<Meeting
|
||||||
conferenceData={conferenceData}
|
conferenceData={conferenceData}
|
||||||
setConferenceData={setConferenceData}
|
setConferenceData={setConferenceData}
|
||||||
userInfo={userInfo}
|
userInfo={userInfo}
|
||||||
|
roomName={roomName}
|
||||||
|
updateRoomName={updateRoomName}
|
||||||
|
submitRoomName={submitRoomName}
|
||||||
|
meetingStarted={meetingStarted}
|
||||||
|
setMeetingStarted={setMeetingStarted}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
const ISPROD = window.location.protocol == "https:";
|
const ISPROD = window.location.protocol == "https:";
|
||||||
const JITSI_DOMAIN = ISPROD
|
const JITSI_DOMAIN = "thisisnotajitsi.filefighter.de";
|
||||||
? "thisisnotajitsi.filefighter.de"
|
|
||||||
: "localhost:8443";
|
|
||||||
const WEBSOCKET_URL =
|
const WEBSOCKET_URL =
|
||||||
"ws" +
|
"ws" +
|
||||||
(ISPROD ? "s" : "") +
|
(ISPROD ? "s" : "") +
|
||||||
|
|
|
@ -9,11 +9,12 @@ interface Props {
|
||||||
conferenceData: ConferenceData | undefined;
|
conferenceData: ConferenceData | undefined;
|
||||||
setConferenceData: (newData: ConferenceData) => void;
|
setConferenceData: (newData: ConferenceData) => void;
|
||||||
userInfo: UserInfo;
|
userInfo: UserInfo;
|
||||||
|
//@ts-ignore
|
||||||
|
roomName, updateRoomName, submitRoomName
|
||||||
|
meetingStarted: Boolean, setMeetingStarted: Function
|
||||||
}
|
}
|
||||||
|
|
||||||
function Meeting({ conferenceData, setConferenceData, userInfo }: Props) {
|
function Meeting({ conferenceData, setConferenceData, userInfo, roomName, updateRoomName, submitRoomName, meetingStarted, setMeetingStarted }: Props) {
|
||||||
const { roomName, updateRoomName, submitRoomName } = useRoomName();
|
|
||||||
const [meetingStarted, setMeetingStarted] = useState(false);
|
|
||||||
|
|
||||||
const startMeeting = useCallback(() => {
|
const startMeeting = useCallback(() => {
|
||||||
submitRoomName();
|
submitRoomName();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { UsersData } from "../../background/types/roomData";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
usersData: UsersData;
|
usersData: UsersData;
|
||||||
|
updateAndSubmitRoomName: Function
|
||||||
}
|
}
|
||||||
|
|
||||||
function Sidebar(props: Props) {
|
function Sidebar(props: Props) {
|
||||||
|
@ -14,17 +15,17 @@ function Sidebar(props: Props) {
|
||||||
return (
|
return (
|
||||||
<div className={`sidebar sidebar-${sidebarVisibility}`}>
|
<div className={`sidebar sidebar-${sidebarVisibility}`}>
|
||||||
<SidebarHeader sidebarVisibility={sidebarVisibility} />
|
<SidebarHeader sidebarVisibility={sidebarVisibility} />
|
||||||
<div>
|
|
||||||
<h3> No room</h3>
|
|
||||||
{props.usersData.usersWithOutRoom.map((username) => (
|
|
||||||
<div>{username}</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
{props.usersData.roomsData.map((roomData) => {
|
{props.usersData.roomsData.map((roomData) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h3> {roomData.roomName} </h3>
|
<h3>
|
||||||
|
<a href="#" onClick={() => {
|
||||||
|
props.updateAndSubmitRoomName(roomData.roomName)
|
||||||
|
}}>
|
||||||
|
{roomData.roomName}
|
||||||
|
</a>
|
||||||
|
</h3>
|
||||||
{roomData.participants.map((participant) => (
|
{roomData.participants.map((participant) => (
|
||||||
<div> {participant.displayName} </div>
|
<div> {participant.displayName} </div>
|
||||||
))}
|
))}
|
||||||
|
@ -32,6 +33,12 @@ function Sidebar(props: Props) {
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<h3> No room</h3>
|
||||||
|
{props.usersData.usersWithOutRoom.map((username) => (
|
||||||
|
<div>{username}</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
<div className="sidebar-footer">
|
<div className="sidebar-footer">
|
||||||
<button onClick={toggleSidebarVisibility}>{sidebarToggleText}</button>
|
<button onClick={toggleSidebarVisibility}>{sidebarToggleText}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,12 +11,22 @@ function useRoomName() {
|
||||||
[setRoomName]
|
[setRoomName]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const updateAndSubmitRoomName = useCallback(
|
||||||
|
(newName: string) => {
|
||||||
|
setRoomName(newName);
|
||||||
|
setRoomNameInUrl(newName);
|
||||||
|
setRoomNameInTitle(newName);
|
||||||
|
console.log("[Rooms] update and submit room name", newName);
|
||||||
|
},
|
||||||
|
[setRoomName]
|
||||||
|
)
|
||||||
|
|
||||||
const submitRoomName = useCallback(() => {
|
const submitRoomName = useCallback(() => {
|
||||||
setRoomNameInUrl(roomName);
|
setRoomNameInUrl(roomName);
|
||||||
setRoomNameInTitle(roomName);
|
setRoomNameInTitle(roomName);
|
||||||
}, [roomName]);
|
}, [roomName]);
|
||||||
|
|
||||||
return { roomName, updateRoomName, submitRoomName };
|
return { roomName, updateRoomName, updateAndSubmitRoomName, submitRoomName };
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRoomNameFromUrl(): string {
|
function getRoomNameFromUrl(): string {
|
||||||
|
|
|
@ -211,7 +211,7 @@ JIBRI_XMPP_PASSWORD=662f13288a07ca64afb4b9b97b4feed6
|
||||||
#
|
#
|
||||||
|
|
||||||
# Container restart policy
|
# Container restart policy
|
||||||
#RESTART_POLICY=unless-stopped
|
RESTART_POLICY=no
|
||||||
|
|
||||||
# Jitsi image version (useful for local development)
|
# Jitsi image version (useful for local development)
|
||||||
#JITSI_IMAGE_VERSION=latest
|
#JITSI_IMAGE_VERSION=latest
|
||||||
|
|
|
@ -346,6 +346,15 @@ services:
|
||||||
networks:
|
networks:
|
||||||
meet.jitsi:
|
meet.jitsi:
|
||||||
|
|
||||||
|
jitsi-rooms:
|
||||||
|
image: jitsi-rooms:67y5d9y2zbi7wkqm2jpcjj1k2614qwx2
|
||||||
|
restart: ${RESTART_POLICY:-unless-stopped}
|
||||||
|
ports:
|
||||||
|
- '9160:9160'
|
||||||
|
networks:
|
||||||
|
meet.jitsi:
|
||||||
|
|
||||||
|
|
||||||
# Custom network so all services can communicate using a FQDN
|
# Custom network so all services can communicate using a FQDN
|
||||||
networks:
|
networks:
|
||||||
meet.jitsi:
|
meet.jitsi:
|
||||||
|
|
Loading…
Reference in New Issue