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"; diff --git a/src/matrix/Session.js b/src/matrix/Session.js index cd676fc5..ec085fd4 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -133,6 +133,14 @@ export class Session { this.needsKeyBackup = new ObservableValue(false); } + get hsApi() { + return this._hsApi; + } + + get sessionInfo() { + return this._sessionInfo; + } + get fingerprintKey() { return this._e2eeAccount?.identityKeys.ed25519; } 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); } 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 = {