Rewriting the way ConverseJS is builtin.

This commit is contained in:
John Livingston
2021-02-20 23:12:12 +01:00
parent d9e461f984
commit 39ab460d68
5 changed files with 63 additions and 24 deletions

View File

@ -1,20 +1,22 @@
require('converse.js')
window.initConverse = function initConverse ({
baseStaticUrl,
jid,
assetsPath,
room,
boshServiceUrl
boshServiceUrl,
websocketServiceUrl
}) {
window.converse.initialize({
assets_path: baseStaticUrl,
assets_path: assetsPath,
authentication: 'anonymous',
auto_login: true,
auto_join_rooms: [
room
],
bosh_service_url: boshServiceUrl,
jid: 'peertube.im.your_domain',
discover_connection_methods: true,
bosh_service_url: boshServiceUrl === '' ? undefined : boshServiceUrl,
websocket_url: websocketServiceUrl === '' ? undefined : websocketServiceUrl,
jid: jid,
notify_all_room_messages: [
room
],

View File

@ -5,7 +5,8 @@
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="description" content="Converse XMPP/Jabber Chat"/>
<script src="{{BASE_STATIC_URL}}/conversejs.js"></script>
<script src="{{BASE_STATIC_URL}}/conversejs/converse.min.js"></script>
<script src="{{BASE_STATIC_URL}}/static/builtin.js"></script>
<style type="text/css">
#conversejs .chat-head {
display: none;
@ -17,9 +18,11 @@
<div id="conversejs-bg"></div>
<script>
initConverse({
baseStaticUrl : '{{BASE_STATIC_URL}}',
jid: '{{JID}}',
assetsPath : '{{BASE_STATIC_URL}}/conversejs/',
room: '{{ROOM}}',
boshServiceUrl: '{{BOSH_SERVICE_URL}}'
boshServiceUrl: '{{BOSH_SERVICE_URL}}',
websocketServiceUrl: '{{WS_SERVICE_URL}}',
})
</script>
</body>