summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-04-21 16:00:34 +0200
committerGitHub <noreply@github.com>2020-04-21 16:00:34 +0200
commit8f650feedec0555c294cd7b242b6519c346b3bc5 (patch)
tree3afa3396d7508d43bc949b15f5310dd96fd706a6 /apps/files_sharing
parent613f0f2c0c2f07ad084a64f85debe9f6845b78f2 (diff)
parent1b93d5f1db6e2c9931f62c96c2dd60b7a2251ce9 (diff)
downloadnextcloud-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/files_sharing')
-rw-r--r--apps/files_sharing/appinfo/routes.php31
-rw-r--r--apps/files_sharing/lib/AppInfo/Application.php80
2 files changed, 35 insertions, 76 deletions
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'));
}