ConverseJS Example.

This commit is contained in:
John Livingston 2021-02-19 19:19:38 +01:00
parent b57165e2d6
commit 5f67c4b0f7
2 changed files with 66 additions and 0 deletions

View File

@ -10,3 +10,14 @@ For now, there is no documentation for how you can setup the webchat.
It has to be setup by your own. For example with a XMPP Server and the ConverseJS Javascript. It has to be setup by your own. For example with a XMPP Server and the ConverseJS Javascript.
Next step: document how you can setup the XMPP server. Next step: document how you can setup the XMPP server.
## ConverseJS
Once you have a XMPP server that allow anonymous authentication, with bosh
(or websocket) enabled, you can - for example - setup a html page that looks like
[this one](documentation/examples/converseJS/index.html). You have of course to
replace the path /conversejs/7.0.3 with your converseJS path, and replace your_domain
by your actual domain.
NB : there is a bug in the converseJS 7.0.4 release. The dist files don't work.
So if you are not building converseJS yourself, use version 7.0.3 instead.

View File

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<title>Converse</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="description" content="Converse XMPP/Jabber Chat"/>
<link type="text/css" rel="stylesheet" media="screen" href="/conversejs/7.0.3/converse.min.css" />
<script src="/conversejs/7.0.3/converse.min.js"></script>
<style type="text/css">
#conversejs .chat-head {
display: none;
}
</style>
</head>
<body class="converse-fullscreen">
<noscript>You need to enable JavaScript to run the Converse.js chat app.</noscript>
<div id="conversejs-bg"></div>
<script>
var urlParams = new URLSearchParams(window.location.search);
var roomParam = urlParams.get('room');
var room = roomParam && /^[\w-]+$/.test(roomParam) ? 'public_' + roomParam : 'public';
converse.initialize({
assets_path: '/conversejs/7.0.3/',
authentication: 'anonymous',
auto_login: true,
auto_join_rooms: [
room + '@room.peertube.im.your_domain',
],
bosh_service_url: 'https://peertube.im.your_domain/http-bind/',
jid: 'peertube.im.your_domain',
notify_all_room_messages: [
room + '@room.peertube.im.your_domain',
],
singleton: true,
auto_focus: false,
hide_muc_participants: false,
keepalive: true,
play_sounds: false,
muc_mention_autocomplete_min_chars: 3,
muc_mention_autocomplete_filter: 'contains',
modtools_disable_assign: true,
muc_disable_slash_commands: ['admin', 'ban', 'clear', 'deop', 'destroy', 'kick', 'member', 'modtools', 'mute', 'op', 'owner', 'register', 'revoke', 'subject', 'topic', 'voice'],
muc_instant_rooms: true,
show_client_info: false,
allow_adhoc_commands: false,
allow_contact_requests: false,
show_controlbox_by_default: false,
view_mode: 'fullscreen',
});
</script>
</body>
</html>