mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-04 05:37:22 +00:00
Authenticate media requests when loading avatars (#2856)
* Load authenicated media * lint * Add tests * Add widget behaviour and test. * Update src/Avatar.test.tsx Co-authored-by: Hugh Nimmo-Smith <hughns@users.noreply.github.com> --------- Co-authored-by: Hugh Nimmo-Smith <hughns@users.noreply.github.com>
This commit is contained in:
@@ -333,15 +333,3 @@ export function getRelativeRoomUrl(
|
||||
: "";
|
||||
return `/room/#${roomPart}?${generateUrlSearchParams(roomId, encryptionSystem, viaServers).toString()}`;
|
||||
}
|
||||
|
||||
export function getAvatarUrl(
|
||||
client: MatrixClient,
|
||||
mxcUrl: string,
|
||||
avatarSize = 96,
|
||||
): string {
|
||||
const width = Math.floor(avatarSize * window.devicePixelRatio);
|
||||
const height = Math.floor(avatarSize * window.devicePixelRatio);
|
||||
// scale is more suitable for larger sizes
|
||||
const resizeMethod = avatarSize <= 96 ? "crop" : "scale";
|
||||
return mxcUrl && client.mxcUrlToHttp(mxcUrl, width, height, resizeMethod)!;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user