Make the router handle OCS AppFramework Routes

This commit is contained in:
Roeland Jago Douma 2016-05-17 10:12:33 +02:00 committed by Roeland Jago Douma
parent 1ff4b7f63d
commit 94cd83ca00
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
1 changed files with 12 additions and 0 deletions

View File

@ -150,6 +150,11 @@ class Router implements IRouter {
$collection = $this->getCollection($app); $collection = $this->getCollection($app);
$collection->addPrefix('/apps/' . $app); $collection->addPrefix('/apps/' . $app);
$this->root->addCollection($collection); $this->root->addCollection($collection);
// Also add the OCS collection
$collection = $this->getCollection($app.'.ocs');
$collection->addPrefix('/ocsapp/apps/' . $app);
$this->root->addCollection($collection);
} }
} }
if (!isset($this->loadedApps['core'])) { if (!isset($this->loadedApps['core'])) {
@ -238,6 +243,13 @@ class Router implements IRouter {
// empty string / 'apps' / $app / rest of the route // empty string / 'apps' / $app / rest of the route
list(, , $app,) = explode('/', $url, 4); list(, , $app,) = explode('/', $url, 4);
$app = \OC_App::cleanAppId($app);
\OC::$REQUESTEDAPP = $app;
$this->loadRoutes($app);
} else if (substr($url, 0, 13) === '/ocsapp/apps/') {
// empty string / 'ocsapp' / 'apps' / $app / rest of the route
list(, , , $app,) = explode('/', $url, 5);
$app = \OC_App::cleanAppId($app); $app = \OC_App::cleanAppId($app);
\OC::$REQUESTEDAPP = $app; \OC::$REQUESTEDAPP = $app;
$this->loadRoutes($app); $this->loadRoutes($app);