mirror of
				https://github.com/owncast/owncast.git
				synced 2025-11-04 13:27:21 +08:00 
			
		
		
		
	* Add user-customizable theming. Closes #1915 * Prettified Code! * Add user-customizable theming. Closes #1915 * Add explicit color for page content background * Prettified Code! Co-authored-by: gabek <gabek@users.noreply.github.com>
		
			
				
	
	
		
			36 lines
		
	
	
		
			822 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			822 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package admin
 | 
						|
 | 
						|
import (
 | 
						|
	"encoding/json"
 | 
						|
	"net/http"
 | 
						|
 | 
						|
	"github.com/owncast/owncast/controllers"
 | 
						|
	"github.com/owncast/owncast/core/data"
 | 
						|
)
 | 
						|
 | 
						|
// SetCustomColorVariableValues sets the custom color variables.
 | 
						|
func SetCustomColorVariableValues(w http.ResponseWriter, r *http.Request) {
 | 
						|
	if !requirePOST(w, r) {
 | 
						|
		return
 | 
						|
	}
 | 
						|
 | 
						|
	type request struct {
 | 
						|
		Value map[string]string `json:"value"`
 | 
						|
	}
 | 
						|
 | 
						|
	decoder := json.NewDecoder(r.Body)
 | 
						|
	var values request
 | 
						|
 | 
						|
	if err := decoder.Decode(&values); err != nil {
 | 
						|
		controllers.WriteSimpleResponse(w, false, "unable to update appearance variable values")
 | 
						|
		return
 | 
						|
	}
 | 
						|
 | 
						|
	if err := data.SetCustomColorVariableValues(values.Value); err != nil {
 | 
						|
		controllers.WriteSimpleResponse(w, false, err.Error())
 | 
						|
		return
 | 
						|
	}
 | 
						|
 | 
						|
	controllers.WriteSimpleResponse(w, true, "custom appearance variables updated")
 | 
						|
}
 |