summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2024-06-27 14:24:05 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2024-06-28 09:35:40 +0200
commit22e687e4a952c66da1c5d78b149072a2c9c48fda (patch)
tree1a206a027d1b2a81cbd31256043f7e28d26260dc /src
parentd27feb0f82dad278d740074159ecaa0378d8f781 (diff)
wip: Send federation settings when connecting to the signaling server
TODO: see note in the code about "/spreed" Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/utils/signaling.js26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/utils/signaling.js b/src/utils/signaling.js
index 60425aa73..982c8d9d6 100644
--- a/src/utils/signaling.js
+++ b/src/utils/signaling.js
@@ -977,8 +977,8 @@ Signaling.Standalone.prototype.doSend = function(msg, callback) {
this.socket.send(JSON.stringify(msg))
}
-Signaling.Standalone.prototype._getBackendUrl = function() {
- return generateOcsUrl('apps/spreed/api/v3/signaling/backend')
+Signaling.Standalone.prototype._getBackendUrl = function(baseURL = undefined ) {
+ return generateOcsUrl('apps/spreed/api/v3/signaling/backend', {}, { baseURL })
}
Signaling.Standalone.prototype.sendHello = function() {
@@ -1165,7 +1165,7 @@ Signaling.Standalone.prototype._joinRoomSuccess = function(token, nextcloudSessi
}
console.debug('Join room', token)
- this.doSend({
+ const message = {
type: 'room',
room: {
roomid: token,
@@ -1174,7 +1174,25 @@ Signaling.Standalone.prototype._joinRoomSuccess = function(token, nextcloudSessi
// the (Nextcloud) user is allowed to join the room.
sessionid: nextcloudSessionId,
},
- }, function(data) {
+ }
+
+ if (this.settings.federation?.server) {
+ message.room.roomid = this.settings.federation.roomId,
+ message.room.federation = {
+ // TODO Should adding "/spreed" be done in the signaling server
+ // instead? The URL configured in Talk administration settings is
+ // just the base URL, and the clients add "/spreed" to connect to
+ // the WebSocket or "api/v1/..." to connect to the HTTP API. When
+ // connecting to a remote signaling server the local signaling
+ // server becomes a client itself, so it might make sense to just
+ // provide the base URL and add "/spreed" in the signaling server.
+ signaling: this.settings.federation.server + '/spreed',
+ url: this._getBackendUrl(this.settings.federation.nextcloudServer),
+ token: this.settings.federation.helloAuthParams.token,
+ }
+ }
+
+ this.doSend(message, function(data) {
this.joinResponseReceived(data, token)
}.bind(this))
}