Commit Graph

142 Commits

Author SHA1 Message Date
Alexandre Alapetite
b1d24fbdb7 PHPStan 2.0 (#7131)
* PHPStan 2.0
fix https://github.com/FreshRSS/FreshRSS/issues/6989
https://github.com/phpstan/phpstan/releases/tag/2.0.0
https://github.com/phpstan/phpstan/blob/2.0.x/UPGRADING.md

* More

* More

* Done

* fix i18n CLI

* Restore a PHPStan Next test
For work towards PHPStan Level 10

* 4 more on Level 10

* fix getTagsForEntry

* API at Level 10

* More Level 10

* Finish Minz at Level 10

* Finish CLI at Level 10

* Finish Controllers at Level 10

* More Level 10

* More

* Pass bleedingEdge

* Clean PHPStan options and add TODOs

* Level 10 for main config

* More

* Consitency array vs. list

* Sanitize themes get_infos

* Simplify TagDAO->getTagsForEntries()

* Finish reportAnyTypeWideningInVarTag

* Prepare checkBenevolentUnionTypes and checkImplicitMixed

* Fixes

* Refix

* Another fix

* Casing of __METHOD__ constant
2024-12-27 12:12:49 +01:00
Alexandre Alapetite
6b14a743cc New state: favorite or unread (#7088)
* New state: favorite or unread
https://github.com/FreshRSS/FreshRSS/discussions/7078#discussioncomment-11526292

* Experiment using this state by default

* Rework state

* Allow ANDS for typos

* Revert change unrelated to this PR

* Revert change of default state

* Add option *unread_or_favorite*

* Fix hide_read_feeds

* i18n: it

Co-authored-by: UserRoot-Luca <55756898+UserRoot-Luca@users.noreply.github.com>

* Update app/i18n/pl/conf.php

Co-authored-by: Zic <55097497+ZicPL@users.noreply.github.com>

* Update app/i18n/pl/conf.php

Co-authored-by: Zic <55097497+ZicPL@users.noreply.github.com>

* Fix i18n

* Fix auto_remove_article

* Fix mark_unread_enabled

---------

Co-authored-by: UserRoot-Luca <55756898+UserRoot-Luca@users.noreply.github.com>
Co-authored-by: Zic <55097497+ZicPL@users.noreply.github.com>
2024-12-15 12:34:18 +01:00
Alexandre Alapetite
272af0f3c4 Improved CSS filter (#7091)
* Improved CSS filter
Remove unwanted elements both before and after sanitizing
fix https://github.com/FreshRSS/FreshRSS/issues/7084
Improved
fix bug in 33fd07f6f2 (commitcomment-150152171)

* fix typing
2024-12-11 23:23:50 +01:00
Alexandre Alapetite
ab9a4e292c OPML export/import for cssFullContentConditions (#7082)
Follow-up of 33fd07f6f2, which should have been a PR.
2024-12-10 14:57:25 +01:00
Alexandre Alapetite
052261bb8e Fix string condition
Follow-up of 33fd07f6f2 , which should have been a PR
2024-12-10 13:59:56 +01:00
Alexandre Alapetite
33fd07f6f2 Conditional retrieval
fix https://github.com/FreshRSS/FreshRSS/issues/6149
2024-12-10 13:50:44 +01:00
Alexandre Alapetite
88eef9832b Fix regression CSS filter encoding (#7081)
fix Unicode of https://github.com/FreshRSS/FreshRSS/pull/7073
Plus optimisation of XPath by keeping it into a variable.
2024-12-10 13:48:30 +01:00
Alexandre Alapetite
5ba5271e48 Sanitize before CSS manipulation (#7073)
Allows using the same CSS filters for content coming from RSS feeds and from Web scraping
fix https://github.com/FreshRSS/FreshRSS/issues/7039
https://github.com/FreshRSS/FreshRSS/issues/7014#issuecomment-2508987606
https://github.com/FreshRSS/FreshRSS/pull/7037
2024-12-08 16:29:29 +01:00
Alexandre Alapetite
594ef04df2 Fallback to GUID if article link is empty (#7051)
* Fallback to GUID is entry link is empty
fix https://github.com/FreshRSS/FreshRSS/issues/7050

* FILTER_NULL_ON_FAILURE
2024-12-03 14:06:14 +01:00
Alexandre Alapetite
d89563ab40 Fix CSS selector for removing elements (#7037)
fix https://github.com/FreshRSS/FreshRSS/issues/7014
Case of negative filter matching the positive filter
2024-11-30 21:17:45 +01:00
Luc SANCHEZ
15745d42b7 Upgrade code to php 8.1 (#6748)
* revert
Fix code indentation
Fix code

Upgrade code to php 8.1

* fix remarques

* code review

* code review

* code review

* Apply suggestions from code review

* code review

* Fixes

* Many remainging updates of array syntax

* Lost case 'reading-list'

* Uneeded PHPDoc

---------

Co-authored-by: Luc Sanchez <l.sanchez-prestataire@alptis.fr>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-11-28 17:11:04 +01:00
Alexandre Alapetite
256dcc21bb New unicity policies for feeds with bad GUIDs (#4487)
New set of unicity criteria options.

New tolerance heuristic:

> `$invalidGuidsTolerance` (default 0.05) The maximum ratio (rounded) of invalid GUIDs to tolerate before degrading the unicity criteria.
> Example for 0.05 (5% rounded): tolerate 0 invalid GUIDs for up to 9 articles, 1 for 10, 2 for 30, 3 for 50, 4 for 70, 5 for 90, 6 for 110, etc.
> The default value of 5% rounded was chosen to allow 1 invalid GUID for feeds of 10 articles, which is a frequently observed amount of articles.
2024-10-14 09:34:16 +02:00
Artur Weigandt
882deab455 Allow SimplePie updates with composer (#4374)
* rename lib/SimplePie to lib/CustomSimplePie

* add test for autoloading SimplePie with PSR-0

* install SimplePie 1.6.0

* Add SimplePie CHANGELOG.md, ignore irrelevant files

* remove unmodified custom classes

* rename all customized SimplePie classes

* Add autoloading for SimplePie PSR-0 and CustomSimplePie classes

* let CustomSimplePie extends SimplePie, remove unchanged code

* let CustomSimplePieMisc extends SimplePie\Misc, remove unchanged code

* Add tests for autoloading

* let CustomSimplePieContentTypeSniffer extends Sniffer, remove unchanged code

* remove unchanged CustomSimplePieEnclosure class

The fixed typos are commited to SimplePie
See 133eac158c

* let CustomSimplePieFile extends SimplePie\File, remove unchanged code

* let CustomSimplePieParser extends SimplePie\Parser, remove unchanged code

* let CustomSimplePieSanitize extends SimplePie\Sanitize, remove unchanged code

* let CustomSimplePieHttpParser extends SimplePie\HTTP\Parser, remove unchanged code

* Remove CustomSimplePie

* Switch SimplePie repo to https://github.com/FreshRSS/simplepie.git

* move to latest branch, update all SimplePie source files

* Use namespaced SimplePie classes, remove SimplePie library folder

* Update to latest SimplePie version with FreshRSS modifications

* Bump SimplePie
Tests expected to fail due to missing a backport of functionalities

* Add fork-specific readme

* Re-implement initial syslog SimplePie GET
https://github.com/FreshRSS/FreshRSS/pull/815
Lacks https://github.com/FreshRSS/FreshRSS/pull/6061

* Closer backport of syslog SimplePie GET
https://github.com/FreshRSS/FreshRSS/pull/6061
But the requests logs will be in the wrong order in case of redirections

* Fixes

* lib update

* SimplePie include a few more files

* Try with cache-hash branch

* Point to newer commit

* Point to newer commit

* Finalise logs

* Finalise

* Bump SimplePie commit

* Bump SimplePie commit

* Readme SimplePie fork

* Bump SimplePie commit

* Better logging

* Bump SimplePie commit

* Reworked approach to work with SimplePie cache
Simpler FreshRSS patches

* Bump SimplePie commit
https://github.com/FreshRSS/simplepie/pull/22

* Simplepie846
https://github.com/FreshRSS/simplepie/pull/23
And additional fixes

* Remove log

* Cherry pick relevant unmerged SimplePie PRs

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-09-14 23:11:10 +02:00
Alexandre Alapetite
bea4ed69fc Improve CSS filter to exclude content (#6807)
* Improve CSS filter to exclude content
Improve https://github.com/FreshRSS/FreshRSS/pull/6786
Fix bug when changing the CSS filter and reloading article, because original content was lost.
Fix similar bug with pathEntries.

* Forgotten i18n

* Type check
2024-09-14 00:55:41 +02:00
Alexandre Alapetite
dfac9f5813 PHPStan booleansInConditions (#6793)
* PHPStan booleansInConditions

* Uniformisation
2024-09-11 17:14:53 +02:00
Alexandre Alapetite
feffa5598c Apply CSS selector filter also when not using full content (#6786)
Before, removing content from articles was only possible when fetching full article contents.
With this PR, the same cleaning can be applied to the normal content provided by RSS feeds.
2024-09-09 10:38:45 +02:00
Alexandre Alapetite
af0498fe67 Fix auto-read tags (#6790)
fix https://github.com/FreshRSS/FreshRSS/issues/6788
2024-09-09 10:36:52 +02:00
Alexandre Alapetite
1a552bd60e Regex search (#6706)
* Regex search
fix https://github.com/FreshRSS/FreshRSS/issues/3549

* Fix PHPStan

* Fix escape

* Fix ungreedy

* Initial support for regex search in PostgreSQL and MySQL

* Improvements, support MySQL

* Fix multiline

* Add support for SQLite

* A few tests

* Added author: and inurl: support, documentation

* author example

* Remove \b for now

* Disable regex sanitization for now

* Fix getInurlRegex

* getNotInurlRegex

* Quotes for inurl:

* Fix test

* Fix quoted tags + regex for tags
https://github.com/FreshRSS/FreshRSS/issues/6761

* Fix wrong regex detection

* Add MariaDB

* Fix logic

* Increase requirements for MySQL and MariaDB
Check support for multiline mode in MySQL

* Remove sanitizeRegexes()

* Allow searching HTML code
Allow searching for instance `/<pre>/`
Fix https://github.com/FreshRSS/FreshRSS/issues/6775#issuecomment-2331769883

* Doc regex search HTML

* Fix Doctype
2024-09-06 09:35:58 +02:00
Alexandre Alapetite
a81656c3ed Upgrade to PHP 8.1 (#6711)
* Upgrade to PHP 8.1
As discussed in https://github.com/FreshRSS/FreshRSS/discussions/5474

https://www.php.net/releases/8.0/en.php
https://www.php.net/releases/8.1/en.php

Upgrade to available native type declarations
https://php.net/language.types.declarations

Upgrade to https://phpunit.de/announcements/phpunit-10.html which requires PHP 8.1+ (good timing, as version 9 was not maintained anymore)

Upgrade `:oldest` Docker dev image to oldest Alpine version supporting PHP 8.1: Alpine 3.16, which includes PHP 8.1.22.

* Include 6736
https://github.com/FreshRSS/FreshRSS/pull/6736
2024-09-06 09:06:46 +02:00
Alexandre Alapetite
91d0e5099b Fix XPath for HTML documents with broken root (#6774)
fix https://github.com/FreshRSS/FreshRSS/issues/6773

The default `.//` prefix for the XPath does not to work for documents, which have content after the end of their main node
2024-09-04 21:02:46 +02:00
Alexandre Alapetite
d2247221bb Minor update whitespace PHPCS rules (#6666)
* Minor update whitespace PHPCS rules
To simplify our configuration, apply more rules, and be clearer about what is added or removed compared with PSR12.
Does not change our current conventions, but just a bit more consistent.

* Forgotten *.phtml

* Sort exclusion patterns + add a few for Extensions repo

* Relaxed some rules
2024-08-01 20:31:40 +02:00
Alexandre Alapetite
58de38bd73 Fix parentheses for complex OR boolean search expressions (#6672)
* Fix OR parentheses

* Pass all tests

* Forgotten comment

* Minor whitespace

* Fix several cases envolving negation

* Line length

* Fix `OR NOT`
2024-08-01 19:44:58 +02:00
Alexandre Alapetite
3dca6ab1ee Extend regex for enclosure images (#6653)
fix https://github.com/FreshRSS/FreshRSS/discussions/6652
2024-07-24 19:34:18 +02:00
Alexandre Alapetite
5b28a35003 Pass PHPStan level 9 (#6544)
* More PHPStan

* More, passing

* 4 more files

* Update to PHPStan 1.11.4
Needed for fixed bug: Consider numeric-string types after string concat
https://github.com/phpstan/phpstan/releases/tag/1.11.4

* Pass PHPStan level 9
Start tracking booleansInConditions

* Fix mark as read

* Fix doctype

* ctype_digit
2024-06-09 20:32:12 +02:00
Luc SANCHEZ
f99c8d5f54 Modernize code to php7.4 (#6043)
* Modernize code to php7.4

* Modernize code to php7.4

* Modernize code to php7.4

* Modernize code to php7.4

* Modernize code to php7.4

* Modernize code to php7.4

* Modernize code to php7.4

* Modernize code to php7.4

* Modernize code to php7.4

* Modernize code to php7.4

* Modernize code to php7.4

* Modernize code to php7.4

* Modernize code to php7.4

* Consistency

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-06-05 22:04:06 +02:00
maTh
fec9e53d0e Empty title guid or first words (#6240)
* settings

* add comments for better understanding

* Update reading.phtml

* overhaul the code

* i18n

* typo

* add a constant to configure the amount of chars

* fix

* simplify

* Update Entry.php

* clean

* Update Entry.php

* Update app/Models/Entry.php

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* Update constants.php

* Update app/Models/Entry.php

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-06-05 21:04:33 +02:00
Alexandre Alapetite
7d110c23a9 Fix attributeBoolean (#6543)
Regression from https://github.com/FreshRSS/FreshRSS/pull/5946
fix https://github.com/FreshRSS/FreshRSS/issues/6521
2024-06-05 14:26:12 +02:00
Alexandre Alapetite
3cd90a2b1f Fix HTTP GET curl options (#6492)
fix https://github.com/FreshRSS/FreshRSS/issues/6491
Regression from https://github.com/FreshRSS/FreshRSS/pull/6177
2024-05-25 18:27:12 +02:00
Alexandre Alapetite
fd7157e40c CSS selector trim (#6428)
fix https://github.com/FreshRSS/FreshRSS/pull/6426#issuecomment-2091159868
2024-05-02 20:36:08 +02:00
Alexandre Alapetite
44625eed25 Fix CSS selector encoding (#6426)
fix https://github.com/FreshRSS/FreshRSS/issues/6229
fix https://github.com/FreshRSS/FreshRSS/issues/6266#issuecomment-2090432818
2024-05-02 19:49:18 +02:00
Alexandre Alapetite
5ca0b893b9 Fix updated entry filters (#6334)
fix https://github.com/FreshRSS/FreshRSS/issues/6331
2024-04-26 13:29:37 +02:00
Alexandre Alapetite
283341e75e Allow multiple authors on enclosures (#6272)
fix https://github.com/FreshRSS/FreshRSS/issues/5066
2024-04-08 11:10:10 +02:00
Alexandre Alapetite
d0072b9fb7 Refactor some cURL options and use CURLOPT_USERPWD (#6177)
* Refactor some cURL options and use CURLOPT_USERPWD
fix https://github.com/FreshRSS/FreshRSS/issues/6176

* Fixes
2024-03-10 23:04:17 +01:00
Alexandre Alapetite
39cc1c11ec New feature: shareable user query (#6052)
* New feature: shareable user query
Share the output of a user query by RSS / HTML / OPML with other people through unique URLs.
Replaces the global admin token, which was the only option (but unsafe) to share RSS outputs with other people.
Also add a new HTML output for people without an RSS reader.

fix https://github.com/FreshRSS/FreshRSS/issues/3066#issuecomment-648977890
fix https://github.com/FreshRSS/FreshRSS/issues/3178#issuecomment-769435504

* Remove unused method

* Fix token saving

* Implement HTML view

* Update i18n for master token

* Revert i18n get_favorite

* Fix missing i18n for user queries from before this PR

* Remove irrelevant tests

* Add link to RSS version

* Fix getGet

* Fix getState

* Fix getSearch

* Alternative getSearch

* Default getOrder

* Explicit default state

* Fix test

* Add OPML sharing

* Remove many redundant SQL queries from original implementation of user queries

* Fix article tags

* Use default user settings

* Prepare public search

* Fixes

* Allow user search on article tags

* Implement user search

* Revert filter bug

* Revert wrong SQL left outer join change

* Implement checkboxes

* Safe check of OPML

* Fix label

* Remove RSS button to favour new sharing method
That sharing button was using a global admin token

* First version of HTTP 304

* Disallow some recusrivity
fix https://github.com/FreshRSS/FreshRSS/issues/6086

* Draft of nav

* Minor httpConditional

* Add support for offset for pagination

* Fix offset pagination

* Fix explicit order ASC

* Add documentation

* Help links i18n

* Note about deprecated master token

* Typo

* Doc about format
2024-02-26 09:01:03 +01:00
Alexandre Alapetite
25166c218b RSS thumbnails (#5972)
* Added addtional media:content for thumbnails

* Fix whitespace

* More attributes for enclosures

* Fix variable

* Fix variable

* No duplicates

---------

Co-authored-by: root <root@ha-server.lan>
2024-02-26 09:00:35 +01:00
Alexandre Alapetite
314077a457 PHPStan prepare exceptions (#6037)
Take advantage of
https://phpstan.org/blog/bring-your-exceptions-under-control

Minimum changes to pass `tooWideThrowType` and `implicitThrows`.

Revert some mistakes from:
https://github.com/FreshRSS/FreshRSS/pull/5504
Preparation needed before new PRs of the same type:
https://github.com/FreshRSS/FreshRSS/pull/5962

Fix several wrong PHPDocs and catches:

> Method ... has ...Exception in PHPDoc @throws tag but it's not thrown.

> Dead catch - ...Exception is never thrown in the try block.
2024-01-15 10:36:30 +01:00
Alexandre Alapetite
70e71b8364 Auto-label (#5954)
Add labels automatically to incoming articles
fix https://github.com/FreshRSS/FreshRSS/issues/2380
fix https://github.com/FreshRSS/FreshRSS/issues/2420
fix https://github.com/FreshRSS/FreshRSS/issues/3279
fix https://github.com/FreshRSS/FreshRSS/discussions/4947
fix https://github.com/FreshRSS/FreshRSS/issues/5728
fix https://github.com/FreshRSS/FreshRSS/issues/5599
2024-01-03 11:23:06 +01:00
Alexandre Alapetite
a80a5f48a1 Pass PHPStan level 8 (#5946)
* Pass PHPStan level 8
And prepare for PHPStan level 9 https://phpstan.org/user-guide/rule-levels

* Revert wrong replace in comment

* Fix PHPStan level 8

* Update PHPStan and other dev dependencies

* Remove obsolete comment

* noVariableVariables and towards bleedingEdge
https://github.com/phpstan/phpstan-strict-rules
https://phpstan.org/blog/what-is-bleeding-edge

* More bleedingEdge

* A bit more PHPStan level 9

* More PHPStan level 9

* Prepare for booleansInConditions
Ignore int and null

* Revert wrong line

* More fixes

* Fix keep_max_n_unread

* Stricter attribute functions

* Stricter callHooks and more PHPStan level 9

* More typing

* A tiny more
2023-12-18 17:59:16 +01:00
Alexandre Alapetite
6bb45a8726 Add filter actions (auto mark read) at category and global levels (#5942)
* Add filter actions (auto mark read) at category level
fix https://github.com/FreshRSS/FreshRSS/issues/3497

* Add filter actions (auto mark read) at global level
fix https://github.com/FreshRSS/FreshRSS/issues/2788

* Fix feed category ID

* Minor comment
2023-12-15 23:04:29 +01:00
Alexandre Alapetite
b65ea97901 Fix PHP 7 compatibility strict_types (#5893)
* Fix PHP 7 compatibility
https://github.com/FreshRSS/FreshRSS/discussions/5892

* Multiple PHP 7 fixes

* PHPStan
2023-11-18 23:21:20 +01:00
Luc SANCHEZ
30c7a61a9b Use strict_types (#5830)
* Little's optimisations and booleans in conditions

* Apply strict type

* Apply strict type

* Apply strict type

* Fix multiple bugs with PHP 8.2 and 8.3

* Many declares missing, more errors fixed

* Apply strict type

* Another approach

* Stronger typing for Minz_Session

* Fix case of SQLite

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-11-16 22:43:00 +01:00
FireFingers21
b1d568697a Fix newlines not always displaying properly in description (#5859)
* Fix newlines not displaying properly

* Add name to credits

* Restore enclosure-description class

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* Update app/Models/Entry.php

XHTML

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-11-13 20:20:14 +01:00
Alexandre Alapetite
8b2f7848eb Add support for enclosures thumbnail (#5806)
* Add support for enclosures thumbnail
fix https://github.com/FreshRSS/FreshRSS/issues/5170

* Changelog
2023-11-01 23:20:22 +01:00
Alexandre Alapetite
06d0099504 Require PHP 7.4+ (#5720)
* Require PHP 7.4+
https://github.com/FreshRSS/FreshRSS/discussions/5474

* Update Docker oldest
Alpine 3.13 with PHP 7.4.26

* Add missing packets to Docker oldest

* Update to typed properties
https://php.net/migration74.new-features#migration74.new-features.core.typed-properties

* More types
2023-10-30 20:47:27 +01:00
Alexandre Alapetite
619d3f54a3 Fix searching thumbnails (#5750)
fix https://github.com/FreshRSS/FreshRSS/issues/5749
2023-10-26 16:33:50 +02:00
Alexandre Alapetite
1c7c1016f4 Fix JSON export/import (#5626)
* Fix import with empty content
fix https://github.com/FreshRSS/FreshRSS/issues/5622
Cherry picks on https://github.com/FreshRSS/FreshRSS/pull/5584

* Fix export of tags / labels
Article-defined tags were wrongly exported as user-defined labels.

* Fix export of tags / labels
Article-defined tags were wrongly exported as user-defined labels.

* Fix bug with many labels

* Better typing

* Comments
2023-09-04 10:09:37 +02:00
Alexandre Alapetite
d165ed1fb6 Fix hash of articles with loadCompleteContent (#5576)
* Fix hash of articles with loadCompleteContent
The detection of modified articles was wrong for feeds using loadCompleteContent. Indeed, the hash is supposed to computed on the content provided by the server of the RSS feed, excluding further modifications.
Furthermore, read hash from database instead of recomputing it all the time.
Slightly related to https://github.com/FreshRSS/FreshRSS/pull/5574

* Explicit SQL alias

* PHPDocs
2023-08-13 15:11:22 +02:00
Alexandre Alapetite
1f05c92376 Fix enclosures in RSS output (#5540)
* Fix enclosures in RSS output
fix https://github.com/FreshRSS/FreshRSS/issues/5539

* another iterable

* Forgotten iterable
2023-07-19 23:40:28 +02:00
Luc SANCHEZ
f8f163d054 Chore/processing of depreciations and updating code to php72 minimum (#5504)
* processing of depreciations and updating of code to php7.2 minimum

* Autoformat many strange array indenting
And revert a few unwanted changes

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-07-07 22:36:27 +02:00
Alexandre Alapetite
1db606bc1b New extension hook entry_auto_read (#5505)
* New extension hook entry_auto_read
For extensions to be notified of articles being automatically marked as read for various reasons

* Documentation + entry_auto_unread
2023-07-05 11:00:26 +02:00