Skip to content

Commit 5b851f8

Browse files
committed
fix(TextToImage): Set better attribute for routes
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent b3847c1 commit 5b851f8

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

core/Controller/TextToImageApiController.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
use OCP\AppFramework\Http\Attribute\ApiRoute;
3434
use OCP\AppFramework\Http\Attribute\BruteForceProtection;
3535
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
36-
use OCP\AppFramework\Http\Attribute\PublicPage;
3736
use OCP\AppFramework\Http\Attribute\UserRateLimit;
3837
use OCP\AppFramework\Http\DataResponse;
3938
use OCP\AppFramework\Http\FileDisplayResponse;
@@ -69,7 +68,7 @@ public function __construct(
6968
*
7069
* 200: Returns availability status
7170
*/
72-
#[PublicPage]
71+
#[NoAdminRequired]
7372
#[ApiRoute(verb: 'GET', url: '/is_available', root: '/text2image')]
7473
public function isAvailable(): DataResponse {
7574
return new DataResponse([
@@ -90,9 +89,8 @@ public function isAvailable(): DataResponse {
9089
* 200: Task scheduled successfully
9190
* 412: Scheduling task is not possible
9291
*/
93-
#[PublicPage]
92+
#[NoAdminRequired]
9493
#[UserRateLimit(limit: 20, period: 120)]
95-
#[AnonRateLimit(limit: 5, period: 120)]
9694
#[ApiRoute(verb: 'POST', url: '/schedule', root: '/text2image')]
9795
public function schedule(string $input, string $appId, string $identifier = '', int $numberOfImages = 8): DataResponse {
9896
$task = new Task($input, $appId, $numberOfImages, $this->userId, $identifier);
@@ -126,7 +124,7 @@ public function schedule(string $input, string $appId, string $identifier = '',
126124
* 200: Task returned
127125
* 404: Task not found
128126
*/
129-
#[PublicPage]
127+
#[NoAdminRequired]
130128
#[BruteForceProtection(action: 'text2image')]
131129
#[ApiRoute(verb: 'GET', url: '/task/{id}', root: '/text2image')]
132130
public function getTask(int $id): DataResponse {
@@ -158,7 +156,7 @@ public function getTask(int $id): DataResponse {
158156
* 200: Image returned
159157
* 404: Task or image not found
160158
*/
161-
#[PublicPage]
159+
#[NoAdminRequired]
162160
#[BruteForceProtection(action: 'text2image')]
163161
#[ApiRoute(verb: 'GET', url: '/task/{id}/image/{index}', root: '/text2image')]
164162
public function getImage(int $id, int $index): DataResponse|FileDisplayResponse {

core/openapi.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4108,7 +4108,6 @@
41084108
"text_to_image_api"
41094109
],
41104110
"security": [
4111-
{},
41124111
{
41134112
"bearer_auth": []
41144113
},
@@ -4178,7 +4177,6 @@
41784177
"text_to_image_api"
41794178
],
41804179
"security": [
4181-
{},
41824180
{
41834181
"bearer_auth": []
41844182
},
@@ -4361,7 +4359,6 @@
43614359
"text_to_image_api"
43624360
],
43634361
"security": [
4364-
{},
43654362
{
43664363
"bearer_auth": []
43674364
},
@@ -4670,7 +4667,6 @@
46704667
"text_to_image_api"
46714668
],
46724669
"security": [
4673-
{},
46744670
{
46754671
"bearer_auth": []
46764672
},

0 commit comments

Comments
 (0)