webtransfer/lib/Controller/PageController.php

48 lines
1.1 KiB
PHP
Raw Normal View History

2024-11-06 15:35:54 +01:00
<?php
declare(strict_types=1);
namespace OCA\WebTransfer\Controller;
2024-11-06 15:35:54 +01:00
use OCA\WebTransfer\AppInfo\Application;
2024-11-06 15:35:54 +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\Attribute\OpenAPI;
use OCP\AppFramework\Http\TemplateResponse;
2024-11-19 14:15:09 +01:00
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
use OCP\IResponse;
2024-11-19 15:29:48 +01:00
use OCP\AppFramework\Http\JSONResponse;
2024-11-06 15:35:54 +01:00
/**
* @psalm-suppress UnusedClass
*/
class PageController extends Controller {
#[NoCSRFRequired]
#[NoAdminRequired]
#[OpenAPI(OpenAPI::SCOPE_IGNORE)]
#[FrontpageRoute(verb: 'GET', url: '/')]
public function index(): TemplateResponse {
return new TemplateResponse(
Application::APP_ID,
'index',
);
}
2024-11-19 14:15:09 +01:00
#[NoCSRFRequired]
2024-11-19 15:29:48 +01:00
#[NoAdminRequired]
#[FrontpageRoute(verb: 'POST', url: '/zipDeposit')]
public function post($archiveUrl, $token) {
2024-11-19 14:15:09 +01:00
$request = $this->request;
$parameters = array('archiveUrl' => $archiveUrl, 'token' => $token);
2024-11-19 14:15:09 +01:00
return new TemplateResponse(
Application::APP_ID,
'index',
$parameters
);
2024-11-19 14:15:09 +01:00
}
2024-11-06 15:35:54 +01:00
}