fix some ts/lint errors

This commit is contained in:
Bruno Windels 2022-03-17 11:31:12 +01:00
parent 07bc0a2376
commit 6daae797e5
4 changed files with 10 additions and 3 deletions

View file

@ -16,7 +16,7 @@ limitations under the License.
import {OLM_ALGORITHM} from "./e2ee/common.js"; import {OLM_ALGORITHM} from "./e2ee/common.js";
import {countBy, groupBy} from "../utils/groupBy"; import {countBy, groupBy} from "../utils/groupBy";
import {LRUCache} from "../../utils/LRUCache"; import {LRUCache} from "../utils/LRUCache";
export class DeviceMessageHandler { export class DeviceMessageHandler {
constructor({storage, callHandler}) { constructor({storage, callHandler}) {

View file

@ -47,6 +47,7 @@ import {
import {SecretStorage} from "./ssss/SecretStorage"; import {SecretStorage} from "./ssss/SecretStorage";
import {ObservableValue} from "../observable/value/ObservableValue"; import {ObservableValue} from "../observable/value/ObservableValue";
import {RetainedObservableValue} from "../observable/value/RetainedObservableValue"; import {RetainedObservableValue} from "../observable/value/RetainedObservableValue";
import {CallHandler} from "./calls/CallHandler";
const PICKLE_KEY = "DEFAULT_KEY"; const PICKLE_KEY = "DEFAULT_KEY";
const PUSHER_KEY = "pusher"; const PUSHER_KEY = "pusher";
@ -81,6 +82,8 @@ export class Session {
if (!this._deviceTracker || !this._olmEncryption) { if (!this._deviceTracker || !this._olmEncryption) {
throw new Error("encryption is not enabled"); 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); await this._deviceTracker.trackRoom(roomId, log);
const devices = await this._deviceTracker.devicesForTrackedRoom(roomId, this._hsApi, 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); 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; return this._sessionInfo.userId;
} }
get callHandler() {
return this._callHandler;
}
// called once this._e2eeAccount is assigned // called once this._e2eeAccount is assigned
_setupEncryption() { _setupEncryption() {
// TODO: this should all go in a wrapper in e2ee/ that is bootstrapped by passing in the account // TODO: this should all go in a wrapper in e2ee/ that is bootstrapped by passing in the account

View file

@ -37,7 +37,7 @@ const CALL_TERMINATED = "m.terminated";
export type Options = Omit<GroupCallOptions, "emitUpdate">; export type Options = Omit<GroupCallOptions, "emitUpdate">;
export class GroupCallHandler { export class CallHandler {
// group calls by call id // group calls by call id
private readonly _calls: ObservableMap<string, GroupCall> = new ObservableMap<string, GroupCall>(); private readonly _calls: ObservableMap<string, GroupCall> = new ObservableMap<string, GroupCall>();
// map of userId to set of conf_id's they are in // map of userId to set of conf_id's they are in

View file

@ -875,7 +875,7 @@ const FALLBACK_ICE_SERVER = 'stun:turn.matrix.org';
/** The length of time a call can be ringing for. */ /** The length of time a call can be ringing for. */
const CALL_TIMEOUT_MS = 60000; 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 { export class CallError extends Error {
code: string; code: string;