11/*
2- * Copyright 2020 The Matrix.org Foundation C.I.C.
2+ * Copyright 2020, 2021 The Matrix.org Foundation C.I.C.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -21,16 +21,24 @@ export interface ITemplateParams {
2121 currentUserId : string ;
2222 userDisplayName ?: string ;
2323 userHttpAvatarUrl ?: string ;
24+ clientId ?: string ;
25+ clientTheme ?: string ;
26+ clientLanguage ?: string ;
2427}
2528
2629export function runTemplate ( url : string , widget : IWidget , params : ITemplateParams ) : string {
2730 // Always apply the supplied params over top of data to ensure the data can't lie about them.
2831 const variables = Object . assign ( { } , widget . data , {
29- matrix_room_id : params . widgetRoomId || "" ,
30- matrix_user_id : params . currentUserId ,
31- matrix_display_name : params . userDisplayName || params . currentUserId ,
32- matrix_avatar_url : params . userHttpAvatarUrl || "" ,
33- matrix_widget_id : widget . id ,
32+ 'matrix_room_id' : params . widgetRoomId || "" ,
33+ 'matrix_user_id' : params . currentUserId ,
34+ 'matrix_display_name' : params . userDisplayName || params . currentUserId ,
35+ 'matrix_avatar_url' : params . userHttpAvatarUrl || "" ,
36+ 'matrix_widget_id' : widget . id ,
37+
38+ // TODO: Convert to stable (https://github.com/matrix-org/matrix-doc/pull/2873)
39+ 'org.matrix.msc2873.client_id' : params . clientId || "" ,
40+ 'org.matrix.msc2873.client_theme' : params . clientTheme || "" ,
41+ 'org.matrix.msc2873.client_language' : params . clientLanguage || "" ,
3442 } ) ;
3543 let result = url ;
3644 for ( const key of Object . keys ( variables ) ) {
0 commit comments