mirror of
https://github.com/nextcloud/server.git
synced 2026-06-05 23:06:48 -04:00
feat(app_api): add initial state data for AppAPI UI part
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com> # Conflicts: # apps/settings/lib/Controller/AppSettingsController.php # Conflicts: # apps/settings/lib/Controller/AppSettingsController.php
This commit is contained in:
parent
2ebef1e3ba
commit
3a51374ff3
1 changed files with 33 additions and 0 deletions
|
|
@ -88,6 +88,8 @@ class AppSettingsController extends Controller {
|
|||
$this->initialState->provideInitialState('appstoreDeveloperDocs', $this->urlGenerator->linkToDocs('developer-manual'));
|
||||
$this->initialState->provideInitialState('appstoreUpdateCount', count($this->getAppsWithUpdates()));
|
||||
|
||||
$this->provideAppApiState();
|
||||
|
||||
$policy = new ContentSecurityPolicy();
|
||||
$policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com');
|
||||
|
||||
|
|
@ -100,6 +102,37 @@ class AppSettingsController extends Controller {
|
|||
return $templateResponse;
|
||||
}
|
||||
|
||||
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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue