|
| 1 | +# MSC2765: Widget avatars |
| 2 | + |
| 3 | +Currently widgets have a name and title associated with them, though no opportunity for avatars |
| 4 | +for a favicon-like experience. This proposal introduces such a concept. |
| 5 | + |
| 6 | +## Proposal |
| 7 | + |
| 8 | +A new optional paramater named `avatar_url` is added to the widget definition. This parameter is |
| 9 | +an MXC URI to an image clients can use to associate with the widget, likely alongside the `name` |
| 10 | +and/or `title`. |
| 11 | + |
| 12 | +Widget avatars SHOULD be legible at small sizes, such as 20x20. The MXC URI in the `avatar_url` |
| 13 | +should be the source material to allow clients to use the `/thumbnail` API to get a size for their |
| 14 | +use case. |
| 15 | + |
| 16 | +Rendering avatars is optional for clients, much like how clients are not required to use the `name` |
| 17 | +or `title` of a widget. |
| 18 | + |
| 19 | +An example widget would be: |
| 20 | + |
| 21 | +```json |
| 22 | +{ |
| 23 | + "creatorUserId": "@alice:example.org", |
| 24 | + "data": { |
| 25 | + "custom_key": "This is a custom key", |
| 26 | + "title": "This is a witty description for the widget" |
| 27 | + }, |
| 28 | + "id": "20200827_WidgetExample", |
| 29 | + "name": "My Cool Widget", |
| 30 | + "type": "m.custom", |
| 31 | + "url": "https://example.org/my/widget.html?roomId=$matrix_room_id", |
| 32 | + "waitForIframeLoad": true, |
| 33 | + "avatar_url": "mxc://example.org/abc123" |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +## Alternatives |
| 38 | + |
| 39 | +We could define a whole structured system for different thumbnail sizes, though we have a thumbnail |
| 40 | +API which can be used to request whatever size is needed by the client. |
| 41 | + |
| 42 | +## Security considerations |
| 43 | + |
| 44 | +Widget avatars could be non-images. Clients should use the thumbnail API to encourage error responses |
| 45 | +from the server when a widget avatar is a non-image. |
| 46 | + |
| 47 | +## Unstable prefix |
| 48 | + |
| 49 | +While this MSC is not in a released version of the specification, clients should use an alternative |
| 50 | +event type for widgets or use `org.matrix.msc2765.avatar_url` when using `m.widget` or `m.widgets` |
| 51 | +as an event type. |
0 commit comments