Set and get custom styling for web interface. For #718
This commit is contained in:
@@ -528,6 +528,17 @@ func SetExternalActions(w http.ResponseWriter, r *http.Request) {
|
||||
controllers.WriteSimpleResponse(w, true, "external actions update")
|
||||
}
|
||||
|
||||
// SetCustomStyles will set the CSS string we insert into the page.
|
||||
func SetCustomStyles(w http.ResponseWriter, r *http.Request) {
|
||||
customStyles, success := getValueFromRequest(w, r)
|
||||
if !success {
|
||||
controllers.WriteSimpleResponse(w, false, "unable to update custom styles")
|
||||
return
|
||||
}
|
||||
|
||||
data.SetCustomStyles(customStyles.Value.(string))
|
||||
}
|
||||
|
||||
func requirePOST(w http.ResponseWriter, r *http.Request) bool {
|
||||
if r.Method != controllers.POST {
|
||||
controllers.WriteSimpleResponse(w, false, r.Method+" not supported")
|
||||
|
||||
@@ -39,6 +39,7 @@ func GetServerConfig(w http.ResponseWriter, r *http.Request) {
|
||||
Logo: data.GetLogoPath(),
|
||||
SocialHandles: data.GetSocialHandles(),
|
||||
NSFW: data.GetNSFW(),
|
||||
CustomStyles: data.GetCustomStyles(),
|
||||
},
|
||||
FFmpegPath: utils.ValidatedFfmpegPath(data.GetFfMpegPath()),
|
||||
StreamKey: data.GetStreamKey(),
|
||||
@@ -94,6 +95,7 @@ type webConfigResponse struct {
|
||||
ExtraPageContent string `json:"extraPageContent"`
|
||||
StreamTitle string `json:"streamTitle"` // What's going on with the current stream
|
||||
SocialHandles []models.SocialHandle `json:"socialHandles"`
|
||||
CustomStyles string `json:"customStyles"`
|
||||
}
|
||||
|
||||
type yp struct {
|
||||
|
||||
Reference in New Issue
Block a user