From 70f27ae30478ed894e09798be6da6699cc17869d Mon Sep 17 00:00:00 2001 From: Simon L Date: Mon, 5 Jun 2023 15:05:14 +0200 Subject: [PATCH 1/3] allow to disable/enable talk-recording Signed-off-by: Simon L --- Containers/nextcloud/entrypoint.sh | 11 +++++++ php/containers.json | 33 +++++++++++++++++-- php/public/disable-talk-recording.js | 4 +++ php/public/index.php | 1 + php/public/options-form-submit.js | 18 ++++++++++ php/src/ContainerDefinitionFetcher.php | 8 +++++ .../Controller/ConfigurationController.php | 5 +++ php/src/Data/ConfigurationManager.php | 21 ++++++++++++ php/src/Docker/DockerActionManager.php | 6 ++++ php/templates/containers.twig | 8 ++++- readme.md | 1 + tests/QA/050-optional-addons.md | 1 + 12 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 php/public/disable-talk-recording.js diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index 9887629e..9236378f 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -583,6 +583,17 @@ else fi fi +# Talk recording +if [ -d "/var/www/html/custom_apps/spreed" ]; then + if [ "$TALK_RECORDING_ENABLED" = 'yes' ]; then + # TODO: migrate to occ command if that becomes available + RECORDING_SERVERS_STRING="{\"servers\":[{\"server\":\"https://$NC_DOMAIN/talk-recording/\",\"verify\":true}],\"secret\":\"$RECORDING_SECRET\"}" + php /var/www/html/occ config:app:set spreed recording_servers --value="$RECORDING_SERVERS_STRING" + else + php /var/www/html/occ config:app:delete spreed recording_servers + fi +fi + # Clamav if [ "$CLAMAV_ENABLED" = 'yes' ]; then count=0 diff --git a/php/containers.json b/php/containers.json index 8d7f9cde..4723e33a 100644 --- a/php/containers.json +++ b/php/containers.json @@ -6,6 +6,7 @@ "nextcloud-aio-onlyoffice", "nextcloud-aio-collabora", "nextcloud-aio-talk", + "nextcloud-aio-talk-recording", "nextcloud-aio-nextcloud" ], "display_name": "Apache", @@ -23,6 +24,7 @@ "NEXTCLOUD_HOST=nextcloud-aio-nextcloud", "COLLABORA_HOST=nextcloud-aio-collabora", "TALK_HOST=nextcloud-aio-talk", + "TALK_RECORDING_HOST=nextcloud-aio-talk-recording", "APACHE_PORT=%APACHE_PORT%", "ONLYOFFICE_HOST=nextcloud-aio-onlyoffice", "TZ=%TIMEZONE%", @@ -170,7 +172,9 @@ "STARTUP_APPS=%NEXTCLOUD_STARTUP_APPS%", "ADDITIONAL_APKS=%NEXTCLOUD_ADDITIONAL_APKS%", "ADDITIONAL_PHP_EXTENSIONS=%NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS%", - "INSTALL_LATEST_MAJOR=%INSTALL_LATEST_MAJOR%" + "INSTALL_LATEST_MAJOR=%INSTALL_LATEST_MAJOR%", + "TALK_RECORDING_ENABLED=%TALK_RECORDING_ENABLED%", + "RECORDING_SECRET=%RECORDING_SECRET%" ], "restart": "unless-stopped", "devices": [ @@ -259,11 +263,34 @@ "TURN_SECRET=%TURN_SECRET%", "SIGNALING_SECRET=%SIGNALING_SECRET%", "TZ=%TIMEZONE%", - "TALK_PORT=%TALK_PORT%" + "TALK_PORT=%TALK_PORT%", + "INTERNAL_SECRET=%TALK_INTERNAL_SECRET%" ], "secrets": [ "TURN_SECRET", - "SIGNALING_SECRET" + "SIGNALING_SECRET", + "TALK_INTERNAL_SECRET" + ], + "restart": "unless-stopped" + }, + { + "container_name": "nextcloud-aio-talk-recording", + "display_name": "Talk Recording", + "image": "nextcloud/aio-talk-recording", + "expose": [ + "1234" + ], + "internal_port": "1234", + "environment": [ + "NC_DOMAIN=%NC_DOMAIN%", + "TZ=%TIMEZONE%", + "RECORDING_SECRET=%RECORDING_SECRET%", + "INTERNAL_SECRET=%TALK_INTERNAL_SECRET%" + ], + "shm_size": 2147483648, + "secrets": [ + "RECORDING_SECRET", + "TALK_INTERNAL_SECRET" ], "restart": "unless-stopped" }, diff --git a/php/public/disable-talk-recording.js b/php/public/disable-talk-recording.js new file mode 100644 index 00000000..72c5de32 --- /dev/null +++ b/php/public/disable-talk-recording.js @@ -0,0 +1,4 @@ +document.addEventListener("DOMContentLoaded", function(event) { + // Talk-recording + document.getElementById("talk-recording").disabled = true; +}); diff --git a/php/public/index.php b/php/public/index.php index f75a514a..87421cdc 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -120,6 +120,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'nextcloud_max_time' => $configurationManager->GetNextcloudMaxTime(), 'nextcloud_memory_limit' => $configurationManager->GetNextcloudMemoryLimit(), 'is_dri_device_enabled' => $configurationManager->isDriDeviceEnabled(), + 'is_talk_recording_enabled' => $configurationManager->isTalkRecordingEnabled(), ]); })->setName('profile'); $app->get('/login', function (Request $request, Response $response, array $args) use ($container) { diff --git a/php/public/options-form-submit.js b/php/public/options-form-submit.js index 6d017315..1b2262ce 100644 --- a/php/public/options-form-submit.js +++ b/php/public/options-form-submit.js @@ -3,6 +3,16 @@ function makeOptionsFormSubmitVisible() { optionsFormSubmit.style.display = 'block'; } +function handleTalkVisibility(talk) { + let talkRecording = document.getElementById("talk-recording") + if (talk.checked) { + talkRecording.disabled = false + } else { + talkRecording.checked = false + talkRecording.disabled = true + } +} + document.addEventListener("DOMContentLoaded", function(event) { // handle submit button for options form var optionsFormSubmit = document.getElementById("options-form-submit"); @@ -25,6 +35,14 @@ document.addEventListener("DOMContentLoaded", function(event) { // Talk var talk = document.getElementById("talk"); talk.addEventListener('change', makeOptionsFormSubmitVisible); + talk.addEventListener('change', handleTalkVisibility); + + // Talk-recording + var talkRecording = document.getElementById("talk-recording"); + talkRecording.addEventListener('change', makeOptionsFormSubmitVisible); + if (!talk.checked) { + talkRecording.disabled = true + } // Imaginary var imaginary = document.getElementById("imaginary"); diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 82ebcfb1..3185b63c 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -81,6 +81,10 @@ class ContainerDefinitionFetcher if (!$this->configurationManager->isTalkEnabled()) { continue; } + } elseif ($entry['container_name'] === 'nextcloud-aio-talk-recording') { + if (!$this->configurationManager->isTalkRecordingEnabled()) { + continue; + } } elseif ($entry['container_name'] === 'nextcloud-aio-imaginary') { if (!$this->configurationManager->isImaginaryEnabled()) { continue; @@ -179,6 +183,10 @@ class ContainerDefinitionFetcher if (!$this->configurationManager->isTalkEnabled()) { continue; } + } elseif ($value === 'nextcloud-aio-talk-recording') { + if (!$this->configurationManager->isTalkRecordingEnabled()) { + continue; + } } elseif ($value === 'nextcloud-aio-imaginary') { if (!$this->configurationManager->isImaginaryEnabled()) { continue; diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index 561cec8c..9ed155ff 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -95,6 +95,11 @@ class ConfigurationController } else { $this->configurationManager->SetTalkEnabledState(0); } + if (isset($request->getParsedBody()['talk-recording'])) { + $this->configurationManager->SetTalkRecordingEnabledState(1); + } else { + $this->configurationManager->SetTalkRecordingEnabledState(0); + } if (isset($request->getParsedBody()['imaginary'])) { $this->configurationManager->SetImaginaryEnabledState(1); } else { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 3b6ce07f..0a40366e 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -230,6 +230,27 @@ class ConfigurationManager $this->WriteConfig($config); } + public function isTalkRecordingEnabled() : bool { + if (!$this->isTalkEnabled()) { + return false; + } + $config = $this->GetConfig(); + if (isset($config['isTalkRecordingEnabled']) && $config['isTalkRecordingEnabled'] === 1) { + return true; + } else { + return false; + } + } + + public function SetTalkRecordingEnabledState(int $value) : void { + if (!$this->isTalkEnabled()) { + $value = 0; + } + $config = $this->GetConfig(); + $config['isTalkRecordingEnabled'] = $value; + $this->WriteConfig($config); + } + /** * @throws InvalidSettingConfigurationException */ diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 903f912b..b7383ca2 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -278,6 +278,12 @@ class DockerActionManager } else { $replacements[1] = ''; } + } elseif ($out[1] === 'TALK_RECORDING_ENABLED') { + if ($this->configurationManager->isTalkRecordingEnabled()) { + $replacements[1] = 'yes'; + } else { + $replacements[1] = ''; + } } elseif ($out[1] === 'ONLYOFFICE_ENABLED') { if ($this->configurationManager->isOnlyofficeEnabled()) { $replacements[1] = 'yes'; diff --git a/php/templates/containers.twig b/php/templates/containers.twig index ac8f896e..dde85fb4 100644 --- a/php/templates/containers.twig +++ b/php/templates/containers.twig @@ -544,6 +544,11 @@ {% else %}

