Commit Graph

630 Commits

Author SHA1 Message Date
Alexandre Alapetite
9e8a17655a Minz provide action name in controller exception (#3624)
Contributes to https://github.com/FreshRSS/FreshRSS/issues/3584
2021-05-16 14:38:19 +02:00
Alexandre Alapetite
97ba6261a8 git update auto change to edge branch (#3589)
* git update auto change to edge branch
For existing installations using automatic git update, checkout *edge* branch if it was still using *master* or *dev*.

* One more prune

* Fix several small issues

* theirs does not work here

* Use migration mechanism

* Better handling of Migration errors

* Test details

* Fix tests

* Do not use new migration system for now
2021-05-15 21:33:43 +02:00
Alexandre Alapetite
607f7e7254 Fix several comments syntaxes (#3615)
Mainly wrong `@return` types in comments
2021-05-08 10:27:18 +02:00
Alexandre Alapetite
224b20edd1 Merge upstream SimplePie PR details (#3614)
https://github.com/simplepie/simplepie/pull/681
https://github.com/simplepie/simplepie/pull/680
https://github.com/simplepie/simplepie/pull/675
2021-05-08 00:56:54 +02:00
Alexandre Alapetite
1f24a5d50e Show start error (#3590)
* Show start error
#fix https://github.com/FreshRSS/FreshRSS/issues/3581
We were not showing the actual error for several types of exceptions, e.g. database connection error.
Possible regression since https://github.com/FreshRSS/FreshRSS/pull/3407

* Try to make the error message less confusing
2021-04-17 20:55:43 +02:00
Alexandre Alapetite
d0d5f1ce3f Merge SimplePie changes (#3588)
Related to https://github.com/simplepie/simplepie/pull/676
from https://github.com/FreshRSS/FreshRSS/pull/1087
2021-04-17 18:10:47 +02:00
Alexandre Alapetite
a57fa9975a Fix wrong SimplePie type hint (#3578)
`SimplePie_Cache` also exists but is something else.
2021-04-08 23:34:21 +02:00
Alexandre Alapetite
150015079f SimplePie fix old regression during manual merge (#3568)
Bug from https://github.com/FreshRSS/FreshRSS/pull/2136
Related upstream PR https://github.com/simplepie/simplepie/pull/676
2021-03-28 18:33:49 +02:00
berumuron
cc6c529562 tec: Remove data/do-install.txt (#3555)
* Remove file data/do-install.txt

This file was painful during update because we had to remember to delete
it each time. It added a security issue by allowing an attacker to
reinstall FreshRSS during the update process.

The (more powerful) file data/applied_migrations.txt has been introduced
in 8619cf6fa to replace do-install.txt. We had to wait for at least one
release in order to make sure existing instances of FreshRSS created the
migration file. It should be ok now.

* Replace i18n install.not_deleted key

* Update documentation to update FreshRSS
2021-03-26 19:41:33 +01:00
Alexandre Alapetite
eeff1a17b0 Suport standard HTTP 410 Gone (#3561)
When a feed returns an HTTP 410 Gone, mute the corresponding feed, i.e. stop refreshing it.
Example of such feed, Les Décodeurs (Libération) https://rss.liberation.fr/rss/100893/
2021-03-26 19:13:23 +01:00
Alexandre Alapetite
0ff6ba4542 SimplePie fix PHP8 uncatched error (#3547)
#fix https://github.com/FreshRSS/FreshRSS/pull/3546
When `loadHTML()` is given a null or empty string.

```
PHP Fatal error:  Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /var/www/freshrss/lib/SimplePie/SimplePie/Locator.php:83
```
2021-03-23 10:54:14 +01:00
Alexis Degrugillier
4f4ce3c71b Remove shortcut validation (#3548)
Before, only standard shortcuts were supported. When other shortcuts were
configured, they were filtered out.
Now, those shortcuts are stored in the configuration and an alert message
is displayed to alert the user that he is using non-standard shortcuts.

See #3481
2021-03-21 15:42:27 +01:00
Alexandre Alapetite
b7fdfbb894 SimplePie prevent cache pollution (#3502)
* SimplePie prevent cache polution
#fix https://github.com/FreshRSS/FreshRSS/pull/3367#issuecomment-766250249
#fix https://github.com/FreshRSS/FreshRSS/pull/3494#issuecomment-790113663

* Fix bug

* Minor improvement

* Update cache filename in FreshRSS (1/2)

* cacheFilename temp

* New SimplePie get_cache_filename()

* Fix typos

* Update lib/SimplePie/SimplePie.php

Typo

* Include user-agent and timeout

* fix array_merge

* Declaration

* force_feed was lost in a commit
2021-03-09 08:41:47 +01:00
Alexandre Alapetite
947e918f05 Travis: Enforce phpcs line length + whitespace (#3488)
* Update Travis line length

* Also check whitespace in CSS files

* Fix line length ext.php

* More syntax, string templates

* Fix exclude-pattern

* Test JS files as well
2021-02-28 12:26:24 +01:00
Alexis Degrugillier
0ce798d40b Add support for extension user files (#3433)
Extension user files can be stored easily in the user folder instead of the static folder.
2021-02-26 18:42:10 +01:00
Brooke
9ea3e7710a Upgrade PHPMailer to 6.3.0 (#3457)
* Upgrade PHPMailer to 6.2.0

* Bump PHPMailer to 6.3.0

Co-authored-by: berumuron <dev@marienfressinaud.fr>
2021-02-24 16:20:40 +01:00
Alexandre Alapetite
75711c3647 Manual update to SimplePie 1.5.6 (#3469)
* Manual update to SimplePie 1.5.6

Follow-up of https://github.com/FreshRSS/FreshRSS/pull/3206 (1.5.5)
Differences
692e8bc19b...155cfcfacd
Related to https://github.com/FreshRSS/FreshRSS/pull/3416 ,
https://github.com/FreshRSS/FreshRSS/pull/3404

* Typo
2021-02-20 23:38:36 +01:00
Kiblyn11
0e6ad01dbf Fix: handle very big feed (#3416)
* fix: handle big xml files which cause out of memory exceptions by working with chunks in cleanMd5 function (because of preg_replace) and parse (because of xml_parse)

* Review

* Fixes in error handling (case of the last call to xml_parse, case of
error during fopen, break in case of XML error...)
* Takes advantage of the chunking for computing the cache hash
* Larger chunks of 1MB

Co-authored-by: e <bokes74743@tjuln.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2021-02-17 21:50:25 +01:00
Alexis Degrugillier
787e8fa463 Add user maintenance hooks (#3440)
The new hook allows to add maintenance extensions at the user level.

See #3398
2021-02-17 16:34:54 +01:00
Alexis Degrugillier
5bd84038a2 Remove Minz validation (#3439)
It should have been done during #3302.
2021-02-11 18:18:42 +01:00
hesch
13b03b232b refactor: remove referer checks, as they are no longer needed (replaced by csrf tokens) (#3432) 2021-02-11 17:38:39 +01:00
Alexis Degrugillier
54f04e1233 Fix configuration local cache (#3431)
Before, setting values did not refresh the configuration cache. Thus
generating some weird behavior when configuring extensions.
Now, the cache is updated with the most recent values when the
configuration is modified.
2021-02-08 22:47:09 +01:00
Alexandre Alapetite
4a87f34bcf API implement OPML import/export (#3424)
#fix https://github.com/FreshRSS/FreshRSS/issues/3421
2021-02-06 12:43:30 +01:00
Alexandre Alapetite
8edce0e209 Fix heredoc syntax (#3426)
Fix regression from https://github.com/FreshRSS/FreshRSS/pull/3407

Identifier must not be indented

PHP 5.6.36 (cli) (built: Apr 28 2018 21:14:51)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend
Technologies
PHP Parse error:  syntax error, unexpected end of file in
lib/lib_rss.php on line 608
Errors parsing lib/lib_rss.php
2021-02-06 12:37:26 +01:00
Alexandre Alapetite
23c43b1fbf Fix return type for broken feeds (#3423)
Fix a rare error when an invalid feed is forced to be added again.
FreshRSS code (not upstream)
2021-02-06 00:58:51 +01:00
Alexandre Alapetite
d42b4c299c Add requirements check in CLI (#3410)
* Add requirements check in CLI

#fix https://github.com/FreshRSS/FreshRSS/issues/1853

* More checks

#fix https://github.com/FreshRSS/FreshRSS/issues/1853
2021-02-05 22:21:31 +01:00
Martin
934f032c19 Better error message on failure (#3407)
* bump default logout from 30 to 365 days

* * Change cookie duration to constant
* Change cookie duration to three months

* use class

* use 90 days (otherwise login form says 91.3 days)

* change class

* also this works now

* Better error message

* inconsistent dot with the other message

* Better error message

* add errorMessage()

* fix style

* html escape the error title

* also html escape error message

* remove spaces before parentheses

* rework the error message

* Minz-friendly

* Update message

Do not advise running this script as wrong user

* Update lib/lib_rss.php

Co-authored-by: Martin <spleefer90@gmail.com>

Co-authored-by: Martin Rys <martin@rys.pw>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2021-02-05 21:59:21 +01:00
Alexis Degrugillier
0577bc772b Add a method to retrieve a configuration value (#3422)
This will simplify extension code by removing a lot of logic from
the extension itself when it's not needed. I've tested it on one
of my extension with all the other recent extension modifications
and I could remove half of the code needed before.
2021-02-05 18:29:37 +01:00
Alexis Degrugillier
36f9d44d54 Fix user configuration in extension (#3412)
Before, only one extension could be configured at a time. Thus we
were loosing the configuration for other extensions when saving.
Now, each extension can be saved without overriding data.

See #3397
2021-02-02 12:40:03 +01:00
Alexis Degrugillier
8285f1df43 Add comprehensive user configuration in extensions (#3397)
Before, the extension configuration was handled by its author. There
was discrepancies between extensions on how the configuration was
stored.
Now, we could rely on a single way of storing configuration. This won't
invalidate how the extensions are storing their configuration but will
allow authors to focus on what is important.
2021-02-02 00:03:09 +01:00
Alexandre Alapetite
45ee7a36d5 PHP8: SimplePie wrong use of isset (#3404)
#fix https://github.com/FreshRSS/FreshRSS/issues/3401 (crash with PHP 8+)

`ceil()` crashes in PHP8+ in case of invalid input such as empty string.
`intval()` fixes the problem with almost identical behaviour than `ceil()` in PHP7- (except for floating point values)

#fix FreshRSS/FreshRSS#3401 (crash with PHP 8+)

Example with feed http://podcast.hr2.de/derTag/podcast.xml

```xml
<enclosure url="https://mp3podcasthr-a.akamaihd.net:443/mp3/podcast/derTag/derTag_20210129_87093232.mp3"
length="" type="audio/mpeg"/>
```

`isset("")` passes and then `ceil("")` crashes due to wrong type in PHP8+:

```
Uncaught TypeError: ceil(): Argument #1 ($num) must be of type
int|float, string given in ./SimplePie/SimplePie/Item.php:2871
```

Upstream patch https://github.com/simplepie/simplepie/pull/670
2021-01-31 13:04:36 +01:00
Alexandre Alapetite
2b007ee989 Explicit PDO::ERRMODE_SILENT (#3408)
`PDO::ERRMODE_SILENT` is the default value
https://php.net/pdo.error-handling
We just make it explicit
#fix https://github.com/FreshRSS/FreshRSS/issues/3402
But in the issue above, it looks like it is in `PDO::ERRMODE_EXCEPTION`
mode
2021-01-30 21:53:17 +01:00
Eris
180ca4d168 Curlopt fixes (#3381)
* sort results in find() method

* Update lib/lib_phpQuery.php

Co-Authored-By: Alexandre Alapetite <alexandre@alapetite.fr>

* Update lib/lib_phpQuery.php

Co-Authored-By: Alexandre Alapetite <alexandre@alapetite.fr>

* Fix fetching articles

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2021-01-17 18:32:24 +01:00
Eris
ee175dd616 CURLOPT parameters per feed (#3367)
* Working curlopt_params

* Examples

* curl_params for fetching the article

* cleanup

* clarification

* Remove debugging

* Options corrected

* Removed Debugging

* i18n not needed (right now)

* Translations and UI rework

* Checks in update.phtml

* Unset Proxy&Cookies

* remove clutter

* minor fuckup

* i18n added properly

* resolve Errors

* linting errors

* linting errors, again

* Review

* Minor revert

* Minor i18n: de

Co-authored-by: maru <maru@nyx.im>
Co-authored-by: Aeris <a3x@eris.cc>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2021-01-16 22:32:18 +01:00
Alexis Degrugillier
29fe125b4a Add constant for PHP requirements (#3369)
* Add constant for PHP requirements

This new constant is used for PHP version check.
This way, we won't forget to modify some part of the code base.

* Remove PHP version checks

Some checks were obsolete because they were checking unsupported
PHP versions.
2021-01-14 23:28:45 +01:00
Alexandre Alapetite
8dfe209799 Possiblity to autoinstall in Docker Compose (#3353)
* Possiblity to autoinstall in Docker Compose

#fix https://github.com/FreshRSS/FreshRSS/issues/3349

It is simply calling our existing CLI: do-install.php and
create-user.php
https://github.com/FreshRSS/FreshRSS/tree/master/cli

FreshRSS will typically be ready a few seconds before the database, so
introduce a tolerance when the database is not available / up (yet) by
trying a few times to connect. Also useful to avoid service interruption
when DB service is restarted.

Example:

```yml
freshrss-app:
    image: freshrss/freshrss
    container_name:
freshrss-app
    hostname: freshrss-app
    restart: unless-stopped

ports:
      - "8080:80"
    depends_on:
      - freshrss-db

volumes:
      - data:/var/www/FreshRSS/data
      -
extensions:/var/www/FreshRSS/extensions
    environment:
      CRON_MIN:
'*/20'
      FRESHRSS_ENV: development
      FRESHRSS_INSTALL: |-

--api_enabled
        --base_url https://rss.example.net

--db-base freshrss
        --db-host freshrss-db
        --db-password
freshrss
        --db-type pgsql
        --db-user freshrss

--default_user admin
        --language en
      FRESHRSS_USER: |-

--api_password freshrss
        --email user@example.net

--language en
        --password freshrss
        --user admin
      TZ:
Europe/Paris
```

* Minor type f in find

* shellcheck
2021-01-11 22:36:50 +01:00
Alexis Degrugillier
f5fdbb9e82 Add class autoload for extension (#3350)
When an extension defines an `autoload` method, it will be registered
automatically before enabling the extension.
For the extension creator, it's easier because there is no need to
register it manually.
2021-01-09 20:49:45 +01:00
Clemens Neubauer
ef458992c1 two new hooks (#3342)
* add two new hooks

I develop a new extension and i need 2 new hooks for it

* update EN documentation

* Correct typing errors

* Update app/views/helpers/javascript_vars.phtml

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2021-01-07 21:45:48 +01:00
Alexis Degrugillier
bfd872e885 Change base extension class type (#3333)
Before, there were some guidelines on how to use the extension class and how to extend it. Those guidelines were defined as comments.
Now, those guidelines are enforced by the code itself. There is no need for those comments anymore.
2021-01-07 21:37:59 +01:00
Alexis Degrugillier
9aa3c03844 Add a deprecation log error for extensions (#3335)
Extensions must override some parent methods. The rule is just a
guideline because only described in comments. The idea is to
deprecate that flexibility and add it to the code. To warn users
beforehand, we log error message regarding incomplete extensions.

See #3333
2021-01-04 23:59:36 +01:00
Alexis Degrugillier
31cb07ac1a Fix author search link (#3315)
Before, when clicking on the author link, the search was done on the
main stream in the normal view. It's fine until the feed is not visible
in the main stream.
Now, the current context is used along with the search.

See #3314
2021-01-03 00:59:57 +01:00
Alexandre Alapetite
9c6682e7ed Avoid manual initialisations of system or user configuration (#3070)
* Avoid manual intialisations of system or user configuration

More consistent use of Context

* Simplify FreshRSS_Context::initUser

* Remove a few manual get_user_configuration

* A bit of debugging

* Fix context user init

* Fix install

* Fix concurrency

Concurrent requests could lead to bad race condition

* Fix actualize cron

Fix case when system i initialised several times
2021-01-02 21:20:19 +01:00
Alexis Degrugillier
08d76967b0 Add temp folder check during install (#3312)
Before, the temp path was not check during install. With some configuration,
FRSS was not working because of a non-writable temp directory. It happened
with XAMPP on MacOS X but it might be the case for other platforms.
Now, the temp path is checked during install to make sure it is writable.

See #3310
2021-01-02 17:14:23 +01:00
Alexis Degrugillier
618cbaf0ce Remove Minz validation during install. (#3302)
As FRSS always comes with Minz, there is no need to validate that
it is there during install. If it turns out we need to validate that,
we might need to validate other libraries as well.
2020-12-29 00:12:17 +01:00
Alexis Degrugillier
3f4c86f80f Add a file for each PDO class (#3301)
Before, we had 5 classes in the ModelPdo file. It was bad for 2 reasons.
The first reason is that it is considered bad practice to have multiple
class in one file. This is especially true when using autoloading. On top
of that it is less readable considering the size of the file. The second
reason is that so far we were lucky. Everytime we needed to access the
database, it was through the ModelPdo class which loads all the other
classes. If we want to access directly the connection, it wont be loaded.
On top of that, the system is configured to work on a single database,
but as we have every connection definition in a single file, all classes
were loaded at the same time. Thus using memory and processing time for
nothing.
Now, we have a file for each class. To work with autoloading, classes
were slightly renamed to match autoloading rules.
2020-12-29 00:11:34 +01:00
Alexandre Alapetite
0a2d9b3b54 Revert "Add a file for each PDO class (#3297)"
This reverts commit e1ee58816b.
2020-12-28 19:53:55 +01:00
Alexandre Alapetite
c246e5d74b Revert "Extract autoloading process (#3283)"
This reverts commit 46cb89adf8.
2020-12-28 19:47:39 +01:00
Alexis Degrugillier
e1ee58816b Add a file for each PDO class (#3297)
Before, we had 5 classes in the ModelPdo file. It was bad for 2 reasons.
The first reason is that it is considered bad practice to have multiple
class in one file. This is especially true when using autoloading. On top
of that it is less readable considering the size of the file. The second
reason is that so far we were lucky. Everytime we needed to access the
database, it was through the ModelPdo class which loads all the other
classes. If we want to access directly the connection, it wont be loaded.
On top of that, the system is configured to work on a single database,
but as we have every connection definition in a single file, all classes
were loaded at the same time. Thus using memory and processing time for
nothing.
Now, we have a file for each class. To work with autoloading, classes
were slightly renamed to match autoloading rules.
2020-12-28 16:44:08 +01:00
Alexandre Alapetite
f7d69ad1de SimplePie Strip comments (#3288)
#fix https://github.com/FreshRSS/FreshRSS/issues/3282 (workaround an nginx configuration bug)

We do not need to keep HTML comments in RSS content.
2020-12-28 13:09:14 +01:00
Alexis Degrugillier
46cb89adf8 Extract autoloading process (#3283)
* Extract autoloading process

The process sits in its own file now to ease future improvements.

* Change the autoload process

Before, the autoload process was too restricted. It was really dependant on our
code tree. It was hard to add more classes to be loaded automatically. On top
of that, it did not support autoloading classes following the PSR-4 recommendation.

Now, the autoload process is more open. It supports partially the PSR-4 recommendation,
there is no specific code to load Minz classes or PHPMailer classes. This is the
starting point to reorganize the codebase to introduce long waiting changes as seen
in #789. It would be a nice to later rework the tree, rename classes, and add namespace
in a fashion that follows the PSR-4. Then specific FRSS workarounds in the autoload
could be dropped.
2020-12-26 12:47:39 +01:00