2013-05-06 14:45:04 -04:00
|
|
|
<?php
|
2024-05-28 10:42:42 -04:00
|
|
|
|
2013-05-06 14:45:04 -04:00
|
|
|
/**
|
2024-05-28 10:42:42 -04:00
|
|
|
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2013-05-06 14:45:04 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCA\Files;
|
|
|
|
|
|
2022-04-08 08:16:21 -04:00
|
|
|
use OC\NavigationManager;
|
2024-10-17 03:19:44 -04:00
|
|
|
use OCA\Files\Service\ChunkedUploadConfig;
|
2022-04-08 08:16:21 -04:00
|
|
|
use OCP\App\IAppManager;
|
2024-12-17 14:11:19 -05:00
|
|
|
use OCP\EventDispatcher\IEventDispatcher;
|
2022-04-08 08:16:21 -04:00
|
|
|
use OCP\IConfig;
|
|
|
|
|
use OCP\IGroupManager;
|
|
|
|
|
use OCP\INavigationManager;
|
|
|
|
|
use OCP\IURLGenerator;
|
|
|
|
|
use OCP\IUserSession;
|
|
|
|
|
use OCP\L10N\IFactory;
|
|
|
|
|
use OCP\Server;
|
2024-08-27 06:13:04 -04:00
|
|
|
use Psr\Log\LoggerInterface;
|
2022-04-08 08:16:21 -04:00
|
|
|
|
2013-05-08 05:56:59 -04:00
|
|
|
class App {
|
2022-04-08 08:16:21 -04:00
|
|
|
private static ?INavigationManager $navigationManager = null;
|
2014-05-08 10:24:24 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the app's navigation manager
|
|
|
|
|
*/
|
2022-04-08 08:16:21 -04:00
|
|
|
public static function getNavigationManager(): INavigationManager {
|
2015-07-13 11:38:13 -04:00
|
|
|
// TODO: move this into a service in the Application class
|
2014-05-08 10:24:24 -04:00
|
|
|
if (self::$navigationManager === null) {
|
2022-04-08 08:16:21 -04:00
|
|
|
self::$navigationManager = new NavigationManager(
|
|
|
|
|
Server::get(IAppManager::class),
|
|
|
|
|
Server::get(IUrlGenerator::class),
|
|
|
|
|
Server::get(IFactory::class),
|
|
|
|
|
Server::get(IUserSession::class),
|
|
|
|
|
Server::get(IGroupManager::class),
|
2024-08-27 06:13:04 -04:00
|
|
|
Server::get(IConfig::class),
|
|
|
|
|
Server::get(LoggerInterface::class),
|
2024-12-17 14:11:19 -05:00
|
|
|
Server::get(IEventDispatcher::class),
|
2017-03-26 13:40:41 -04:00
|
|
|
);
|
2017-03-26 15:15:25 -04:00
|
|
|
self::$navigationManager->clear(false);
|
2014-05-08 10:24:24 -04:00
|
|
|
}
|
|
|
|
|
return self::$navigationManager;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-08 08:16:21 -04:00
|
|
|
public static function extendJsConfig($settings): void {
|
2016-10-07 10:27:54 -04:00
|
|
|
$appConfig = json_decode($settings['array']['oc_appconfig'], true);
|
|
|
|
|
|
|
|
|
|
$appConfig['files'] = [
|
2024-10-17 03:19:44 -04:00
|
|
|
'max_chunk_size' => ChunkedUploadConfig::getMaxChunkSize(),
|
2016-10-07 10:27:54 -04:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$settings['array']['oc_appconfig'] = json_encode($appConfig);
|
|
|
|
|
}
|
2013-08-18 05:02:08 -04:00
|
|
|
}
|