From a312238e7909c6451e608a91c326ad250dda875c Mon Sep 17 00:00:00 2001 From: Daenney Date: Thu, 9 Mar 2023 18:55:45 +0100 Subject: [feature] Provide .well-known/host-meta endpoint (#1604) * [feature] Provide .well-known/host-meta endpoint This adds the host-meta endpoint as Mastodon clients use this to discover the API domain to use when the host and account domains aren't the same. * Address review comments --- internal/api/util/mime.go | 1 + internal/api/util/negotiate.go | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'internal/api/util') diff --git a/internal/api/util/mime.go b/internal/api/util/mime.go index 30f0f0d6e..cfdc3b08b 100644 --- a/internal/api/util/mime.go +++ b/internal/api/util/mime.go @@ -25,6 +25,7 @@ type MIME string const ( AppJSON MIME = `application/json` AppXML MIME = `application/xml` + AppXMLXRD MIME = `application/xrd+xml` AppRSSXML MIME = `application/rss+xml` AppActivityJSON MIME = `application/activity+json` AppActivityLDJSON MIME = `application/ld+json; profile="https://www.w3.org/ns/activitystreams"` diff --git a/internal/api/util/negotiate.go b/internal/api/util/negotiate.go index 3a5f21775..06a202815 100644 --- a/internal/api/util/negotiate.go +++ b/internal/api/util/negotiate.go @@ -58,6 +58,11 @@ var HTMLOrActivityPubHeaders = []MIME{ AppActivityLDJSON, } +var HostMetaHeaders = []MIME{ + AppXMLXRD, + AppXML, +} + // NegotiateAccept takes the *gin.Context from an incoming request, and a // slice of Offers, and performs content negotiation for the given request // with the given content-type offers. It will return a string representation -- cgit v1.2.3