Skip to content
39 changes: 39 additions & 0 deletions apps/cloud_federation_api/appinfo/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Joas Schilling <[email protected]>
*
* @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' => '',
],
],
];
11 changes: 9 additions & 2 deletions apps/files/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@
$this,
[
'routes' => [
[
'name' => 'View#showFile',
'url' => '/f/{fileid}',
'verb' => 'GET',
'root' => '',
],

[
'name' => 'API#getThumbnail',
'url' => '/api/v1/thumbnail/{x}/{y}/{file}',
Expand Down Expand Up @@ -146,7 +153,7 @@

/** @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');
6 changes: 3 additions & 3 deletions apps/files_external/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
31 changes: 31 additions & 0 deletions apps/files_sharing/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,37 @@
'ExternalShares' => ['url' => '/api/externalShares'],
],
'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',
Expand Down
80 changes: 4 additions & 76 deletions apps/files_sharing/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@

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;
Expand All @@ -51,10 +49,7 @@
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;
Expand All @@ -80,48 +75,10 @@ public function __construct(array $urlParams = []) {
$mountProviderCollection = $server->getMountProviderCollection();
$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(
Expand All @@ -138,50 +95,21 @@ public function __construct(array $urlParams = []) {
$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()
);
Expand All @@ -205,7 +133,7 @@ function () use ($c) {
}

protected function registerMountProviders(IMountProviderCollection $mountProviderCollection) {
$mountProviderCollection->registerProvider($this->getContainer()->query('MountProvider'));
$mountProviderCollection->registerProvider($this->getContainer()->query(MountProvider::class));
$mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider'));
}

Expand Down
6 changes: 3 additions & 3 deletions apps/files_versions/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
]);

/** @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');
4 changes: 3 additions & 1 deletion apps/testing/appinfo/app.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php

declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud GmbH.
*
Expand All @@ -21,4 +23,4 @@
*
*/

$app = new \OCA\Testing\AppInfo\Application();
$app = \OC::$server->query(\OCA\Testing\AppInfo\Application::class);
14 changes: 7 additions & 7 deletions apps/user_ldap/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
*/

/** @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');
Expand Down
12 changes: 0 additions & 12 deletions core/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,6 @@
// Logins for passwordless auth
['name' => 'WebAuthn#startAuthentication', 'url' => 'login/webauthn/start', 'verb' => 'POST'],
['name' => 'WebAuthn#finishAuthentication', 'url' => 'login/webauthn/finish', 'verb' => 'POST'],

// Legacy routes that need to be globally available while they are handled by an app
['name' => 'viewcontroller#showFile', 'url' => '/f/{fileid}', 'verb' => 'GET', 'app' => 'files'],
['name' => 'sharecontroller#showShare', 'url' => '/s/{token}', 'verb' => 'GET', 'app' => 'files_sharing'],
['name' => 'sharecontroller#showAuthenticate', 'url' => '/s/{token}/authenticate/{redirect}', 'verb' => 'GET', 'app' => 'files_sharing'],
['name' => 'sharecontroller#authenticate', 'url' => '/s/{token}/authenticate/{redirect}', 'verb' => 'POST', 'app' => 'files_sharing'],
['name' => 'sharecontroller#downloadShare', 'url' => '/s/{token}/download', 'verb' => 'GET', 'app' => 'files_sharing'],
['name' => 'publicpreview#directLink', 'url' => '/s/{token}/preview', 'verb' => 'GET', 'app' => 'files_sharing'],
['name' => 'requesthandlercontroller#addShare', 'url' => '/ocm/shares', 'verb' => 'POST', 'app' => 'cloud_federation_api'],
['name' => 'requesthandlercontroller#receiveNotification', 'url' => '/ocm/notifications', 'verb' => 'POST', 'app' => 'cloud_federation_api'],
['name' => 'pagecontroller#showCall', 'url' => '/call/{token}', 'verb' => 'GET', 'app' => 'spreed'],
['name' => 'pagecontroller#authenticatePassword', 'url' => '/call/{token}', 'verb' => 'POST', 'app' => 'spreed'],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are now in nextcloud/spreed#3134

All other apps are in this PR

],
'ocs' => [
['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
Expand Down
Loading