From a55924d28c988ba067d4495e72e2a592d2dcabdb Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Fri, 8 Jul 2022 10:09:41 +0200 Subject: [PATCH] Add warning if process depends on disabled RTMP/SRT server --- src/utils/restreamer.js | 12 ++++++++---- src/views/Main/index.js | 14 +++++++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/utils/restreamer.js b/src/utils/restreamer.js index 886a6e5..4f43d41 100644 --- a/src/utils/restreamer.js +++ b/src/utils/restreamer.js @@ -2798,11 +2798,19 @@ class Restreamer { p.state.progress.outputs[i].address = replace(p.state.progress.outputs[i].address); } + if (!p.state.command) { + p.state.command = []; + } + p.state.command = p.state.command.map(replace); p.state.last_logline = replace(p.state.last_logline); } if (p.report) { + if (!p.report.prelude) { + p.report.prelude = []; + } + p.report.prelude = p.report.prelude.map(replace); p.report.log = p.report.log.map((l) => [l[0], replace(l[1])]); @@ -2812,10 +2820,6 @@ class Restreamer { } } - if (p.service) { - p.service.token = replace(p.service.token); - } - return p; } diff --git a/src/views/Main/index.js b/src/views/Main/index.js index ff60574..ec7dc2a 100644 --- a/src/views/Main/index.js +++ b/src/views/Main/index.js @@ -79,6 +79,7 @@ export default function Main(props) { open: false, data: '', }); + const [$config, setConfig] = React.useState(null); const navigate = useNavigate(); const address = props.restreamer.Address() + '/'; @@ -96,7 +97,10 @@ export default function Main(props) { }, []); const load = async () => { - let metadata = await props.restreamer.GetIngestMetadata(_channelid); + const config = props.restreamer.ConfigActive(); + setConfig(config); + + const metadata = await props.restreamer.GetIngestMetadata(_channelid); if (metadata.version && metadata.version === 1) { setMetadata({ ...$metadata, @@ -141,6 +145,14 @@ export default function Main(props) { } } + if (!$config.source.network.rtmp.enabled && $metadata.control.rtmp.enable) { + state.state = 'error'; + state.progress.error = 'RTMP server is not enabled, but required.'; + } else if (!$config.source.network.srt.enabled && $metadata.control.srt.enable) { + state.state = 'error'; + state.progress.error = 'SRT server is not enabled, but required.'; + } + setState({ ...$state, ...state,