Commit graph

82 commits

Author SHA1 Message Date
Maxence Lange
6af64a5495 feat(ocm): event on ocm discovery and ocm request
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2026-01-07 17:54:26 -01:00
Daniel Calviño Sánchez
51ed61bb4a fix: Fix caching routes by users with an active session
When a user has an active session only the apps that are enabled for the
user are initially loaded. In order to cache the routes the routes for
all apps are loaded, but routes defined in routes.php are taken into
account only if the app was already loaded. Therefore, when the routes
were cached in a request by a user with an active session only the
routes for apps enabled for that user were cached, and those routes were
used by any other user, independently of which apps they had access to.
To solve that now all the enabled apps are explicitly loaded before
caching the routes.

Note that this did not affect routes defined using annotations on the
controller files; in that case the loaded routes do not depend on the
previously loaded apps, as it explicitly checks all the enabled apps.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-12-12 16:10:20 +01:00
Daniel Calviño Sánchez
0ba2f5e537 Revert "fix(CachingRouter): Disable cache for findMatchingRoute"
This reverts commit 90948f5096.

It temporary disabled cache for routes until an actual fix was added,
which is done in the following commits.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-12-12 16:06:47 +01:00
provokateurin
90948f5096
fix(CachingRouter): Disable cache for findMatchingRoute
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-12-09 09:16:01 +01:00
zak39
a98ba27a0f fix(route): Change "core.ProfilePage.index" to lowercase
Signed-off-by: zak39 <fotia.baptiste@hotmail.com>
2025-08-20 11:52:36 +02:00
Joas Schilling
a957e3a2c2
feat(occ): Add commands to list all routes and match a single one
Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-06-25 08:19:08 +02:00
Côme Chilliet
b188fad8e8
fix(router): In debug mode, cache routes only for 3 seconds
This allows testing a newly added or changed route in your application
 without having to wait 1 hour or bump the application version.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-12 16:12:22 +02:00
Côme Chilliet
bb485fb733
fix: Load all partially enabled apps routes
This avoids cache issues if some apps are only enabled for some groups,
 by loading the routes from all apps enabled for anyone, not only the
 current user.
If the queried application is disabled for the current user based on
 groups, the middleware will cancel the query.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-05 18:06:08 +02:00
Côme Chilliet
0d78c60759
fix: Fix psalm issue by adding missing parameter for profiler
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-05 17:58:54 +02:00
Côme Chilliet
446b22ac3c
feat(router): Add fallback for legacy action and file routes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-05 17:58:54 +02:00
Côme Chilliet
216da3a81c
fix: Deprecate action and actionInclude from routes and fix actionInclude
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-05 17:58:53 +02:00
Côme Chilliet
5c9092bc5b
fix: Use a more fitting cache key
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-05 17:58:53 +02:00
Côme Chilliet
01575b7d95
feat(router): Use Symfony CompiledUrlMatcherDumper to cache routes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-05 17:58:53 +02:00
Côme Chilliet
ee3abdd81b
feat(router): Cache routes in local cache if possible
This is not ideal because serializing the routecollection is not easy.
It seems Symfony has its own way of doing things by dumping routes to a
 PHP file, maybe that would be better, but it would mean pulling a new
 symfony dependency and maybe refactor our Router.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-05 17:58:46 +02:00
