mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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
This commit is contained in:
@@ -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),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user