diff options
author | Andrey Borysenko <andrey18106x@gmail.com> | 2024-10-17 03:38:05 +0300 |
---|---|---|
committer | Andrey Borysenko <andrey18106x@gmail.com> | 2024-10-29 20:54:08 +0200 |
commit | e4d586697c49283397163d35904d79b55371e635 (patch) | |
tree | b6ebdb0502e8cd64c0ceaa0c22ace9f1c3973769 /apps/settings/lib | |
parent | 3a840c102a382f9084ac358e39f7e6dadef692ed (diff) | |
download | nextcloud-server-e4d586697c49283397163d35904d79b55371e635.tar.gz nextcloud-server-e4d586697c49283397163d35904d79b55371e635.zip |
WIP: address review comments, small fixes
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
Diffstat (limited to 'apps/settings/lib')
-rw-r--r-- | apps/settings/lib/Controller/AppSettingsController.php | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index 95edce40a05..86d0f81aef8 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -90,7 +90,12 @@ class AppSettingsController extends Controller { $this->initialState->provideInitialState('appstoreDeveloperDocs', $this->urlGenerator->linkToDocs('developer-manual')); $this->initialState->provideInitialState('appstoreUpdateCount', count($this->getAppsWithUpdates())); - $this->provideAppApiState(); + if ($this->appManager->isInstalled('app_api')) { + try { + Server::get(\OCA\AppAPI\Service\ExAppsPageService::class)->provideAppApiState($this->initialState); + } catch (\Psr\Container\NotFoundExceptionInterface|\Psr\Container\ContainerExceptionInterface $e) { + } + } $policy = new ContentSecurityPolicy(); $policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com'); @@ -105,40 +110,6 @@ class AppSettingsController extends Controller { } /** - * @psalm-suppress UndefinedClass - */ - private function provideAppApiState(): void { - $appApiEnabled = $this->appManager->isInstalled('app_api'); - $this->initialState->provideInitialState('appApiEnabled', $appApiEnabled); - $daemonConfigAccessible = false; - $defaultDaemonConfig = null; - - if ($appApiEnabled) { - $exAppFetcher = Server::get(\OCA\AppAPI\Fetcher\ExAppFetcher::class); - $this->initialState->provideInitialState('appstoreExAppUpdateCount', count($exAppFetcher->getExAppsWithUpdates())); - - $defaultDaemonConfigName = $this->config->getAppValue('app_api', 'default_daemon_config'); - if ($defaultDaemonConfigName !== '') { - $daemonConfigService = Server::get(\OCA\AppAPI\Service\DaemonConfigService::class); - $daemonConfig = $daemonConfigService->getDaemonConfigByName($defaultDaemonConfigName); - if ($daemonConfig !== null) { - $defaultDaemonConfig = $daemonConfig->jsonSerialize(); - unset($defaultDaemonConfig['deploy_config']['haproxy_password']); - $dockerActions = Server::get(\OCA\AppAPI\DeployActions\DockerActions::class); - $dockerActions->initGuzzleClient($daemonConfig); - $daemonConfigAccessible = $dockerActions->ping($dockerActions->buildDockerUrl($daemonConfig)); - if (!$daemonConfigAccessible) { - $this->logger->warning(sprintf('Deploy daemon "%s" is not accessible by Nextcloud. Please verify its configuration', $daemonConfig->getName())); - } - } - } - } - - $this->initialState->provideInitialState('defaultDaemonConfigAccessible', $daemonConfigAccessible); - $this->initialState->provideInitialState('defaultDaemonConfig', $defaultDaemonConfig); - } - - /** * Get all active entries for the app discover section */ #[NoCSRFRequired] @@ -475,6 +446,7 @@ class AppSettingsController extends Controller { $formattedApps[] = [ 'id' => $app['id'], + 'app_api' => false, 'name' => $app['translations'][$currentLanguage]['name'] ?? $app['translations']['en']['name'], 'description' => $app['translations'][$currentLanguage]['description'] ?? $app['translations']['en']['description'], 'summary' => $app['translations'][$currentLanguage]['summary'] ?? $app['translations']['en']['summary'], |