diff --git a/public/config.json b/public/config.json index 38a792efa84a4292b91e4a9950d79940f0b13ba6..fad29ef06331f1bdeef1daaea5f44ea4d5e39465 100644 --- a/public/config.json +++ b/public/config.json @@ -8,5 +8,6 @@ }, "token": "k9SL1R~GcdbjiFjC", "invite_user": "@botuser:matrix.midhun.dev", - "encrypt_room": true + "encrypt_room": true, + "avatar": "https://i.imgur.com/FD1z37K.png" } diff --git a/src/types/IChatterboxConfig.ts b/src/types/IChatterboxConfig.ts index 6fab8eeb4f382a8e90f2a3c7f540db121dd09c05..c555e79db1c01bf8e01ca78a12ea543a183ed3f2 100644 --- a/src/types/IChatterboxConfig.ts +++ b/src/types/IChatterboxConfig.ts @@ -13,6 +13,8 @@ export interface IChatterboxConfig { header: IHeader; // Token needed for token-authenticated registration token: string; + // URL of the image that should be used as the users avatar + avatar: string; } interface IHeader { diff --git a/src/viewmodels/tiles.ts b/src/viewmodels/tiles.ts index b91ae0222db2b298798b5adc7d7a4c856990b3e8..ec627354812b7c3e3c8822285dd4eae10f0b6978 100644 --- a/src/viewmodels/tiles.ts +++ b/src/viewmodels/tiles.ts @@ -5,36 +5,84 @@ class ChatterboxTextTile extends TextTile { get displayName() { return this.isOwn? "me" : super.displayName; } + + get avatarLetter() { + return ""; + } + + avatarUrl() { + return this.isOwn? this._options.config["avatar"]: null; + } } class ChatterboxImageTile extends ImageTile { get displayName() { return this.isOwn? "me" : super.displayName; } + + get avatarLetter() { + return ""; + } + + avatarUrl() { + return this.isOwn? this._options.config["avatar"]: null; + } } class ChatterboxVideoTile extends VideoTile { get displayName() { return this.isOwn? "me" : super.displayName; } + + get avatarLetter() { + return ""; + } + + avatarUrl() { + return this.isOwn? this._options.config["avatar"]: null; + } } class ChatterboxFileTile extends FileTile { get displayName() { return this.isOwn? "me" : super.displayName; } + + get avatarLetter() { + return ""; + } + + avatarUrl() { + return this.isOwn? this._options.config["avatar"]: null; + } } class ChatterboxLocationTile extends LocationTile { get displayName() { return this.isOwn? "me" : super.displayName; } + + get avatarLetter() { + return ""; + } + + avatarUrl() { + return this.isOwn? this._options.config["avatar"]: null; + } } class ChatterboxRedactedTile extends RedactedTile { get displayName() { return this.isOwn? "me" : super.displayName; } + + get avatarLetter() { + return ""; + } + + avatarUrl() { + return this._options.config["avatar"]; + } } // We don't want to show the (long and random) user-id in this announcement!