diff options
author | Joachim Bauch <bauch@struktur.de> | 2017-07-21 09:22:28 +0200 |
---|---|---|
committer | Joachim Bauch <bauch@struktur.de> | 2017-11-02 11:23:10 +0100 |
commit | e083e7225670443f06bc4bfb7f84b86f98c0fb39 (patch) | |
tree | 6fbb32467003a2914d376d09743255b78a8bd81e /js/signaling.js | |
parent | 0f3d5926604fad18aeaacd7fa35e0b9c20a8078a (diff) |
Pass all signaling-related settings as JSON object to frontend.
Signed-off-by: Joachim Bauch <bauch@struktur.de>
Diffstat (limited to 'js/signaling.js')
-rw-r--r-- | js/signaling.js | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/js/signaling.js b/js/signaling.js index cb598dc98..efaf86762 100644 --- a/js/signaling.js +++ b/js/signaling.js @@ -3,7 +3,8 @@ OCA.SpreedMe = OCA.SpreedMe || {}; - function SignalingBase() { + function SignalingBase(settings) { + this.settings = settings; this.sessionId = ''; this.currentCallToken = null; this.handlers = {}; @@ -110,7 +111,7 @@ }; // Connection to the internal signaling server provided by the app. - function InternalSignaling() { + function InternalSignaling(/*settings*/) { SignalingBase.prototype.constructor.apply(this, arguments); this.spreedArrayConnection = []; @@ -431,7 +432,7 @@ }.bind(this)); }; - function StandaloneSignaling(url) { + function StandaloneSignaling(settings, url) { SignalingBase.prototype.constructor.apply(this, arguments); // Make sure we are using websocket urls. if (url.indexOf("https://") === 0) { @@ -601,7 +602,6 @@ } else { var user = OC.getCurrentUser(); var url = OC.generateUrl("/apps/spreed/signalling/backend"); - var ticket = $("#app").attr("data-signalingticket"); msg = { "type": "hello", "hello": { @@ -610,7 +610,7 @@ "url": OC.getProtocol() + "://" + OC.getHost() + url, "params": { "userid": user.uid, - "ticket": ticket, + "ticket": this.settings.ticket } } } @@ -753,11 +753,17 @@ }; OCA.SpreedMe.createSignalingConnection = function() { - var url = $("#app").attr("data-signalingserver"); + var settings = $("#app #signaling-settings").text(); + if (settings) { + settings = JSON.parse(settings); + } else { + settings = {}; + } + var url = settings['server']; if (url) { - return new StandaloneSignaling(url); + return new StandaloneSignaling(settings, url); } else { - return new InternalSignaling(); + return new InternalSignaling(settings); } }; |