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
1 change: 1 addition & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
['name' => 'OCSApi#setAppInitProgressDeprecated', 'url' => '/apps/status/{appId}', 'verb' => 'PUT'],
['name' => 'OCSApi#setAppInitProgress', 'url' => '/ex-app/status', 'verb' => 'PUT'],
['name' => 'OCSApi#getEnabledState', 'url' => '/ex-app/state', 'verb' => 'GET'],
['name' => 'OCSApi#getNextcloudAbsoluteUrl', 'url' => '/api/v1/info/nextcloud_url/absolute', 'verb' => 'GET'],

// ExApps
['name' => 'OCSExApp#getNextcloudUrl', 'url' => '/api/v1/info/nextcloud_url', 'verb' => 'GET'],
Expand Down
14 changes: 12 additions & 2 deletions lib/Controller/OCSApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
use OCA\AppAPI\AppInfo\Application;
use OCA\AppAPI\Attribute\AppAPIAuth;
use OCA\AppAPI\Service\AppAPIService;

use OCA\AppAPI\Service\ExAppService;

use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
Expand All @@ -22,6 +22,7 @@
use OCP\AppFramework\OCS\OCSBadRequestException;
use OCP\AppFramework\OCSController;
use OCP\IRequest;
use OCP\IURLGenerator;
use Psr\Log\InvalidArgumentException;
use Psr\Log\LoggerInterface;

Expand All @@ -33,6 +34,7 @@ public function __construct(
private readonly LoggerInterface $logger,
private readonly AppAPIService $service,
private readonly ExAppService $exAppService,
private readonly IURLGenerator $urlGenerator,
) {
parent::__construct(Application::APP_ID, $request);

Expand Down Expand Up @@ -89,7 +91,6 @@ public function setAppInitProgress(int $progress, string $error = ''): DataRespo
return new DataResponse();
}


/**
* Retrieves the enabled status of an ExApp (0 for disabled, 1 for enabled).
* Note: This endpoint is accessible even if the ExApp itself is disabled.
Expand All @@ -106,4 +107,13 @@ public function getEnabledState(): DataResponse {
}
return new DataResponse($exApp->getEnabled());
}

#[AppAPIAuth]
#[PublicPage]
#[NoCSRFRequired]
public function getNextcloudAbsoluteUrl(string $url): DataResponse {
return new DataResponse([
'absolute_url' => $this->urlGenerator->getAbsoluteURL($url),
], Http::STATUS_OK);
}
}
Loading