Add “services” and “metadata” to NodeInfo/2.0 (#1922)
* add services to nodeinfo/2.0 * add metadata to Nodeinfo/2.0
This commit is contained in:
parent
afeef6f276
commit
10cdf3d9b8
@ -59,6 +59,13 @@ func NodeInfoController(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
// NodeInfoV2Controller returns the V2 node info response.
|
// NodeInfoV2Controller returns the V2 node info response.
|
||||||
func NodeInfoV2Controller(w http.ResponseWriter, r *http.Request) {
|
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 {
|
type software struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
@ -74,10 +81,12 @@ func NodeInfoV2Controller(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
type response struct {
|
type response struct {
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
|
Services services `json:"services"`
|
||||||
Software software `json:"software"`
|
Software software `json:"software"`
|
||||||
Protocols []string `json:"protocols"`
|
Protocols []string `json:"protocols"`
|
||||||
Usage usage `json:"usage"`
|
Usage usage `json:"usage"`
|
||||||
OpenRegistrations bool `json:"openRegistrations"`
|
OpenRegistrations bool `json:"openRegistrations"`
|
||||||
|
Metadata metadata `json:"metadata"`
|
||||||
}
|
}
|
||||||
|
|
||||||
if !data.GetFederationEnabled() {
|
if !data.GetFederationEnabled() {
|
||||||
@ -89,6 +98,10 @@ func NodeInfoV2Controller(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
res := response{
|
res := response{
|
||||||
Version: "2.0",
|
Version: "2.0",
|
||||||
|
Services: services{
|
||||||
|
Inbound: []string{""},
|
||||||
|
Outbound: []string{""},
|
||||||
|
},
|
||||||
Software: software{
|
Software: software{
|
||||||
Name: "owncast",
|
Name: "owncast",
|
||||||
Version: config.VersionNumber,
|
Version: config.VersionNumber,
|
||||||
@ -103,6 +116,9 @@ func NodeInfoV2Controller(w http.ResponseWriter, r *http.Request) {
|
|||||||
},
|
},
|
||||||
OpenRegistrations: false,
|
OpenRegistrations: false,
|
||||||
Protocols: []string{"activitypub"},
|
Protocols: []string{"activitypub"},
|
||||||
|
Metadata: metadata{
|
||||||
|
ChatEnabled: !data.GetChatDisabled(),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := writeResponse(res, w); err != nil {
|
if err := writeResponse(res, w); err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user