refactor(controller): usage of attributes instead of annotations
This commit is contained in:
parent
37b9beb8f7
commit
b03a7f7bad
8 changed files with 45 additions and 69 deletions
|
|
@ -29,6 +29,10 @@ use OCP\AppFramework\Http\TemplateResponse;
|
|||
use OCP\IRequest;
|
||||
use OCP\IUserSession;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||
use OCP\AppFramework\Http\Attribute\PublicPage;
|
||||
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
||||
|
||||
class JsController extends Controller
|
||||
{
|
||||
|
|
@ -50,11 +54,10 @@ class JsController extends Controller
|
|||
$this->l10nFactory = $l10nFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @PublicPage
|
||||
*/
|
||||
#[NoCSRFRequired]
|
||||
#[NoAdminRequired]
|
||||
#[PublicPage]
|
||||
#[FrontpageRoute(verb: 'GET', url: '/js/script')]
|
||||
public function script(): TemplateResponse
|
||||
{
|
||||
$response = new TemplateResponse(Application::APP_ID, 'js/script', $this->getConfig(), 'blank');
|
||||
|
|
@ -63,11 +66,10 @@ class JsController extends Controller
|
|||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @PublicPage
|
||||
*/
|
||||
#[NoCSRFRequired]
|
||||
#[NoAdminRequired]
|
||||
#[PublicPage]
|
||||
#[FrontpageRoute(verb: 'GET', url: '/js/config')]
|
||||
public function config(): JSONResponse
|
||||
{
|
||||
return new JSONResponse($this->getConfig());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue