From 10cdf3d9b8524f6c2beb923bb95585d2b1307360 Mon Sep 17 00:00:00 2001 From: Meisam <39205857+MFTabriz@users.noreply.github.com> Date: Tue, 24 May 2022 04:35:29 +0200 Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=9Cservices=E2=80=9D=20and=20?= =?UTF-8?q?=E2=80=9Cmetadata=E2=80=9D=20to=20NodeInfo/2.0=20(#1922)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add services to nodeinfo/2.0 * add metadata to Nodeinfo/2.0 --- activitypub/controllers/nodeinfo.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/activitypub/controllers/nodeinfo.go b/activitypub/controllers/nodeinfo.go index 6d25894e1..5f73bf8d7 100644 --- a/activitypub/controllers/nodeinfo.go +++ b/activitypub/controllers/nodeinfo.go @@ -59,6 +59,13 @@ func NodeInfoController(w http.ResponseWriter, r *http.Request) { // NodeInfoV2Controller returns the V2 node info response. func NodeInfoV2Controller(w http.ResponseWriter, r *http.Request) { + type metadata struct { + ChatEnabled bool `json:"chat_enabled"` + } + type services struct { + Outbound []string `json:"outbound"` + Inbound []string `json:"inbound"` + } type software struct { Name string `json:"name"` Version string `json:"version"` @@ -74,10 +81,12 @@ func NodeInfoV2Controller(w http.ResponseWriter, r *http.Request) { } type response struct { Version string `json:"version"` + Services services `json:"services"` Software software `json:"software"` Protocols []string `json:"protocols"` Usage usage `json:"usage"` OpenRegistrations bool `json:"openRegistrations"` + Metadata metadata `json:"metadata"` } if !data.GetFederationEnabled() { @@ -89,6 +98,10 @@ func NodeInfoV2Controller(w http.ResponseWriter, r *http.Request) { res := response{ Version: "2.0", + Services: services{ + Inbound: []string{""}, + Outbound: []string{""}, + }, Software: software{ Name: "owncast", Version: config.VersionNumber, @@ -103,6 +116,9 @@ func NodeInfoV2Controller(w http.ResponseWriter, r *http.Request) { }, OpenRegistrations: false, Protocols: []string{"activitypub"}, + Metadata: metadata{ + ChatEnabled: !data.GetChatDisabled(), + }, } if err := writeResponse(res, w); err != nil {