|
|
|
@ -59,6 +59,13 @@ func NodeInfoController(w http.ResponseWriter, r *http.Request) {
@@ -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) {
@@ -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) {
@@ -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) {
@@ -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 { |
|
|
|
|