Skip to content

Commit cda7180

Browse files
Merge tag 'v2.3.1' into AMP.chat
[Full Changelog](matrix-org/matrix-react-sdk@v2.3.0...v2.3.1) * Fix jitsi popout URL [\matrix-org#4327](matrix-org#4327) * Remove underscore from Jitsi conference names [\matrix-org#4324](matrix-org#4324) * Fix popout support for jitsi widgets [\matrix-org#4322](matrix-org#4322) Change-Id: I7e1aa18ccac13d107d4c72400ee91932c37cbef4
2 parents aed0142 + adb2fc8 commit cda7180

File tree

11 files changed

+155
-154
lines changed

11 files changed

+155
-154
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
Changes in [2.3.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v2.3.1) (2020-04-01)
2+
===================================================================================================
3+
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v2.3.0...v2.3.1)
4+
5+
* Fix jitsi popout URL
6+
[\#4327](https://github.com/matrix-org/matrix-react-sdk/pull/4327)
7+
* Remove underscore from Jitsi conference names
8+
[\#4324](https://github.com/matrix-org/matrix-react-sdk/pull/4324)
9+
* Fix popout support for jitsi widgets
10+
[\#4322](https://github.com/matrix-org/matrix-react-sdk/pull/4322)
11+
112
Changes in [2.3.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v2.3.0) (2020-03-30)
213
===================================================================================================
314
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v2.3.0-rc.1...v2.3.0)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "matrix-react-sdk",
3-
"version": "2.3.0",
3+
"version": "2.3.1",
44
"description": "SDK for matrix.org using React",
55
"author": "matrix.org",
66
"repository": {

src/CallHandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ async function _startCallApp(roomId, type) {
430430
return;
431431
}
432432

433-
const confId = `JitsiConference_${generateHumanReadableId()}`;
433+
const confId = `JitsiConference${generateHumanReadableId()}`;
434434
const jitsiDomain = SdkConfig.get()['jitsi']['preferredDomain'];
435435

436436
let widgetUrl = WidgetUtils.getLocalJitsiWrapperUrl();

src/FromWidgetPostMessageApi.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ import {MatrixClientPeg} from "./MatrixClientPeg";
2424
import RoomViewStore from "./stores/RoomViewStore";
2525
import {IntegrationManagers} from "./integrations/IntegrationManagers";
2626
import SettingsStore from "./settings/SettingsStore";
27-
import {Capability, KnownWidgetActions} from "./widgets/WidgetApi";
28-
import SdkConfig from "./SdkConfig";
27+
import {Capability} from "./widgets/WidgetApi";
2928

3029
const WIDGET_API_VERSION = '0.0.2'; // Current API version
3130
const SUPPORTED_WIDGET_API_VERSIONS = [
@@ -220,13 +219,6 @@ export default class FromWidgetPostMessageApi {
220219
}
221220
} else if (action === 'get_openid') {
222221
// Handled by caller
223-
} else if (action === KnownWidgetActions.GetRiotWebConfig) {
224-
if (ActiveWidgetStore.widgetHasCapability(widgetId, Capability.GetRiotWebConfig)) {
225-
this.sendResponse(event, {
226-
api: INBOUND_API_NAME,
227-
config: SdkConfig.get(),
228-
});
229-
}
230222
} else {
231223
console.warn('Widget postMessage event unhandled');
232224
this.sendError(event, {message: 'The postMessage was unhandled'});

src/SdkConfig.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ export const DEFAULTS: ConfigOptions = {
3030
jitsi: {
3131
// Default conference domain
3232
preferredDomain: "jitsi.riot.im",
33-
// Default Jitsi Meet API location
34-
externalApiUrl: "https://jitsi.riot.im/libs/external_api.min.js",
3533
},
3634
};
3735

src/components/views/elements/AppTile.js

Lines changed: 129 additions & 57 deletions
Large diffs are not rendered by default.

src/components/views/elements/PersistentApp.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright 2018 New Vector Ltd
3-
Copyright 2019 The Matrix.org Foundation C.I.C.
3+
Copyright 2019, 2020 The Matrix.org Foundation C.I.C.
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -75,11 +75,7 @@ export default createReactClass({
7575
const AppTile = sdk.getComponent('elements.AppTile');
7676
return <AppTile
7777
key={app.id}
78-
id={app.id}
79-
eventId={app.eventId}
80-
url={app.url}
81-
name={app.name}
82-
type={app.type}
78+
app={app}
8379
fullWidth={true}
8480
room={persistentWidgetInRoom}
8581
userId={MatrixClientPeg.get().credentials.userId}

src/components/views/rooms/AppsDrawer.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,7 @@ export default createReactClass({
160160

161161
return (<AppTile
162162
key={app.id}
163-
id={app.id}
164-
eventId={app.eventId}
165-
url={app.url}
166-
name={app.name}
167-
type={app.type}
163+
app={app}
168164
fullWidth={arr.length<2 ? true : false}
169165
room={this.props.room}
170166
userId={this.props.userId}

src/components/views/rooms/Stickerpicker.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,14 @@ export default class Stickerpicker extends React.Component {
240240
// Set default name
241241
stickerpickerWidget.content.name = stickerpickerWidget.name || _t("Stickerpack");
242242

243+
// FIXME: could this use the same code as other apps?
244+
const stickerApp = {
245+
id: stickerpickerWidget.id,
246+
url: stickerpickerWidget.content.url,
247+
name: stickerpickerWidget.content.name,
248+
type: stickerpickerWidget.content.type,
249+
};
250+
243251
stickersContent = (
244252
<div className='mx_Stickers_content_container'>
245253
<div
@@ -253,11 +261,8 @@ export default class Stickerpicker extends React.Component {
253261
>
254262
<PersistedElement persistKey={PERSISTED_ELEMENT_KEY} style={{zIndex: STICKERPICKER_Z_INDEX}}>
255263
<AppTile
256-
id={stickerpickerWidget.id}
257-
url={stickerpickerWidget.content.url}
258-
name={stickerpickerWidget.content.name}
264+
app={stickerApp}
259265
room={this.props.room}
260-
type={stickerpickerWidget.content.type}
261266
fullWidth={true}
262267
userId={MatrixClientPeg.get().credentials.userId}
263268
creatorUserId={stickerpickerWidget.sender || MatrixClientPeg.get().credentials.userId}

src/utils/WidgetUtils.js

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,6 @@ import ActiveWidgetStore from "../stores/ActiveWidgetStore";
3030
import {IntegrationManagers} from "../integrations/IntegrationManagers";
3131
import {Capability} from "../widgets/WidgetApi";
3232

33-
/**
34-
* Encodes a URI according to a set of template variables. Variables will be
35-
* passed through encodeURIComponent.
36-
* @param {string} pathTemplate The path with template variables e.g. '/foo/$bar'.
37-
* @param {Object} variables The key/value pairs to replace the template
38-
* variables with. E.g. { '$bar': 'baz' }.
39-
* @return {string} The result of replacing all template variables e.g. '/foo/baz'.
40-
*/
41-
function encodeUri(pathTemplate, variables) {
42-
for (const key in variables) {
43-
if (!variables.hasOwnProperty(key)) {
44-
continue;
45-
}
46-
pathTemplate = pathTemplate.replace(
47-
key, encodeURIComponent(variables[key]),
48-
);
49-
}
50-
return pathTemplate;
51-
}
52-
5333
export default class WidgetUtils {
5434
/* Returns true if user is able to send state events to modify widgets in this room
5535
* (Does not apply to non-room-based / user widgets)
@@ -402,18 +382,6 @@ export default class WidgetUtils {
402382
}
403383

404384
static makeAppConfig(appId, app, senderUserId, roomId, eventId) {
405-
const myUserId = MatrixClientPeg.get().credentials.userId;
406-
const user = MatrixClientPeg.get().getUser(myUserId);
407-
const params = {
408-
'$matrix_user_id': myUserId,
409-
'$matrix_room_id': roomId,
410-
'$matrix_display_name': user ? user.displayName : myUserId,
411-
'$matrix_avatar_url': user ? MatrixClientPeg.get().mxcUrlToHttp(user.avatarUrl) : '',
412-
413-
// TODO: Namespace themes through some standard
414-
'$theme': SettingsStore.getValue("theme"),
415-
};
416-
417385
if (!senderUserId) {
418386
throw new Error("Widgets must be created by someone - provide a senderUserId");
419387
}
@@ -423,32 +391,6 @@ export default class WidgetUtils {
423391
app.eventId = eventId;
424392
app.name = app.name || app.type;
425393

426-
if (app.type === 'jitsi') {
427-
console.log("Replacing Jitsi widget URL with local wrapper");
428-
if (!app.data || !app.data.conferenceId) {
429-
// Assumed to be a v1 widget: add a data object for visibility on the wrapper
430-
// TODO: Remove this once mobile supports v2 widgets
431-
console.log("Replacing v1 Jitsi widget with v2 equivalent");
432-
const parsed = new URL(app.url);
433-
app.data = {
434-
conferenceId: parsed.searchParams.get("confId"),
435-
domain: "jitsi.riot.im", // v1 widgets have this hardcoded
436-
};
437-
}
438-
439-
app.url = WidgetUtils.getLocalJitsiWrapperUrl({forLocalRender: true});
440-
}
441-
442-
if (app.data) {
443-
Object.keys(app.data).forEach((key) => {
444-
params['$' + key] = app.data[key];
445-
});
446-
447-
app.waitForIframeLoad = (app.data.waitForIframeLoad === 'false' ? false : true);
448-
}
449-
450-
app.url = encodeUri(app.url, params);
451-
452394
return app;
453395
}
454396

@@ -462,7 +404,6 @@ export default class WidgetUtils {
462404
// widgets from at all, but it probably makes sense for sanity.
463405
if (appType === 'jitsi') {
464406
capWhitelist.push(Capability.AlwaysOnScreen);
465-
capWhitelist.push(Capability.GetRiotWebConfig);
466407
}
467408

468409
return capWhitelist;

0 commit comments

Comments
 (0)