summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2016-04-19 18:15:31 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2016-04-19 18:15:31 +0200
commita0b0aeea3964c5fecc6863f9e80d3f7c8bea4e25 (patch)
tree08d2681de47c986175e11a7d24b41209a17cbf22
parente2637ac62e61dbc9bfeaa1e87fd46497c2fb10e0 (diff)
Fix #978
-rw-r--r--CHANGELOG.md3
-rw-r--r--README.md23
-rw-r--r--appinfo/application.php20
3 files changed, 20 insertions, 26 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8b8f94277..ffd21b1ee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+owncloud-news (8.7.1)
+* **Bugfix**: Send Chrome's user agent string instead of our own since mod_security, which is used on some servers, thinks that only browsers are allowed to send user agents. This will fix feed updates for some websites, e.g. joomla.org, (because we all know that Joomla is big on security ;) ), #978
+
owncloud-news (8.7.0)
* **Enhancement**: Better lock down Composer versions to prevent shipping newer PHP libraries then intended when compiling the project
* **Enhancement**: Mark current article as active while scrolling
diff --git a/README.md b/README.md
index bedae9e81..e4cbd9268 100644
--- a/README.md
+++ b/README.md
@@ -215,29 +215,6 @@ Some hints:
* type clob is usually an Sql TEXT
* length for integer fields means bytes, so an integer with length 8 means its 64bit
-
-### I'm getting a feed not found error when adding a feed, but it works in picoFeed/Miniflux
-Some websites block the News app because the mistake its user agent string for an attack (most notably https://www.joomla.org/announcements.feed\?type\=rss). You can test for this issue by changing the default user agent string in **appinfo/application.php**.
-
-Search the section that defines the user agent:
-
-```php
-$userAgent = 'ownCloud News/' . $appConfig->getConfig('version') .
- ' (+https://owncloud.org/; 1 subscriber;)';
-```
-
-and replace it with the following line:
-
-```php
-$userAgent = 'test';
-```
-
-If this fixes the issue, contact the feed's administrators and ask them to fix their server setup.
-
-**Hint**: Should you not be able to set up picoFeed or Miniflux, you can simply use the bundled picoFeed version to test the website, e.g.:
-
- php -f vendor/fguillot/picofeed/picofeed feed https://www.joomla.org/announcements.feed\?type\=rss
-
### I am getting: Exception: Some\\Class does not exist erros in my owncloud.log
This is very often caused by missing or old files, e.g. by failing to upload all of the News app' files or errors during installation. Before you report a bug, please recheck if all files from the archive are in place and accessible.
diff --git a/appinfo/application.php b/appinfo/application.php
index dfe036166..4c8a3769a 100644
--- a/appinfo/application.php
+++ b/appinfo/application.php
@@ -59,6 +59,7 @@ class Application extends App {
/**
* App config parser
*/
+ /** @noinspection PhpParamsInspection */
$this->registerService(AppConfig::class, function($c) {
$config = new AppConfig(
$c->query(INavigationManager::class),
@@ -73,14 +74,17 @@ class Application extends App {
/**
* Core
*/
+ /** @noinspection PhpParamsInspection */
$this->registerService('LoggerParameters', function($c) {
return ['app' => $c->query('AppName')];
});
+ /** @noinspection PhpParamsInspection */
$this->registerService('databaseType', function($c) {
return $c->query(IConfig::class)->getSystemValue('dbtype');
});
+ /** @noinspection PhpParamsInspection */
$this->registerService('ConfigView', function($c) {
$fs = $c->query(IRootFolder::class);
$path = 'news/config';
@@ -92,6 +96,7 @@ class Application extends App {
});
+ /** @noinspection PhpParamsInspection */
$this->registerService(Config::class, function($c) {
$config = new Config(
$c->query('ConfigView'),
@@ -102,6 +107,7 @@ class Application extends App {
return $config;
});
+ /** @noinspection PhpParamsInspection */
$this->registerService(HTMLPurifier::class, function($c) {
$directory = $c->query(IConfig::class)
->getSystemValue('datadirectory') . '/news/cache/purifier';
@@ -127,14 +133,19 @@ class Application extends App {
/**
* Fetchers
*/
+ /** @noinspection PhpParamsInspection */
$this->registerService(PicoFeedConfig::class, function($c) {
// FIXME: move this into a separate class for testing?
$config = $c->query(Config::class);
- $appConfig = $c->query(AppConfig::class);
$proxy = $c->query(ProxyConfigParser::class);
- $userAgent = 'ownCloud News/' . $appConfig->getConfig('version') .
- ' (+https://owncloud.org/; 1 subscriber;)';
+ // use chrome's user agent string since mod_security rules
+ // assume that only browsers can send user agent strings. This
+ // can lead to blocked feed updates like joomla.org
+ // For more information see
+ // https://www.atomicorp.com/wiki/index.php/WAF_309925
+ $userAgent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36' .
+ '(KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36';
$pico = new PicoFeedConfig();
$pico->setClientUserAgent($userAgent)
@@ -166,6 +177,7 @@ class Application extends App {
return $pico;
});
+ /** @noinspection PhpParamsInspection */
$this->registerService(Fetcher::class, function($c) {
$fetcher = new Fetcher();
@@ -186,6 +198,7 @@ class Application extends App {
* @param string $file path relative to this file, __DIR__ will be prepended
*/
private function registerFileContents($key, $file) {
+ /** @noinspection PhpParamsInspection */
$this->registerService($key, function () use ($file) {
return file_get_contents(__DIR__ . '/' . $file);
});
@@ -217,6 +230,7 @@ class Application extends App {
* @param string $factory fully qualified factory class name
*/
private function registerFactory($key, $factory) {
+ /** @noinspection PhpParamsInspection */
$this->registerService($key, function ($c) use ($factory) {
return $c->query($factory)->build();
});