Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into rav/registration_terms
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed May 8, 2024
2 parents 90c5e30 + f4b34ba commit cffcea0
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clarify that appservices should be notified of events relating to the sender_localpart user.
1 change: 1 addition & 0 deletions changelogs/internal/newsfragments/1814.clarification
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for rendering string formats.
1 change: 1 addition & 0 deletions changelogs/server_server/newsfragments/1818.clarification
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clarify that whitespace around commas is allowed in the `X-Matrix` `Authorization` header value params list.
12 changes: 7 additions & 5 deletions content/server-server-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
11 changes: 7 additions & 4 deletions data/api/application-service/definitions/registration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions data/custom-formats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
32 changes: 29 additions & 3 deletions layouts/partials/openapi/render-object-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@

* `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 := "" }}
Expand All @@ -143,6 +145,15 @@
{{ $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.
Expand All @@ -167,7 +178,7 @@

{{ $type = delimit $types "|" }}
{{ else }}
{{/* A simple type like string or boolean */}}
{{/* A simple type like integer or boolean */}}
{{ $type = (htmlEscape .type) }}
{{ end }}

Expand Down Expand Up @@ -241,8 +252,8 @@
{{ range $formatId, $formatType := $formatMap.Values }}
{{ $formatKey := "string" }}
{{ if ne $formatId "string" }}
{{ with index site.Data "custom-formats" $formatId }}
{{ $formatKey = printf "<a href=\"%s\">%s</a>" (htmlEscape .url) (htmlEscape .title) }}
{{ with partial "custom-format" $formatId }}
{{ $formatKey = . }}
{{ else }}
{{ errorf "Unsupported value for `x-pattern-format`: %s" $formatId }}
{{ end }}
Expand Down Expand Up @@ -290,3 +301,18 @@
{{ 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 "<a href=\"%s\">%s</a>" (htmlEscape .url) (htmlEscape .title) }}
{{ end }}

{{ return $customFormat }}
{{ end }}

0 comments on commit cffcea0

Please sign in to comment.