Merge remote-tracking branch 'origin/main' into rav/registration_terms

This commit is contained in:
Richard van der Hoff 2024-05-08 14:43:45 +01:00
commit cffcea0bb8
7 changed files with 51 additions and 12 deletions

View file

@ -0,0 +1 @@
Clarify that appservices should be notified of events relating to the sender_localpart user.

View file

@ -0,0 +1 @@
Add support for rendering string formats.

View file

@ -0,0 +1 @@
Clarify that whitespace around commas is allowed in the `X-Matrix` `Authorization` header value params list.

View file

@ -350,9 +350,10 @@ def authorization_headers(origin_name, origin_signing_key,
The format of the Authorization header is given in The format of the Authorization header is given in
[RFC 7235](https://datatracker.ietf.org/doc/html/rfc7235#section-2.1). 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 summary, the header begins with authorization scheme `X-Matrix`, followed by one
one or more spaces, followed by a comma-separated list of parameters written as 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 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 values must be enclosed in quotes if they contain characters that are not
allowed in `token`s, as defined in allowed in `token`s, as defined in
[RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6); if a [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 For compatibility with older servers, the sender should
- only include one space after `X-Matrix`, - only include one space after `X-Matrix`,
- only use lower-case names, and - only use lower-case names,
- avoid using backslashes in parameter values. - 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 For compatibility with older servers, the recipient should allow colons to be
included in values without requiring the value to be enclosed in quotes. included in values without requiring the value to be enclosed in quotes.

View file

@ -29,7 +29,9 @@ properties:
description: A secret token that the homeserver will use authenticate requests to the application service. description: A secret token that the homeserver will use authenticate requests to the application service.
sender_localpart: sender_localpart:
type: string 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: namespaces:
type: object type: object
title: Namespaces title: Namespaces
@ -40,9 +42,10 @@ properties:
- $ref: namespace_list.yaml - $ref: namespace_list.yaml
- description: |- - description: |-
A list of namespaces defining the user IDs that the application A list of namespaces defining the user IDs that the application
service is interested in. Events will be sent to the AS if a service is interested in, in addition to its `sender_localpart`.
local user matching one of the namespaces is the target of the event, Events will be sent to the AS if a local user matching one of the
or is a joined member of the room where the event occurred. namespaces is the target of the event, or is a joined member of
the room where the event occurred.
rooms: rooms:
allOf: allOf:
- $ref: namespace_list.yaml - $ref: namespace_list.yaml

View file

@ -31,3 +31,8 @@ mx-event-id:
title: Event ID title: Event ID
url: /appendices#event-ids url: /appendices#event-ids
# regex: "^\\$" # regex: "^\\$"
uri:
title: URI
url: http://tools.ietf.org/html/rfc3986
# no regex

View file

@ -128,6 +128,8 @@ resolve-additional-types.)
* `anchor`: optional HTML element id for the target type, which will be used to link to it. * `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" }} {{ define "partials/property-type" }}
{{ $type := "" }} {{ $type := "" }}
@ -143,6 +145,15 @@ resolve-additional-types.)
{{ $items := .items }} {{ $items := .items }}
{{ $inner_type := partial "property-type" $items }} {{ $inner_type := partial "property-type" $items }}
{{ $type = delimit (slice "[" $inner_type "]") "" }} {{ $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 }} {{ else if or (reflect.IsSlice .type) .oneOf }}
{{/* {{/*
It's legal to specify an array of types. It's legal to specify an array of types.
@ -167,7 +178,7 @@ resolve-additional-types.)
{{ $type = delimit $types "|" }} {{ $type = delimit $types "|" }}
{{ else }} {{ else }}
{{/* A simple type like string or boolean */}} {{/* A simple type like integer or boolean */}}
{{ $type = (htmlEscape .type) }} {{ $type = (htmlEscape .type) }}
{{ end }} {{ end }}
@ -241,8 +252,8 @@ resolve-additional-types.)
{{ range $formatId, $formatType := $formatMap.Values }} {{ range $formatId, $formatType := $formatMap.Values }}
{{ $formatKey := "string" }} {{ $formatKey := "string" }}
{{ if ne $formatId "string" }} {{ if ne $formatId "string" }}
{{ with index site.Data "custom-formats" $formatId }} {{ with partial "custom-format" $formatId }}
{{ $formatKey = printf "<a href=\"%s\">%s</a>" (htmlEscape .url) (htmlEscape .title) }} {{ $formatKey = . }}
{{ else }} {{ else }}
{{ errorf "Unsupported value for `x-pattern-format`: %s" $formatId }} {{ errorf "Unsupported value for `x-pattern-format`: %s" $formatId }}
{{ end }} {{ 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-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 -}} {{ if (index .property "x-changedInMatrixVersion") }}{{ partial "changed-in" (dict "changes_dict" (index .property "x-changedInMatrixVersion")) }}{{ end -}}
{{ 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 "<a href=\"%s\">%s</a>" (htmlEscape .url) (htmlEscape .title) }}
{{ end }}
{{ return $customFormat }}
{{ end }}