Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add server support discovery endpoint #1733

Merged
merged 8 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelogs/client_server/newsfragments/1733.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add server support discovery endpoint, as per [MSC1929](https://github.com/matrix-org/matrix-spec-proposals/pull/1929).
2 changes: 2 additions & 0 deletions content/client-server-api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ specify parameter values. The flow for this method is as follows:

{{% http-api spec="client-server" api="versions" %}}

{{% http-api spec="client-server" api="support" %}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced this belongs under "Server discovery". I'd be inclined to put it in a new "Module", but I'm open to other suggestions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rationale behind the suggestion to put it here is you're discovering information about the server without necessarily needing to speak the rest of Matrix. Both authenticated and unauthenticated clients can use this, and it's "before" the homeserver APIs really start to do anything.

Arguably though, we should rename or introduce a section for .well-known stuff. I think this is best left to a future PR at this stage.


## Client Authentication

Most API endpoints require the user to identify themselves by presenting
Expand Down
135 changes: 135 additions & 0 deletions data/api/client-server/support.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Copyright 2024 Kévin Commaille
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
openapi: 3.1.0
info:
title: Matrix Client-Server Support Discovery API
version: 1.0.0
paths:
/matrix/support:
get:
summary: Gets homeserver contacts and support details.
description: |-
Gets server admin contact and support page of the domain.

Like the [well-known discovery URI](/client-server-api/#well-known-uri),
this should be accessed with the hostname of the homeserver by making a
GET request to `https://hostname/.well-known/matrix/support`.

Note that this endpoint is not necessarily handled by the homeserver.
It may be served by another webserver, used for discovering support
information for the homeserver.
operationId: getWellknownSupport
x-addedInMatrixVersion: "1.10"
responses:
"200":
description: Server support information.
content:
application/json:
schema:
type: object
properties:
contacts:
type: array
description: |-
Ways to contact the server administrator.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should define "administrator" somewhere here. I believe the MSC had some notion of what the admin's contact could be used for - can we incorporate that into the schema somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything on the MSC about why the admins would be contacted, other than the description of the role property.


At least one of `contacts` or `support_page` is required.
If only `contacts` is set, it must contain at least one
item.
items:
type: object
title: Contact
description: A way to contact the server administrator.
properties:
matrix_id:
type: string
description: |-
A [Matrix User ID](/appendices/#user-identifiers)
representing the administrator.

It could be an account registered on a different
homeserver so the administrator can be contacted
when the homeserver is down.

At least one of `matrix_id` or `email_address` is
required.
email_address:
type: string
description: |-
An email address to reach the administrator.

At least one of `matrix_id` or `email_address` is
required.
role:
type: string
enum:
- "m.role.admin"
- "m.role.security"
description: |-
An informal description of what the contact methods
are used for.

`m.role.admin` is a catch-all role for any queries
and `m.role.security` is intended for sensitive
requests.

Unspecified roles are permitted through the use of
[Namespaced Identifiers](/appendices/#common-namespaced-identifier-grammar).
required:
- role
example: {
"matrix_id": "@admin:example.org",
"email_address": "[email protected]",
"role": "m.role.admin"
}
support_page:
type: string
description: |-
The URL of a page to give users help specific to the
homeserver, like extra login/registration steps.

At least one of `contacts` or `support_page` is required.
example: "https://example.org/support.html"
examples:
response:
value:
{
"contacts": [
{
"matrix_id": "@admin:example.org",
"email_address": "[email protected]",
"role": "m.role.admin"
},
{
"email_address": "[email protected]",
"role": "m.role.security"
}
],
"support_page": "https://example.org/support.html"
}
"404":
description: No server support information available.
tags:
- Server administration
servers:
- url: "{protocol}://{hostname}{basePath}"
variables:
protocol:
enum:
- https
default: https
hostname:
default: localhost:8008
basePath:
default: /.well-known
Loading