Merge pull request #55795 from nextcloud/backport/55776/stable28

[stable28] fix(TextToImage): Set better attribute for routes
pull/56184/head
Joas Schilling 2025-10-16 15:01:18 +07:00 committed by GitHub
commit 584084b693
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 10 deletions

@ -32,7 +32,6 @@ use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\AnonRateLimit;
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;
@ -68,7 +67,7 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController {
*
* 200: Returns availability status
*/
#[PublicPage]
#[NoAdminRequired]
public function isAvailable(): DataResponse {
return new DataResponse([
'isAvailable' => $this->textToImageManager->hasProviders(),
@ -88,9 +87,8 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController {
* 200: Task scheduled successfully
* 412: Scheduling task is not possible
*/
#[PublicPage]
#[NoAdminRequired]
#[UserRateLimit(limit: 20, period: 120)]
#[AnonRateLimit(limit: 5, period: 120)]
public function schedule(string $input, string $appId, string $identifier = '', int $numberOfImages = 8): DataResponse {
$task = new Task($input, $appId, $numberOfImages, $this->userId, $identifier);
try {
@ -123,7 +121,7 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController {
* 200: Task returned
* 404: Task not found
*/
#[PublicPage]
#[NoAdminRequired]
#[BruteForceProtection(action: 'text2image')]
public function getTask(int $id): DataResponse {
try {
@ -154,7 +152,7 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController {
* 200: Image returned
* 404: Task or image not found
*/
#[PublicPage]
#[NoAdminRequired]
#[BruteForceProtection(action: 'text2image')]
public function getImage(int $id, int $index): DataResponse|FileDisplayResponse {
try {

@ -5421,7 +5421,6 @@
"text_to_image_api"
],
"security": [
{},
{
"bearer_auth": []
},
@ -5491,7 +5490,6 @@
"text_to_image_api"
],
"security": [
{},
{
"bearer_auth": []
},
@ -5674,7 +5672,6 @@
"text_to_image_api"
],
"security": [
{},
{
"bearer_auth": []
},
@ -5983,7 +5980,6 @@
"text_to_image_api"
],
"security": [
{},
{
"bearer_auth": []
},