From 37b4be55e94250486147f3250a3b5513c65b2fc3 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Wed, 15 Oct 2025 09:33:35 +0200 Subject: [PATCH] fix(TextToImage): Set better attribute for routes Signed-off-by: Marcel Klehr --- core/Controller/TextToImageApiController.php | 10 ++++------ core/openapi-full.json | 4 ---- core/openapi.json | 4 ---- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/core/Controller/TextToImageApiController.php b/core/Controller/TextToImageApiController.php index 05c764e874bab..e07bf4f0cf753 100644 --- a/core/Controller/TextToImageApiController.php +++ b/core/Controller/TextToImageApiController.php @@ -17,7 +17,6 @@ use OCP\AppFramework\Http\Attribute\ApiRoute; use OCP\AppFramework\Http\Attribute\BruteForceProtection; use OCP\AppFramework\Http\Attribute\NoAdminRequired; -use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\Attribute\UserRateLimit; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\FileDisplayResponse; @@ -53,7 +52,7 @@ public function __construct( * * 200: Returns availability status */ - #[PublicPage] + #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/is_available', root: '/text2image')] public function isAvailable(): DataResponse { return new DataResponse([ @@ -74,9 +73,8 @@ public function isAvailable(): DataResponse { * 200: Task scheduled successfully * 412: Scheduling task is not possible */ - #[PublicPage] + #[NoAdminRequired] #[UserRateLimit(limit: 20, period: 120)] - #[AnonRateLimit(limit: 5, period: 120)] #[ApiRoute(verb: 'POST', url: '/schedule', root: '/text2image')] public function schedule(string $input, string $appId, string $identifier = '', int $numberOfImages = 8): DataResponse { $task = new Task($input, $appId, $numberOfImages, $this->userId, $identifier); @@ -110,7 +108,7 @@ public function schedule(string $input, string $appId, string $identifier = '', * 200: Task returned * 404: Task not found */ - #[PublicPage] + #[NoAdminRequired] #[BruteForceProtection(action: 'text2image')] #[ApiRoute(verb: 'GET', url: '/task/{id}', root: '/text2image')] public function getTask(int $id): DataResponse { @@ -142,7 +140,7 @@ public function getTask(int $id): DataResponse { * 200: Image returned * 404: Task or image not found */ - #[PublicPage] + #[NoAdminRequired] #[BruteForceProtection(action: 'text2image')] #[ApiRoute(verb: 'GET', url: '/task/{id}/image/{index}', root: '/text2image')] public function getImage(int $id, int $index): DataResponse|FileDisplayResponse { diff --git a/core/openapi-full.json b/core/openapi-full.json index 9271d05b3296b..fd9d661619a3f 100644 --- a/core/openapi-full.json +++ b/core/openapi-full.json @@ -5904,7 +5904,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -5974,7 +5973,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -6155,7 +6153,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -6464,7 +6461,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, diff --git a/core/openapi.json b/core/openapi.json index 8a8225c9b04c0..526fec5f5d2c1 100644 --- a/core/openapi.json +++ b/core/openapi.json @@ -5904,7 +5904,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -5974,7 +5973,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -6155,7 +6153,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -6464,7 +6461,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] },