repod/lib/Controller/PageController.php

41 lines
857 B
PHP
Raw Permalink Normal View History

2023-06-24 15:18:27 +00:00
<?php
declare(strict_types=1);
namespace OCA\RePod\Controller;
use OCA\RePod\AppInfo\Application;
use OCP\AppFramework\Controller;
2023-07-02 22:12:40 +00:00
use OCP\AppFramework\Http\ContentSecurityPolicy;
2023-06-24 15:18:27 +00:00
use OCP\AppFramework\Http\TemplateResponse;
2023-07-18 19:44:12 +00:00
use OCP\IConfig;
2023-06-24 15:18:27 +00:00
use OCP\IRequest;
use OCP\Util;
class PageController extends Controller
{
2024-01-18 10:43:58 +00:00
public function __construct(
IRequest $request,
private IConfig $config
) {
2023-06-24 15:18:27 +00:00
parent::__construct(Application::APP_ID, $request);
}
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
2023-12-23 16:25:20 +00:00
public function index(): TemplateResponse {
2023-06-24 15:18:27 +00:00
Util::addScript(Application::APP_ID, 'repod-main');
2023-07-02 22:12:40 +00:00
$csp = new ContentSecurityPolicy();
$csp->addAllowedImageDomain('*');
2023-08-27 10:45:19 +00:00
$csp->addAllowedMediaDomain('*');
2023-07-02 22:12:40 +00:00
$response = new TemplateResponse(Application::APP_ID, 'main');
$response->setContentSecurityPolicy($csp);
2023-07-27 21:01:24 +00:00
2023-07-02 22:12:40 +00:00
return $response;
2023-06-24 15:18:27 +00:00
}
}