summaryrefslogtreecommitdiffstats
path: root/lib/private/Route
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-10-31 11:03:01 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2020-11-03 09:39:49 +0100
commite25a7137ccfd4eb64de885256d154665c951f6a4 (patch)
treec001f270a6ba76574c30ed7e29175cadbc128e9e /lib/private/Route
parent9d559d282ecfbcf02d3d331b7de99ed80d5858b2 (diff)
downloadnextcloud-server-e25a7137ccfd4eb64de885256d154665c951f6a4.tar.gz
nextcloud-server-e25a7137ccfd4eb64de885256d154665c951f6a4.zip
Cleanup route registration logic
This was a bunch of cylic things being called. This is an attempt to clean this all up. If an app provides an array of routes. We just parse them and hand them back. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Route')
-rw-r--r--lib/private/Route/Router.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php
index 94c637e5e0d..4e1264666e4 100644
--- a/lib/private/Route/Router.php
+++ b/lib/private/Route/Router.php
@@ -33,6 +33,7 @@
namespace OC\Route;
+use OC\AppFramework\Routing\RouteParser;
use OCP\AppFramework\App;
use OCP\ILogger;
use OCP\Route\IRouter;
@@ -426,8 +427,14 @@ class Router implements IRouter {
*/
private function setupRoutes($routes, $appName) {
if (is_array($routes)) {
- $application = $this->getApplicationClass($appName);
- $application->registerRoutes($this, $routes);
+ $routeParser = new RouteParser();
+
+ $defaultRoutes = $routeParser->parseDefaultRoutes($routes, $appName);
+ $ocsRoutes = $routeParser->parseOCSRoutes($routes, $appName);
+
+ $this->root->addCollection($defaultRoutes);
+ $ocsRoutes->addPrefix('/ocsapp');
+ $this->root->addCollection($ocsRoutes);
}
}