mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 19:52:25 -06: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:
parent
9ba35c65eb
commit
a312238e79
9 changed files with 167 additions and 4 deletions
|
|
@ -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),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue