Skip to content

Commit

Permalink
feat(capabilities): return conversion capabilities
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Danzberger <[email protected]>
  • Loading branch information
elzody committed Dec 27, 2024
1 parent 21fbe9a commit b1d9670
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/private/CapabilitiesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(LoggerInterface $logger) {
}

/**
* Get an array of al the capabilities that are registered at this manager
* Get an array of all the capabilities that are registered at this manager
*
* @param bool $public get public capabilities only
* @throws \InvalidArgumentException
Expand Down
4 changes: 4 additions & 0 deletions lib/private/OCS/CoreCapabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace OC\OCS;

use OCP\Capabilities\ICapability;
use OCP\Conversion\IConversionManager;
use OCP\IConfig;
use OCP\IURLGenerator;

Expand All @@ -22,6 +23,7 @@ class CoreCapabilities implements ICapability {
*/
public function __construct(
private IConfig $config,
private IConversionManager $conversionManager,
) {
}

Expand All @@ -34,6 +36,7 @@ public function __construct(
* webdav-root: string,
* reference-api: boolean,
* reference-regex: string,
* conversions: array<string, string|array<string>>,
* mod-rewrite-working: boolean,
* },
* }
Expand All @@ -45,6 +48,7 @@ public function getCapabilities(): array {
'webdav-root' => $this->config->getSystemValueString('webdav-root', 'remote.php/webdav'),
'reference-api' => true,
'reference-regex' => IURLGenerator::URL_REGEX_NO_MODIFIERS,
'conversions' => array_merge([], ...$this->conversionManager->getMimeTypes()),
'mod-rewrite-working' => $this->config->getSystemValueBool('htaccess.IgnoreFrontController') || getenv('front_controller_active') === 'true',
],
];
Expand Down
5 changes: 4 additions & 1 deletion lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,10 @@ public function __construct($webRoot, \OC\Config $config) {
$this->registerService(CapabilitiesManager::class, function (ContainerInterface $c) {
$manager = new CapabilitiesManager($c->get(LoggerInterface::class));
$manager->registerCapability(function () use ($c) {
return new \OC\OCS\CoreCapabilities($c->get(\OCP\IConfig::class));
return new \OC\OCS\CoreCapabilities(
$c->get(\OCP\IConfig::class),
$c->get(\OCP\Conversion\IConversionManager::class)
);
});
$manager->registerCapability(function () use ($c) {
return $c->get(\OC\Security\Bruteforce\Capabilities::class);
Expand Down

0 comments on commit b1d9670

Please sign in to comment.