aboutsummaryrefslogtreecommitdiffstats
path: root/core/Controller/RecommendedAppsController.php
blob: ba35bc8705e4a8d352ee9aa9db9f9afad4819a0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
namespace OC\Core\Controller;

use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\Attribute\OpenAPI;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\StandaloneTemplateResponse;
use OCP\IInitialStateService;
use OCP\IRequest;
use OCP\IURLGenerator;

#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
class RecommendedAppsController extends Controller {
	public function __construct(
		IRequest $request,
		public IURLGenerator $urlGenerator,
		private IInitialStateService $initialStateService,
	) {
		parent::__construct('core', $request);
	}

	/**
	 * @return Response
	 */
	#[NoCSRFRequired]
	#[FrontpageRoute(verb: 'GET', url: '/core/apps/recommended')]
	public function index(): Response {
		$defaultPageUrl = $this->urlGenerator->linkToDefaultPageUrl();
		$this->initialStateService->provideInitialState('core', 'defaultPageUrl', $defaultPageUrl);
		return new StandaloneTemplateResponse($this->appName, 'recommendedapps', [], 'guest');
	}
}