Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/utils/e2ee/encryption.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Encryption {
/**
* Check if the current browser supports encryption.
*
* @return {boolean} Returns true if supported and throws an error otherwise.
* @return {Promise<boolean>} Returns true if supported and throws an error otherwise.
* @async
*/
static async isSupported() {
Expand Down
57 changes: 30 additions & 27 deletions src/utils/signaling.js
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ Signaling.Standalone.prototype._getBackendUrl = function(baseURL = undefined) {
return generateOcsUrl('apps/spreed/api/v3/signaling/backend', {}, { baseURL })
}

Signaling.Standalone.prototype.sendHello = function() {
Signaling.Standalone.prototype.sendHello = async function() {
if (this.resumeId) {
console.debug('Trying to resume session', this.sessionId)
const msg = {
Expand All @@ -1027,33 +1027,36 @@ Signaling.Standalone.prototype.sendHello = function() {
helloVersion = '1.0'
}
const features = ['chat-relay']
Encryption.isSupported()
.then(() => {
features.push('encryption')
})
.catch(() => {
// Ignore any errors.
})
.finally(() => {
const msg = {
type: 'hello',
hello: {
version: helloVersion,
auth: {
url,
params: this.settings.helloAuthParams[helloVersion],
},
},
}
if (features.length > 0) {
msg.hello.features = features
}
if (this.settings.helloAuthParams.internal) {
msg.hello.auth.type = 'internal'
msg.hello.auth.params = this.settings.helloAuthParams.internal

try {
if (Encryption.isEnabled()) {
const isSupported = await Encryption.isSupported()
if (isSupported) {
features.push('encryption')
}
this.doSend(msg, this.helloResponseReceived.bind(this))
})
}
} catch (error) {
// Ignore any errors.
}

const msg = {
type: 'hello',
hello: {
version: helloVersion,
auth: {
url,
params: this.settings.helloAuthParams[helloVersion],
},
},
}
if (features.length > 0) {
msg.hello.features = features
}
if (this.settings.helloAuthParams.internal) {
msg.hello.auth.type = 'internal'
msg.hello.auth.params = this.settings.helloAuthParams.internal
}
this.doSend(msg, this.helloResponseReceived.bind(this))
}

Signaling.Standalone.prototype.helloResponseReceived = function(data) {
Expand Down
Loading