Commit Graph

306 Commits

Author SHA1 Message Date
Morris Jobke 157c652762
Merge pull request #21825 from nextcloud/fix/appframework/services
Fix AppFramework services
2020-07-14 17:07:38 +02:00
Morris Jobke fba64a972f
Merge pull request #21812 from nextcloud/feature/noid/app-bootstrap-without-app.php
Do not load app.php if Application implements IBootstrap
2020-07-14 17:06:06 +02:00
Roeland Jago Douma dca2469462
Merge pull request #21833 from nextcloud/docfix/noid/irequest_getHeader
Fix PHPDoc of IRequest::getHeader
2020-07-14 16:43:09 +02:00
Roeland Jago Douma fa9dfd83c9
Fix AppFramework services
* We can't just register an alias as the services need the appId to be
  injected. if we just register an alias this blows up since the main
  container doesn't have the appId.
* Moved the Authtokens over to show the PoC works

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-07-14 16:01:14 +02:00
Morris Jobke d9cc2f0213
Do not load app.php if Application implements IBootstrap
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-07-14 15:55:23 +02:00
Christoph Wurst f03f88b437
Delegate bootstrap registration lazily
* Keep the registration context
* Expose the context object for other components
* Ensure registration is only run once

Search providers are migrated for demonstration.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-07-14 15:33:32 +02:00
Georg Ehrke 3bdfb380fc
Fix PHPDoc of IRequest::getHeader
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
2020-07-14 14:20:43 +02:00
Roeland Jago Douma 3f447b9c8c
Fix supporting defaults for routes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-07-08 19:52:45 +02:00
Roeland Jago Douma edc1c77dd9
Do not create a RouteActionHandler object for each route
This is not required and doesn't allow us to be properly lazy. On top of
it this doesnt allow us to cache the routes (since closures/objects
can't be cached).

This is the first small step into cleaning up the routing we have

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-07-07 12:33:22 +02:00
Holger Hees e70249e089
Update SecurityMiddleware.php
OC::$WEBROOT can be empty in case if your nextcloud installation has no url prefix. This will result in an empty Location Header.

in other areas OC::$WEBROOT is always used together with an /
2020-07-06 21:34:46 +02:00
Christoph Wurst 4a3ea04baa
Callable parameter injection
This is like what we have to DI and classes, but for callables.

The motivating factor is to get rid of *service locators* in the `boot`
method of apps as a new pattern is about to emerge where we have lots of
`query` calls on the app or server container in order to fetch some
services.

With this little helper it's possible to call another (public) method
and magically have everything injected.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-07-03 14:37:46 +02:00
Joas Schilling 74a9cadc50
Fix IPv6 remote addresses from X_FORWARDED_FOR headers before validating
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-07-02 11:13:13 +02:00
Christoph Wurst 4488e846a5
Add unified search API
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-06-24 14:20:25 +02:00
Joas Schilling ad0731a63c
Make annotations case insensitive
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-06-23 20:18:23 +02:00
Roeland Jago Douma fbf9772a3e
Allow to specify the cookie type for appframework responses
In general it is good to set them to Lax. But also to give devs more
control over them is not a bad thing.

Helps with #21474

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-06-22 08:38:44 +02:00
Roeland Jago Douma 6ec8042d88
Merge pull request #21469 from nextcloud/bugfix/noid/event-service-listener-registration
Fix event service listener registration
2020-06-19 21:28:29 +02:00
Christoph Wurst 2b7b7144d4
Allow crash reporters registration during app bootstrap
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-06-19 10:38:26 +02:00
Joas Schilling 9cf32a3999
Fix event service listener registration
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-06-18 15:00:19 +02:00
Christoph Wurst 32bf95c774
Continue with next app when one errors during register
My patch at #21461 had a little error in that it exits the method when a
query exception is encountered during the register step of an app. What
we actually want is to continue with the next app and finish the overall
registration procedure.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-06-18 09:17:00 +02:00
Christoph Wurst 5ab5a5f89e
Catch all exceptions when an app is registering or booting
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-06-17 21:07:42 +02:00
Christoph Wurst 69571fb536
Add dedicated API for apps' bootstrapping process
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-06-17 09:22:21 +02:00
Morris Jobke 4e49e1da16
Allow TemplateResponse to be compressed
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-05-15 08:38:39 +02:00
Morris Jobke e0d2cd40e7
Fix return code of AppConfig::deleteUserValue
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-05-13 14:55:00 +02:00
Roeland Jago Douma 12fa748c49
Move the notmodified check to middleware where it belongs
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-05-13 08:11:24 +02:00
Roeland Jago Douma 203d7eb1d3
Add AppFramework GZip middleware to gzip responses
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-05-12 09:09:48 +02:00
Roeland Jago Douma 0659656c72
Merge pull request #20786 from nextcloud/enh/dicontainer_cleanup
DI Cleanup
2020-05-09 11:02:02 +02:00
Morris Jobke 08e78ff3b2
Fix OCPSinceChecker and php-cs
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-05-08 11:20:46 +02:00
Roeland Jago Douma 32c93ee08e
Move over the IConfig for globalscale
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-05-08 08:50:01 +02:00
Roeland Jago Douma 163463dea5
Add InitialState Appframework service
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-05-07 10:13:06 +02:00
Roeland Jago Douma 4e59c6f9b5
Remove double registrations
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-05-07 08:47:43 +02:00
Roeland Jago Douma 8a8623c569
Simple AppConfig wrapper for the AppFramework
9 out of 10 cases apps want to access their own appconfig. Hence it
would be nice not to have to enter the app id all the time. This simple
wrapper just passes on the appid in all calls.

Basically this allows for simpler code in the apps.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-05-02 15:34:28 +02:00
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +02:00
Roeland Jago Douma c870b6ab2e
Fix new routing in settings etc
Also prefix resources
Unify the prefix handling
Handle urls with and without slash

Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-04-22 13:09:25 +02:00
Joas Schilling 250467e842
Extend tests for root url
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-04-18 11:21:28 +02:00
Joas Schilling f93d55eebd
PHP CS fixes
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-04-18 11:21:28 +02:00
Joas Schilling 3f8168b6e5
Allow some apps to have root URLs in their own routing file
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-04-18 11:21:28 +02:00
Christoph Wurst 734c62bee0
Format code according to PSR2
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:56:50 +02:00
Christoph Wurst 28f8eb5dba
Add visibility to all constants
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:54:27 +02:00
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +02:00
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 10:35:09 +02:00
Christoph Wurst 3a415e4139
Remove space between switch case and colon
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 16:17:53 +02:00
Christoph Wurst 44577e4345
Remove trailing and in between spaces
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 16:07:47 +02:00
Christoph Wurst afbd9c4e6e
Unify function spacing to PSR2 recommendation
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 13:54:22 +02:00
Christoph Wurst 2fbad1ed72
Fix (array) indent style to always use one tab
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 10:16:08 +02:00
Christoph Wurst 85e369cddb
Fix multiline comments
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-08 22:24:54 +02:00
Christoph Wurst 1a9330cd69
Update the license headers for Nextcloud 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-31 14:52:54 +02:00
Christoph Wurst 463b388589
Merge pull request #20170 from nextcloud/techdebt/remove-unused-imports
Remove unused imports
2020-03-27 17:14:08 +01:00
Christoph Wurst b80ebc9674
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-26 16:34:56 +01:00
Christoph Wurst 74936c49ea
Remove unused imports
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-25 22:08:08 +01:00
Christoph Wurst 5fc4c91a76
Fix mismatching doc block parameter types
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-06 16:28:42 +01:00