provokateurin
db70ff6488
refactor(App): Remove registerRoutes method
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-05-15 13:46:14 +02:00
Côme Chilliet
20c6d1a7e9
feat: Improve init a bit, and add more profiling steps
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-05-13 16:08:49 +02:00
Côme Chilliet
34139987d6 fix: Replace OC_App calls by IAppManager
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-02-24 17:48:34 +01:00
skjnldsv
2e50a39265 fix(files): properly forward open params from short urls
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
2025-02-18 10:53:23 +01:00
skjnldsv
54be2ef0f3 fix(profile): add legacy root for old core.ProfilePage.index
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
2024-11-14 10:25:33 +01:00
provokateurin
9836e9b164
chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-19 14:21:20 +02:00
Côme Chilliet
7ed583cb8e
chore: Migrate cleanAppId and getAppPath calls to IAppManager from OC_App
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-09-13 10:08:43 +02:00
provokateurin
12b44844e1
fix(Router): Load attribute routes of all apps when not app is specified
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-08-27 10:42:47 +02:00
Daniel Kesselberg
af6de04e9e
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +02:00
Andy Scherzinger
dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-24 13:11:22 +02:00
provokateurin
4c5e05f37e
fix(Router): Stop loading routes of disabled apps
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-05-10 07:22:25 +02:00
Côme Chilliet
733a818139
fix: Migrate a few more classes away from OC_App::getAppPath
Also fixed AppTest

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-22 12:19:01 +02:00
Côme Chilliet
ec5133b739 fix: Apply new coding standard to all files
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-02 14:16:21 +02:00
provokateurin
df6175ccb1
feat(AppFramework): Add Route attribute
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-02-21 12:07:50 +01:00
provokateurin
66e7056c5e
fix(Routing): Only use lowercase names for registering and matching routes
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-02-21 12:07:50 +01:00
Joas Schilling
aa5f037af7
chore: apply changes from Nextcloud coding standards 1.1.1
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2023-11-23 10:36:13 +01:00
Hamid Dehnavi
d0b20534b9 Refactor "substr" calls to improve code readability
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
2023-07-07 04:54:20 +03:30
Faraz Samapoor
e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
2023-05-15 15:17:19 +03:30
Robin Appelman
b911da3e1e
DI for Router
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-02-13 22:51:14 +01:00
Robin Appelman
b68be79464 more routing performance instrumentation
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-02-10 11:12:26 +01:00
luz paz
368f83095d Fix typos in lib/private subdirectory
Found via `codespell -q 3 -S l10n -L jus ./lib/private`

Signed-off-by: luz paz <luzpaz@github.com>
2022-07-27 08:52:17 -04:00
Côme Chilliet
6be7aa112f
Migrate from ILogger to LoggerInterface in lib/private
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-24 16:21:25 +01:00
Karel Hink
18cc6c11b5 Fix Lots of Error: file_exists(): open_basedir restriction in effect. in Log
Signed-off-by: Karel Hink <info@karelhink.cz>
2021-07-30 19:28:52 +00:00
Vincent Petry
8535340d9a
Revert "First attempt to check against core routes before loading all app routes"
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-06-29 17:54:30 +02:00
John Molakvoæ (skjnldsv)
215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +02:00
Julius Härtl
4b1576e978
First attempt to check against core routes before loading all app routes
Most of the time we will find a matching route in either the loaded ones
matched on the URL or in the core ones. Therfore we can attempt to try
those first and only load all app routes if no match was found by the
Symfony URLMatcher.

Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-06-02 17:57:04 +02:00
Roeland Jago Douma
618805b14f Fix RedundantPropertyInitializationCheck
For #25839

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2021-03-09 09:49:45 +01:00
dependabot-preview[bot]
eb502c02ff
Bump nextcloud/coding-standard from 0.3.0 to 0.5.0
Bumps [nextcloud/coding-standard](https://github.com/nextcloud/coding-standard) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/nextcloud/coding-standard/releases)
- [Changelog](https://github.com/nextcloud/coding-standard/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nextcloud/coding-standard/compare/v0.3.0...v0.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-02-18 13:31:24 +01:00
Roeland Jago Douma
484f52bb4d
Also unset the other possible unused paramters
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-12-16 20:31:30 +01:00
Christoph Wurst
d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +01:00
Roeland Jago Douma
72a9c35be3
Remove some IRouter methods
This is not the end. IRouter needs to burn.
But it is a start.

🎵 we didn't start the fire 🎵

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-11-17 14:08:20 +01:00
Roeland Jago Douma
e25a7137cc
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>
2020-11-03 09:39:49 +01:00
Christoph Wurst
d9015a8c94
Format code to a single space around binary operators
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-10-05 20:25:24 +02:00
Morris Jobke
387cac4c5f
Properly inject IRouter into URLGenerator to properly encapsulate tests
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-08-19 22:00:47 +02:00
Morris Jobke
053ee7b386
Only load routes of the app which is requested
* Add fallback to load all routes if needed
* Move partial loaded routes test to proper place

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-08-19 21:58:20 +02:00
Joas Schilling
ea8f68bea6 Hand in the route and the parameters of the request
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
2020-08-05 12:52:16 +00:00