From ee50071c8dc0871020e0aa16d6ceabb334ccef9a Mon Sep 17 00:00:00 2001 From: Jan Stabenow Date: Thu, 26 Sep 2024 08:34:06 +0200 Subject: [PATCH] Mod uses params instead of defaultProps --- src/Footer.js | 41 ++- src/Header.js | 83 +++--- src/RestreamerUI.js | 16 +- src/Router.js | 30 +- src/index.js | 2 +- src/misc/ActionButton.js | 48 ++- src/misc/BoxText.js | 23 +- src/misc/BoxTextarea.js | 8 +- src/misc/Changelog.js | 27 +- src/misc/ChannelList.js | 70 ++--- src/misc/Checkbox.js | 15 +- src/misc/ColorPicker.js | 16 +- src/misc/CopyButton.js | 9 +- src/misc/Duration.js | 10 +- src/misc/EncodingSelect.js | 73 +++-- src/misc/Env.js | 6 +- src/misc/Filesize.js | 17 +- src/misc/FilterSelect.js | 25 +- src/misc/FormInlineButton.js | 34 ++- src/misc/LanguageSelect.js | 8 +- src/misc/ModalContent.js | 26 +- src/misc/MultiSelect.js | 27 +- src/misc/MultiSelectOption.js | 14 +- src/misc/Number.js | 14 +- src/misc/Paper.js | 51 ++-- src/misc/PaperContent.js | 11 +- src/misc/PaperFooter.js | 11 +- src/misc/PaperHeader.js | 33 +- src/misc/PaperThumb.js | 10 +- src/misc/Password.js | 58 ++-- src/misc/Player/index.js | 72 +++-- src/misc/Player/videojs.js | 13 +- src/misc/Progress.js | 105 +++++-- src/misc/Select.js | 18 +- src/misc/SelectCustom.js | 85 +++--- src/misc/TabPanel.js | 5 +- src/misc/TabsHorizontal.js | 12 +- src/misc/TabsVerticalGrid.js | 8 +- src/misc/TextField.js | 47 ++- src/misc/TextFieldCopy.js | 44 ++- src/misc/Textarea.js | 85 +++--- src/misc/UploadButton.js | 40 +-- src/misc/coders/Decoders/audio/default.js | 17 +- src/misc/coders/Decoders/video/av1_cuvid.js | 17 +- src/misc/coders/Decoders/video/default.js | 17 +- src/misc/coders/Decoders/video/h264_cuvid.js | 17 +- src/misc/coders/Decoders/video/h264_mmal.js | 17 +- src/misc/coders/Decoders/video/hevc_cuvid.js | 17 +- src/misc/coders/Decoders/video/mjpeg_cuvid.js | 17 +- src/misc/coders/Decoders/video/mpeg1_cuvid.js | 17 +- src/misc/coders/Decoders/video/mpeg2_cuvid.js | 17 +- src/misc/coders/Decoders/video/mpeg2_mmal.js | 17 +- src/misc/coders/Decoders/video/mpeg4_cuvid.js | 17 +- src/misc/coders/Decoders/video/mpeg4_mmal.js | 17 +- src/misc/coders/Decoders/video/nvdec.js | 17 +- src/misc/coders/Decoders/video/vc1_cuvid.js | 17 +- src/misc/coders/Decoders/video/vc1_mmal.js | 17 +- .../coders/Decoders/video/videotoolbox.js | 17 +- src/misc/coders/Decoders/video/vp8_cuvid.js | 17 +- src/misc/coders/Decoders/video/vp9_cuvid.js | 17 +- src/misc/coders/Encoders/audio/aac.js | 17 +- .../coders/Encoders/audio/aac_audiotoolbox.js | 17 +- src/misc/coders/Encoders/audio/aac_libfdk.js | 17 +- src/misc/coders/Encoders/audio/copy.js | 17 +- .../coders/Encoders/audio/mp3_libmp3lame.js | 17 +- src/misc/coders/Encoders/audio/none.js | 17 +- src/misc/coders/Encoders/audio/opus.js | 52 ++-- .../coders/Encoders/audio/opus_libopus.js | 17 +- src/misc/coders/Encoders/audio/vorbis.js | 17 +- .../coders/Encoders/audio/vorbis_libvorbis.js | 17 +- src/misc/coders/Encoders/video/av1_libaom.js | 26 +- .../coders/Encoders/video/av1_librav1e.js | 26 +- src/misc/coders/Encoders/video/copy.js | 17 +- .../coders/Encoders/video/h264_libx264.js | 35 +-- src/misc/coders/Encoders/video/h264_nvenc.js | 53 +--- src/misc/coders/Encoders/video/h264_omx.js | 17 +- .../coders/Encoders/video/h264_v4l2m2m.js | 17 +- src/misc/coders/Encoders/video/h264_vaapi.js | 35 +-- .../Encoders/video/h264_videotoolbox.js | 26 +- .../coders/Encoders/video/hevc_libx265.js | 35 +-- src/misc/coders/Encoders/video/hevc_vaapi.js | 35 +-- .../Encoders/video/hevc_videotoolbox.js | 26 +- src/misc/coders/Encoders/video/none.js | 17 +- src/misc/coders/Encoders/video/rawvideo.js | 17 +- src/misc/coders/Encoders/video/vp9_libvpx.js | 17 +- src/misc/coders/Encoders/video/vp9_vaapi.js | 35 +-- src/misc/coders/settings/Audio.js | 116 ++++--- src/misc/coders/settings/Video.js | 282 +++++++----------- src/misc/controls/HLS.js | 13 +- src/misc/controls/License/index.js | 31 +- src/misc/controls/Limits.js | 13 +- src/misc/controls/Metadata.js | 13 +- src/misc/controls/Preview.js | 15 +- src/misc/controls/Process.js | 13 +- src/misc/controls/RTMP.js | 20 +- src/misc/controls/SRT.js | 20 +- src/misc/controls/Snapshot.js | 13 +- src/misc/controls/Source.js | 30 +- src/misc/filters/audio/Loudnorm.js | 11 +- src/misc/filters/audio/Pan.js | 20 +- src/misc/filters/audio/Resample.js | 89 +++--- src/misc/filters/audio/Volume.js | 40 +-- src/misc/filters/video/Bwdif.js | 38 +-- src/misc/filters/video/Framerate.js | 39 +-- src/misc/filters/video/HFlip.js | 11 +- src/misc/filters/video/Scale.js | 20 +- src/misc/filters/video/Transpose.js | 20 +- src/misc/filters/video/VFlip.js | 11 +- src/misc/modals/Debug.js | 20 +- src/misc/modals/Dialog.js | 82 +++-- src/misc/modals/Hint.js | 81 ++--- src/misc/modals/Probe.js | 14 +- src/misc/modals/Process.js | 36 ++- src/misc/modals/Textarea.js | 27 +- src/theme/components/chip.js | 4 +- src/utils/auth0.js | 2 +- src/views/ChannelSelect.js | 8 +- src/views/Edit/Profile.js | 99 +++--- src/views/Edit/ProfileSummary.js | 19 +- src/views/Edit/SourceSelect.js | 84 +++--- src/views/Edit/Sources/ALSA.js | 29 +- src/views/Edit/Sources/AVFoundation.js | 31 +- src/views/Edit/Sources/AudioLoop.js | 31 +- src/views/Edit/Sources/Framebuffer.js | 26 +- src/views/Edit/Sources/Network.js | 206 ++++++------- src/views/Edit/Sources/NoAudio.js | 9 +- src/views/Edit/Sources/Raspicam.js | 19 +- src/views/Edit/Sources/V4L.js | 20 +- src/views/Edit/Sources/VideoAudio.js | 9 +- src/views/Edit/Sources/VideoLoop.js | 31 +- src/views/Edit/Sources/VirtualAudio.js | 14 +- src/views/Edit/Sources/VirtualVideo.js | 14 +- src/views/Edit/StreamSelect.js | 34 +-- src/views/Edit/Summary.js | 18 +- src/views/Edit/Wizard/Abort.js | 19 +- src/views/Edit/Wizard/Audio.js | 60 ++-- src/views/Edit/Wizard/Error.js | 12 +- src/views/Edit/Wizard/License.js | 19 +- src/views/Edit/Wizard/Metadata.js | 19 +- src/views/Edit/Wizard/Probe.js | 8 +- src/views/Edit/Wizard/Saving.js | 8 +- src/views/Edit/Wizard/Source.js | 15 +- src/views/Edit/Wizard/Sources/AVFoundation.js | 36 +-- src/views/Edit/Wizard/Sources/InternalHLS.js | 24 +- src/views/Edit/Wizard/Sources/InternalRTMP.js | 30 +- src/views/Edit/Wizard/Sources/InternalSRT.js | 28 +- src/views/Edit/Wizard/Sources/Network.js | 24 +- src/views/Edit/Wizard/Sources/Raspicam.js | 21 +- src/views/Edit/Wizard/Sources/V4L.js | 24 +- src/views/Edit/Wizard/Video.js | 37 ++- src/views/Edit/Wizard/VideoProfile.js | 64 ++-- src/views/Edit/Wizard/index.js | 50 ++-- src/views/Edit/index.js | 42 ++- src/views/Incompatible.js | 18 +- src/views/Invalid.js | 10 +- src/views/Login.js | 22 +- src/views/Main/Egress.js | 74 +++-- src/views/Main/Progress.js | 14 +- src/views/Main/Publication.js | 25 +- src/views/Main/index.js | 76 ++--- src/views/Password.js | 42 ++- src/views/Playersite.js | 104 ++----- src/views/Publication/Add.js | 16 +- src/views/Publication/Edit.js | 38 ++- src/views/Publication/Player.js | 30 +- src/views/Publication/Process.js | 12 +- src/views/Publication/Services/Akamai.js | 14 +- src/views/Publication/Services/Azure.js | 14 +- src/views/Publication/Services/Brightcove.js | 14 +- src/views/Publication/Services/CDN77.js | 14 +- src/views/Publication/Services/Core.js | 22 +- src/views/Publication/Services/DASH.js | 14 +- src/views/Publication/Services/DLive.js | 14 +- src/views/Publication/Services/DaCast.js | 14 +- src/views/Publication/Services/Dailymotion.js | 18 +- src/views/Publication/Services/Dummy.js | 18 +- src/views/Publication/Services/Facebook.js | 14 +- src/views/Publication/Services/Framebuffer.js | 16 +- src/views/Publication/Services/HLS.js | 14 +- src/views/Publication/Services/Icecast.js | 16 +- src/views/Publication/Services/Image2.js | 14 +- src/views/Publication/Services/Instagram.js | 29 +- src/views/Publication/Services/Kick.js | 14 +- src/views/Publication/Services/Linkedin.js | 14 +- src/views/Publication/Services/Livepush.js | 14 +- .../Publication/Services/Livespotting.js | 14 +- src/views/Publication/Services/MPEGTS.js | 14 +- .../Publication/Services/MediaNetwork.js | 14 +- src/views/Publication/Services/NimoTv.js | 14 +- src/views/Publication/Services/Owncast.js | 14 +- src/views/Publication/Services/PeerTube.js | 14 +- src/views/Publication/Services/PicartoTv.js | 14 +- src/views/Publication/Services/RTMP.js | 24 +- src/views/Publication/Services/RTSP.js | 14 +- src/views/Publication/Services/Red5.js | 14 +- src/views/Publication/Services/Restream.js | 14 +- src/views/Publication/Services/Rumble.js | 14 +- src/views/Publication/Services/SRT.js | 14 +- src/views/Publication/Services/Telegram.js | 14 +- src/views/Publication/Services/TikTok.js | 14 +- src/views/Publication/Services/Trovo.js | 14 +- src/views/Publication/Services/Twitch.js | 14 +- src/views/Publication/Services/Twitter.js | 16 +- src/views/Publication/Services/UDP.js | 14 +- src/views/Publication/Services/Vimeo.js | 14 +- src/views/Publication/Services/WOWZA.js | 14 +- src/views/Publication/Services/Wettercom.js | 16 +- src/views/Publication/Services/Youtube.js | 24 +- src/views/Publication/TabContent.js | 18 +- src/views/Settings.js | 47 ++- src/views/Welcome.js | 2 +- 211 files changed, 2221 insertions(+), 3654 deletions(-) diff --git a/src/Footer.js b/src/Footer.js index a6c645b..6597f70 100644 --- a/src/Footer.js +++ b/src/Footer.js @@ -67,7 +67,11 @@ const useStyles = makeStyles((theme) => ({ }, })); -function Resources(props) { +function Resources({ + getResources = () => { + return null; + }, +}) { const classes = useStyles(); const [$popover, setPopover] = React.useState(null); const [$resources, setResources] = React.useState(null); @@ -94,7 +98,7 @@ function Resources(props) { }, []); const update = async () => { - const resources = await props.resources(); + const resources = await getResources(); if (resources === null) { return; } @@ -347,12 +351,6 @@ function Resources(props) { ); } -Resources.defaultProps = { - resources: () => { - return null; - }, -}; - const initVersion = (initialVersion) => { if (!initialVersion) { initialVersion = {}; @@ -367,11 +365,18 @@ const initVersion = (initialVersion) => { return version; }; -export default function Footer(props) { +export default function Footer({ + expand = false, + app = '', + name = '', + version = initVersion(), + getResources = () => { + return null; + }, +}) { const classes = useStyles(); - const version = initVersion(props.version); - if (props.expand === true) { + if (expand === true) { return ( @@ -379,10 +384,10 @@ export default function Footer(props) { - {props.app} v{version.number} ({version.arch}) {props.name ? '- ' + props.name : ''} + {app} v{version.number} ({version.arch}) {name ? '- ' + name : ''} - + @@ -401,13 +406,3 @@ export default function Footer(props) { ); } } - -Footer.defaultProps = { - expand: false, - app: '', - name: '', - version: initVersion(), - resources: () => { - return null; - }, -}; diff --git a/src/Header.js b/src/Header.js index 0cdfffa..41e664d 100644 --- a/src/Header.js +++ b/src/Header.js @@ -160,12 +160,12 @@ const StyledMenu = styled((props) => ( }, })); -function AboutModal(props) { +function AboutModal({ open = false, onClose = () => {} }) { const classes = useStyles(); return ( - - + + @@ -215,12 +215,17 @@ function AboutModal(props) { ); } -AboutModal.defaultProps = { - open: false, - onClose: () => {}, -}; - -function HeaderMenu(props) { +function HeaderMenu({ + onChannel = () => {}, + onPlayersite = () => {}, + onSettings = () => {}, + onLogout = () => {}, + expand = true, + showPlayersite = false, + showSettings = false, + hasUpdates = false, + hasService = false, +}) { const classes = useStyles(); const [$anchorEl, setAnchorEl] = React.useState(null); @@ -238,17 +243,17 @@ function HeaderMenu(props) { Storage.Set('language', language); }; - if (props.expand === true) { + if (expand === true) { return ( - + - + - {props.hasService === true && ( + {hasService === true && ( @@ -259,18 +264,18 @@ function HeaderMenu(props) { )} - {props.showPlayersite === true && ( - + {showPlayersite === true && ( + Playersite )} - {props.showSettings === true && ( - + {showSettings === true && ( + - + System @@ -300,7 +305,7 @@ function HeaderMenu(props) { - + @@ -348,19 +353,17 @@ function HeaderMenu(props) { } } -HeaderMenu.defaultProps = { - onChannel: () => {}, - onPlayersite: () => {}, - onSettings: () => {}, - onLogout: () => {}, - expand: false, - showPlayersite: false, - showSettings: false, - hasUpdates: false, - hasService: false, -}; - -export default function Header(props) { +export default function Header({ + onChannel = () => {}, + onPlayersite = () => {}, + onSettings = () => {}, + onLogout = () => {}, + expand = true, + showPlayersite = false, + showSettings = false, + hasUpdates = false, + hasService = false, +}) { const classes = useStyles(); return ( @@ -372,14 +375,20 @@ export default function Header(props) { Restreamer - + ); } - -Header.defaultProps = { - expand: false, -}; diff --git a/src/RestreamerUI.js b/src/RestreamerUI.js index 7b22b16..6ac419d 100644 --- a/src/RestreamerUI.js +++ b/src/RestreamerUI.js @@ -40,7 +40,7 @@ const useStyles = makeStyles((theme) => ({ }, })); -export default function RestreamerUI(props) { +export default function RestreamerUI({ address = '' }) { const classes = useStyles(); const [$state, setState] = React.useState({ @@ -121,7 +121,7 @@ export default function RestreamerUI(props) { }; const handleMount = async () => { - restreamer.current = new Restreamer(props.address); + restreamer.current = new Restreamer(address); restreamer.current.AddListener((event) => { notify(event.severity, event.type, event.message); }); @@ -452,7 +452,7 @@ export default function RestreamerUI(props) { name = restreamer.current.Name(); } - let resources = () => { + let getResources = () => { return null; }; @@ -490,7 +490,7 @@ export default function RestreamerUI(props) { ); } else { view = ; - resources = handleResources; + getResources = handleResources; } } @@ -523,7 +523,7 @@ export default function RestreamerUI(props) { -