Skip to content

Conversation

andrey18106
Copy link
Contributor

@andrey18106 andrey18106 commented Jul 16, 2024

This PR introduces new (mandatory if you use the ExApp proxy) registration of the routes that are allowed to call on ExApp via AppAPI ExApp proxy.

In your ExApp info.xml - external-app add the routes declaration, e.g.:

<routes>
	<route>
		<url>.*</url>
		<verb>GET,POST,PUT,DELETE</verb>
		<access_level>USER</access_level>
		<headers_to_exclude>[]</headers_to_exclude>
	</route>
</routes>

allows all routes, or more specific:

<routes>
	<route>
		<url>img\/.*</url>
		<verb>GET</verb>
		<access_level>USER</access_level>
		<headers_to_exclude>[]</headers_to_exclude>
	</route>
	<route>
		<url>js\/.*</url>
		<verb>GET</verb>
		<access_level>USER</access_level>
		<headers_to_exclude>[]</headers_to_exclude>
	</route>
	<route>
		<url>css\/.*</url>
		<verb>GET</verb>
		<access_level>USER</access_level>
		<headers_to_exclude>[]</headers_to_exclude>
	</route>
	<route>
		<url>api\/.*</url>
		<verb>GET,POST,PUT,DELETE</verb>
		<access_level>USER</access_level>
		<headers_to_exclude>[]</headers_to_exclude>
	</route>
</routes>

andrey18106 added a commit that referenced this pull request Jul 23, 2024
This reverts commit ca4c14c.

We need this to keep the #327 included in NC 27.

We'll drop it's support after AppAPI 3.0.0.

---------

Signed-off-by: Andrey Borysenko <[email protected]>
@andrey18106 andrey18106 force-pushed the public-pages-routes-support branch from 1b4d4e4 to e7b6c9c Compare July 23, 2024 18:13
@andrey18106 andrey18106 changed the title WIP: ExApp routes draft ExApp routes (public/user/admin) support Jul 24, 2024
@bigcat88
Copy link
Member

Logs are full of errors:

