From b27fdfa03e469cdd1b04a4fa617526b24a78dbaa Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 29 Aug 2024 17:45:57 -0600 Subject: [PATCH] quick_jibri_installer.sh: start migration to configure via patches. --- ...t-enable-livestreaming-and-recording.patch | 66 +++++++++++++++++++ .../002-jitsi-meet-welcome-page-on-off.patch | 31 +++++++++ quick_jibri_installer.sh | 46 +++++++------ 3 files changed, 119 insertions(+), 24 deletions(-) create mode 100644 patches/jitsi-meet/001-jitsi-meet-enable-livestreaming-and-recording.patch create mode 100644 patches/jitsi-meet/002-jitsi-meet-welcome-page-on-off.patch diff --git a/patches/jitsi-meet/001-jitsi-meet-enable-livestreaming-and-recording.patch b/patches/jitsi-meet/001-jitsi-meet-enable-livestreaming-and-recording.patch new file mode 100644 index 0000000..51b5f9e --- /dev/null +++ b/patches/jitsi-meet/001-jitsi-meet-enable-livestreaming-and-recording.patch @@ -0,0 +1,66 @@ +# Quick Jibri Installer - *buntu (LTS) based systems. +# SwITNet Ltd © - 2024, https://switnet.net/ +# GPLv3 or later. + +Patch jitsi-meet config.js to enable recording and livestreaming by default. + +diff --git a/etc/jitsi/meet/${DOMAIN}-config.js b/etc/jitsi/meet/${DOMAIN}-config.js +index dcb860b..8f64c7c 100644 +--- a/etc/jitsi/meet/${DOMAIN}-config.js ++++ b/etc/jitsi/meet/${DOMAIN}-config.js +@@ -343,12 +343,12 @@ var config = { + // // showPrejoinWarning: true, + // }, + +- // recordingService: { ++ recordingService: { + // // When integrations like dropbox are enabled only that will be shown, + // // by enabling fileRecordingsServiceEnabled, we show both the integrations + // // and the generic recording service (its configuration and storage type + // // depends on jibri configuration) +- // enabled: false, ++ enabled: true, + + // // Whether to show the possibility to share file recording with other people + // // (e.g. meeting participants), based on the actual implementation +@@ -357,7 +357,7 @@ var config = { + + // // Hide the warning that says we only store the recording for 24 hours. + // hideStorageWarning: false, +- // }, ++ }, + + // DEPRECATED. Use recordingService.enabled instead. + // fileRecordingsServiceEnabled: false, +@@ -368,7 +368,7 @@ var config = { + // Local recording configuration. + // localRecording: { + // // Whether to disable local recording or not. +- // disable: false, ++ // disable: true, + + // // Whether to notify all participants when a participant is recording locally. + // notifyAllParticipants: false, +@@ -378,9 +378,9 @@ var config = { + // }, + + // Customize the Live Streaming dialog. Can be modified for a non-YouTube provider. +- // liveStreaming: { ++ liveStreaming: { + // // Whether to enable live streaming or not. +- // enabled: false, ++ enabled: true, + // // Terms link + // termsLink: 'https://www.youtube.com/t/terms', + // // Data privacy link +@@ -388,8 +388,8 @@ var config = { + // // RegExp string that validates the stream key input field + // validatorRegExpString: '^(?:[a-zA-Z0-9]{4}(?:-(?!$)|$)){4}', + // // Documentation reference for the live streaming feature. +- // helpLink: 'https://jitsi.org/live' +- // }, ++ helpLink: 'https://forge.switnet.net/switnet/quick-jibri-installer' ++ }, + + // DEPRECATED. Use liveStreaming.enabled instead. + // liveStreamingEnabled: false, diff --git a/patches/jitsi-meet/002-jitsi-meet-welcome-page-on-off.patch b/patches/jitsi-meet/002-jitsi-meet-welcome-page-on-off.patch new file mode 100644 index 0000000..fab6e3f --- /dev/null +++ b/patches/jitsi-meet/002-jitsi-meet-welcome-page-on-off.patch @@ -0,0 +1,31 @@ +# Quick Jibri Installer - *buntu (LTS) based systems. +# SwITNet Ltd © - 2024, https://switnet.net/ +# GPLv3 or later. + +Patch jitsi-meet config.js to enable/disable welcome page. + +diff --git a/etc/jitsi/meet/${DOMAIN}-config.js b/etc/jitsi/meet/${DOMAIN}-config.js +index dcb860b..2094287 100644 +--- a/etc/jitsi/meet/${DOMAIN}-config.js ++++ b/etc/jitsi/meet/${DOMAIN}-config.js +@@ -664,13 +664,13 @@ var config = { + // enableWelcomePage: true, + + // Configs for welcome page. +- // welcomePage: { +- // // Whether to disable welcome page. In case it's disabled a random room +- // // will be joined when no room is specified. +- // disabled: false, +- // // If set, landing page will redirect to this URL. +- // customUrl: '' +- // }, ++ welcomePage: { ++ // Whether to disable welcome page. In case it's disabled a random room ++ // will be joined when no room is specified. ++ disabled: ${ENABLE_WELCP_BOL}, ++ // If set, landing page will redirect to this URL. ++ customUrl: '' ++ }, + + // Configs for the lobby screen. + // lobby: { diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index ee0edcc..a5176ba 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -546,6 +546,7 @@ JIBRI_XORG_CONF="/etc/jitsi/jibri/xorg-video-dummy.conf" WS_MATCH1="# ensure all static content can always be found first" WS_MATCH2="external_api.js" MEET_MATCH1="disable simulcast support." +export DOMAIN # Make sure we can rely on the match strings. printf "> Testing match strings on config files.\n" @@ -853,20 +854,16 @@ BREWERY # Jibri tweaks for /etc/jitsi/meet/$DOMAIN-config.js sed -i "s|conference.$DOMAIN|internal.auth.$DOMAIN|" "$MEET_CONF" -#Enable recording by default. -sed -i "s|// recordingService:|recordingService:|" "$MEET_CONF" -sed -i "/recordingService/,/hideStorageWarning/s|// enabled: false,| enabled: true,|" "$MEET_CONF" -sed -i "/hideStorageWarning: false/,/}/s|// },|},|" "$MEET_CONF" +#Enable recording & livestreaming by default. +echo "> Patching config.js to enable recording and livestreaming by default..." +echo " Read more about patches at the patches folder." +envsubst < \ + patches/jitsi-meet/001-jitsi-meet-enable-livestreaming-and-recording.patch | \ + patch --no-backup-if-mismatch -d / -p1 + #Prepare hidden domain for jibri/jigasi silent users. sed -i "/fileRecordingsServiceEnabled: false,/a \\ hiddenDomain: \'recorder.$DOMAIN\'," "$MEET_CONF" - -#Enable livestreaming by default. -sed -i "s|// liveStreaming:|liveStreaming:|" "$MEET_CONF" -sed -i "/liveStreaming:/,/helpLink:/s|// enabled: false,| enabled: true,|" "$MEET_CONF" -sed -i "s|// helpLink:| helpLink:|" "$MEET_CONF" -sed -i "/helpLink:/,/}/s|// },|},|" "$MEET_CONF" - # Recording directory if [ ! -d "$DIR_RECORD" ]; then mkdir "$DIR_RECORD" @@ -1047,22 +1044,23 @@ fi sed -i "s|// startWithVideoMuted: false,|startWithVideoMuted: true,|" "$MEET_CONF" #Start with audio muted but admin -sed -i "s|// startAudioMuted: 10,|startAudioMuted: 1,|" "$MEET_CONF" +sed -i "s|// startAudioMuted: 10,|startAudioMuted: 2,|" "$MEET_CONF" #Disable/enable welcome page -if [ "$ENABLE_WELCP" = "yes" ]; then - sed -i "/ welcomePage: {/,/},/s|// ||" "$MEET_CONF" - sed -i "/ welcomePage: {/,/},/s|disabled: .*,|disabled: true,|" "$MEET_CONF" -elif [ "$ENABLE_WELCP" = "no" ]; then - sed -i "/ welcomePage: {/,/},/s|// ||" "$MEET_CONF" - sed -i "/ welcomePage: {/,/},/s|disabled: .*,|disabled: false,|" "$MEET_CONF" -fi +[ "$ENABLE_WELCP" = "yes" ] && ENABLE_WELCP_BOL=true +[ "$ENABLE_WELCP" = "no" ] && ENABLE_WELCP_BOL=false +export ENABLE_WELCP_BOL +echo "> Patching config.js to modify welcompage behavior..." +echo " Read more about patches at the patches folder." +envsubst < \ + patches/jitsi-meet/002-jitsi-meet-welcome-page-on-off.patch | \ + patch --no-backup-if-mismatch -d / -p1 + #Enable close page -if [ "$ENABLE_CLOCP" = "yes" ]; then - sed -i "s|.*enableClosePage:.*| enableClosePage: true,|" "$MEET_CONF" -elif [ "$ENABLE_CLOCP" = "no" ]; then - sed -i "s|.*enableClosePage:.*| enableClosePage: false,|" "$MEET_CONF" -fi +[ "$ENABLE_CLOCP" = "yes" ] && \ + sed -i "s|// enableClosePage:.*|enableClosePage: true,|" "$MEET_CONF" +[ "$ENABLE_CLOCP" = "no" ] && \ + sed -i "s|// enableClosePage:.*|enableClosePage: false,|" "$MEET_CONF" #Add pre-join screen by default, since it improves YouTube autoplay capabilities #pre-join screen by itself don't require autorization by moderator, don't confuse with lobby which does.