-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Room type with Converse.js replacing jitsi #385
Merged
Merged
Changes from 19 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
5adf316
initial converse inclusion with creation of streaming room
7c00673
Merge branch 'master' into chat
f865b07
cleaned up converse init
671a839
pushing for andrew to look at
02165d2
initial configuration for converse
rene-grigory dfde39e
Merge branch 'master' into chat
rene-grigory 1d57567
merged from upstream
rene-grigory c10398c
merged from upstream
rene-grigory dfcdb08
removed node_modules from git
rene-grigory 09b1df7
created auto logout when leaving the room
1fe98b3
got rid of needless code
b85be73
ready for styling and cleanup
f155948
finished hijacking css
rene-grigory 7c00179
Merge branch 'master' into chat
rene-grigory 21f35c3
revered iframe link
rene-grigory fd36859
code clean up
rene-grigory d7599ec
Merge branch 'master' into chat
80adc18
fixed comment in rooms.proto
rene-grigory 9c99bb2
logout user in beforeUnload
rene-grigory a093676
hide offline users and brought in the latest convers.js lib
rene-grigory 85c5117
Merge branch 'master' into chat
rene-grigory 5165ca7
format cleanup
rene-grigory 30346f8
more cleanup and useing Config.baseUrl to point at the bash service
rene-grigory 4eaa9ed
replaced old listener with MutationObserver since none of the convers…
rene-grigory 83df75c
removed comment and fixed console.error
rene-grigory f3b7421
added style variables for the chat box
rene-grigory File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React, { useEffect } from "react"; | ||
|
||
/** | ||
* This component is used to render a Converse.js chat component on the | ||
* left side and an IFrame on the right. While this component does have | ||
* the jitsi-video class in the render it is only for placement: there | ||
* is no jitsi video in this component. | ||
* | ||
* This component works in conjunction with the CHATSTREAM room type. | ||
* | ||
* @param props a combo of roomData and jitsiData | ||
* @returns | ||
*/ | ||
export const ChatStreamRoom = ({ | ||
id: roomId, | ||
name: roomName, | ||
displayName, | ||
boshUrl, | ||
iframeOptions: { src }, | ||
}) => { | ||
// register the 'jitsi-plugin' and initialize converse and cleanup after close | ||
useEffect(() => { | ||
let logout = null; | ||
let plugins = null; | ||
|
||
// configure the 'jitsi-plugin' to get our hands on the converse api logout | ||
try { | ||
window.converse.plugins.add("jitsi-plugin", { | ||
initialize: function () { | ||
logout = this._converse.api.user.logout; | ||
plugins = this._converse.pluggable.plugins; | ||
|
||
// add event listener to restucture the chatbox | ||
this._converse.api.listen.on("chatBoxInsertedIntoDOM", () => { | ||
const title = document.querySelector(".chatbox-title__text"); | ||
const dd = document.querySelector(".chatbox-title__buttons"); | ||
|
||
title.innerHTML = roomName; | ||
dd.remove(); | ||
}); | ||
}, | ||
}); | ||
} catch (error) { | ||
// do nothing since the plugin is already registered | ||
console.error("Well, that didn't work"); | ||
} | ||
|
||
// initialize converse | ||
window.converse.initialize({ | ||
authentication: "anonymous", | ||
auto_login: true, | ||
auto_join_rooms: [ | ||
{ jid: `${roomId}@muc.party.jitsi`, nick: displayName }, | ||
], | ||
bosh_service_url: boshUrl, | ||
jid: "guest.party.jitsi", | ||
singleton: true, | ||
clear_cache_on_logout: true, | ||
whitelisted_plugins: ["jitsi-plugin"], | ||
view_mode: "embedded", | ||
}); | ||
|
||
// listen to beforeunload to logout and cleanup | ||
window.addEventListener("beforeunload", () => { | ||
plugins["jitsi-plugin"] = undefined; | ||
logout(); | ||
}); | ||
|
||
// call the converse api logout at cleanup | ||
return () => { | ||
plugins["jitsi-plugin"] = undefined; | ||
logout(); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<div className="iframe-room"> | ||
<div className="jitsi-video"></div> | ||
<div className="iframe-section"> | ||
<iframe src={src} height="100%" width="100%" frameBorder="0px"></iframe> | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently the
chatBoxInsertedIntoDOM
event will be removed in the next major version: https://github.com/conversejs/converse.js/blob/master/CHANGES.mdWe could replace it with one of these events: https://github.com/conversejs/converse.js/blob/master/src/plugins/minimize/index.js#L128-L133