diff options
Diffstat (limited to 'internal/processing')
-rw-r--r-- | internal/processing/fedi/wellknown.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/processing/fedi/wellknown.go b/internal/processing/fedi/wellknown.go index 6f113ac5d..7be75649b 100644 --- a/internal/processing/fedi/wellknown.go +++ b/internal/processing/fedi/wellknown.go @@ -28,6 +28,10 @@ import ( ) const ( + hostMetaXMLNS = "http://docs.oasis-open.org/ns/xri/xrd-1.0" + hostMetaRel = "lrdd" + hostMetaType = "application/xrd+xml" + hostMetaTemplate = ".well-known/webfinger?resource={uri}" nodeInfoVersion = "2.0" nodeInfoSoftwareName = "gotosocial" nodeInfoRel = "http://nodeinfo.diaspora.software/ns/schema/" + nodeInfoVersion @@ -96,6 +100,22 @@ func (p *Processor) NodeInfoGet(ctx context.Context) (*apimodel.Nodeinfo, gtserr }, nil } +// HostMetaGet returns a host-meta struct in response to a host-meta request. +func (p *Processor) HostMetaGet() *apimodel.HostMeta { + protocol := config.GetProtocol() + host := config.GetHost() + return &apimodel.HostMeta{ + XMLNS: hostMetaXMLNS, + Link: []apimodel.Link{ + { + Rel: hostMetaRel, + Type: hostMetaType, + Template: fmt.Sprintf("%s://%s/%s", protocol, host, hostMetaTemplate), + }, + }, + } +} + // WebfingerGet handles the GET for a webfinger resource. Most commonly, it will be used for returning account lookups. func (p *Processor) WebfingerGet(ctx context.Context, requestedUsername string) (*apimodel.WellKnownResponse, gtserror.WithCode) { // Get the local account the request is referring to. |