|
|
@ -6,6 +6,7 @@ import ( |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/owncast/owncast/core" |
|
|
|
"github.com/owncast/owncast/core" |
|
|
|
|
|
|
|
"github.com/owncast/owncast/core/data" |
|
|
|
"github.com/owncast/owncast/router/middleware" |
|
|
|
"github.com/owncast/owncast/router/middleware" |
|
|
|
"github.com/owncast/owncast/utils" |
|
|
|
"github.com/owncast/owncast/utils" |
|
|
|
) |
|
|
|
) |
|
|
@ -15,7 +16,6 @@ func GetStatus(w http.ResponseWriter, r *http.Request) { |
|
|
|
status := core.GetStatus() |
|
|
|
status := core.GetStatus() |
|
|
|
response := webStatusResponse{ |
|
|
|
response := webStatusResponse{ |
|
|
|
Online: status.Online, |
|
|
|
Online: status.Online, |
|
|
|
ViewerCount: status.ViewerCount, |
|
|
|
|
|
|
|
ServerTime: time.Now(), |
|
|
|
ServerTime: time.Now(), |
|
|
|
LastConnectTime: status.LastConnectTime, |
|
|
|
LastConnectTime: status.LastConnectTime, |
|
|
|
LastDisconnectTime: status.LastDisconnectTime, |
|
|
|
LastDisconnectTime: status.LastDisconnectTime, |
|
|
@ -23,6 +23,10 @@ func GetStatus(w http.ResponseWriter, r *http.Request) { |
|
|
|
StreamTitle: status.StreamTitle, |
|
|
|
StreamTitle: status.StreamTitle, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if !data.GetHideViewerCount() { |
|
|
|
|
|
|
|
response.ViewerCount = status.ViewerCount |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
w.Header().Set("Content-Type", "application/json") |
|
|
|
w.Header().Set("Content-Type", "application/json") |
|
|
|
middleware.DisableCache(w) |
|
|
|
middleware.DisableCache(w) |
|
|
|
|
|
|
|
|
|
|
@ -33,7 +37,7 @@ func GetStatus(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
|
|
|
|
|
|
|
type webStatusResponse struct { |
|
|
|
type webStatusResponse struct { |
|
|
|
Online bool `json:"online"` |
|
|
|
Online bool `json:"online"` |
|
|
|
ViewerCount int `json:"viewerCount"` |
|
|
|
ViewerCount int `json:"viewerCount,omitempty"` |
|
|
|
ServerTime time.Time `json:"serverTime"` |
|
|
|
ServerTime time.Time `json:"serverTime"` |
|
|
|
LastConnectTime *utils.NullTime `json:"lastConnectTime"` |
|
|
|
LastConnectTime *utils.NullTime `json:"lastConnectTime"` |
|
|
|
LastDisconnectTime *utils.NullTime `json:"lastDisconnectTime"` |
|
|
|
LastDisconnectTime *utils.NullTime `json:"lastDisconnectTime"` |
|
|
|