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/wellknown.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'internal/api/wellknown.go') diff --git a/internal/api/wellknown.go b/internal/api/wellknown.go index 7edbb4d7d..a837667fb 100644 --- a/internal/api/wellknown.go +++ b/internal/api/wellknown.go @@ -20,6 +20,7 @@ package api import ( "github.com/gin-gonic/gin" + "github.com/superseriousbusiness/gotosocial/internal/api/wellknown/hostmeta" "github.com/superseriousbusiness/gotosocial/internal/api/wellknown/nodeinfo" "github.com/superseriousbusiness/gotosocial/internal/api/wellknown/webfinger" "github.com/superseriousbusiness/gotosocial/internal/middleware" @@ -30,6 +31,7 @@ import ( type WellKnown struct { nodeInfo *nodeinfo.Module webfinger *webfinger.Module + hostMeta *hostmeta.Module } func (w *WellKnown) Route(r router.Router, m ...gin.HandlerFunc) { @@ -45,11 +47,13 @@ func (w *WellKnown) Route(r router.Router, m ...gin.HandlerFunc) { w.nodeInfo.Route(wellKnownGroup.Handle) w.webfinger.Route(wellKnownGroup.Handle) + w.hostMeta.Route(wellKnownGroup.Handle) } func NewWellKnown(p *processing.Processor) *WellKnown { return &WellKnown{ nodeInfo: nodeinfo.New(p), webfinger: webfinger.New(p), + hostMeta: hostmeta.New(p), } } -- cgit v1.2.3