From 0febd99fbe4f01a5fe43b0411cb54c40687657e0 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Sun, 5 Jul 2020 12:54:01 +0100 Subject: [PATCH 01/12] Add _unstable_getSharedRooms --- src/client.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/client.js b/src/client.js index 7efa758e9..4f1eb960b 100644 --- a/src/client.js +++ b/src/client.js @@ -4843,6 +4843,23 @@ MatrixClient.prototype._storeClientOptions = function() { return this.store.storeClientOptions(serializableOpts); }; +/** + * Gets a set of room IDs in common with another user + * @param {string} userId The userId to check. + * @return {Promise} Resolves to a set of rooms + * @return {module:http-api.MatrixError} Rejects: with an error response. + */ +MatrixClient.prototype._unstable_getSharedRooms = function(userId) { + const path = utils.encodeUri("/user/$userId/shared_rooms/$otherUserId", { + $userId: this.credentials.userId, + $otherUserId: userId, + }); + return this._http.authedRequest( + undefined, "GET", path, undefined, undefined, + {prefix: PREFIX_UNSTABLE}, + ); +}; + /** * High level helper method to stop the client from polling and allow a * clean shutdown. From e69e6e198122214117b07138f6b19844c207636c Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Sun, 5 Jul 2020 13:47:32 +0100 Subject: [PATCH 02/12] Update _unstable_getSharedRooms response format --- src/client.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client.js b/src/client.js index 4f1eb960b..3a00d1493 100644 --- a/src/client.js +++ b/src/client.js @@ -4849,15 +4849,16 @@ MatrixClient.prototype._storeClientOptions = function() { * @return {Promise} Resolves to a set of rooms * @return {module:http-api.MatrixError} Rejects: with an error response. */ -MatrixClient.prototype._unstable_getSharedRooms = function(userId) { +MatrixClient.prototype._unstable_getSharedRooms = async function(userId) { const path = utils.encodeUri("/user/$userId/shared_rooms/$otherUserId", { $userId: this.credentials.userId, $otherUserId: userId, }); - return this._http.authedRequest( + const res = await this._http.authedRequest( undefined, "GET", path, undefined, undefined, {prefix: PREFIX_UNSTABLE}, ); + return res.rooms; }; /** From cf0a5305e043829900a0ab3385c78ca6a0b4fe43 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Sun, 5 Jul 2020 14:09:18 +0100 Subject: [PATCH 03/12] Throw if server does not support getSharedRooms --- src/client.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client.js b/src/client.js index 3a00d1493..098478a5c 100644 --- a/src/client.js +++ b/src/client.js @@ -4850,6 +4850,9 @@ MatrixClient.prototype._storeClientOptions = function() { * @return {module:http-api.MatrixError} Rejects: with an error response. */ MatrixClient.prototype._unstable_getSharedRooms = async function(userId) { + if (!(await this.doesServerSupportUnstableFeature("uk.half-shot.msc2664"))) { + throw Error('Server does not support shared_rooms API'); + } const path = utils.encodeUri("/user/$userId/shared_rooms/$otherUserId", { $userId: this.credentials.userId, $otherUserId: userId, From 4577dc8f445940f891c2be01417b0a5c34261d0d Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Sun, 5 Jul 2020 15:02:51 +0100 Subject: [PATCH 04/12] s/msc2644/msc2666/ --- src/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.js b/src/client.js index 098478a5c..779f611ad 100644 --- a/src/client.js +++ b/src/client.js @@ -4850,7 +4850,7 @@ MatrixClient.prototype._storeClientOptions = function() { * @return {module:http-api.MatrixError} Rejects: with an error response. */ MatrixClient.prototype._unstable_getSharedRooms = async function(userId) { - if (!(await this.doesServerSupportUnstableFeature("uk.half-shot.msc2664"))) { + if (!(await this.doesServerSupportUnstableFeature("uk.half-shot.msc2666"))) { throw Error('Server does not support shared_rooms API'); } const path = utils.encodeUri("/user/$userId/shared_rooms/$otherUserId", { From 80fe66c481a4e66f06ab6b6eabeed23978a6e869 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Fri, 10 Jul 2020 12:01:23 +0100 Subject: [PATCH 05/12] Add /uk.half-shot.msc2666/ prefix --- src/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.js b/src/client.js index 779f611ad..b90c29c6b 100644 --- a/src/client.js +++ b/src/client.js @@ -4853,7 +4853,7 @@ MatrixClient.prototype._unstable_getSharedRooms = async function(userId) { if (!(await this.doesServerSupportUnstableFeature("uk.half-shot.msc2666"))) { throw Error('Server does not support shared_rooms API'); } - const path = utils.encodeUri("/user/$userId/shared_rooms/$otherUserId", { + const path = utils.encodeUri("/uk.half-shot.msc2666/user/$userId/shared_rooms/$otherUserId", { $userId: this.credentials.userId, $otherUserId: userId, }); From a919c798f8c904202b3a5c6efe97a2995a926f31 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Fri, 31 Jul 2020 14:46:26 +0100 Subject: [PATCH 06/12] Update _unstable_getSharedRooms to match spec --- src/client.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/client.js b/src/client.js index b90c29c6b..40435f059 100644 --- a/src/client.js +++ b/src/client.js @@ -4849,19 +4849,18 @@ MatrixClient.prototype._storeClientOptions = function() { * @return {Promise} Resolves to a set of rooms * @return {module:http-api.MatrixError} Rejects: with an error response. */ -MatrixClient.prototype._unstable_getSharedRooms = async function(userId) { +MatrixClient.prototype._unstable_getSharedRooms = async function() { if (!(await this.doesServerSupportUnstableFeature("uk.half-shot.msc2666"))) { throw Error('Server does not support shared_rooms API'); } - const path = utils.encodeUri("/uk.half-shot.msc2666/user/$userId/shared_rooms/$otherUserId", { + const path = utils.encodeUri("/uk.half-shot.msc2666/user/shared_rooms/userId", { $userId: this.credentials.userId, - $otherUserId: userId, }); const res = await this._http.authedRequest( undefined, "GET", path, undefined, undefined, {prefix: PREFIX_UNSTABLE}, ); - return res.rooms; + return res.joined; }; /** From 1a1fe759c312b656c7467be1080e09cd66da50a7 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Tue, 18 Aug 2020 18:41:45 +0100 Subject: [PATCH 07/12] fix encoding bug --- src/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.js b/src/client.js index 40435f059..a747860ea 100644 --- a/src/client.js +++ b/src/client.js @@ -4853,7 +4853,7 @@ MatrixClient.prototype._unstable_getSharedRooms = async function() { if (!(await this.doesServerSupportUnstableFeature("uk.half-shot.msc2666"))) { throw Error('Server does not support shared_rooms API'); } - const path = utils.encodeUri("/uk.half-shot.msc2666/user/shared_rooms/userId", { + const path = utils.encodeUri("/uk.half-shot.msc2666/user/shared_rooms/$userId", { $userId: this.credentials.userId, }); const res = await this._http.authedRequest( From 6ec7e3a0b7fb97463b07a18a67954bff64317010 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Tue, 18 Aug 2020 18:42:55 +0100 Subject: [PATCH 08/12] UserId must be sane --- src/client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client.js b/src/client.js index a747860ea..2b1210fd4 100644 --- a/src/client.js +++ b/src/client.js @@ -4849,12 +4849,12 @@ MatrixClient.prototype._storeClientOptions = function() { * @return {Promise} Resolves to a set of rooms * @return {module:http-api.MatrixError} Rejects: with an error response. */ -MatrixClient.prototype._unstable_getSharedRooms = async function() { +MatrixClient.prototype._unstable_getSharedRooms = async function(userId) { if (!(await this.doesServerSupportUnstableFeature("uk.half-shot.msc2666"))) { throw Error('Server does not support shared_rooms API'); } const path = utils.encodeUri("/uk.half-shot.msc2666/user/shared_rooms/$userId", { - $userId: this.credentials.userId, + $userId: userId, }); const res = await this._http.authedRequest( undefined, "GET", path, undefined, undefined, From 6e7b9ca6c08f86372491cde55a1a20f4db301dbc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Dec 2020 16:54:57 +0000 Subject: [PATCH 09/12] Bump node-notifier from 8.0.0 to 8.0.1 Bumps [node-notifier](https://github.com/mikaelbr/node-notifier) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/mikaelbr/node-notifier/releases) - [Changelog](https://github.com/mikaelbr/node-notifier/blob/v8.0.1/CHANGELOG.md) - [Commits](https://github.com/mikaelbr/node-notifier/compare/v8.0.0...v8.0.1) Signed-off-by: dependabot[bot] --- yarn.lock | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/yarn.lock b/yarn.lock index 672692477..8acea00d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4984,6 +4984,13 @@ lru-cache@^4.1.5: pseudomap "^1.0.2" yallist "^2.1.2" +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + make-dir@^2.0.0, make-dir@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" @@ -5269,9 +5276,9 @@ node-modules-regexp@^1.0.0: integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= node-notifier@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-8.0.0.tgz#a7eee2d51da6d0f7ff5094bc7108c911240c1620" - integrity sha512-46z7DUmcjoYdaWyXouuFNNfUo6eFa94t23c53c+lG/9Cvauk4a98rAUp9672X5dxGdQmLpPzTxzu8f/OeEPaFA== + version "8.0.1" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-8.0.1.tgz#f86e89bbc925f2b068784b31f382afdc6ca56be1" + integrity sha512-BvEXF+UmsnAfYfoapKM9nGxnP+Wn7P91YfXmrKnfcYCx6VBeoN5Ez5Ogck6I8Bi5k4RlpqRYaw75pAwzX9OphA== dependencies: growly "^1.3.0" is-wsl "^2.2.0" @@ -6381,9 +6388,11 @@ semver@^6.0.0, semver@^6.1.0, semver@^6.1.2, semver@^6.3.0: integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== semver@^7.2.1, semver@^7.3.2: - version "7.3.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" - integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== + version "7.3.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" + integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== + dependencies: + lru-cache "^6.0.0" set-blocking@^2.0.0: version "2.0.0" @@ -7297,9 +7306,9 @@ uuid@^3.3.2: integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== uuid@^8.3.0: - version "8.3.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.1.tgz#2ba2e6ca000da60fce5a196954ab241131e05a31" - integrity sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg== + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== v8-compile-cache@^2.0.3: version "2.2.0" @@ -7571,6 +7580,11 @@ yallist@^2.1.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + yargs-parser@^18.1.2: version "18.1.3" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" From f8f76f6806b7c4a111aa67f60b2182ae4e600b11 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 4 Jan 2021 19:58:12 +0000 Subject: [PATCH 10/12] Add DTMF sending support --- src/webrtc/call.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index fea0db149..2dd8e319c 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -694,6 +694,21 @@ export class MatrixCall extends EventEmitter { return callOnHold; } + /** + * Sends a DTMF digit to the other party + * @param digit The digit (nb. string - '#' and '*' are dtmf too) + */ + sendDtmfDigit(digit: string) { + for (const sender of this.peerConn.getSenders()) { + if (sender.track.kind === 'audio' && sender.dtmf) { + sender.dtmf.insertDTMF(digit); + return; + } + } + + throw new Error("Unable to kind a track to send DTMF on"); + } + private updateMuteStatus() { if (!this.localAVStream) { return; From b692cd109e36425f56ba1821894aa1bef623ff86 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 12 Jan 2021 17:58:35 +0000 Subject: [PATCH 11/12] Don't log if no WebRTC as hopefully explained in comment --- src/webrtc/call.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index fc20301e4..c69ab2e4c 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -1663,7 +1663,8 @@ export function setVideoInput(deviceId: string) { videoInput = deviceId; } export function createNewMatrixCall(client: any, roomId: string, options?: CallOpts) { // typeof prevents Node from erroring on an undefined reference if (typeof(window) === 'undefined' || typeof(document) === 'undefined') { - logger.info("No window or document object: WebRTC is not supported in this environment"); + // NB. We don't log here as apps try to create a call object as a test for + // whether calls are supported, so we shouldn't fill the logs up. return null; } From 5b1fdb7b37e1c918d9ed5c3b209b00ce77b35475 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 13 Jan 2021 11:37:30 +0000 Subject: [PATCH 12/12] Typo Co-authored-by: J. Ryan Stinnett --- src/webrtc/call.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index 2dd8e319c..a2b049031 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -706,7 +706,7 @@ export class MatrixCall extends EventEmitter { } } - throw new Error("Unable to kind a track to send DTMF on"); + throw new Error("Unable to find a track to send DTMF on"); } private updateMuteStatus() {