@@ -435,6 +435,23 @@ func SetSocialHandles(w http.ResponseWriter, r *http.Request) {
|
||||
controllers.WriteSimpleResponse(w, true, "social handles updated")
|
||||
}
|
||||
|
||||
// SetChatDisabled will disable chat functionality.
|
||||
func SetChatDisabled(w http.ResponseWriter, r *http.Request) {
|
||||
if !requirePOST(w, r) {
|
||||
return
|
||||
}
|
||||
|
||||
configValue, success := getValueFromRequest(w, r)
|
||||
if !success {
|
||||
controllers.WriteSimpleResponse(w, false, "unable to update chat disabled")
|
||||
return
|
||||
}
|
||||
|
||||
data.SetChatDisabled(configValue.Value.(bool))
|
||||
|
||||
controllers.WriteSimpleResponse(w, true, "chat disabled status updated")
|
||||
}
|
||||
|
||||
func requirePOST(w http.ResponseWriter, r *http.Request) bool {
|
||||
if r.Method != controllers.POST {
|
||||
controllers.WriteSimpleResponse(w, false, r.Method+" not supported")
|
||||
|
||||
@@ -43,6 +43,7 @@ func GetServerConfig(w http.ResponseWriter, r *http.Request) {
|
||||
StreamKey: data.GetStreamKey(),
|
||||
WebServerPort: config.WebServerPort,
|
||||
RTMPServerPort: data.GetRTMPPortNumber(),
|
||||
ChatDisabled: data.GetChatDisabled(),
|
||||
VideoSettings: videoSettings{
|
||||
VideoQualityVariants: videoQualityVariants,
|
||||
LatencyLevel: data.GetStreamLatencyLevel().Level,
|
||||
@@ -71,6 +72,7 @@ type serverConfigAdminResponse struct {
|
||||
VideoSettings videoSettings `json:"videoSettings"`
|
||||
LatencyLevel int `json:"latencyLevel"`
|
||||
YP yp `json:"yp"`
|
||||
ChatDisabled bool `json:"chatDisabled"`
|
||||
}
|
||||
|
||||
type videoSettings struct {
|
||||
|
||||
@@ -21,6 +21,7 @@ type webConfigResponse struct {
|
||||
ExtraPageContent string `json:"extraPageContent"`
|
||||
StreamTitle string `json:"streamTitle,omitempty"` // What's going on with the current stream
|
||||
SocialHandles []models.SocialHandle `json:"socialHandles"`
|
||||
ChatDisabled bool `json:"chatDisabled"`
|
||||
}
|
||||
|
||||
// GetWebConfig gets the status of the server.
|
||||
@@ -48,6 +49,7 @@ func GetWebConfig(w http.ResponseWriter, r *http.Request) {
|
||||
ExtraPageContent: pageContent,
|
||||
StreamTitle: data.GetStreamTitle(),
|
||||
SocialHandles: socialHandles,
|
||||
ChatDisabled: data.GetChatDisabled(),
|
||||
}
|
||||
|
||||
if err := json.NewEncoder(w).Encode(configuration); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user