@@ -30,26 +30,6 @@ import ActiveWidgetStore from "../stores/ActiveWidgetStore";
3030import { IntegrationManagers } from "../integrations/IntegrationManagers" ;
3131import { 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-
5333export 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