Skip to content

Conversation

@nickvergessen
Copy link
Member

Turns out with non default apps_path the Talk installation still fails because the path is wrong invalid causing double namespace registration again.

Fix nextcloud/spreed#2806

I'm very close to just killing the restriction for apps instead to have their prefix, and just do the same as with ocs routes, just allow it for apps to be in root but don't promote it. If they don't specify a root we fall back to the apps/{id} like before...

@nickvergessen
Copy link
Member Author

The alternate patch would be:

diff --git a/core/routes.php b/core/routes.php
index 5fb13bc298..1796a817ec 100644
--- a/core/routes.php
+++ b/core/routes.php
@@ -95,8 +95,8 @@ $application->registerRoutes($this, [
                ['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'],
+//             ['name' => 'pagecontroller#showCall', 'url' => '/call/{token}', 'verb' => 'GET', 'app' => 'spreed'],
+//             ['name' => 'pagecontroller#authenticatePassword', 'url' => '/call/{token}', 'verb' => 'POST', 'app' => 'spreed'],
        ],
        'ocs' => [
                ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
diff --git a/lib/private/AppFramework/Routing/RouteConfig.php b/lib/private/AppFramework/Routing/RouteConfig.php
index ec6c397155..9d4d9fbd47 100644
--- a/lib/private/AppFramework/Routing/RouteConfig.php
+++ b/lib/private/AppFramework/Routing/RouteConfig.php
@@ -147,8 +147,12 @@ class RouteConfig {
                foreach ($simpleRoutes as $simpleRoute) {
                        $name = $simpleRoute['name'];
                        $postfix = $simpleRoute['postfix'] ?? '';
+                       $root = $simpleRoute['root'] ?? '/apps/' . $this->appName;
+                       if ($this->appName === 'core') {
+                               $root = '';
+                       }
 
-                       $url = $simpleRoute['url'];
+                       $url = $root . $simpleRoute['url'];
                        $verb = strtoupper($simpleRoute['verb'] ?? 'GET');
 
                        $split = explode('#', $name, 2);
diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php
index 5b73a1f697..a04c6f5218 100644
--- a/lib/private/Route/Router.php
+++ b/lib/private/Route/Router.php
@@ -151,7 +151,7 @@ class Router implements IRouter {
                                $this->useCollection($app);
                                $this->requireRouteFile($file, $app);
                                $collection = $this->getCollection($app);
-                               $collection->addPrefix('/apps/' . $app);
+                               $collection->addPrefix('');
                                $this->root->addCollection($collection);
 
                                // Also add the OCS collection

and in talk:

diff --git a/appinfo/routes.php b/appinfo/routes.php
index f0729ba8..0519f423 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -28,6 +28,18 @@ return [
                        'url' => '/',
                        'verb' => 'GET',
                ],
+               [
+                       'name' => 'Page#showCall',
+                       'url' => '/call/{token}',
+                       'verb' => 'GET',
+                       'root' => '',
+               ],
+               [
+                       'name' => 'Page#authenticatePassword',
+                       'url' => '/call/{token}',
+                       'verb' => 'POST',
+                       'root' => '',
+               ],
        ],
        'ocs' => [
                /**

@rullzer
Copy link
Member

rullzer commented Mar 23, 2020

I'm very close to just killing the restriction for apps instead to have their prefix, and just do the same as with ocs routes, just allow it for apps to be in root but don't promote it. If they don't specify a root we fall back to the apps/{id} like before...

Yeah. I'm still a bit hessitant as it might lead to conflicting routes etc.

@nickvergessen nickvergessen deleted the ignore-unavailable-app-on-foreign-route-call branch April 14, 2020 18:04
@nickvergessen
Copy link
Member Author

So closing in favor of #20114

Might have a look at it for 18 thou

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot declare class OCA\Talk\Migration\Version2000Date20170707093535

3 participants