Commit Graph

174 Commits

Author SHA1 Message Date
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 84d88d4b5d
Improve TTL+muted logic (#6115)
Fix https://github.com/FreshRSS/FreshRSS/issues/6111
2024-02-21 09:47:05 +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
eta-orionis 9c97d8ca72
JSONFeeds, JSON scraping, and POST requests for feeds (#5662)
* allow POST requests for feeds

* added json dotpath and jsonfeed subscriptions. No translation strings yet

* debug and fix jsonfeed parser

* bugfix params saved when editing feed

* added translations for JSON features

* Update docs for web scraping

* make fix-all
and revert unrelated changes, plus a few manual fixes, but there are still several type errors

* Fix some i18n

* refactor json parsing for both feed types

* cleanup unnecessary comment

* refactored generation of SimplePie for XPath and JSON feeds

* Fix merge error

* Update to newer FreshRSS code

* A bit of refactoring

* doc, whitespace

* JSON Feed is in two words

* Add support for array syntax

* Whitespace

* Add OPML export/import

* Work on i18n

* Accept application/feed+json

* Rework POST

* Fix update

* OPML for cURL options

* Fix types

* Fix Typos

---------

Co-authored-by: Erion Elmasllari <elmasllari@factorsixty.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-01-10 08:23:45 +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 803fa8fdb5
Fix PHP7 susbtr (#5929)
fix https://github.com/FreshRSS/FreshRSS/issues/5928
`susbstr` might return false in PHP7
Regression from https://github.com/FreshRSS/FreshRSS/pull/5830
2023-12-06 11:58:49 +01:00
Alexandre Alapetite f0d4f2762d
Rework keepmax (#5905)
* Rework keepmax
fix https://github.com/FreshRSS/FreshRSS/issues/5702
fix https://github.com/FreshRSS/FreshRSS/issues/5870

* More WIP

* Minor progress

* Progress

* Beta

* Improved debug message

* Revert noCommit

* Fix variable reset

* Remove debug syslogs
2023-12-03 19:52:02 +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
Alexandre Alapetite 9eba8726ac
API fix add feed with title (#5868)
fix https://github.com/FreshRSS/FreshRSS/issues/5866
2023-11-14 12:58:57 +01:00
Alexandre Alapetite 44a7c54a5a
Update WebSub documentation a bit (#5829)
* Update WebSub documentation a bit

* Marien prefers not to promote his hub too much :-)
2023-11-08 20:24:24 +01:00
Alexandre Alapetite 348028a290
New feature important feeds (#5782)
* New feature important feeds

* Fix PHPStan

* Initial style for important feeds + keep unread

* Change UI order

* Count important unread

* Never mark as read important feeds during scroll

* Fix i18n conf.iew.normal regression

* Fix reader view

* More fix reader view

* Create important.svg

* Fix title

* Fix counter

* Account for important during  mark-all-as-read

* Fix underline colour

* 📌

* Changelog

---------

Co-authored-by: math-gh <>
Co-authored-by: maTh <1645099+math-GH@users.noreply.github.com>
2023-11-08 20:23:54 +01:00
Alexandre Alapetite 5ca9101ce8
Fix type regression filterActions (#5786)
Regression from https://github.com/FreshRSS/FreshRSS/pull/5720
2023-10-30 22:28:34 +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 db53d2655b
Allow string in XPath tags (#5653)
fix https://github.com/FreshRSS/FreshRSS/issues/5651
2023-09-14 20:24:22 +02:00
Alexandre Alapetite 4039f6c9a4
Fix cache refresh (#5562)
Improvement of https://github.com/FreshRSS/FreshRSS/pull/4422

The main problem was due to `touch()` not automatically clearing the file status cache, and requiring a call to `clearstatcache()`. Example:

```
php > touch('/tmp/touch.txt');
php > echo date('c', filemtime('/tmp/touch.txt'));
2023-08-03T17:27:43+02:00
php > touch('/tmp/touch.txt');
php > echo date('c', filemtime('/tmp/touch.txt'));
2023-08-03T17:27:43+02:00
php > clearstatcache(true, '/tmp/touch.txt');
php > echo date('c', filemtime('/tmp/touch.txt'));
2023-08-03T17:28:21+02:00
```
2023-08-03 21:56:35 +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 de59076ae1
Remove unneeded quotes in warning (#5480)
* Remove unneeded quotes in warning
fix https://github.com/FreshRSS/FreshRSS/issues/5479

* Minor whitespace
2023-06-20 09:05:55 +02:00
Alexandre Alapetite 723f7577d0
Refactor lastSeen and markReadAsGone (#5470)
* Refactor lastSeen and markReadAsGone
Make the logic a bit more robust and explicit

* Remove forgotten SQL param

* Add test inTransaction

* More robust transaction

* Add a debug log

* Add max timestamp to markAsReadUponGone

* Reduce number of debug lines

* typing

* Better detection of when feed is empty

* More explicit case for push
2023-06-16 16:11:16 +02:00
Alexandre Alapetite 2038d50110
PHPStan Level 7 for Minz_Request, FreshRSS_Feed, Minz_Error (#5400)
* PHPStan Level 7 for Minz_Request

* PHPStan Level 7 for FreshRSS_Feed

* PHPStan Level 7 for Minz_Error
2023-05-15 19:26:48 +02:00
Alexandre Alapetite 6e2f2f1c1e
A few additional PHPStan rules (#5388)
A subset of
https://github.com/phpstan/phpstan-strict-rules
2023-05-11 13:02:04 +02:00
Alexandre Alapetite 30c69ef147
Use PHPStan dynamicConstantNames (#5370)
https://phpstan.org/config-reference#constants
Avoid a few phpstan-ignore-next-line
2023-05-04 19:47:54 +02:00
Alexandre Alapetite bd9fa803f1
PHPStan Level 7 complete DAOs (#5354)
* PHPStan Level 7 complete DAOs

* Finalise PHPStan Level 7 for CategoryDAO

* PHPStan Level 7 for Context and Search

* Apply suggestions from code review

Co-authored-by: Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com>
2023-05-02 14:38:32 +02:00
Alexandre Alapetite 115724622f
PHPStan Level 7 for ten more files (#5327)
* PHPStan Level 7 for nine more files

* Minor syntax

* One more
2023-04-23 11:58:15 +02:00
Alexandre Alapetite 8abe53d879
Improve markAsReadUponGone (#5315)
* Improve markAsReadUponGone
Fix case  when the uptream feed has zero article, then old articles would never be automatically marked as read with the "mark as read when gone" policy, which was only based on the timestamp of new articles from the uptream feed.

* Fix typo

* Simplify request
Needs to be re-tested with SQLite + MySQL

* While waiting to check syntax on all database types

* Fix multiple errors
In the case of WebSub, and in the case of invalid GUIDs
2023-04-20 21:46:25 +02:00
Alexandre Alapetite 5579dc88ab
Better XPath failure (#5317)
Report feeds as errored for more cases
2023-04-20 08:21:37 +02:00
Alexandre Alapetite 62496339b6
More consistent use of iterable type (#5308)
For `yield`
2023-04-17 16:24:35 +02:00
Alexandre Alapetite f3760f138d
Complete PHPStan Level 6 (#5305)
* Complete PHPStan Level 6
Fix https://github.com/FreshRSS/FreshRSS/issues/4112
And initiate PHPStan Level 7

* PHPStan Level 6 for tests
* Use phpstan/phpstan-phpunit
* Update to PHPStan version 1.10

* Fix mixed bug

* Fix mixed return bug

* Fix paginator bug

* Fix FreshRSS_UserConfiguration

* A couple more Minz_Configuration bug fixes

* A few trivial PHPStan Level 7 fixes

* A few more simple PHPStan Level 7

* More files passing PHPStan Level 7
Add interface to replace removed class from https://github.com/FreshRSS/FreshRSS/pull/5251

* A few more PHPStan Level 7 preparations

* A few last details
2023-04-17 08:30:21 +02:00
Luc SANCHEZ a19b56064d
PHPstan level 6 for Category.php (#5298)
* PHPstan level 6 for Category.php

* Fix a few things

* Minor fixes

* A few more fixes

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-04-15 01:19:22 +02:00
Luc SANCHEZ 5f898dcc5e
Modernize Constants and use new constant for string 'currentUser' (#5089)
* Modernize Constants and use new constant 'currentUser'

* Add FreshRSS_Context::currentUser() function and use

* Add FreshRSS_Context::currentUser() function and use

* Add FreshRSS_Context::currentUser() function and use

* Add FreshRSS_Context::currentUser() function and use

* Add FreshRSS_Context::currentUser() function and use

* Update app/Controllers/userController.php

* Update app/Controllers/userController.php

* Update app/Controllers/userController.php

* Update app/Models/Auth.php

* Update p/api/greader.php

* Update p/api/greader.php

* Update p/api/greader.php

* Update app/Models/Context.php

* Update app/Models/LogDAO.php

* Update lib/Minz/Log.php

* Update p/api/greader.php

* Update app/layout/header.phtml

* Update app/views/helpers/export/articles.phtml

* Update cli/do-install.php

* Remarque's from Alkarex

* Remarque's from Alkarex

* Refactor using new Minz_User class

* Consistent naming of public constants

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-03-26 14:17:22 +02:00
Alexandre Alapetite 05ae1b0d26
XML+XPath (#5076)
* XML+XPath
#fix https://github.com/FreshRSS/FreshRSS/issues/5075
Implementation allowing to take an XML document as input using an XML parser (instead of an HTML parser for HTML+XPath)

* Remove noise from another PR

* Better MIME for XML

* And add glob *.xml for cache cleaning

* Minor syntax

* Add glob json for clean cache
2023-02-09 13:57:20 +01:00
Alexandre Alapetite e899e4edd9
More robust application of access permissions (#5062)
* More robust application of access permissions
We were in particular missing directory traversal `+X` in our current recommendations.
Extracted to own shell script so it can easily be invoked.
Update access permissions in Docker to account to be more robust.
#fix https://github.com/FreshRSS/FreshRSS/discussions/5037

* Minor simplification

* Restrict mkdir permissions
Default mkdir permissions are 0777, which is not good for security, so downgrade to 0770.
2023-02-06 15:42:53 +01:00
Alexandre Alapetite 07efaf71ea
Fix error handling when updating URL (#5039)
Fix 3 related error handling when updating the feed URL with an invalid URL. Previously leading to unclear 500 page with additional PHP errors.
2023-01-26 08:59:34 +01:00
Alexandre Alapetite 8f9c4143fc
Better enclosures (#4944)
* Better enclosures
#fix https://github.com/FreshRSS/FreshRSS/issues/4702
Improvement of https://github.com/FreshRSS/FreshRSS/pull/2898

* A few fixes

* Better enclosure titles

* Improve thumbnails

* Implement thumbnail for HTML+XPath

* Avoid duplicate enclosures
#fix https://github.com/FreshRSS/FreshRSS/issues/1668

* Fix regex

* Add basic support for media:credit
And use <figure> for enclosures

* Fix link encoding + simplify code

* Fix some SimplePie bugs
Encoding errors in enclosure links

* Remove debugging syslog

* Remove debugging syslog

* SimplePie fix multiple RSS2 enclosures
#fix https://github.com/FreshRSS/FreshRSS/issues/4974

* Improve thumbnails

* Performance with yield
Avoid generating all enclosures if not used

* API keep providing enclosures inside content
Clients are typically not showing the enclosures to the users (tested with News+, FeedMe, Readrops, Fluent Reader Lite)

* Lint

* Fix API output enclosure

* Fix API content strcut

* API tolerate enclosures without a type
2023-01-06 19:53:43 +01:00
Alexandre Alapetite 4bf678f8e4
HTML+XPath allow content as HTML (#4878)
* HTML+XPath allow content as HTML
#fix https://github.com/FreshRSS/FreshRSS/issues/4869

* Wrong variable reuse

* Allow both HTML and expressions
2022-11-22 08:15:22 +01:00
Alexandre Alapetite 5897487f2f
Fix path_entries encoding (#4823)
* Fix path_entries encoding
#fix https://github.com/FreshRSS/FreshRSS/issues/4815

* Fix preview
2022-11-07 08:34:12 +01:00
Alexandre Alapetite e96b6266b5
Fix curlopt options for HTML+XPath (#4759)
Improvement of https://github.com/FreshRSS/FreshRSS/pull/4220
2022-10-21 15:11:52 +02:00
Alexandre Alapetite 648a876d77
Add support for custom XPath date/time format (#4703)
* Add support for custom XPath date/time format
#fix https://github.com/FreshRSS/FreshRSS/issues/4701
Improvement of https://github.com/FreshRSS/FreshRSS/pull/4220

* Format is not XPath

* Remove TODOs in en-GB
2022-10-09 15:43:30 +02:00
Alexandre Alapetite e626fd249e
Fix regression 4688 (#4700)
Minor regression from https://github.com/FreshRSS/FreshRSS/pull/4688
2022-10-07 12:59:31 +02:00
Alexandre Alapetite 82c4a54fea
Compat PHP 8.1 strip_tags (#4688)
#fix https://github.com/FreshRSS/FreshRSS/issues/4687
2022-10-04 23:07:17 +02:00
Alexandre Alapetite 1603c10bba
XPath ability to define the UID manually (#4507)
* XPath ability to define the UID manually

* Fix error in i18n
2022-08-18 12:10:55 +02:00
Alexandre Alapetite 82ac1d1e67
Refactor entry-to-GReader API format (#4490)
* Refactor entry to GReader API format
Some code was copied in two locations and not completely uniform.
Cleaning of related variables and functions (e.g. better types for entries and categories as objects vs. as IDs).
Usecase: I need to call the same GReader-compatible serialization from an extension

* Fixed some edge cases

* Keep summary instead of content
`summary` and `content` seems to be used interchangeably in the Google Reader API. We have been using `summary` for our client API and  `content` in our export/import, so stick to that.
2022-08-08 12:04:02 +02:00
Alexandre Alapetite 509c8cae63
Dynamic OPML (#4407)
* Dynamic OPML draft
#fix https://github.com/FreshRSS/FreshRSS/issues/4191

* Export dynamic OPML
http://opml.org/spec2.opml#1629043127000

* Restart with simpler approach

* Minor revert

* Export dynamic OPML also for single feeds

* Special category type for importing dynamic OPML

* Parameter for excludeMutedFeeds

* Details

* More draft

* i18n

* Fix update

* Draft manual import working

* Working manual refresh

* Draft automatic update

* Working Web refresh + fixes

* Import/export dynamic OPML settings

* Annoying numerous lines in SQL logs

* Fix minor JavaScript error

* Fix auto adding new columns

* Add require

* Add missing 🗲

* Missing space

* Disable adding new feeds to dynamic categories

* Link from import

* i18n typo

* Improve theme icon function

* Fix pink-dark
2022-07-04 09:53:26 +02:00
Alexandre Alapetite d785ddde2a
New option to automatically mark as read gone articles (#4426)
* New option to automatically mark as read gone articles
Option to automatically and immediately mark as read entries / articles that are no longer provided in their upstream RSS / ATOM / XPath feed

* Reduce SQL queries
Optimisation: Perform cache update only once
2022-06-25 11:15:51 +02:00
Alexandre Alapetite 2a0b47a8a4
No XPath error on empty list (#4425)
Set feed error state to true if the *list* of items cannot be find by XPath, but do not set the error state to true if that list happens to be empty (the resulting feed will be with an *empty* state instead of *error* state)
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/4220
2022-06-23 13:26:22 +02:00
Alexandre Alapetite f365a9aeb4
Update all test dependencies (#4419)
* Update all test dependencies

* Remove old false-positive

* Minor update lock files

* Increase PHPStan memory for Fedora
https://github.com/FreshRSS/FreshRSS/pull/4400#issuecomment-1159514197

* Require PHP8+ for tests
Due to small changes of signature in `ob_implicit_flush` and `simplexml_load_string`, cf. https://github.com/FreshRSS/FreshRSS/pull/4123

* Missing lint in CSS files
2022-06-19 20:08:42 +02:00
Alexandre Alapetite 7f0c378482
Fix favicons update (#4358)
Better update the favicons when the URL changes
2022-05-13 23:14:09 +02:00
Alexandre Alapetite 4a87206f28
OPML export/import of some proprietary FreshRSS attributes (#4342)
* OPML export/import of some proprietary FreshRSS attributes
#fix https://github.com/FreshRSS/FreshRSS/issues/4077
And one of the TODOs of https://github.com/FreshRSS/FreshRSS/pull/4220
XPath options, CSS Selector, and action filters

* Bump library patch version

* OPML namespace + documentation

* Add example
2022-05-12 22:15:10 +02:00
Alexandre Alapetite 954cc0510d
HTML+XPath fallback to feed title (#4288)
* HTML+XPath fallback to feed title
Except when adding the feed, the following refreshes should fallback to feed title when generating the internal RSS representation.
Improvement of https://github.com/FreshRSS/FreshRSS/pull/4220
2022-03-23 11:39:31 +01:00
Alexandre Alapetite e8af54a476
WebSub: Use hash instead of base64 to handle long URLs (#4282)
* WebSub: Use hash instead of base64 to handle long URLs

* Use 410 Gone
(Part of the WebSub specification https://www.w3.org/TR/websub/ )
2022-03-22 23:13:13 +01:00