API + Data changes to support split up of stream keys and admin passwords

This commit is contained in:
Gabe Kangas
2022-11-22 22:08:25 -08:00
parent 1645451faa
commit c9e3ccad45
11 changed files with 116 additions and 37 deletions

View File

@@ -22,7 +22,7 @@ type UserAccessTokenHandlerFunc func(user.User, http.ResponseWriter, *http.Reque
func RequireAdminAuth(handler http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
username := "admin"
password := data.GetStreamKey()
password := data.GetAdminPassword()
realm := "Owncast Authenticated Request"
// The following line is kind of a work around.

View File

@@ -159,7 +159,10 @@ func Start() error {
// Update config values
// Change the current streaming key in memory
http.HandleFunc("/api/admin/config/key", middleware.RequireAdminAuth(admin.SetStreamKey))
http.HandleFunc("/api/admin/config/adminpass", middleware.RequireAdminAuth(admin.SetAdminPassword))
// Set an array of valid stream keys
http.HandleFunc("/api/admin/config/streamkeys", middleware.RequireAdminAuth(admin.SetStreamKeys))
// Change the extra page content in memory
http.HandleFunc("/api/admin/config/pagecontent", middleware.RequireAdminAuth(admin.SetExtraPageContent))