164 Commits

Author SHA1 Message Date
Alexandre Alapetite
af1e5cb9bc More uniform SQL search and PHP search (#8329)
* More uniform SQL search and PHP search
The behaviour depends though on the database.
Improve https://github.com/FreshRSS/FreshRSS/discussions/8265#discussioncomment-15278980

* Try to use transliterator_transliterate function instead
2025-12-20 11:06:39 +01:00
Alexandre Alapetite
00cd5df294 Use native PHP #[Deprecated] (#8325)
https://php.watch/versions/8.4/Deprecated
And enfore it with PHPUnit + PHPStan.
Especially useful for extensions.
2025-12-17 10:11:18 +01:00
Alexandre Alapetite
a18c35046d Housekeeping lib_rss.php (#8193)
* Housekeeping lib_rss.php
`lib_rss.php` had become much too large, especially after https://github.com/FreshRSS/FreshRSS/pull/7924
Moved most functions to other places.
Mostly no change of code otherwise (see comments).

* Extension: composer run-script phpstan-third-party
2025-11-11 08:17:12 +01:00
Alexandre Alapetite
b6c63d2239 Better transitions between groups of articles (#8174)
fix https://github.com/FreshRSS/FreshRSS/issues/7520
fix https://github.com/FreshRSS/FreshRSS/issues/8168
fix https://github.com/FreshRSS/FreshRSS/discussions/8172
2025-11-04 12:49:21 +01:00
Alexandre Alapetite
6440f9c9a9 Fix DOM fatal error while filtering retrieved full content (#8161)
https://github.com/FreshRSS/FreshRSS/pull/8132 was not sufficient.
Fix *PHP Fatal error: Uncaught Error: Couldn't fetch DOMElement. Node no longer exists*
2025-10-26 22:35:11 +01:00
Alexandre Alapetite
5909cc5756 Fix DOM error while filtering retrieved full content (#8132)
```
PHP Fatal error: Uncaught Error: Couldn't fetch DOMElement in app/Models/Entry.php:998
```
2025-10-17 15:56:19 +02:00
Alexandre Alapetite
1ef354a63e GReader API frss:priority (#7583)
* GReader API frss:priority
Experiment with a FreshRSS namespace in the GReader API to see whether there is any interest.
fix https://github.com/FreshRSS/FreshRSS/issues/1868

`'frss:priority'` can be: `'important'`, `'main'`, `'category'`, `'feed'` (there is also the value `hidden`, but which is filtered out and as such never sent through the API at the moment)

* Add visibility feed
https://github.com/FreshRSS/FreshRSS/pull/7972
2025-10-17 12:54:00 +02:00
Alexandre Alapetite
f08f7dcff9 Sort by article length (#8119)
* Sort by article length
fix https://github.com/FreshRSS/Extensions/issues/378
Very basic using simply SQL `LENGTH()` function.

<img width="492" height="217" alt="image" src="https://github.com/user-attachments/assets/7cf37303-76c8-4411-b8b1-075e81535b60" />

* Improve content length retrieval
2025-10-16 21:15:44 +02:00
Alexandre Alapetite
7e72033859 Filter on last user modified (#8093)
Example: `userdate:PT1H` to select only articles modified by user during the last hour
Fix https://github.com/FreshRSS/FreshRSS/issues/4280#issuecomment-3393078024

Useful for instance to bulk mark as unread recently marked articles by error:
1. Click on the toggle button to show the read articles (making sure the toggle for the unread articles is off)
2. Sort by *User modified 9→1*
3. Filter by *user modified date*, for instance to the last 3 hours by typing `userdate:PT3H`
4. Click in the drop-down menu *Mark selection as unread*

P.S.: I have added at the same time a bunch of unit tests for date-related logic
2025-10-15 00:12:19 +02:00
Federico Scodelaro
673067a52d Last user modified (#7886)
* feat: Add user modified functionality

Closes https://github.com/FreshRSS/FreshRSS/issues/7862

Changes proposed in this pull request:

This is an implementation of the proposed feature. It allows entries to have a new field that will be updated whenever an item is marked as read/unread or bookmark/removed from bookmarks. And a new sort criteria to sort by it.

How to test the feature manually:

1. Mark items from a feed as read/unread
2. Mark items from a feed as bookmark / remove bookmark
3. Sort by the new criteria

* feat: Add sort functionality
* feat: Add sort nav button
* fix: Use correct migrations
* fix: Add internationalization
* fix: Linter errors
* chore: PR comments

* Update app/i18n/fr/index.php
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* Update app/i18n/pl/index.php
Co-authored-by: Inverle <inverle@proton.me>

* Update app/i18n/nl/index.php
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>

* make fix-all
* Fixes
* More fixes sort
* Fix wrong index
* Fix unneeded column
* Fix auto-create indexes
* Some copilot suggestions
* One more fix
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Co-authored-by: Inverle <inverle@proton.me>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
2025-10-11 00:43:38 +02:00
Alexandre Alapetite
df4b76f74b PHPStan 2.1.29 (#8052)
Replace:
* https://github.com/FreshRSS/FreshRSS/pull/8049
* https://github.com/FreshRSS/FreshRSS/pull/8050
2025-10-01 21:02:42 +02:00
Alexandre Alapetite
2601897c55 API optimisation: more streaming of outputs (#8041)
* API optimisation: more streaming of outputs
I spotted a memory issue when testing https://github.com/FreshRSS/FreshRSS/pull/7714
Attempt to stream results more, instead of keeping too much in memory.
Could be further improved.

* Apply suggestions from code review

Co-authored-by: Alexis Degrugillier <aledeg@users.noreply.github.com>

* Minor whitespace JSON formatting

---------

Co-authored-by: Alexis Degrugillier <aledeg@users.noreply.github.com>
2025-10-01 20:21:24 +02:00
Alexis Degrugillier
72884813e1 Add hook enums (#8036)
- add an enum to handle hook types (enum are available since PHP 8.1)
- change hook calls from string value to enum value
2025-09-30 22:59:41 +02:00
Alexandre Alapetite
62f32ccadf PHPStan: finalise strictArrayFilter (#7794)
As well as reportPossiblyNonexistentConstantArrayOffset.
And disable PHPStan-next from GitHub Action, since the work is completed for now.
2025-08-07 22:19:45 +02:00
Alexandre Alapetite
fe9ef3b506 Include enclosures in entries hash (#7719)
* Include enclosures in entries hash
Fix https://github.com/FreshRSS/FreshRSS/issues/7718
Negative side-effect: users using the option to automatically mark updated articles as unread will have some articles with enclosures appear as unread

* Changelog with warning
2025-07-26 15:57:58 +02:00
Alexandre Alapetite
c8bbf35534 Add search operator c: for categories (#7696)
* Add search operator `c:` for categories
fix https://github.com/FreshRSS/FreshRSS/discussions/7692
Allow searching for e.g. `c:23,34`
2025-06-29 11:09:08 +02:00
Inverle
18b5c8ec6d Handle redirects when scraping feed from HTML (#7654)
* Handle redirects when scraping feed from HTML

* pass codesniffer

* pass PHPStan

* Optimize

* Another approach relying on HTML base
Standard way to save an HTML document with relative references

* Fix case of existing HTML base
which should not be overriden

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2025-06-22 00:09:18 +02:00
Alexandre Alapetite
5f6ef05ffc Fix bigint timestamps on 32-bit (#7375)
* Fix bigint timestamps on 32-bit
fix https://github.com/FreshRSS/FreshRSS/issues/7374
SQL requests for BIGINT fields may return a string on 32-bit systems instead of an integer

* Calculations may also be string
2025-02-26 17:01:25 +01:00
Alexandre Alapetite
f7b4a1e742 PHPStan more checkImplicitMixed (#7339)
* PHPStan more checkImplicitMixed

* Draft Entry.php

* Finish Entry.php

* Finish FeedDAO.php and Themes.php
2025-02-23 17:08:17 +01:00
Alexandre Alapetite
d6c2daee51 Add search operator intext: (#7228)
* Add search operator intext:
fix https://github.com/FreshRSS/FreshRSS/issues/6188
https://github.com/FreshRSS/FreshRSS/discussions/7220

* Add example to doc
2025-01-25 09:16:13 +01:00
Alexandre Alapetite
5368f38753 Reduce undeeded use of elvis operator ?: (#7204) 2025-01-10 08:13:09 +01:00
Alexandre Alapetite
50adb55982 Add some missing PHP native types (#7191)
* Add some missing PHP native types
Replaces https://github.com/FreshRSS/FreshRSS/pull/7184

* Clean some types
2025-01-08 13:26:09 +01:00
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