From f2cdc96ee1b4579454479e8f2019e9719b84568b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 21 Jan 2025 14:41:45 +0100 Subject: [PATCH] fix: Make the High-performance backend warnings more actionable Signed-off-by: Joas Schilling Signed-off-by: Maksim Sukharev --- lib/Settings/Admin/AdminSettings.php | 3 ++ lib/SetupCheck/HighPerformanceBackend.php | 11 +++++-- lib/SetupCheck/RecordingBackend.php | 12 ++++--- lib/SetupCheck/SIPConfiguration.php | 12 ++++--- .../AdminSettings/SignalingServers.vue | 33 ++++++++++++++----- src/types/index.ts | 3 ++ src/views/AdminSettings.vue | 5 ++- 7 files changed, 60 insertions(+), 19 deletions(-) diff --git a/lib/Settings/Admin/AdminSettings.php b/lib/Settings/Admin/AdminSettings.php index 6039bfa842e..619c984538c 100644 --- a/lib/Settings/Admin/AdminSettings.php +++ b/lib/Settings/Admin/AdminSettings.php @@ -25,6 +25,7 @@ use OCP\IUserSession; use OCP\L10N\IFactory; use OCP\Settings\ISettings; +use OCP\Support\Subscription\IRegistry; use OCP\Util; class AdminSettings implements ISettings { @@ -38,6 +39,7 @@ public function __construct( private ICacheFactory $memcacheFactory, private IGroupManager $groupManager, private MatterbridgeManager $bridgeManager, + private IRegistry $subscription, IUserSession $userSession, private IL10N $l10n, private IFactory $l10nFactory, @@ -126,6 +128,7 @@ protected function initTurnServers(): void { } protected function initSignalingServers(): void { + $this->initialState->provideInitialState('has_valid_subscription', $this->subscription->delegateHasValidSubscription()); $this->initialState->provideInitialState('has_cache_configured', $this->memcacheFactory->isAvailable()); $this->initialState->provideInitialState('signaling_mode', $this->talkConfig->getSignalingMode(false)); $this->initialState->provideInitialState('signaling_servers', [ diff --git a/lib/SetupCheck/HighPerformanceBackend.php b/lib/SetupCheck/HighPerformanceBackend.php index 28de6e56cd2..d86334bc22d 100644 --- a/lib/SetupCheck/HighPerformanceBackend.php +++ b/lib/SetupCheck/HighPerformanceBackend.php @@ -16,6 +16,7 @@ use OCP\IURLGenerator; use OCP\SetupCheck\ISetupCheck; use OCP\SetupCheck\SetupResult; +use OCP\Support\Subscription\IRegistry; class HighPerformanceBackend implements ISetupCheck { public function __construct( @@ -24,6 +25,7 @@ public function __construct( readonly protected IURLGenerator $urlGenerator, readonly protected IL10N $l, readonly protected Manager $signalManager, + readonly protected IRegistry $subscription, ) { } @@ -39,11 +41,16 @@ public function run(): SetupResult { if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_INTERNAL) { $setupResult = SetupResult::error(...); if ($this->talkConfig->getHideSignalingWarning()) { - $setupResult = SetupResult::warning(...); + $setupResult = SetupResult::info(...); } + $documentation = 'https://nextcloud-talk.readthedocs.io/en/latest/quick-install/'; + if ($this->subscription->delegateHasValidSubscription()) { + $documentation = 'https://portal.nextcloud.com/article/Nextcloud-Talk/High-Performance-Backend/Installation-of-Nextcloud-Talk-High-Performance-Backend'; + } + return $setupResult( $this->l->t('No High-performance backend configured - Running Nextcloud Talk without the High-performance backend only scales for very small calls (max. 2-3 participants). Please set up the High-performance backend to ensure calls with multiple participants work seamlessly.'), - 'https://portal.nextcloud.com/article/Nextcloud-Talk/High-Performance-Backend/Installation-of-Nextcloud-Talk-High-Performance-Backend', + $documentation, ); } diff --git a/lib/SetupCheck/RecordingBackend.php b/lib/SetupCheck/RecordingBackend.php index 3a4262cfa1a..b4ab15c9750 100644 --- a/lib/SetupCheck/RecordingBackend.php +++ b/lib/SetupCheck/RecordingBackend.php @@ -25,16 +25,20 @@ public function getCategory(): string { } public function getName(): string { - return $this->l->t('Recording backend'); + $name = $this->l->t('Recording backend'); + if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_INTERNAL) { + return '[skip] ' . $name; + } + return $name; } public function run(): SetupResult { - if ($this->talkConfig->getSignalingMode() !== Config::SIGNALING_INTERNAL) { - return SetupResult::success(); + if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_INTERNAL) { + return SetupResult::success($this->l->t('Using the recording backend requires a High-performance backend.')); } if (empty($this->talkConfig->getRecordingServers())) { return SetupResult::info($this->l->t('No recording backend configured')); } - return SetupResult::error($this->l->t('Using the recording backend requires a High-performance backend.')); + return SetupResult::success(); } } diff --git a/lib/SetupCheck/SIPConfiguration.php b/lib/SetupCheck/SIPConfiguration.php index a3dbe3f2cac..e595541cccb 100644 --- a/lib/SetupCheck/SIPConfiguration.php +++ b/lib/SetupCheck/SIPConfiguration.php @@ -25,16 +25,20 @@ public function getCategory(): string { } public function getName(): string { - return $this->l->t('SIP dial-in'); + $name = $this->l->t('SIP configuration'); + if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_INTERNAL) { + return '[skip] ' . $name; + } + return $name; } public function run(): SetupResult { - if ($this->talkConfig->getSignalingMode() !== Config::SIGNALING_INTERNAL) { - return SetupResult::success(); + if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_INTERNAL) { + return SetupResult::success($this->l->t('Using the SIP functionality requires a High-performance backend.')); } if ($this->talkConfig->getSIPSharedSecret() === '' && $this->talkConfig->getDialInInfo() === '') { return SetupResult::info($this->l->t('No SIP backend configured')); } - return SetupResult::error($this->l->t('Using the SIP functionality requires a High-performance backend.')); + return SetupResult::success(); } } diff --git a/src/components/AdminSettings/SignalingServers.vue b/src/components/AdminSettings/SignalingServers.vue index b70660668ee..64753fe3427 100644 --- a/src/components/AdminSettings/SignalingServers.vue +++ b/src/components/AdminSettings/SignalingServers.vue @@ -6,9 +6,24 @@