diff --git a/core/Controller/TextToImageApiController.php b/core/Controller/TextToImageApiController.php index d2c3e1ec288..819673df739 100644 --- a/core/Controller/TextToImageApiController.php +++ b/core/Controller/TextToImageApiController.php @@ -17,7 +17,6 @@ use OCP\AppFramework\Http\Attribute\AnonRateLimit; 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; @@ -54,7 +53,7 @@ class TextToImageApiController extends OCSController { * * 200: Returns availability status */ - #[PublicPage] + #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/is_available', root: '/text2image')] public function isAvailable(): DataResponse { return new DataResponse([ @@ -75,9 +74,8 @@ class TextToImageApiController extends OCSController { * 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); @@ -111,7 +109,7 @@ class TextToImageApiController extends OCSController { * 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 { @@ -143,7 +141,7 @@ class TextToImageApiController extends OCSController { * 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 943005cb00e..c36571b9dd8 100644 --- a/core/openapi-full.json +++ b/core/openapi-full.json @@ -7253,7 +7253,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -7311,6 +7310,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } } @@ -7323,7 +7350,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -7492,6 +7518,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } } @@ -7504,7 +7558,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -7648,6 +7701,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } }, @@ -7841,7 +7922,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -7968,6 +8048,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } } diff --git a/core/openapi.json b/core/openapi.json index bc3fc2de975..5980dd07d7f 100644 --- a/core/openapi.json +++ b/core/openapi.json @@ -7253,7 +7253,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -7311,6 +7310,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } } @@ -7323,7 +7350,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -7492,6 +7518,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } } @@ -7504,7 +7558,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -7648,6 +7701,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } }, @@ -7841,7 +7922,6 @@ "text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -7968,6 +8048,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } } diff --git a/openapi.json b/openapi.json index a52109d8d64..ccb6bfd4e34 100644 --- a/openapi.json +++ b/openapi.json @@ -10766,7 +10766,6 @@ "core/text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -10824,6 +10823,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } } @@ -10836,7 +10863,6 @@ "core/text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -11005,6 +11031,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } } @@ -11017,7 +11071,6 @@ "core/text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -11161,6 +11214,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } }, @@ -11354,7 +11435,6 @@ "core/text_to_image_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -11481,6 +11561,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } }