aboutsummaryrefslogtreecommitdiffstats
path: root/core/Controller/AvatarController.php
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2024-01-10 12:35:44 +0100
committerprovokateurin <kate@provokateurin.de>2024-02-21 12:07:50 +0100
commit2c51933b6bc5e8f2633114e9acc493fb72a314d7 (patch)
tree43100b132f7e9cd4e899edf0584884c7fa9f0cbc /core/Controller/AvatarController.php
parent0117cd26940f2b0dcfd92ccf663bcf8853437193 (diff)
downloadnextcloud-server-2c51933b6bc5e8f2633114e9acc493fb72a314d7.tar.gz
nextcloud-server-2c51933b6bc5e8f2633114e9acc493fb72a314d7.zip
refactor(core): Switch to attribute based routing
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'core/Controller/AvatarController.php')
-rw-r--r--core/Controller/AvatarController.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php
index 32858b52612..03f59fd6439 100644
--- a/core/Controller/AvatarController.php
+++ b/core/Controller/AvatarController.php
@@ -34,6 +34,7 @@ namespace OC\Core\Controller;
use OC\AppFramework\Utility\TimeFactory;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\DataDisplayResponse;
use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\AppFramework\Http\JSONResponse;
@@ -82,6 +83,7 @@ class AvatarController extends Controller {
* 200: Avatar returned
* 404: Avatar not found
*/
+ #[FrontpageRoute(verb: 'GET', url: '/avatar/{userId}/{size}/dark')]
public function getAvatarDark(string $userId, int $size) {
if ($size <= 64) {
if ($size !== 64) {
@@ -128,6 +130,7 @@ class AvatarController extends Controller {
* 200: Avatar returned
* 404: Avatar not found
*/
+ #[FrontpageRoute(verb: 'GET', url: '/avatar/{userId}/{size}')]
public function getAvatar(string $userId, int $size) {
if ($size <= 64) {
if ($size !== 64) {
@@ -161,6 +164,7 @@ class AvatarController extends Controller {
/**
* @NoAdminRequired
*/
+ #[FrontpageRoute(verb: 'POST', url: '/avatar/')]
public function postAvatar(?string $path = null): JSONResponse {
$files = $this->request->getUploadedFile('files');
@@ -283,6 +287,7 @@ class AvatarController extends Controller {
/**
* @NoAdminRequired
*/
+ #[FrontpageRoute(verb: 'DELETE', url: '/avatar/')]
public function deleteAvatar(): JSONResponse {
try {
$avatar = $this->avatarManager->getAvatar($this->userId);
@@ -299,6 +304,7 @@ class AvatarController extends Controller {
*
* @return JSONResponse|DataDisplayResponse
*/
+ #[FrontpageRoute(verb: 'GET', url: '/avatar/tmp')]
public function getTmpAvatar() {
$tmpAvatar = $this->cache->get('tmpAvatar');
if (is_null($tmpAvatar)) {
@@ -325,6 +331,7 @@ class AvatarController extends Controller {
/**
* @NoAdminRequired
*/
+ #[FrontpageRoute(verb: 'POST', url: '/avatar/cropped')]
public function postCroppedAvatar(?array $crop = null): JSONResponse {
if (is_null($crop)) {
return new JSONResponse(['data' => ['message' => $this->l10n->t("No crop data provided")]],