retro/lib/Controller/PageController.php

40 lines
1000 B
PHP
Raw Normal View History

2024-12-26 21:15:05 +01:00
<?php
declare(strict_types=1);
namespace OCA\Retro\Controller;
2024-12-26 21:15:05 +01:00
use OCA\Retro\AppInfo\Application;
2024-12-26 21:15:05 +01:00
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\IRequest;
use OCP\Util;
2024-12-26 21:15:05 +01:00
class PageController extends Controller
{
public function __construct(IRequest $request, private IInitialState $initialState)
{
parent::__construct(Application::APP_ID, $request);
}
2024-12-26 21:15:05 +01:00
#[NoCSRFRequired]
#[NoAdminRequired]
#[FrontpageRoute(verb: 'GET', url: '/{path}')]
public function index(): TemplateResponse
{
Util::addStyle(Application::APP_ID, Application::APP_ID . '-main');
Util::addScript(Application::APP_ID, Application::APP_ID . '-main');
$this->initialState->provideInitialState();
2024-12-26 21:15:05 +01:00
return new TemplateResponse(
Application::APP_ID,
'index',
);
}
}