зеркало из https://github.com/nextcloud/spreed.git
Merge pull request #13157 from nextcloud/bugfix/noid/add-setup-checks
fix(setupchecks): Add setup checks for current checks
This commit is contained in:
Коммит
a6f75cbf38
|
@ -107,6 +107,11 @@ use OCA\Talk\Search\MessageSearch;
|
|||
use OCA\Talk\Search\UnifiedSearchCSSLoader;
|
||||
use OCA\Talk\Search\UnifiedSearchFilterPlugin;
|
||||
use OCA\Talk\Settings\Personal;
|
||||
use OCA\Talk\SetupCheck\BackgroundBlurLoading;
|
||||
use OCA\Talk\SetupCheck\FederationLockCache;
|
||||
use OCA\Talk\SetupCheck\RecommendCache;
|
||||
use OCA\Talk\SetupCheck\RecordingBackend;
|
||||
use OCA\Talk\SetupCheck\SIPConfiguration;
|
||||
use OCA\Talk\Share\Listener as ShareListener;
|
||||
use OCA\Talk\Signaling\Listener as SignalingListener;
|
||||
use OCA\Talk\Status\Listener as StatusListener;
|
||||
|
@ -332,6 +337,12 @@ class Application extends App implements IBootstrap {
|
|||
$context->registerTalkBackend(TalkBackend::class);
|
||||
|
||||
$context->registerTeamResourceProvider(TalkTeamResourceProvider::class);
|
||||
|
||||
$context->registerSetupCheck(RecommendCache::class);
|
||||
$context->registerSetupCheck(FederationLockCache::class);
|
||||
$context->registerSetupCheck(RecordingBackend::class);
|
||||
$context->registerSetupCheck(SIPConfiguration::class);
|
||||
$context->registerSetupCheck(BackgroundBlurLoading::class);
|
||||
}
|
||||
|
||||
public function boot(IBootContext $context): void {
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
namespace OCA\Talk\SetupCheck;
|
||||
|
||||
use OCA\Settings\SetupChecks\CheckServerResponseTrait;
|
||||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Check whether the WASM URLs works
|
||||
*/
|
||||
class BackgroundBlurLoading implements ISetupCheck {
|
||||
use CheckServerResponseTrait;
|
||||
|
||||
public function __construct(
|
||||
protected IL10N $l10n,
|
||||
protected IConfig $config,
|
||||
protected IURLGenerator $urlGenerator,
|
||||
protected IClientService $clientService,
|
||||
protected LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'talk';
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('Background blur');
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
$url = $this->urlGenerator->linkTo('spreed', 'js/tflite.wasm');
|
||||
$noResponse = true;
|
||||
$responses = $this->runHEAD($url);
|
||||
foreach ($responses as $response) {
|
||||
$noResponse = false;
|
||||
if ($response->getStatusCode() === 200) {
|
||||
return SetupResult::success();
|
||||
}
|
||||
}
|
||||
|
||||
if ($noResponse) {
|
||||
return SetupResult::info(
|
||||
$this->l10n->t('Could not check for WASM loading support. Please check manually if your web server serves `.wasm` files.') . "\n" . $this->serverConfigHelp(),
|
||||
$this->urlGenerator->linkToDocs('admin-nginx'),
|
||||
);
|
||||
}
|
||||
return SetupResult::warning(
|
||||
$this->l10n->t('Your web server is not properly set up to deliver `.wasm` files. This is typically an issue with the Nginx configuration. For background blur it needs an adjustment to also deliver `.wasm` files. Compare your Nginx configuration to the recommended configuration in our documentation.'),
|
||||
$this->urlGenerator->linkToDocs('admin-nginx'),
|
||||
);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Talk\SetupCheck;
|
||||
|
||||
use OC\Memcache\NullCache;
|
||||
use OCA\Talk\Config;
|
||||
use OCP\ICacheFactory;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class FederationLockCache implements ISetupCheck {
|
||||
public function __construct(
|
||||
readonly protected Config $talkConfig,
|
||||
readonly protected ICacheFactory $cacheFactory,
|
||||
readonly protected IURLGenerator $urlGenerator,
|
||||
readonly protected IL10N $l,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'talk';
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l->t('Federation');
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
if (!$this->talkConfig->isFederationEnabled()) {
|
||||
return SetupResult::success();
|
||||
}
|
||||
if (!$this->cacheFactory->createLocking('talkroom_') instanceof NullCache) {
|
||||
return SetupResult::success();
|
||||
}
|
||||
return SetupResult::warning(
|
||||
$this->l->t('It is highly recommended to configure "memcache.locking" when Talk Federation is enabled.'),
|
||||
$this->urlGenerator->linkToDocs('admin-cache'),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Talk\SetupCheck;
|
||||
|
||||
use OCA\Talk\Config;
|
||||
use OCP\ICacheFactory;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class RecommendCache implements ISetupCheck {
|
||||
public function __construct(
|
||||
readonly protected Config $talkConfig,
|
||||
readonly protected ICacheFactory $cacheFactory,
|
||||
readonly protected IURLGenerator $urlGenerator,
|
||||
readonly protected IL10N $l,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'talk';
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l->t('High-performance backend');
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_INTERNAL) {
|
||||
return SetupResult::success();
|
||||
}
|
||||
if ($this->cacheFactory->isAvailable()) {
|
||||
return SetupResult::success();
|
||||
}
|
||||
return SetupResult::warning(
|
||||
$this->l->t('It is highly recommended to configure a memory cache when running Nextcloud Talk with a High-performance backend.'),
|
||||
$this->urlGenerator->linkToDocs('admin-cache'),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Talk\SetupCheck;
|
||||
|
||||
use OCA\Talk\Config;
|
||||
use OCP\IL10N;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class RecordingBackend implements ISetupCheck {
|
||||
public function __construct(
|
||||
readonly protected Config $talkConfig,
|
||||
readonly protected IL10N $l,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'talk';
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l->t('Recording backend');
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
if ($this->talkConfig->getSignalingMode() !== Config::SIGNALING_INTERNAL) {
|
||||
return SetupResult::success();
|
||||
}
|
||||
if (empty($this->talkConfig->getRecordingServers())) {
|
||||
return SetupResult::success();
|
||||
}
|
||||
return SetupResult::error($this->l->t('Using the recording backend requires a High-performance backend.'));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Talk\SetupCheck;
|
||||
|
||||
use OCA\Talk\Config;
|
||||
use OCP\IL10N;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class SIPConfiguration implements ISetupCheck {
|
||||
public function __construct(
|
||||
readonly protected Config $talkConfig,
|
||||
readonly protected IL10N $l,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'talk';
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l->t('SIP dial-in');
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
if ($this->talkConfig->getSignalingMode() !== Config::SIGNALING_INTERNAL) {
|
||||
return SetupResult::success();
|
||||
}
|
||||
if ($this->talkConfig->getSIPSharedSecret() === '' && $this->talkConfig->getDialInInfo() === '') {
|
||||
return SetupResult::success();
|
||||
}
|
||||
return SetupResult::error($this->l->t('Using the SIP functionality requires a High-performance backend.'));
|
||||
}
|
||||
}
|
|
@ -89,6 +89,7 @@
|
|||
<file name="tests/stubs/oc_core_command_base.php" />
|
||||
<file name="tests/stubs/oc_hooks_emitter.php" />
|
||||
<file name="tests/stubs/oc_http_client_response.php" />
|
||||
<file name="tests/stubs/oc_memcache.php" />
|
||||
<file name="tests/stubs/oca_circles.php" />
|
||||
<file name="tests/stubs/oca_federation_trustedservers.php" />
|
||||
<file name="tests/stubs/oca_files_events.php" />
|
||||
|
|
|
@ -6,11 +6,6 @@
|
|||
<code><![CDATA[BeforeTemplateRenderedEvent]]></code>
|
||||
</UndefinedClass>
|
||||
</file>
|
||||
<file src="lib/Chat/ChatManager.php">
|
||||
<UndefinedClass>
|
||||
<code><![CDATA[NullCache]]></code>
|
||||
</UndefinedClass>
|
||||
</file>
|
||||
<file src="lib/Chat/Parser/SystemMessage.php">
|
||||
<UndefinedClass>
|
||||
<code><![CDATA[\OC_Util]]></code>
|
||||
|
@ -86,6 +81,11 @@
|
|||
<code><![CDATA[NoUserException]]></code>
|
||||
</UndefinedClass>
|
||||
</file>
|
||||
<file src="lib/SetupCheck/BackgroundBlurLoading.php">
|
||||
<UndefinedTrait>
|
||||
<code><![CDATA[CheckServerResponseTrait]]></code>
|
||||
</UndefinedTrait>
|
||||
</file>
|
||||
<file src="lib/Share/Listener.php">
|
||||
<UndefinedClass>
|
||||
<code><![CDATA[$event->getView()]]></code>
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
namespace OC\Memcache {
|
||||
|
||||
use OCP\IMemcache;
|
||||
|
||||
class NullCache implements IMemcache {
|
||||
public function add($key, $value, $ttl = 0) {
|
||||
}
|
||||
|
||||
public function inc($key, $step = 1) {
|
||||
}
|
||||
|
||||
public function dec($key, $step = 1) {
|
||||
}
|
||||
|
||||
public function cas($key, $old, $new) {
|
||||
}
|
||||
|
||||
public function cad($key, $old) {
|
||||
}
|
||||
|
||||
public function ncad(string $key, mixed $old): bool {
|
||||
}
|
||||
}
|
||||
|
||||
class ArrayCache implements IMemcache {
|
||||
public function add($key, $value, $ttl = 0) {
|
||||
}
|
||||
|
||||
public function inc($key, $step = 1) {
|
||||
}
|
||||
|
||||
public function dec($key, $step = 1) {
|
||||
}
|
||||
|
||||
public function cas($key, $old, $new) {
|
||||
}
|
||||
|
||||
public function cad($key, $old) {
|
||||
}
|
||||
|
||||
public function ncad(string $key, mixed $old): bool {
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
namespace OCA\Settings\SetupChecks {
|
||||
use Generator;
|
||||
|
||||
trait CheckServerResponseTrait {
|
||||
protected function serverConfigHelp(): string {
|
||||
}
|
||||
}
|
||||
|
||||
trait CheckServerResponseTrait2 {
|
||||
protected function serverConfigHelp(): string {
|
||||
}
|
||||
|
||||
protected function runHEAD(string $url, bool $ignoreSSL = true, bool $httpErrors = true): Generator {
|
||||
}
|
||||
|
||||
protected function runRequest(string $method, string $url, array $options = []): Generator {
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче