diff --git a/docs/features.md b/docs/features.md index 99b42a4..95c0399 100644 --- a/docs/features.md +++ b/docs/features.md @@ -208,8 +208,9 @@ The short list is in the [README](../README.md). `/.well-known/matrix/server` and `/client` (and its CORS header), SRV records, the signing keys and which homeserver software and version answer, the client API and its spec versions, ways to log in, - `/.well-known/matrix/support`, and what Element X needs (sliding sync, - OAuth 2.0 logins, a call server). It also checks the way there: each + `/.well-known/matrix/support` (each contact the owner lists, by role, + with their Matrix ID and email, and the support page), and what Element + X needs (sliding sync, OAuth 2.0 logins, a call server). It also checks the way there: each name's addresses and whether Iran's filter answers for them (10.10.34.x), where each server is (a town and network in Iran, else a country), whether IPv4 and IPv6 both connect, and how long the name, diff --git a/internal/deploy/reach.go b/internal/deploy/reach.go index af67256..7743ac2 100644 --- a/internal/deploy/reach.go +++ b/internal/deploy/reach.go @@ -306,12 +306,34 @@ func clientProbe(ctx context.Context, c *config.Config, own bool) ([]Finding, st add("Element X calls", Warn, "the well-known names no call server, so Element X can't call") } + // Who to ask for help, as the server's owner says (MSC1929). var support struct { - Contacts []json.RawMessage `json:"contacts"` - Page string `json:"support_page"` + Contacts []struct { + Role string `json:"role"` + MXID string `json:"matrix_id"` + Email string `json:"email_address"` + } `json:"contacts"` + Page string `json:"support_page"` } if _, err := getJSON(ctx, scheme+c.Domain+"/.well-known/matrix/support", insecure, &support); err == nil && (len(support.Contacts) > 0 || support.Page != "") { - add("Support", Pass, "/.well-known/matrix/support lists %d contact(s) %s", len(support.Contacts), support.Page) + for _, ct := range support.Contacts { + role := strings.TrimPrefix(strings.TrimPrefix(ct.Role, "m.role."), "org.matrix.msc1929.") + if role == "" { + role = "contact" + } + var ways []string + for _, w := range []string{ct.MXID, ct.Email} { + if w != "" { + ways = append(ways, w) + } + } + if len(ways) > 0 { + add("Support", Pass, "%s: %s", role, strings.Join(ways, ", ")) + } + } + if support.Page != "" { + add("Support", Pass, "page: %s", support.Page) + } } else if !own { add("Support", Pass, "no /.well-known/matrix/support (optional)") } diff --git a/internal/deploy/reach_test.go b/internal/deploy/reach_test.go index 953180e..c10d2f3 100644 --- a/internal/deploy/reach_test.go +++ b/internal/deploy/reach_test.go @@ -97,6 +97,9 @@ func TestProbeServer(t *testing.T) { fmt.Fprint(w, `{"versions": ["v1.11", "v1.12"], "unstable_features": {"org.matrix.simplified_msc3575": true}}`) case "/_matrix/client/v3/login": fmt.Fprint(w, `{"flows": [{"type": "m.login.password"}, {"type": "m.login.sso"}]}`) + case "/.well-known/matrix/support": + fmt.Fprint(w, `{"contacts": [{"role": "m.role.admin", "matrix_id": "@admin:example.org", "email_address": "admin@example.org"}, + {"role": "m.role.security", "email_address": "security@example.org"}], "support_page": "https://example.org/help"}`) case "/_matrix/client/v1/auth_metadata": fmt.Fprint(w, `{}`) case "/_matrix/client/v3/register": @@ -124,7 +127,7 @@ func TestProbeServer(t *testing.T) { all := strings.Join(lines, "\n") for _, want := range []string{"0 Delegation: the name has a port", "0 Federation API: " + name + " answers as " + name, "0 Well-known: sends apps to " + srv.URL, "spec up to v1.12", "0 Logins: password, sso", - "0 Element X sync", "0 Element X login", "0 Element X calls", "0 Support: no /.well-known/matrix/support", + "0 Element X sync", "0 Element X login", "0 Element X calls", "0 Support: admin: @admin:example.org, admin@example.org", "0 Support: security: security@example.org", "0 Support: page: https://example.org/help", "1 Software: Synapse 1.140.0: older than 1.163.2", "1 DNS: 127.0.0.1 → 127.0.0.1 (this computer)", "0 IPv4 and IPv6: " + name + ": IPv4 connects, no IPv6 address", "0 Speed: connected", "0 Certificate: " + name + ": TLS 1.3", "0 HSTS: not sent", "0 Sign-ups: open, with a captcha", "0 Public rooms: 7 rooms", "0 Features: ✗ spaces ✗ threads ✓ authenticated media"} {