diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index d4da85752d8..37bf404e8f6 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -5,8 +5,10 @@ */ namespace OC\Core\Controller; +use OC\App\AppManager; use OC\CapabilitiesManager; use OC\Security\IdentityProof\Manager; +use OC_App; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\ApiRoute; use OCP\AppFramework\Http\Attribute\OpenAPI; @@ -23,6 +25,7 @@ class OCSController extends \OCP\AppFramework\OCSController { private IUserSession $userSession, private IUserManager $userManager, private Manager $keyManager, + private AppManager $appManager, ) { parent::__construct($appName, $request); } @@ -49,7 +52,7 @@ class OCSController extends \OCP\AppFramework\OCSController { * * Get the capabilities * - * @return DataResponse}, array{}> + * @return DataResponse, features: array>, apps: array}>}, array{}> * * 200: Capabilities returned */ @@ -72,6 +75,15 @@ class OCSController extends \OCP\AppFramework\OCSController { $result['capabilities'] = $this->capabilitiesManager->getCapabilities(true); } + $result['features'] = $this->capabilitiesManager->getFeatures(); + + $result['apps'] = []; + foreach (OC_App::getEnabledApps() as $app) { + $info = $this->appManager->getAppInfo($app); + $result['apps'][$app]['version'] = (string)$info['version']; + $result['apps'][$app]['api_versions'] = array_values(array_map(static fn ($apiVersion) => (string)$apiVersion, (array)$info['api-version'])); + } + $response = new DataResponse($result); $response->setETag(md5(json_encode($result))); return $response; diff --git a/core/openapi-full.json b/core/openapi-full.json index a62e587bf06..66e9e6dc702 100644 --- a/core/openapi-full.json +++ b/core/openapi-full.json @@ -2724,7 +2724,9 @@ "type": "object", "required": [ "version", - "capabilities" + "capabilities", + "features", + "apps" ], "properties": { "version": { @@ -2766,6 +2768,36 @@ "additionalProperties": { "type": "object" } + }, + "features": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "apps": { + "type": "object", + "additionalProperties": { + "type": "object", + "required": [ + "version", + "api_versions" + ], + "properties": { + "version": { + "type": "string" + }, + "api_versions": { + "type": "array", + "items": { + "type": "string" + } + } + } + } } } } diff --git a/core/openapi.json b/core/openapi.json index 51698f6d430..c8fe4091cb9 100644 --- a/core/openapi.json +++ b/core/openapi.json @@ -2724,7 +2724,9 @@ "type": "object", "required": [ "version", - "capabilities" + "capabilities", + "features", + "apps" ], "properties": { "version": { @@ -2766,6 +2768,36 @@ "additionalProperties": { "type": "object" } + }, + "features": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "apps": { + "type": "object", + "additionalProperties": { + "type": "object", + "required": [ + "version", + "api_versions" + ], + "properties": { + "version": { + "type": "string" + }, + "api_versions": { + "type": "array", + "items": { + "type": "string" + } + } + } + } } } }