Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions core/Controller/TextToImageApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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([
Expand All @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 0 additions & 4 deletions core/openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -6144,7 +6144,6 @@
"text_to_image_api"
],
"security": [
{},
{
"bearer_auth": []
},
Expand Down Expand Up @@ -6214,7 +6213,6 @@
"text_to_image_api"
],
"security": [
{},
{
"bearer_auth": []
},
Expand Down Expand Up @@ -6395,7 +6393,6 @@
"text_to_image_api"
],
"security": [
{},
{
"bearer_auth": []
},
Expand Down Expand Up @@ -6704,7 +6701,6 @@
"text_to_image_api"
],
"security": [
{},
{
"bearer_auth": []
},
Expand Down
4 changes: 0 additions & 4 deletions core/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -6144,7 +6144,6 @@
"text_to_image_api"
],
"security": [
{},
{
"bearer_auth": []
},
Expand Down Expand Up @@ -6214,7 +6213,6 @@
"text_to_image_api"
],
"security": [
{},
{
"bearer_auth": []
},
Expand Down Expand Up @@ -6395,7 +6393,6 @@
"text_to_image_api"
],
"security": [
{},
{
"bearer_auth": []
},
Expand Down Expand Up @@ -6704,7 +6701,6 @@
"text_to_image_api"
],
"security": [
{},
{
"bearer_auth": []
},
Expand Down
Loading