From b14759a27b29f79064244c9ca8d2dda60bb91b42 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 4 Aug 2022 17:15:16 -0400 Subject: [PATCH 1/4] Add `room_types` and `room_type` to `/publicRooms` (#1199) MSC: https://github.com/matrix-org/matrix-spec-proposals/pull/3827 Incorporates https://github.com/matrix-org/matrix-spec-proposals/pull/3858 --- .../client_server/newsfragments/1199.feature | 1 + .../definitions/public_rooms_chunk.yaml | 5 +++++ .../definitions/public_rooms_response.yaml | 3 ++- data/api/client-server/list_public_rooms.yaml | 17 +++++++++++++--- data/api/client-server/space_hierarchy.yaml | 1 + data/api/server-server/public_rooms.yaml | 20 +++++++++++++++---- 6 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 changelogs/client_server/newsfragments/1199.feature diff --git a/changelogs/client_server/newsfragments/1199.feature b/changelogs/client_server/newsfragments/1199.feature new file mode 100644 index 00000000..ca32e966 --- /dev/null +++ b/changelogs/client_server/newsfragments/1199.feature @@ -0,0 +1 @@ +Add `room_types` filter and `room_type` response to `/publicRooms`, as per [MSC3827](https://github.com/matrix-org/matrix-spec-proposals/pull/3827). \ No newline at end of file diff --git a/data/api/client-server/definitions/public_rooms_chunk.yaml b/data/api/client-server/definitions/public_rooms_chunk.yaml index ff563a3c..9c6ae6fc 100644 --- a/data/api/client-server/definitions/public_rooms_chunk.yaml +++ b/data/api/client-server/definitions/public_rooms_chunk.yaml @@ -57,6 +57,11 @@ properties: The room's join rule. When not present, the room is assumed to be `public`. example: "public" + room_type: + type: string + x-addedInMatrixVersion: "1.4" + description: |- + The `type` of room (from [`m.room.create`](/client-server-api/#mroomcreate)), if any. required: - room_id - num_joined_members diff --git a/data/api/client-server/definitions/public_rooms_response.yaml b/data/api/client-server/definitions/public_rooms_response.yaml index 23f38eff..ba2b712c 100644 --- a/data/api/client-server/definitions/public_rooms_response.yaml +++ b/data/api/client-server/definitions/public_rooms_response.yaml @@ -62,7 +62,8 @@ example: { "room_id": "!ol19s:bleecker.street", "topic": "Tasty tasty cheese", "world_readable": true, - "join_rule": "public" + "join_rule": "public", + "room_type": "m.space" } ], "next_batch": "p190q", diff --git a/data/api/client-server/list_public_rooms.yaml b/data/api/client-server/list_public_rooms.yaml index b702f1bf..6391bbbd 100644 --- a/data/api/client-server/list_public_rooms.yaml +++ b/data/api/client-server/list_public_rooms.yaml @@ -198,8 +198,18 @@ paths: generic_search_term: type: string description: |- - A string to search for in the room metadata, e.g. name, - topic, canonical alias etc. (Optional). + An optional string to search for in the room metadata, e.g. name, + topic, canonical alias, etc. + room_types: + type: array + x-addedInMatrixVersion: "1.4" + items: + type: string + description: |- + An optional list of [room types](/client-server-api/#types) to search + for. To include rooms without a room type, specify `null` within this + list. When not specified, all applicable rooms (regardless of type) + are returned. include_all_networks: type: boolean description: |- @@ -215,7 +225,8 @@ paths: example: { "limit": 10, "filter": { - "generic_search_term": "foo" + "generic_search_term": "foo", + "room_types": [null, "m.space"] }, "include_all_networks": false, "third_party_instance_id": "irc" diff --git a/data/api/client-server/space_hierarchy.yaml b/data/api/client-server/space_hierarchy.yaml index 91bf67c9..9469d0c1 100644 --- a/data/api/client-server/space_hierarchy.yaml +++ b/data/api/client-server/space_hierarchy.yaml @@ -129,6 +129,7 @@ paths: - type: object title: ChildRoomsChunk properties: + # Override x-addedInMatrixVersion for room_type (this endpoint had it first) room_type: type: string description: |- diff --git a/data/api/server-server/public_rooms.yaml b/data/api/server-server/public_rooms.yaml index ba949bcc..c65a649a 100644 --- a/data/api/server-server/public_rooms.yaml +++ b/data/api/server-server/public_rooms.yaml @@ -110,8 +110,18 @@ paths: generic_search_term: type: string description: |- - A string to search for in the room metadata, e.g. name, - topic, canonical alias etc. (Optional). + An optional string to search for in the room metadata, e.g. name, + topic, canonical alias, etc. + room_types: + type: array + x-addedInMatrixVersion: "1.4" + items: + type: string + description: |- + An optional list of [room types](/client-server-api/#types) to search + for. To include rooms without a room type, specify `null` within this + list. When not specified, all applicable rooms (regardless of type) + are returned. include_all_networks: type: boolean description: |- @@ -127,7 +137,8 @@ paths: example: { "limit": 10, "filter": { - "generic_search_term": "foo" + "generic_search_term": "foo", + "room_types": [null, "m.space"] }, "include_all_networks": false, "third_party_instance_id": "irc" @@ -185,7 +196,8 @@ paths: "room_id": "!ol19s:bleecker.street", "topic": "Tasty tasty cheese", "world_readable": true, - "join_rule": "public" + "join_rule": "public", + "room_type": "m.space" } ], "next_batch": "p190q", From afc0e6a026e8d1c40541f120b6850223e750d703 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 9 Aug 2022 12:44:51 -0400 Subject: [PATCH 2/4] Add CORP headers to media repo (#1197) * Add CORP headers to media repo MSC: https://github.com/matrix-org/matrix-spec-proposals/pull/3828 * Write weird CSS rules to make added-in work inline in the CS spec Even though our content doesn't need 2 paragraphs, it's good to have the capability to render it in the future. * Remove test paragraph * Refine prose * spelling is key --- assets/scss/custom.scss | 23 +++++++++++++++++++ .../client_server/newsfragments/1197.feature | 1 + .../client-server-api/modules/content_repo.md | 7 ++++++ .../shortcodes/boxes/added-in-paragraph.html | 22 ++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 changelogs/client_server/newsfragments/1197.feature create mode 100644 layouts/shortcodes/boxes/added-in-paragraph.html diff --git a/assets/scss/custom.scss b/assets/scss/custom.scss index 5a89d648..36566d9a 100644 --- a/assets/scss/custom.scss +++ b/assets/scss/custom.scss @@ -260,6 +260,29 @@ footer { border-left-width: 5px; background: $warning-background; } + + // XXX: See the added-in-paragraph.html shortcode for more information on these styles. + &.added-in-paragraph { + // Remove the padding and margin to remove the box look + margin: 0 !important; // !important on both to override table-related rules + padding: 0 !important; + + // Make pairs of "added-in" and content inline to each other. We do pairs so authors can + // describe two paragraphs with added-in prefixes within a single box, reducing DOM + // complexity. Each paragraph is expected to be prefixed with an added-in, however. + // + // XXX: We assume the added-in and text will be rendered as paragraph elements. + > p { + display: inline; + } + > p:nth-child(2n) { // "even" rule to target just the content paragraphs + // Force a paragraph break after the content (insert a couple
tags) + &::after { + content: '\A\A'; + white-space: pre; + } + } + } } /* Styles for sections that are rendered from data, such as HTTP APIs and event schemas */ diff --git a/changelogs/client_server/newsfragments/1197.feature b/changelogs/client_server/newsfragments/1197.feature new file mode 100644 index 00000000..d4ea9b42 --- /dev/null +++ b/changelogs/client_server/newsfragments/1197.feature @@ -0,0 +1 @@ +Add `Cross-Origin-Resource-Policy` (CORP) headers to media repository, as per [MSC3828](https://github.com/matrix-org/matrix-spec-proposals/pull/3828). \ No newline at end of file diff --git a/content/client-server-api/modules/content_repo.md b/content/client-server-api/modules/content_repo.md index 467065a5..0366f920 100644 --- a/content/client-server-api/modules/content_repo.md +++ b/content/client-server-api/modules/content_repo.md @@ -19,6 +19,13 @@ When serving content, the server SHOULD provide a `Content-Security-Policy` header. The recommended policy is `sandbox; default-src 'none'; script-src 'none'; plugin-types application/pdf; style-src 'unsafe-inline'; object-src 'self';`. +{{% boxes/added-in-paragraph %}} +{{< added-in v="1.4" >}} The server SHOULD additionally provide +`Cross-Origin-Resource-Policy: cross-origin` when serving content to allow +(web) clients to access restricted APIs such as `SharedArrayBuffer` when +interacting with the media repository. +{{% /boxes/added-in-paragraph %}} + #### Matrix Content (MXC) URIs Content locations are represented as Matrix Content (MXC) URIs. They diff --git a/layouts/shortcodes/boxes/added-in-paragraph.html b/layouts/shortcodes/boxes/added-in-paragraph.html new file mode 100644 index 00000000..20ca3932 --- /dev/null +++ b/layouts/shortcodes/boxes/added-in-paragraph.html @@ -0,0 +1,22 @@ +{{/* + + "Temporary" shortcode for rendering paragraphs which want/need inline added-in tags. It is + assumed that your content is described as follows: + + {{% boxes/added-in-paragraph %}} + {{< added-in v="1.4" >}} Your text here + + {{< added-in v="1.4" >}} Your other text here + {{% /boxes/added-in-paragraph %}} + + The assumption is that at a later date this added-in-paragraph shortcode can be removed, making + the angle bracket-defined added-in shortcodes *just work*. + + It is important that each new "content" paragraph (the bit after added-in) is preceded with + and added-in, otherwise you might find your text being weirdly merged. + + This exists while the added-in shortcode cannot be inline in the client-server spec. + See https://github.com/matrix-org/matrix-spec/issues/1204 + +*/}} +{{ partial "alert" (dict "type" "added-in-paragraph" "content" .Inner) }} From 19308248988104307d214743c961947a051a4094 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Wed, 10 Aug 2022 10:44:38 +0100 Subject: [PATCH 3/4] include CS-api modules with `{{<` (#1205) ... because that fixes everything. Or at least, #1204. --- .../internal/newsfragments/1205.clarification | 1 + content/client-server-api/_index.md | 70 +++++++++---------- 2 files changed, 36 insertions(+), 35 deletions(-) create mode 100644 changelogs/internal/newsfragments/1205.clarification diff --git a/changelogs/internal/newsfragments/1205.clarification b/changelogs/internal/newsfragments/1205.clarification new file mode 100644 index 00000000..6fb72a7a --- /dev/null +++ b/changelogs/internal/newsfragments/1205.clarification @@ -0,0 +1 @@ +Fix rendering of shortcodes within the client-server API. diff --git a/content/client-server-api/_index.md b/content/client-server-api/_index.md index a814144c..3d80c849 100644 --- a/content/client-server-api/_index.md +++ b/content/client-server-api/_index.md @@ -2608,38 +2608,38 @@ operations and run in a resource constrained environment. Like embedded applications, they are not intended to be fully-fledged communication systems. -{{% cs-module name="instant_messaging" %}} -{{% cs-module name="rich_replies" %}} -{{% cs-module name="voip_events" %}} -{{% cs-module name="typing_notifications" %}} -{{% cs-module name="receipts" %}} -{{% cs-module name="read_markers" %}} -{{% cs-module name="presence" %}} -{{% cs-module name="content_repo" %}} -{{% cs-module name="send_to_device" %}} -{{% cs-module name="device_management" %}} -{{% cs-module name="end_to_end_encryption" %}} -{{% cs-module name="secrets" %}} -{{% cs-module name="history_visibility" %}} -{{% cs-module name="push" %}} -{{% cs-module name="third_party_invites" %}} -{{% cs-module name="search" %}} -{{% cs-module name="guest_access" %}} -{{% cs-module name="room_previews" %}} -{{% cs-module name="tags" %}} -{{% cs-module name="account_data" %}} -{{% cs-module name="admin" %}} -{{% cs-module name="event_context" %}} -{{% cs-module name="sso_login" %}} -{{% cs-module name="dm" %}} -{{% cs-module name="ignore_users" %}} -{{% cs-module name="stickers" %}} -{{% cs-module name="report_content" %}} -{{% cs-module name="third_party_networks" %}} -{{% cs-module name="openid" %}} -{{% cs-module name="server_acls" %}} -{{% cs-module name="mentions" %}} -{{% cs-module name="room_upgrades" %}} -{{% cs-module name="server_notices" %}} -{{% cs-module name="moderation_policies" %}} -{{% cs-module name="spaces" %}} +{{< cs-module name="instant_messaging" >}} +{{< cs-module name="rich_replies" >}} +{{< cs-module name="voip_events" >}} +{{< cs-module name="typing_notifications" >}} +{{< cs-module name="receipts" >}} +{{< cs-module name="read_markers" >}} +{{< cs-module name="presence" >}} +{{< cs-module name="content_repo" >}} +{{< cs-module name="send_to_device" >}} +{{< cs-module name="device_management" >}} +{{< cs-module name="end_to_end_encryption" >}} +{{< cs-module name="secrets" >}} +{{< cs-module name="history_visibility" >}} +{{< cs-module name="push" >}} +{{< cs-module name="third_party_invites" >}} +{{< cs-module name="search" >}} +{{< cs-module name="guest_access" >}} +{{< cs-module name="room_previews" >}} +{{< cs-module name="tags" >}} +{{< cs-module name="account_data" >}} +{{< cs-module name="admin" >}} +{{< cs-module name="event_context" >}} +{{< cs-module name="sso_login" >}} +{{< cs-module name="dm" >}} +{{< cs-module name="ignore_users" >}} +{{< cs-module name="stickers" >}} +{{< cs-module name="report_content" >}} +{{< cs-module name="third_party_networks" >}} +{{< cs-module name="openid" >}} +{{< cs-module name="server_acls" >}} +{{< cs-module name="mentions" >}} +{{< cs-module name="room_upgrades" >}} +{{< cs-module name="server_notices" >}} +{{< cs-module name="moderation_policies" >}} +{{< cs-module name="spaces" >}} From 5572d33453cf27896e4e78c435bb6e7c200d2c05 Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Tue, 16 Aug 2022 18:12:10 +0100 Subject: [PATCH 4/4] Require `access_token`, `device_id` and `user_id` fields in `/login` response (#1210) --- changelogs/client_server/newsfragments/1210.clarification | 1 + data/api/client-server/login.yaml | 1 + 2 files changed, 2 insertions(+) create mode 100644 changelogs/client_server/newsfragments/1210.clarification diff --git a/changelogs/client_server/newsfragments/1210.clarification b/changelogs/client_server/newsfragments/1210.clarification new file mode 100644 index 00000000..6a024852 --- /dev/null +++ b/changelogs/client_server/newsfragments/1210.clarification @@ -0,0 +1 @@ +Clarify that the "device_id", "user_id" and "access_token" fields are required in the response body of `POST /_matrix/client/v3/login`. \ No newline at end of file diff --git a/data/api/client-server/login.yaml b/data/api/client-server/login.yaml index d279445d..4c348fcd 100644 --- a/data/api/client-server/login.yaml +++ b/data/api/client-server/login.yaml @@ -210,6 +210,7 @@ paths: form as the one returned from .well-known autodiscovery. allOf: - "$ref": "definitions/wellknown/full.yaml" + required: ["access_token", "device_id", "user_id"] 400: description: |- Part of the request was invalid. For example, the login type may not be recognised.