diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-04-21 16:00:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-21 16:00:34 +0200 |
commit | 8f650feedec0555c294cd7b242b6519c346b3bc5 (patch) | |
tree | 3afa3396d7508d43bc949b15f5310dd96fd706a6 /apps | |
parent | 613f0f2c0c2f07ad084a64f85debe9f6845b78f2 (diff) | |
parent | 1b93d5f1db6e2c9931f62c96c2dd60b7a2251ce9 (diff) | |
download | nextcloud-server-8f650feedec0555c294cd7b242b6519c346b3bc5.tar.gz nextcloud-server-8f650feedec0555c294cd7b242b6519c346b3bc5.zip |
Merge pull request #20114 from nextcloud/techdebt/noid/allow-some-apps-to-have-root-urls
Allow some apps to have root URLs in their own routing file
Diffstat (limited to 'apps')
-rw-r--r-- | apps/cloud_federation_api/appinfo/routes.php | 39 | ||||
-rw-r--r-- | apps/files/appinfo/routes.php | 11 | ||||
-rw-r--r-- | apps/files_external/appinfo/routes.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/appinfo/routes.php | 31 | ||||
-rw-r--r-- | apps/files_sharing/lib/AppInfo/Application.php | 80 | ||||
-rw-r--r-- | apps/files_versions/appinfo/routes.php | 6 | ||||
-rw-r--r-- | apps/testing/appinfo/app.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/appinfo/routes.php | 14 |
8 files changed, 99 insertions, 92 deletions
diff --git a/apps/cloud_federation_api/appinfo/routes.php b/apps/cloud_federation_api/appinfo/routes.php new file mode 100644 index 00000000000..8dbc0e3e931 --- /dev/null +++ b/apps/cloud_federation_api/appinfo/routes.php @@ -0,0 +1,39 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +return [ + 'routes' => [ + [ + 'name' => 'RequestHandler#addShare', + 'url' => '/ocm/shares', + 'verb' => 'POST', + 'root' => '', + ], + [ + 'name' => 'RequestHandler#receiveNotification', + 'url' => '/ocm/notifications', + 'verb' => 'POST', + 'root' => '', + ], + ], +]; diff --git a/apps/files/appinfo/routes.php b/apps/files/appinfo/routes.php index 825249b0874..d304ceb7b28 100644 --- a/apps/files/appinfo/routes.php +++ b/apps/files/appinfo/routes.php @@ -42,6 +42,13 @@ $application->registerRoutes( [ 'routes' => [ [ + 'name' => 'View#showFile', + 'url' => '/f/{fileid}', + 'verb' => 'GET', + 'root' => '', + ], + + [ 'name' => 'API#getThumbnail', 'url' => '/api/v1/thumbnail/{x}/{y}/{file}', 'verb' => 'GET', @@ -146,7 +153,7 @@ $application->registerRoutes( /** @var $this \OC\Route\Router */ -$this->create('files_ajax_download', 'ajax/download.php') +$this->create('files_ajax_download', 'apps/files/ajax/download.php') ->actionInclude('files/ajax/download.php'); -$this->create('files_ajax_list', 'ajax/list.php') +$this->create('files_ajax_list', 'apps/files/ajax/list.php') ->actionInclude('files/ajax/list.php'); diff --git a/apps/files_external/appinfo/routes.php b/apps/files_external/appinfo/routes.php index c504110210b..17484594a45 100644 --- a/apps/files_external/appinfo/routes.php +++ b/apps/files_external/appinfo/routes.php @@ -60,11 +60,11 @@ ] ); -$this->create('files_external_oauth1', 'ajax/oauth1.php') +$this->create('files_external_oauth1', 'apps/files_external/ajax/oauth1.php') ->actionInclude('files_external/ajax/oauth1.php'); -$this->create('files_external_oauth2', 'ajax/oauth2.php') +$this->create('files_external_oauth2', 'apps/files_external/ajax/oauth2.php') ->actionInclude('files_external/ajax/oauth2.php'); -$this->create('files_external_list_applicable', '/applicable') +$this->create('files_external_list_applicable', '/apps/files_external/applicable') ->actionInclude('files_external/ajax/applicable.php'); diff --git a/apps/files_sharing/appinfo/routes.php b/apps/files_sharing/appinfo/routes.php index 1346e0c6899..a4edada738c 100644 --- a/apps/files_sharing/appinfo/routes.php +++ b/apps/files_sharing/appinfo/routes.php @@ -31,6 +31,37 @@ return [ ], 'routes' => [ [ + 'name' => 'Share#showShare', + 'url' => '/s/{token}', + 'verb' => 'GET', + 'root' => '', + ], + [ + 'name' => 'Share#showAuthenticate', + 'url' => '/s/{token}/authenticate/{redirect}', + 'verb' => 'GET', + 'root' => '', + ], + [ + 'name' => 'Share#authenticate', + 'url' => '/s/{token}/authenticate/{redirect}', + 'verb' => 'POST', + 'root' => '', + ], + [ + 'name' => 'Share#downloadShare', + 'url' => '/s/{token}/download', + 'verb' => 'GET', + 'root' => '', + ], + [ + 'name' => 'PublicPreview#directLink', + 'url' => '/s/{token}/preview', + 'verb' => 'GET', + 'root' => '', + ], + + [ 'name' => 'externalShares#testRemote', 'url' => '/testremote', 'verb' => 'GET' diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index 34db7441daa..c7198c12cf1 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -34,8 +34,6 @@ namespace OCA\Files_Sharing\AppInfo; use OC\AppFramework\Utility\SimpleContainer; use OCA\Files_Sharing\Capabilities; -use OCA\Files_Sharing\Controller\ExternalSharesController; -use OCA\Files_Sharing\Controller\ShareController; use OCA\Files_Sharing\External\Manager; use OCA\Files_Sharing\Listener\LoadAdditionalListener; use OCA\Files_Sharing\Listener\LoadSidebarListener; @@ -51,10 +49,7 @@ use OCA\Files_Sharing\Notification\Notifier; use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCA\Files\Event\LoadSidebar; use OCP\AppFramework\App; -use OCP\AppFramework\Utility\IControllerMethodReflector; -use OCP\Defaults; use OCP\EventDispatcher\IEventDispatcher; -use OCP\Federation\ICloudIdManager; use OCP\Files\Config\IMountProviderCollection; use OCP\Group\Events\UserAddedEvent; use OCP\IContainer; @@ -81,47 +76,9 @@ class Application extends App { $notifications = $server->getNotificationManager(); /** - * Controllers - */ - $container->registerService('ShareController', function (SimpleContainer $c) use ($server) { - $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application(); - return new ShareController( - $c->query('AppName'), - $c->query('Request'), - $server->getConfig(), - $server->getURLGenerator(), - $server->getUserManager(), - $server->getLogger(), - $server->getActivityManager(), - $server->getShareManager(), - $server->getSession(), - $server->getPreviewManager(), - $server->getRootFolder(), - $federatedSharingApp->getFederatedShareProvider(), - $server->getEventDispatcher(), - $server->getL10N($c->query('AppName')), - $server->query(Defaults::class) - ); - }); - $container->registerService('ExternalSharesController', function (SimpleContainer $c) { - return new ExternalSharesController( - $c->query('AppName'), - $c->query('Request'), - $c->query('ExternalManager'), - $c->query('HttpClientService') - ); - }); - - /** * Core class wrappers */ - $container->registerService('HttpClientService', function (SimpleContainer $c) use ($server) { - return $server->getHTTPClientService(); - }); - $container->registerService(ICloudIdManager::class, function (SimpleContainer $c) use ($server) { - return $server->getCloudIdManager(); - }); - $container->registerService('ExternalManager', function (SimpleContainer $c) use ($server) { + $container->registerService(Manager::class, function (SimpleContainer $c) use ($server) { $user = $server->getUserSession()->getUser(); $uid = $user ? $user->getUID() : null; return new \OCA\Files_Sharing\External\Manager( @@ -138,50 +95,21 @@ class Application extends App { $uid ); }); - $container->registerAlias(Manager::class, 'ExternalManager'); /** * Middleware */ - $container->registerService('SharingCheckMiddleware', function (SimpleContainer $c) use ($server) { - return new SharingCheckMiddleware( - $c->query('AppName'), - $server->getConfig(), - $server->getAppManager(), - $server->query(IControllerMethodReflector::class), - $server->getShareManager(), - $server->getRequest() - ); - }); - - $container->registerService(ShareInfoMiddleware::class, function () use ($server) { - return new ShareInfoMiddleware( - $server->getShareManager() - ); - }); - - // Execute middlewares - $container->registerMiddleWare('SharingCheckMiddleware'); + $container->registerMiddleWare(SharingCheckMiddleware::class); $container->registerMiddleWare(OCSShareAPIMiddleware::class); $container->registerMiddleWare(ShareInfoMiddleware::class); - $container->registerService('MountProvider', function (IContainer $c) { - /** @var \OCP\IServerContainer $server */ - $server = $c->query('ServerContainer'); - return new MountProvider( - $server->getConfig(), - $server->getShareManager(), - $server->getLogger() - ); - }); - $container->registerService('ExternalMountProvider', function (IContainer $c) { /** @var \OCP\IServerContainer $server */ $server = $c->query('ServerContainer'); return new \OCA\Files_Sharing\External\MountProvider( $server->getDatabaseConnection(), function () use ($c) { - return $c->query('ExternalManager'); + return $c->query(Manager::class); }, $server->getCloudIdManager() ); @@ -205,7 +133,7 @@ class Application extends App { } protected function registerMountProviders(IMountProviderCollection $mountProviderCollection) { - $mountProviderCollection->registerProvider($this->getContainer()->query('MountProvider')); + $mountProviderCollection->registerProvider($this->getContainer()->query(MountProvider::class)); $mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider')); } diff --git a/apps/files_versions/appinfo/routes.php b/apps/files_versions/appinfo/routes.php index 7252ddcd22b..35a746777dc 100644 --- a/apps/files_versions/appinfo/routes.php +++ b/apps/files_versions/appinfo/routes.php @@ -40,9 +40,9 @@ $application->registerRoutes($this, [ ]); /** @var $this \OCP\Route\IRouter */ -$this->create('files_versions_download', 'download.php') +$this->create('files_versions_download', 'apps/files_versions/download.php') ->actionInclude('files_versions/download.php'); -$this->create('files_versions_ajax_getVersions', 'ajax/getVersions.php') +$this->create('files_versions_ajax_getVersions', 'apps/files_versions/ajax/getVersions.php') ->actionInclude('files_versions/ajax/getVersions.php'); -$this->create('files_versions_ajax_rollbackVersion', 'ajax/rollbackVersion.php') +$this->create('files_versions_ajax_rollbackVersion', 'apps/files_versions/ajax/rollbackVersion.php') ->actionInclude('files_versions/ajax/rollbackVersion.php'); diff --git a/apps/testing/appinfo/app.php b/apps/testing/appinfo/app.php index 48d8da8c20b..e588ce47433 100644 --- a/apps/testing/appinfo/app.php +++ b/apps/testing/appinfo/app.php @@ -1,4 +1,6 @@ <?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2016, ownCloud GmbH. * @@ -21,4 +23,4 @@ * */ -$app = new \OCA\Testing\AppInfo\Application(); +$app = \OC::$server->query(\OCA\Testing\AppInfo\Application::class); diff --git a/apps/user_ldap/appinfo/routes.php b/apps/user_ldap/appinfo/routes.php index d7955446a47..d3ff28a3f19 100644 --- a/apps/user_ldap/appinfo/routes.php +++ b/apps/user_ldap/appinfo/routes.php @@ -28,19 +28,19 @@ declare(strict_types=1); */ /** @var $this \OCP\Route\IRouter */ -$this->create('user_ldap_ajax_clearMappings', 'ajax/clearMappings.php') +$this->create('user_ldap_ajax_clearMappings', 'apps/user_ldap/ajax/clearMappings.php') ->actionInclude('user_ldap/ajax/clearMappings.php'); -$this->create('user_ldap_ajax_deleteConfiguration', 'ajax/deleteConfiguration.php') +$this->create('user_ldap_ajax_deleteConfiguration', 'apps/user_ldap/ajax/deleteConfiguration.php') ->actionInclude('user_ldap/ajax/deleteConfiguration.php'); -$this->create('user_ldap_ajax_getConfiguration', 'ajax/getConfiguration.php') +$this->create('user_ldap_ajax_getConfiguration', 'apps/user_ldap/ajax/getConfiguration.php') ->actionInclude('user_ldap/ajax/getConfiguration.php'); -$this->create('user_ldap_ajax_getNewServerConfigPrefix', 'ajax/getNewServerConfigPrefix.php') +$this->create('user_ldap_ajax_getNewServerConfigPrefix', 'apps/user_ldap/ajax/getNewServerConfigPrefix.php') ->actionInclude('user_ldap/ajax/getNewServerConfigPrefix.php'); -$this->create('user_ldap_ajax_setConfiguration', 'ajax/setConfiguration.php') +$this->create('user_ldap_ajax_setConfiguration', 'apps/user_ldap/ajax/setConfiguration.php') ->actionInclude('user_ldap/ajax/setConfiguration.php'); -$this->create('user_ldap_ajax_testConfiguration', 'ajax/testConfiguration.php') +$this->create('user_ldap_ajax_testConfiguration', 'apps/user_ldap/ajax/testConfiguration.php') ->actionInclude('user_ldap/ajax/testConfiguration.php'); -$this->create('user_ldap_ajax_wizard', 'ajax/wizard.php') +$this->create('user_ldap_ajax_wizard', 'apps/user_ldap/ajax/wizard.php') ->actionInclude('user_ldap/ajax/wizard.php'); $application = new \OCP\AppFramework\App('user_ldap'); |