{"file":"/home/runner/work/app_api/app_api/lib/private/DB/QueryBuilder/QueryBuilder.php","line":270,"function":"executeQuery","class":"OC\\DB\\ConnectionAdapter","type":"->","args":["SELECT `exs`.* FROM `*PREFIX*ex_task_processing` `exs` INNER JOIN `*PREFIX*ex_apps` `exa` ON `exa`.`appid` = `exs`.`app_id` WHERE `exa`.`enabled` = :dcValue1",[1],[1]]},{"file":"/home/runner/work/app_api/app_api/apps/app_api/lib/Db/TaskProcessing/TaskProcessingProviderMapper.php","line":32,"function":"executeQuery","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/home/runner/work/app_api/app_api/apps/app_api/lib/Service/ProvidersAI/TaskProcessingService.php","line":44,"function":"findAllEnabled","class":"OCA\\AppAPI\\Db\\TaskProcessing\\TaskProcessingProviderMapper","type":"->","args":[]},{"file":"/home/runner/work/app_api/app_api/apps/app_api/lib/Service/ProvidersAI/TaskProcessingService.php","line":132,"function":"getRegisteredTaskProcessingProviders","class":"OCA\\AppAPI\\Service\\ProvidersAI\\TaskProcessingService","type":"->","args":[]},{"file":"/home/runner/work/app_api/app_api/apps/app_api/lib/AppInfo/Application.php","line":98,"function":"registerExAppTaskProcessingProviders","class":"OCA\\AppAPI\\Service\\ProvidersAI\\TaskProcessingService","type":"->","args":[["OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous\u0000/home/runner/work/app_api/app_api/lib/private/AppFramework/Bootstrap/RegistrationContext.php:161$5e"],["OC\\Server"]]},{"file":"/home/runner/work/app_api/app_api/lib/private/AppFramework/Bootstrap/Coordinator.php","line":99,"function":"register","class":"OCA\\AppAPI\\AppInfo\\Application","type":"->","args":[["OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous\u0000/home/runner/work/app_api/app_api/lib/private/AppFramework/Bootstrap/RegistrationContext.php:161$5e"]]},{"file":"/home/runner/work/app_api/app_api/lib/private/AppFramework/Bootstrap/Coordinator.php","line":52,"function":"registerApps","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->","args":[["app_api"]]},{"file":"/home/runner/work/app_api/app_api/lib/private/Installer.php","line":95,"function":"runLazyRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->","args":["app_api"]},{"file":"/home/runner/work/app_api/app_api/core/Command/App/Enable.php","line":93,"function":"installApp","class":"OC\\Installer","type":"->","args":["app_api",true]},{"file":"/home/runner/work/app_api/app_api/core/Command/App/Enable.php","line":63,"function":"enableApp","class":"OC\\Core\\Command\\App\\Enable","type":"->","args":["app_api",[],true,["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/home/runner/work/app_api/app_api/3rdparty/symfony/console/Command/Command.php","line":298,"function":"execute","class":"OC\\Core\\Command\\App\\Enable","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/home/runner/work/app_api/app_api/3rdparty/symfony/console/Application.php","line":1040,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/home/runner/work/app_api/app_api/3rdparty/symfony/console/Application.php","line":301,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\App\\Enable"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/home/runner/work/app_api/app_api/3rdparty/symfony/console/Application.php","line":171,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/home/runner/work/app_api/app_api/lib/private/Console/Application.php","line":183,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/home/runner/work/app_api/app_api/console.php","line":87,"function":"run","class":"OC\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"]]},{"file":"/home/runner/work/app_api/app_api/occ","line":11,"args":["/home/runner/work/app_api/app_api/console.php"],"function":"require_once"}],"File":"/home/runner/work/app_api/app_api/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","Line":130}}},"message":"An exception occurred while executing a query: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation \"oc_ex_task_processing\" does not exist\nLINE 1: SELECT \"exs\".* FROM \"oc_ex_task_processing\" \"exs\" INNER JOIN...\n                            ^","exception":{},"CustomMessage":"An exception occurred while executing a query: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation \"oc_ex_task_processing\" does not exist\nLINE 1: SELECT \"exs\".* FROM \"oc_ex_task_processing\" \"exs\" INNER JOIN...\n                            ^"}}

which is preventing to see clear why the DeployTests are failing when they should not...

@andrey18106 andrey18106 force-pushed the public-pages-routes-support branch from 70d8892 to 70bc3f3 Compare July 26, 2024 19:13
Signed-off-by: Andrey Borysenko <[email protected]>
Signed-off-by: Andrey Borysenko <[email protected]>
Signed-off-by: Andrey Borysenko <[email protected]>
Signed-off-by: Andrey Borysenko <[email protected]>
Signed-off-by: Andrey Borysenko <[email protected]>
Signed-off-by: Andrey Borysenko <[email protected]>
Signed-off-by: Andrey Borysenko <[email protected]>
@andrey18106 andrey18106 force-pushed the public-pages-routes-support branch from 70bc3f3 to 3bcc649 Compare July 30, 2024 16:51
@andrey18106 andrey18106 marked this pull request as ready for review July 30, 2024 16:55
Signed-off-by: Andrey Borysenko <[email protected]>
Signed-off-by: Andrey Borysenko <[email protected]>
Signed-off-by: Andrey Borysenko <[email protected]>
@bigcat88
Copy link
Member

what happens when ExApp get update - in which place routes get updated?

@andrey18106
Copy link
Contributor Author

what happens when ExApp get update - in which place routes get updated?

Before update the ExApp is being disabled, which should unregister the routes, after install of new ExApp container and enable procedure - the new ExApp routes then should be registered. This won'twork if it's already disabled though..

@bigcat88
Copy link
Member

bigcat88 commented Jul 31, 2024

after install of new ExApp container and enable procedure

does this will work even if ExApp defines routes only in info.xml file and not register them with API?

@andrey18106
Copy link
Contributor Author

andrey18106 commented Jul 31, 2024

after install of new ExApp container and enable procedure

does this will work even if ExApp defines routes only in info.xml file and not register them with API?

It must be registered via API, there is no routes in info.xml.

@bigcat88
Copy link
Member

It should be registered via API, there is no routes in info.xml.

there is, you implemented it.

$appInfo['external-app']['routes'] allow it to be in info.xml

Copy link
Member

@bigcat88 bigcat88 left a comment

Choose a reason for hiding this comment

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

tested a little, looks very great

@andrey18106 andrey18106 merged commit 65003cd into main Aug 2, 2024
@andrey18106 andrey18106 deleted the public-pages-routes-support branch August 2, 2024 13:47
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.

2 participants