Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
fix(api): validate stream key payload. Closes #3082
Gabe Kangas37b4d46e85d3
diff --git a/controllers/admin/config.go b/controllers/admin/config.goindex 76b452fe20..feebd6d2c5 100644--- a/controllers/admin/config.go+++ b/controllers/admin/config.go@@ -850,6 +850,18 @@ func SetStreamKeys(w http.ResponseWriter, r *http.Request) {return}+ if len(streamKeys.Value) == 0 {+ controllers.WriteSimpleResponse(w, false, "must provide at least one valid stream key")+ return+ }++ for _, streamKey := range streamKeys.Value {+ if streamKey.Key == "" {+ controllers.WriteSimpleResponse(w, false, "stream key cannot be empty")+ return+ }+ }+if err := data.SetStreamKeys(streamKeys.Value); err != nil {controllers.WriteSimpleResponse(w, false, err.Error())returndiff --git a/test/automated/api/configmanagement.test.js b/test/automated/api/configmanagement.test.jsindex 5bab5a318a..f0a2ad0a94 100644--- a/test/automated/api/configmanagement.test.js+++ b/test/automated/api/configmanagement.test.js@@ -187,6 +187,18 @@ test('verify default admin configuration', async (done) => {done();});+test('verify stream key validation', async (done) => {+ const badPayload = { id: 'zz', comment: 'ouch' };+ const url = '/api/admin/config/streamkeys';+ const res = await request+ .post(url)+ .auth('admin', defaultAdminPassword)+ .send(badPayload)+ .expect(400);++ done();+});+test('set server name', async (done) => {const res = await sendAdminRequest('config/name', newServerName);done();