{% endif %} + {% if is_talk_recording_enabled == true %} +
+ {% else %} +
+ {% endif %} {% if is_onlyoffice_enabled == true %}
{% else %} @@ -552,7 +557,7 @@ - Minimal system requirements: When any optional addon is enabled, at least 2GB RAM, a dual-core CPU and 40GB system storage are required. When enabling ClamAV or Fulltextsearch, at least 3GB RAM are required. When enabling everything, at least 4GB RAM are required. Recommended are at least 1GB more RAM than the minimal requirement. For further advices and recommendations see this documentation

+ Minimal system requirements: When any optional addon is enabled, at least 2GB RAM, a dual-core CPU and 40GB system storage are required. When enabling ClamAV, Talk Recording or Fulltextsearch, at least 3GB RAM are required. When enabling everything, at least 5GB RAM are required. Recommended are at least 1GB more RAM than the minimal requirement. For further advices and recommendations see this documentation

{% if isAnyRunning == true or is_x64_platform == false %} {% endif %} @@ -562,6 +567,7 @@ + {% endif %} {% if is_collabora_enabled == true and isAnyRunning == false and was_start_button_clicked == true %} diff --git a/readme.md b/readme.md index 46ec48d4..9acaee3a 100644 --- a/readme.md +++ b/readme.md @@ -6,6 +6,7 @@ Included are: - Nextcloud Office - High performance backend for Nextcloud Files - High performance backend for Nextcloud Talk and TURN-server +- Nextcloud Talk Recording-server - Backup solution (based on [BorgBackup](https://github.com/borgbackup/borg#what-is-borgbackup)) - Imaginary (for previews of heic, heif, illustrator, pdf, svg, tiff and webp) - ClamAV (Antivirus backend for Nextcloud) diff --git a/tests/QA/050-optional-addons.md b/tests/QA/050-optional-addons.md index 9719839f..99296cf3 100644 --- a/tests/QA/050-optional-addons.md +++ b/tests/QA/050-optional-addons.md @@ -9,6 +9,7 @@ - [ ] Nextcloud Talk by opening the Talk app in Nextcloud, creating a new chat and trying to join a call in this chat. Also verifying in the settings that the HPB and turn server work. - [ ] Imaginary by having a look if when uploading a new picture in Nextcloud, it adds some log entries to the container - [ ] Fulltextsearch by trying to search for a heading inside a file in Nextcloud + - [ ] Talk-recording by starting a call and trying to record something - [ ] When Collabora is enabled, it should show below the Optional Addons section a section where you can change the dictionaries for collabora. `de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru` should be a valid setting. E.g. `de.De` not. If already set, it should show a button that allows to remove the setting again. You can now continue with [060-environmental-variables.md](./060-environmental-variables.md) \ No newline at end of file From 4953ce95c6468d1e007769da7812f7efc41b5d9b Mon Sep 17 00:00:00 2001 From: Simon L Date: Mon, 5 Jun 2023 18:44:36 +0200 Subject: [PATCH 2/3] dont expose it publicly Signed-off-by: Simon L --- Containers/nextcloud/entrypoint.sh | 2 +- php/containers.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index 9236378f..a1734cb8 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -587,7 +587,7 @@ fi if [ -d "/var/www/html/custom_apps/spreed" ]; then if [ "$TALK_RECORDING_ENABLED" = 'yes' ]; then # TODO: migrate to occ command if that becomes available - RECORDING_SERVERS_STRING="{\"servers\":[{\"server\":\"https://$NC_DOMAIN/talk-recording/\",\"verify\":true}],\"secret\":\"$RECORDING_SECRET\"}" + RECORDING_SERVERS_STRING="{\"servers\":[{\"server\":\"http://$TALK_RECORDING_HOST:1234/\",\"verify\":true}],\"secret\":\"$RECORDING_SECRET\"}" php /var/www/html/occ config:app:set spreed recording_servers --value="$RECORDING_SERVERS_STRING" else php /var/www/html/occ config:app:delete spreed recording_servers diff --git a/php/containers.json b/php/containers.json index 4723e33a..9a8dfaab 100644 --- a/php/containers.json +++ b/php/containers.json @@ -24,7 +24,6 @@ "NEXTCLOUD_HOST=nextcloud-aio-nextcloud", "COLLABORA_HOST=nextcloud-aio-collabora", "TALK_HOST=nextcloud-aio-talk", - "TALK_RECORDING_HOST=nextcloud-aio-talk-recording", "APACHE_PORT=%APACHE_PORT%", "ONLYOFFICE_HOST=nextcloud-aio-onlyoffice", "TZ=%TIMEZONE%", @@ -174,7 +173,8 @@ "ADDITIONAL_PHP_EXTENSIONS=%NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS%", "INSTALL_LATEST_MAJOR=%INSTALL_LATEST_MAJOR%", "TALK_RECORDING_ENABLED=%TALK_RECORDING_ENABLED%", - "RECORDING_SECRET=%RECORDING_SECRET%" + "RECORDING_SECRET=%RECORDING_SECRET%", + "TALK_RECORDING_HOST=nextcloud-aio-talk-recording" ], "restart": "unless-stopped", "devices": [ From e9d8e1845a2e90666f77f96e7528890f966c542c Mon Sep 17 00:00:00 2001 From: Simon L Date: Tue, 6 Jun 2023 09:26:14 +0200 Subject: [PATCH 3/3] wait for talk-recording to become available Signed-off-by: Simon L --- Containers/nextcloud/entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index a1734cb8..2c32d0be 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -586,6 +586,10 @@ fi # Talk recording if [ -d "/var/www/html/custom_apps/spreed" ]; then if [ "$TALK_RECORDING_ENABLED" = 'yes' ]; then + while ! nc -z "$TALK_RECORDING_HOST" 1234; do + echo "waiting for Talk Recording to become available..." + sleep 5 + done # TODO: migrate to occ command if that becomes available RECORDING_SERVERS_STRING="{\"servers\":[{\"server\":\"http://$TALK_RECORDING_HOST:1234/\",\"verify\":true}],\"secret\":\"$RECORDING_SECRET\"}" php /var/www/html/occ config:app:set spreed recording_servers --value="$RECORDING_SERVERS_STRING"