diff --git a/changelogs/application_service/newsfragments/1810.clarification b/changelogs/application_service/newsfragments/1810.clarification new file mode 100644 index 00000000..66dab495 --- /dev/null +++ b/changelogs/application_service/newsfragments/1810.clarification @@ -0,0 +1 @@ +Clarify that appservices should be notified of events relating to the sender_localpart user. diff --git a/changelogs/internal/newsfragments/1814.clarification b/changelogs/internal/newsfragments/1814.clarification new file mode 100644 index 00000000..a540ea7e --- /dev/null +++ b/changelogs/internal/newsfragments/1814.clarification @@ -0,0 +1 @@ +Add support for rendering string formats. diff --git a/changelogs/server_server/newsfragments/1818.clarification b/changelogs/server_server/newsfragments/1818.clarification new file mode 100644 index 00000000..8c50b6ac --- /dev/null +++ b/changelogs/server_server/newsfragments/1818.clarification @@ -0,0 +1 @@ +Clarify that whitespace around commas is allowed in the `X-Matrix` `Authorization` header value params list. \ No newline at end of file diff --git a/content/server-server-api.md b/content/server-server-api.md index fb1b06f4..e92d871c 100644 --- a/content/server-server-api.md +++ b/content/server-server-api.md @@ -350,9 +350,10 @@ def authorization_headers(origin_name, origin_signing_key, The format of the Authorization header is given in [RFC 7235](https://datatracker.ietf.org/doc/html/rfc7235#section-2.1). In -summary, the header begins with authorization scheme `X-Matrix`, followed by -one or more spaces, followed by a comma-separated list of parameters written as -name=value pairs. The names are case insensitive and order does not matter. The +summary, the header begins with authorization scheme `X-Matrix`, followed by one +or more spaces, followed by a comma-separated list of parameters written as +name=value pairs. Zero or more spaces and tabs around each comma are allowed. +The names are case insensitive and order does not matter. The values must be enclosed in quotes if they contain characters that are not allowed in `token`s, as defined in [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6); if a @@ -363,8 +364,9 @@ replaced by the character that follows the backslash. For compatibility with older servers, the sender should - only include one space after `X-Matrix`, -- only use lower-case names, and -- avoid using backslashes in parameter values. +- only use lower-case names, +- avoid using backslashes in parameter values, and +- avoid including whitespace around the commas between name=value pairs. For compatibility with older servers, the recipient should allow colons to be included in values without requiring the value to be enclosed in quotes. diff --git a/data/api/application-service/definitions/registration.yaml b/data/api/application-service/definitions/registration.yaml index d9dfe748..2d65a32c 100644 --- a/data/api/application-service/definitions/registration.yaml +++ b/data/api/application-service/definitions/registration.yaml @@ -29,7 +29,9 @@ properties: description: A secret token that the homeserver will use authenticate requests to the application service. sender_localpart: type: string - description: The localpart of the user associated with the application service. + description: |- + The localpart of the user associated with the application service. Events will be sent to the AS if this user is the target of the event, or + is a joined member of the room where the event occurred. namespaces: type: object title: Namespaces @@ -40,9 +42,10 @@ properties: - $ref: namespace_list.yaml - description: |- A list of namespaces defining the user IDs that the application - service is interested in. Events will be sent to the AS if a - local user matching one of the namespaces is the target of the event, - or is a joined member of the room where the event occurred. + service is interested in, in addition to its `sender_localpart`. + Events will be sent to the AS if a local user matching one of the + namespaces is the target of the event, or is a joined member of + the room where the event occurred. rooms: allOf: - $ref: namespace_list.yaml diff --git a/data/custom-formats.yaml b/data/custom-formats.yaml index f0001c80..5da7e6ab 100644 --- a/data/custom-formats.yaml +++ b/data/custom-formats.yaml @@ -31,3 +31,8 @@ mx-event-id: title: Event ID url: /appendices#event-ids # regex: "^\\$" + +uri: + title: URI + url: http://tools.ietf.org/html/rfc3986 + # no regex diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index 72ea5a8a..d2b09acb 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -128,6 +128,8 @@ resolve-additional-types.) * `anchor`: optional HTML element id for the target type, which will be used to link to it. + * `format`: optional string for the format of the type, used for strings. + */}} {{ define "partials/property-type" }} {{ $type := "" }} @@ -143,6 +145,15 @@ resolve-additional-types.) {{ $items := .items }} {{ $inner_type := partial "property-type" $items }} {{ $type = delimit (slice "[" $inner_type "]") "" }} + {{ else if eq .type "string" }} + {{ $type = "string" }} + + {{/* If the string uses a known format, use it. */}} + {{ with .format }} + {{ with partial "custom-format" . }} + {{ $type = . }} + {{ end }} + {{ end }} {{ else if or (reflect.IsSlice .type) .oneOf }} {{/* It's legal to specify an array of types. @@ -167,7 +178,7 @@ resolve-additional-types.) {{ $type = delimit $types "|" }} {{ else }} - {{/* A simple type like string or boolean */}} + {{/* A simple type like integer or boolean */}} {{ $type = (htmlEscape .type) }} {{ end }} @@ -241,8 +252,8 @@ resolve-additional-types.) {{ range $formatId, $formatType := $formatMap.Values }} {{ $formatKey := "string" }} {{ if ne $formatId "string" }} - {{ with index site.Data "custom-formats" $formatId }} - {{ $formatKey = printf "%s" (htmlEscape .url) (htmlEscape .title) }} + {{ with partial "custom-format" $formatId }} + {{ $formatKey = . }} {{ else }} {{ errorf "Unsupported value for `x-pattern-format`: %s" $formatId }} {{ end }} @@ -290,3 +301,18 @@ resolve-additional-types.) {{ if (index .property "x-addedInMatrixVersion") }}{{ partial "added-in" (dict "v" (index .property "x-addedInMatrixVersion")) }}{{ end -}} {{ if (index .property "x-changedInMatrixVersion") }}{{ partial "changed-in" (dict "changes_dict" (index .property "x-changedInMatrixVersion")) }}{{ end -}} {{ end }} + + +{{/* + Computes the type to display for a string format, given the identifier of + the format as a string. +*/}} +{{ define "partials/custom-format" }} + {{ $customFormat := "" }} + + {{ with index site.Data "custom-formats" . }} + {{ $customFormat = printf "%s" (htmlEscape .url) (htmlEscape .title) }} + {{ end }} + + {{ return $customFormat }} +{{ end }}