From 763618cc4fc16b7066b219f160982754411ab33b Mon Sep 17 00:00:00 2001 From: mdastgheib Date: Wed, 20 Sep 2023 21:35:03 -0500 Subject: [PATCH 1/2] feat: Added UI advanced options '-referer' header functionality --- src/views/Edit/Sources/Network.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/views/Edit/Sources/Network.js b/src/views/Edit/Sources/Network.js index 5d8409b..234eba4 100644 --- a/src/views/Edit/Sources/Network.js +++ b/src/views/Edit/Sources/Network.js @@ -67,6 +67,7 @@ const initSettings = (initialSettings) => { forceFramerate: false, framerate: 25, userAgent: '', + referer: '', http_proxy: '', ...settings.http, }; @@ -287,6 +288,10 @@ const createInputs = (settings, config, skills) => { input.options.push('-user_agent', settings.http.userAgent); } + if (settings.http.referer.length !== 0) { + input.options.push('-referer', settings.http.referer); + } + if (settings.http.http_proxy.length !== 0) { input.options.push('-http_proxy', settings.http.http_proxy); } @@ -546,6 +551,15 @@ function AdvancedSettings(props) { onChange={props.onChange('http', 'userAgent')} /> + + + Date: Fri, 22 Sep 2023 15:10:08 +0200 Subject: [PATCH 2/2] Rename Referer to Referrer in the label --- src/views/Edit/Sources/Network.js | 2 +- src/views/Edit/Sources/Network.test.js | 41 ++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/views/Edit/Sources/Network.js b/src/views/Edit/Sources/Network.js index 57c0282..ea5787e 100644 --- a/src/views/Edit/Sources/Network.js +++ b/src/views/Edit/Sources/Network.js @@ -555,7 +555,7 @@ function AdvancedSettings(props) { diff --git a/src/views/Edit/Sources/Network.test.js b/src/views/Edit/Sources/Network.test.js index 9a9a3cc..9204145 100644 --- a/src/views/Edit/Sources/Network.test.js +++ b/src/views/Edit/Sources/Network.test.js @@ -84,6 +84,7 @@ const pullmatrix = { forceFramerate: true, framerate: 25, userAgent: 'foobaz/1', + referer: 'http://example.com', http_proxy: '', }, general: { @@ -128,7 +129,21 @@ pullmatrix.tests = [ skills: $skills_ffmpeg4, input: { address: 'http://admin:foobar@127.0.0.1/live/stream.m3u8', - options: ['-fflags', '+genpts', '-thread_queue_size', 512, '-analyzeduration', 20000000, '-re', '-r', 25, '-user_agent', 'foobaz/1'], + options: [ + '-fflags', + '+genpts', + '-thread_queue_size', + 512, + '-analyzeduration', + 20000000, + '-re', + '-r', + 25, + '-user_agent', + 'foobaz/1', + '-referer', + 'http://example.com', + ], }, }, { @@ -164,7 +179,21 @@ pullmatrix.tests = [ skills: $skills_ffmpeg5, input: { address: 'http://admin:foobar@127.0.0.1/live/stream.m3u8', - options: ['-fflags', '+genpts', '-thread_queue_size', 512, '-analyzeduration', 20000000, '-re', '-r', 25, '-user_agent', 'foobaz/1'], + options: [ + '-fflags', + '+genpts', + '-thread_queue_size', + 512, + '-analyzeduration', + 20000000, + '-re', + '-r', + 25, + '-user_agent', + 'foobaz/1', + '-referer', + 'http://example.com', + ], }, }, { @@ -285,7 +314,7 @@ pushmatrix.tests = [ skills: $skills_ffmpeg4, config: $config, input: { - address: 'rtmp://localhost/live/external.stream?token=foobar', + address: '{rtmp,name=external.stream}', options: ['-fflags', '+genpts', '-thread_queue_size', 512, '-analyzeduration', 3000000], }, }, @@ -295,7 +324,7 @@ pushmatrix.tests = [ skills: $skills_ffmpeg4, config: $config, input: { - address: 'srt://localhost?mode=caller&transtype=live&streamid=external,mode:request,token:foobar&passphrase=bazfoobazfoo', + address: '{srt,name=external.stream,mode=request}', options: ['-fflags', '+genpts', '-thread_queue_size', 512], }, }, @@ -305,7 +334,7 @@ pushmatrix.tests = [ skills: $skills_ffmpeg5, config: $config, input: { - address: 'rtmp://localhost/live/external.stream?token=foobar', + address: '{rtmp,name=external.stream}', options: ['-fflags', '+genpts', '-thread_queue_size', 512, '-analyzeduration', 3000000], }, }, @@ -315,7 +344,7 @@ pushmatrix.tests = [ skills: $skills_ffmpeg5, config: $config, input: { - address: 'srt://localhost?mode=caller&transtype=live&streamid=external,mode:request,token:foobar&passphrase=bazfoobazfoo', + address: '{srt,name=external.stream,mode=request}', options: ['-fflags', '+genpts', '-thread_queue_size', 512], }, },