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;
|
2024-10-18 13:19:45 +00:00
|
|
|
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
|
|
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
|
|
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
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;
|
2024-08-25 09:53:52 +00:00
|
|
|
use OCP\IRequest;
|
2023-06-24 15:18:27 +00:00
|
|
|
use OCP\Util;
|
|
|
|
|
2023-06-24 16:37:25 +00:00
|
|
|
class PageController extends Controller
|
|
|
|
{
|
2024-08-22 15:34:27 +00:00
|
|
|
public function __construct(
|
2024-11-10 12:18:53 +00:00
|
|
|
IRequest $request
|
2024-08-25 09:53:52 +00:00
|
|
|
) {
|
|
|
|
parent::__construct(Application::APP_ID, $request);
|
|
|
|
}
|
2024-08-22 15:34:27 +00:00
|
|
|
|
2024-10-18 13:19:45 +00:00
|
|
|
#[NoAdminRequired]
|
|
|
|
#[NoCSRFRequired]
|
|
|
|
#[FrontpageRoute(verb: 'GET', url: '/')]
|
2023-12-23 16:25:20 +00:00
|
|
|
public function index(): TemplateResponse {
|
2024-09-13 15:52:10 +00:00
|
|
|
Util::addScript(Application::APP_ID, Application::APP_ID.'-main');
|
2024-10-17 14:29:49 +00:00
|
|
|
Util::addStyle(Application::APP_ID, Application::APP_ID.'-main');
|
2023-06-24 15:18:27 +00:00
|
|
|
|
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
|
|
|
|
2024-05-29 21:47:20 +00:00
|
|
|
$response = new TemplateResponse(Application::APP_ID, 'main');
|
2023-07-02 22:12:40 +00:00
|
|
|
$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
|
|
|
}
|
2024-08-27 07:42:52 +00:00
|
|
|
|
2024-10-18 13:19:45 +00:00
|
|
|
#[NoAdminRequired]
|
|
|
|
#[NoCSRFRequired]
|
|
|
|
#[FrontpageRoute(verb: 'GET', url: '/discover')]
|
2024-08-27 14:41:58 +00:00
|
|
|
public function discover(): TemplateResponse {
|
|
|
|
return $this->index();
|
|
|
|
}
|
|
|
|
|
2024-10-18 13:19:45 +00:00
|
|
|
#[NoAdminRequired]
|
|
|
|
#[NoCSRFRequired]
|
|
|
|
#[FrontpageRoute(verb: 'GET', url: '/feed/{path}', requirements: ['path' => '.+'])]
|
2024-08-27 07:42:52 +00:00
|
|
|
public function feed(): TemplateResponse {
|
|
|
|
return $this->index();
|
|
|
|
}
|
2023-06-24 15:18:27 +00:00
|
|
|
}
|