@matrix-widget-toolkit/mui 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +4 -3
- package/build/esm/index.js +4 -3
- package/package.json +1 -1
package/build/cjs/index.js
CHANGED
|
@@ -681,10 +681,11 @@ function ElementMuiThemeProvider(_a) {
|
|
|
681
681
|
*/
|
|
682
682
|
function createAvatarUrl(url, _a) {
|
|
683
683
|
var _b = _a === void 0 ? {} : _a, _c = _b.size, size = _c === void 0 ? 60 : _c;
|
|
684
|
-
var
|
|
685
|
-
if (
|
|
684
|
+
var mxcPrefix = 'mxc://';
|
|
685
|
+
if (url.indexOf(mxcPrefix) !== 0) {
|
|
686
686
|
return url;
|
|
687
687
|
}
|
|
688
|
+
var mxcUrl = url.slice(mxcPrefix.length);
|
|
688
689
|
// TODO: Instead of retrieving the home server from an env variable, it would
|
|
689
690
|
// be good to get this passed by the widget host, e.g. as an URL parameter.
|
|
690
691
|
// In general our tight CSP makes it difficult to load images from this
|
|
@@ -693,7 +694,7 @@ function createAvatarUrl(url, _a) {
|
|
|
693
694
|
// current users id and resolving the home server URL from the well-known
|
|
694
695
|
// endpoint. However, this would also require a broad connect-src in the CSP.
|
|
695
696
|
var homeServer = getEnvironment('REACT_APP_HOME_SERVER_URL', 'https://matrix-client.matrix.org');
|
|
696
|
-
var imageUrl = new URL("/_matrix/media/r0/thumbnail/".concat(mxcUrl
|
|
697
|
+
var imageUrl = new URL("/_matrix/media/r0/thumbnail/".concat(mxcUrl, "?width=").concat(size, "&height=").concat(size, "&method=crop"), homeServer);
|
|
697
698
|
return imageUrl.toString();
|
|
698
699
|
}
|
|
699
700
|
|
package/build/esm/index.js
CHANGED
|
@@ -669,10 +669,11 @@ function ElementMuiThemeProvider(_a) {
|
|
|
669
669
|
*/
|
|
670
670
|
function createAvatarUrl(url, _a) {
|
|
671
671
|
var _b = _a === void 0 ? {} : _a, _c = _b.size, size = _c === void 0 ? 60 : _c;
|
|
672
|
-
var
|
|
673
|
-
if (
|
|
672
|
+
var mxcPrefix = 'mxc://';
|
|
673
|
+
if (url.indexOf(mxcPrefix) !== 0) {
|
|
674
674
|
return url;
|
|
675
675
|
}
|
|
676
|
+
var mxcUrl = url.slice(mxcPrefix.length);
|
|
676
677
|
// TODO: Instead of retrieving the home server from an env variable, it would
|
|
677
678
|
// be good to get this passed by the widget host, e.g. as an URL parameter.
|
|
678
679
|
// In general our tight CSP makes it difficult to load images from this
|
|
@@ -681,7 +682,7 @@ function createAvatarUrl(url, _a) {
|
|
|
681
682
|
// current users id and resolving the home server URL from the well-known
|
|
682
683
|
// endpoint. However, this would also require a broad connect-src in the CSP.
|
|
683
684
|
var homeServer = getEnvironment('REACT_APP_HOME_SERVER_URL', 'https://matrix-client.matrix.org');
|
|
684
|
-
var imageUrl = new URL("/_matrix/media/r0/thumbnail/".concat(mxcUrl
|
|
685
|
+
var imageUrl = new URL("/_matrix/media/r0/thumbnail/".concat(mxcUrl, "?width=").concat(size, "&height=").concat(size, "&method=crop"), homeServer);
|
|
685
686
|
return imageUrl.toString();
|
|
686
687
|
}
|
|
687
688
|
|
package/package.json
CHANGED