mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
feat(core): Expose app versions, API versions and features in capabilities
Signed-off-by: provokateurin <kate@provokateurin.de>
This commit is contained in:
parent
908bafc5d5
commit
1987e4d39b
3 changed files with 79 additions and 3 deletions
|
|
@ -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<Http::STATUS_OK, array{version: array{major: int, minor: int, micro: int, string: string, edition: '', extendedSupport: bool}, capabilities: array<string, mixed>}, array{}>
|
||||
* @return DataResponse<Http::STATUS_OK, array{version: array{major: int, minor: int, micro: int, string: string, edition: '', extendedSupport: bool}, capabilities: array<string, mixed>, features: array<string, list<string>>, apps: array<string, array{version: string, api_versions: list<string>}>}, 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;
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue