From 936ac2e9325d0bf631362637bd9a828418302bf4 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Wed, 25 May 2022 08:52:31 +0530 Subject: [PATCH 1/5] Make hsApi public --- src/matrix/Session.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/matrix/Session.js b/src/matrix/Session.js index cd676fc5..68bae7ea 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -133,6 +133,10 @@ export class Session { this.needsKeyBackup = new ObservableValue(false); } + get hsApi() { + return this._hsApi; + } + get fingerprintKey() { return this._e2eeAccount?.identityKeys.ed25519; } From 2465180300e14ce1ad28712f4949069526a9ad36 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Wed, 25 May 2022 14:48:20 +0530 Subject: [PATCH 2/5] Make sessionInfo public --- src/matrix/Session.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/matrix/Session.js b/src/matrix/Session.js index 68bae7ea..ec085fd4 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -137,6 +137,10 @@ export class Session { return this._hsApi; } + get sessionInfo() { + return this._sessionInfo; + } + get fingerprintKey() { return this._e2eeAccount?.identityKeys.ed25519; } From 96f58327ee997952aa65407c7ce9f6aa57e2c04c Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Thu, 26 May 2022 08:57:38 +0530 Subject: [PATCH 3/5] Export LoginFailure from client --- src/lib.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.ts b/src/lib.ts index 6e93be14..34d57458 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -19,7 +19,7 @@ export type {ILogItem} from "./logging/types"; export {IDBLogPersister} from "./logging/IDBLogPersister"; export {ConsoleReporter} from "./logging/ConsoleReporter"; export {Platform} from "./platform/web/Platform.js"; -export {Client, LoadStatus} from "./matrix/Client.js"; +export {Client, LoadStatus, LoginFailure} from "./matrix/Client.js"; export {RoomStatus} from "./matrix/room/common"; export {AttachmentUpload} from "./matrix/room/AttachmentUpload"; export {CallIntent} from "./matrix/calls/callEventTypes"; From 46230e59add55f2d16f151496ecec4e78060d731 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Thu, 26 May 2022 11:59:50 +0530 Subject: [PATCH 4/5] Add setProfileAvatarURl and displayName --- src/matrix/net/HomeServerApi.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/matrix/net/HomeServerApi.ts b/src/matrix/net/HomeServerApi.ts index 30406c34..7f0f17ca 100644 --- a/src/matrix/net/HomeServerApi.ts +++ b/src/matrix/net/HomeServerApi.ts @@ -302,6 +302,14 @@ export class HomeServerApi { return this._get(`/profile/${encodeURIComponent(userId)}`); } + setProfileDisplayName(userId, displayName, options?: BaseRequestOptions): IHomeServerRequest { + return this._put(`/profile/${encodeURIComponent(userId)}/displayname`, {}, { displayname: displayName }, options); + } + + setProfileAvatarUrl(userId, avatarUrl, options?: BaseRequestOptions): IHomeServerRequest { + return this._put(`/profile/${encodeURIComponent(userId)}/avatar_url`, {}, { avatar_url: avatarUrl }, options); + } + createRoom(payload: Record, options?: BaseRequestOptions): IHomeServerRequest { return this._post(`/createRoom`, {}, payload, options); } From dc1f0fecb5a1f6b8c0f52ba9e77d6faa44117d1f Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Mon, 6 Jun 2022 13:04:48 +0530 Subject: [PATCH 5/5] Add profile world type --- src/matrix/room/RoomBeingCreated.ts | 7 ++++--- src/matrix/room/common.ts | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/matrix/room/RoomBeingCreated.ts b/src/matrix/room/RoomBeingCreated.ts index f825c163..08c8af3d 100644 --- a/src/matrix/room/RoomBeingCreated.ts +++ b/src/matrix/room/RoomBeingCreated.ts @@ -151,9 +151,10 @@ export class RoomBeingCreated extends EventEmitter<{change: never}> { createOptions.room_alias_name = this.options.alias; } if (this.options.type !== undefined) { - createOptions.creation_content = { - type: this.options.type === RoomType.World ? "org.matrix.msc3815.world" : undefined, - }; + let type: string | undefined = undefined; + if (this.options.type === RoomType.World) type = "org.matrix.msc3815.world"; + if (this.options.type === RoomType.Profile) type = "org.matrix.msc3815.profile"; + createOptions.creation_content = { type }; } if (this.options.isFederationDisabled === true) { if (createOptions.creation_content === undefined) createOptions.creation_content = {}; diff --git a/src/matrix/room/common.ts b/src/matrix/room/common.ts index bd6adda4..ba1bd8e3 100644 --- a/src/matrix/room/common.ts +++ b/src/matrix/room/common.ts @@ -48,7 +48,8 @@ export enum RoomVisibility { } export enum RoomType { - World + World, + Profile, } type RoomResponse = {