diff --git a/apps/files/appinfo/routes.php b/apps/files/appinfo/routes.php index 03a025cadf5e3..b286328f36921 100644 --- a/apps/files/appinfo/routes.php +++ b/apps/files/appinfo/routes.php @@ -50,44 +50,44 @@ ], [ - 'name' => 'API#getThumbnail', + 'name' => 'Api#getThumbnail', 'url' => '/api/v1/thumbnail/{x}/{y}/{file}', 'verb' => 'GET', 'requirements' => ['file' => '.+'] ], [ - 'name' => 'API#updateFileTags', + 'name' => 'Api#updateFileTags', 'url' => '/api/v1/files/{path}', 'verb' => 'POST', 'requirements' => ['path' => '.+'], ], [ - 'name' => 'API#getRecentFiles', + 'name' => 'Api#getRecentFiles', 'url' => '/api/v1/recent/', 'verb' => 'GET' ], [ - 'name' => 'API#updateFileSorting', + 'name' => 'Api#updateFileSorting', 'url' => '/api/v1/sorting', 'verb' => 'POST' ], [ - 'name' => 'API#showHiddenFiles', + 'name' => 'Api#showHiddenFiles', 'url' => '/api/v1/showhidden', 'verb' => 'POST' ], [ - 'name' => 'API#cropImagePreviews', + 'name' => 'Api#cropImagePreviews', 'url' => '/api/v1/cropimagepreviews', 'verb' => 'POST' ], [ - 'name' => 'API#showGridView', + 'name' => 'Api#showGridView', 'url' => '/api/v1/showgridview', 'verb' => 'POST' ], [ - 'name' => 'API#getGridView', + 'name' => 'Api#getGridView', 'url' => '/api/v1/showgridview', 'verb' => 'GET' ], @@ -102,12 +102,12 @@ 'verb' => 'GET', ], [ - 'name' => 'API#toggleShowFolder', + 'name' => 'Api#toggleShowFolder', 'url' => '/api/v1/toggleShowFolder/{key}', 'verb' => 'POST' ], [ - 'name' => 'API#getNodeType', + 'name' => 'Api#getNodeType', 'url' => '/api/v1/quickaccess/get/NodeType', 'verb' => 'GET', ], diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php index e2f79a0a42c39..d2a5c894ac8f7 100644 --- a/apps/files/lib/AppInfo/Application.php +++ b/apps/files/lib/AppInfo/Application.php @@ -75,25 +75,6 @@ public function __construct(array $urlParams = []) { } public function register(IRegistrationContext $context): void { - /** - * Controllers - */ - $context->registerService('APIController', function (ContainerInterface $c) { - /** @var IServerContainer $server */ - $server = $c->get(IServerContainer::class); - - return new ApiController( - $c->get('AppName'), - $c->get(IRequest::class), - $c->get(IUserSession::class), - $c->get(TagService::class), - $c->get(IPreview::class), - $c->get(IShareManager::class), - $c->get(IConfig::class), - $server->getUserFolder() - ); - }); - /** * Services */ diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index d2d5d40ec3f0e..3064b68b1844a 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -38,6 +38,7 @@ namespace OCA\Files\Controller; use OC\Files\Node\Node; +use OCA\Files\AppInfo\Application; use OCA\Files\Service\TagService; use OCA\Files\SidebarNavigationManager; use OCP\AppFramework\Controller; @@ -48,6 +49,7 @@ use OCP\AppFramework\Http\Response; use OCP\Files\File; use OCP\Files\Folder; +use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\IConfig; use OCP\IPreview; @@ -78,33 +80,32 @@ class ApiController extends Controller { private $navigationManager; /** - * @param string $appName * @param IRequest $request * @param IUserSession $userSession * @param TagService $tagService * @param IPreview $previewManager * @param IManager $shareManager * @param IConfig $config - * @param Folder $userFolder + * @param IRootFolder $rootFolder + * @param SidebarNavigationManager $navigationManager */ public function __construct( - $appName, IRequest $request, IUserSession $userSession, TagService $tagService, IPreview $previewManager, IManager $shareManager, IConfig $config, - Folder $userFolder, + IRootFolder $rootFolder, SidebarNavigationManager $navigationManager ) { - parent::__construct($appName, $request); + parent::__construct(Application::APP_ID, $request); $this->userSession = $userSession; $this->tagService = $tagService; $this->previewManager = $previewManager; $this->shareManager = $shareManager; $this->config = $config; - $this->userFolder = $userFolder; + $this->userFolder = $rootFolder->getUserFolder($userSession->getUser()->getUID()); $this->navigationManager = $navigationManager; }