Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

allow custom roomnode function as part of config to make deployment changes easier to merge

Philipp Hancke9ceb0799edf9
diff --git a/app.js b/app.js
index 4bb34bf6ab..c0b545360d 100644
--- a/app.js
+++ b/app.js
@@ -48,19 +48,27 @@ function doJoin() {
var roomnode = null;
var path = window.location.pathname;
var roomjid;
- /*
- * this is making assumptions about how the URL->room mapping happens.
- * It currently assumes deployment at root, with a rewrite like the
- * following one (for nginx):
- location ~ ^/([a-zA-Z0-9]+)$ {
- rewrite ^/(.*)$ / break;
- }
- */
- if (path.length > 1) {
- roomnode = path.substr(1).toLowerCase();
+
+ // determinde the room node from the url
+ // TODO: just the roomnode or the whole bare jid?
+ if (config.getroomnode && typeof config.getroomnode === 'function') {
+ // custom function might be responsible for doing the pushstate
+ roomnode = config.getroomnode(path);
} else {
- roomnode = Math.random().toString(36).substr(2, 20);
- window.history.pushState('VideoChat', 'Room: ' + roomnode, window.location.pathname + roomnode);
+ /* fall back to default strategy
+ * this is making assumptions about how the URL->room mapping happens.
+ * It currently assumes deployment at root, with a rewrite like the
+ * following one (for nginx):
+ location ~ ^/([a-zA-Z0-9]+)$ {
+ rewrite ^/(.*)$ / break;
+ }
+ */
+ if (path.length > 1) {
+ roomnode = path.substr(1).toLowerCase();
+ } else {
+ roomnode = Math.random().toString(36).substr(2, 20);
+ window.history.pushState('VideoChat', 'Room: ' + roomnode, window.location.pathname + roomnode);
+ }
}
roomjid = roomnode + '@' + config.hosts.muc;
diff --git a/config.js b/config.js
index b18a4ec49f..ee99d54114 100644
--- a/config.js
+++ b/config.js
@@ -4,6 +4,7 @@ var config = {
muc: 'meet.jit.si', // FIXME: use XEP-0030
bridge: 'jitsi-videobridge.lambada.jitsi.net' // FIXME: use XEP-0030
},
+// getroomnode: function (path) { return 'someprefixpossiblybasedonpath'; },
useNicks: false,
bosh: '//lambada.jitsi.net/http-bind' // FIXME: use xep-0156 for that
};