Skip to content

Commit 40ef83c

Browse files
Merge pull request #55792 from nextcloud/backport/55776/stable31
[stable31] fix(TextToImage): Set better attribute for routes
2 parents 81a1072 + 8af7739 commit 40ef83c

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

core/Controller/TextToImageApiController.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use OCP\AppFramework\Http\Attribute\ApiRoute;
1818
use OCP\AppFramework\Http\Attribute\BruteForceProtection;
1919
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
20-
use OCP\AppFramework\Http\Attribute\PublicPage;
2120
use OCP\AppFramework\Http\Attribute\UserRateLimit;
2221
use OCP\AppFramework\Http\DataResponse;
2322
use OCP\AppFramework\Http\FileDisplayResponse;
@@ -53,7 +52,7 @@ public function __construct(
5352
*
5453
* 200: Returns availability status
5554
*/
56-
#[PublicPage]
55+
#[NoAdminRequired]
5756
#[ApiRoute(verb: 'GET', url: '/is_available', root: '/text2image')]
5857
public function isAvailable(): DataResponse {
5958
return new DataResponse([
@@ -74,9 +73,8 @@ public function isAvailable(): DataResponse {
7473
* 200: Task scheduled successfully
7574
* 412: Scheduling task is not possible
7675
*/
77-
#[PublicPage]
76+
#[NoAdminRequired]
7877
#[UserRateLimit(limit: 20, period: 120)]
79-
#[AnonRateLimit(limit: 5, period: 120)]
8078
#[ApiRoute(verb: 'POST', url: '/schedule', root: '/text2image')]
8179
public function schedule(string $input, string $appId, string $identifier = '', int $numberOfImages = 8): DataResponse {
8280
$task = new Task($input, $appId, $numberOfImages, $this->userId, $identifier);
@@ -110,7 +108,7 @@ public function schedule(string $input, string $appId, string $identifier = '',
110108
* 200: Task returned
111109
* 404: Task not found
112110
*/
113-
#[PublicPage]
111+
#[NoAdminRequired]
114112
#[BruteForceProtection(action: 'text2image')]
115113
#[ApiRoute(verb: 'GET', url: '/task/{id}', root: '/text2image')]
116114
public function getTask(int $id): DataResponse {
@@ -142,7 +140,7 @@ public function getTask(int $id): DataResponse {
142140
* 200: Image returned
143141
* 404: Task or image not found
144142
*/
145-
#[PublicPage]
143+
#[NoAdminRequired]
146144
#[BruteForceProtection(action: 'text2image')]
147145
#[ApiRoute(verb: 'GET', url: '/task/{id}/image/{index}', root: '/text2image')]
148146
public function getImage(int $id, int $index): DataResponse|FileDisplayResponse {

core/openapi-full.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6144,7 +6144,6 @@
61446144
"text_to_image_api"
61456145
],
61466146
"security": [
6147-
{},
61486147
{
61496148
"bearer_auth": []
61506149
},
@@ -6214,7 +6213,6 @@
62146213
"text_to_image_api"
62156214
],
62166215
"security": [
6217-
{},
62186216
{
62196217
"bearer_auth": []
62206218
},
@@ -6395,7 +6393,6 @@
63956393
"text_to_image_api"
63966394
],
63976395
"security": [
6398-
{},
63996396
{
64006397
"bearer_auth": []
64016398
},
@@ -6704,7 +6701,6 @@
67046701
"text_to_image_api"
67056702
],
67066703
"security": [
6707-
{},
67086704
{
67096705
"bearer_auth": []
67106706
},

core/openapi.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6144,7 +6144,6 @@
61446144
"text_to_image_api"
61456145
],
61466146
"security": [
6147-
{},
61486147
{
61496148
"bearer_auth": []
61506149
},
@@ -6214,7 +6213,6 @@
62146213
"text_to_image_api"
62156214
],
62166215
"security": [
6217-
{},
62186216
{
62196217
"bearer_auth": []
62206218
},
@@ -6395,7 +6393,6 @@
63956393
"text_to_image_api"
63966394
],
63976395
"security": [
6398-
{},
63996396
{
64006397
"bearer_auth": []
64016398
},
@@ -6704,7 +6701,6 @@
67046701
"text_to_image_api"
67056702
],
67066703
"security": [
6707-
{},
67086704
{
67096705
"bearer_auth": []
67106706
},

0 commit comments

Comments
 (0)