From 6daae797e5e38589d8cc215e7d3f3abc8313c033 Mon Sep 17 00:00:00 2001 From: Bruno Windels <274386+bwindels@users.noreply.github.com> Date: Thu, 17 Mar 2022 11:31:12 +0100 Subject: [PATCH] fix some ts/lint errors --- src/matrix/DeviceMessageHandler.js | 2 +- src/matrix/Session.js | 7 +++++++ src/matrix/calls/CallHandler.ts | 2 +- src/matrix/calls/PeerCall.ts | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/matrix/DeviceMessageHandler.js b/src/matrix/DeviceMessageHandler.js index 91ef82f6..80fd1592 100644 --- a/src/matrix/DeviceMessageHandler.js +++ b/src/matrix/DeviceMessageHandler.js @@ -16,7 +16,7 @@ limitations under the License. import {OLM_ALGORITHM} from "./e2ee/common.js"; import {countBy, groupBy} from "../utils/groupBy"; -import {LRUCache} from "../../utils/LRUCache"; +import {LRUCache} from "../utils/LRUCache"; export class DeviceMessageHandler { constructor({storage, callHandler}) { diff --git a/src/matrix/Session.js b/src/matrix/Session.js index 69cd9ee0..dbc0b17e 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -47,6 +47,7 @@ import { import {SecretStorage} from "./ssss/SecretStorage"; import {ObservableValue} from "../observable/value/ObservableValue"; import {RetainedObservableValue} from "../observable/value/RetainedObservableValue"; +import {CallHandler} from "./calls/CallHandler"; const PICKLE_KEY = "DEFAULT_KEY"; const PUSHER_KEY = "pusher"; @@ -81,6 +82,8 @@ export class Session { if (!this._deviceTracker || !this._olmEncryption) { throw new Error("encryption is not enabled"); } + // TODO: just get the devices we're sending the message to, not all the room devices + // although we probably already fetched all devices to send messages in the likely e2ee room await this._deviceTracker.trackRoom(roomId, log); const devices = await this._deviceTracker.devicesForTrackedRoom(roomId, this._hsApi, log); const encryptedMessage = await this._olmEncryption.encrypt(message.type, message.content, devices, this._hsApi, log); @@ -132,6 +135,10 @@ export class Session { return this._sessionInfo.userId; } + get callHandler() { + return this._callHandler; + } + // called once this._e2eeAccount is assigned _setupEncryption() { // TODO: this should all go in a wrapper in e2ee/ that is bootstrapped by passing in the account diff --git a/src/matrix/calls/CallHandler.ts b/src/matrix/calls/CallHandler.ts index a0cd8473..a36b17f6 100644 --- a/src/matrix/calls/CallHandler.ts +++ b/src/matrix/calls/CallHandler.ts @@ -37,7 +37,7 @@ const CALL_TERMINATED = "m.terminated"; export type Options = Omit; -export class GroupCallHandler { +export class CallHandler { // group calls by call id private readonly _calls: ObservableMap = new ObservableMap(); // map of userId to set of conf_id's they are in diff --git a/src/matrix/calls/PeerCall.ts b/src/matrix/calls/PeerCall.ts index a4ea8cca..9a702ebd 100644 --- a/src/matrix/calls/PeerCall.ts +++ b/src/matrix/calls/PeerCall.ts @@ -875,7 +875,7 @@ const FALLBACK_ICE_SERVER = 'stun:turn.matrix.org'; /** The length of time a call can be ringing for. */ const CALL_TIMEOUT_MS = 60000; -const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); +//const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); export class CallError extends Error { code: string;