Commit Graph

108 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 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 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 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
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
Alexandre Alapetite 85345559c7
Compatibility PHP 8.2 for running automated tests (#5826)
https://php.net/pdo.errorinfo has slightly changed signature
2023-11-07 13:15:48 +01:00
Alexandre Alapetite ad8bae5aca
Rework SQL field length (#5788)
* SQL auto-update field length
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/5756
Only for PostgreSQL and MySQL / MariaDB. Not possible for SQLite

* Account for MySQL 65535
Partial revert of https://github.com/FreshRSS/FreshRSS/pull/5756
> The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead.
2023-10-31 02:01:50 +01:00
Alexandre Alapetite 0324df6f88
SQL increase length of VARCHAR fields (#5756)
* SQL increase length of VARCHAR fields
Increase length of all fields, keeping the limits for:
* Unique indexes on UTF-8: 191 bytes for MySQL;
* Unique indexes on ASCII: 767 bytes for MySQL;
* Max URL for external tools: 32768 characters;
* Max VARCHAR: 65535 bytes for MySQL;
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/5038
Fix https://github.com/FreshRSS/FreshRSS/issues/4986

* Fix length test
2023-10-30 20:47:50 +01:00
Alexandre Alapetite f050a94b48
SQL: clean old auto-updates (#5649)
Should help with some DB lock issues.

Complete https://github.com/FreshRSS/FreshRSS/pull/3558 after https://github.com/FreshRSS/FreshRSS/pull/5625 already cherry-picked from it.

* Removed auto-update of MySQL GUID case sensitivity
https://github.com/FreshRSS/FreshRSS/pull/2078
  * Contributed to a DB lock in https://github.com/FreshRSS/FreshRSS/issues/5008

Also removed the following non-problematic auto-updates, simply because they were older than the above ones
* Auto-create custom labels (1.12.0) https://github.com/FreshRSS/FreshRSS/pull/2027
* Auto-add JSON column for feeds (1.11.0) https://github.com/FreshRSS/FreshRSS/pull/1838
* Auto-create temporary tables (1.7.0) https://github.com/FreshRSS/FreshRSS/pull/1470
2023-09-12 10:43:14 +02:00
Alexandre Alapetite 98559cebc3
Remove obsolete TTL migration code (#5625)
Remove `updateTTL` function used to help migration to 5+ year-old FreshRSS 1.10 and FreshRSS 0.7.3 https://github.com/FreshRSS/FreshRSS/pull/1750
This function contributed to locking the database https://github.com/FreshRSS/FreshRSS/pull/5574
Subset of https://github.com/FreshRSS/FreshRSS/pull/3558
2023-09-06 21:41:17 +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 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 d8c535c25c
PHPStan Level 7 for Share userController logs_pagination (#5393) 2023-05-13 22:47:51 +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 fde4e79ed0
SQL attributes native unicode (#5371)
Save our attributes for entries, feeds, and tags as native Unicode instead of JSON escape sequences such as `\u00f8` which are difficult to work with.
2023-05-04 19:48:09 +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 c72914bba2
PHPStan Level 7 for more DAO PDO (#5328)
* PHPStan Level 7 for more DAO PDO
With new function to address common type and check problems

* A bit more

* PHPStan Level 7 for FreshRSS_Entry
2023-04-28 14:01:11 +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 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
Alexandre Alapetite efcc8f387b
PHPStan level 6 for remaining DAO classes (#5299)
* PHPStan level 6 FreshRSS_CategoryDAO
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/5298
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4112

* PHPStan Level 6 for FeedDAO and a bit more

* PHPStan Level 6 for tagDAO
2023-04-15 22:04:37 +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
Alexandre Alapetite 288ed04ccc
PHPStan level 6 for all PDO and Exception classes (#5239)
* PHPStan level 6 for all PDO and Exception classes
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4112

* Fix type

* Now also our remaining own librairies

* Motivation for a few more files

* A few more DAO classes

* Last interface
2023-03-31 08:23:39 +02:00
Alexandre Alapetite 1a0616562d
Remove FreshRSS_Searchable for better types (#5212)
* Remove FreshRSS_Searchable for better types
The interface was not used, and it was preventing more precise types for the different `searchById()` methods, as they each have different input and output types.

* Fix type
2023-03-22 08:26:39 +01:00
Alexandre Alapetite 44f72889a5
Safer updateCachedValues (#5158)
#fix https://github.com/FreshRSS/FreshRSS/issues/5156
2023-03-04 10:06:30 +01:00
Alexandre Alapetite 2f02754522
Increase max feed URL length and drop unicity (#5038)
* Increase max feed URL length and drop unicity
#fix https://github.com/FreshRSS/FreshRSS/issues/4338
Drop the unicity constraint on our feed URL. In practice, this did not add much value as identical feeds could have different URLs. And it generated several problems, for instance during renaming or automatic redirections such as from HTTP to HTTPS, with collisions for which we dot not have any elegant handling.
I have kept a high limit of 32768 because cURL does not seem to have any limit except memory, which might lead to memory problems. This is the highest server-side value reported by https://www.sistrix.com/ask-sistrix/technical-seo/site-structure/url-length-how-long-can-a-url-be

* Same for Web site URL
For consistency
2023-01-26 08:13:38 +01:00
Alexandre Alapetite 72265c1eca
Fix OPML import special (#4708)
#fix https://github.com/FreshRSS/FreshRSS/issues/4704
From https://github.com/FreshRSS/FreshRSS/pull/4407
2022-10-09 13:37:29 +02:00
Alexandre Alapetite 412b60ca83
Fix transaction rollbacks during auto-update (#4622)
#fix https://github.com/FreshRSS/FreshRSS/issues/4600
We first need to commit the SQL transaction before being able to auto-update.
Avoid error such as:
> 25P02: 7 ERROR:  current transaction is aborted, commands ignored until end of transaction block
2022-09-19 11:51:44 +02:00
Alexandre Alapetite 0c472402f2
Workaround invalid OPMLs (#4591)
* Workaround invalid OPMLs
#fix https://github.com/FreshRSS/FreshRSS/issues/4590
Accept OPML files lacking text attributes

* Tolerate missing head element
2022-09-09 22:56:34 +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 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 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 1fe66ad020
Implement Web scraping "HTML + XPath" (#4220)
* More PHP type hints for Fever
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/4201
Related to https://github.com/FreshRSS/FreshRSS/issues/4200

* Detail

* Draft

* Progress

* More draft

* Fix thumbnail PHP type hint
https://github.com/FreshRSS/FreshRSS/issues/4215

* More types

* A bit more

* Refactor FreshRSS_Entry::fromArray

* Progress

* Starts to work

* Categories

* Fonctional

* Layout update

* Fix relative URLs

* Cache system

* Forgotten files

* Remove a debug line

* Automatic form validation of XPath expressions

* data-leave-validation

* Fix reload action

* Simpler examples

* Fix column type for PostgreSQL

* Enforce HTTP encoding

* Readme

* Fix get full content

* target="_blank"

* gitignore

* htmlspecialchars_utf8

* Implement HTML <base>
And fix/revert `xml:base` support in SimplePie e49c578817

* SimplePie upstream PR merged
https://github.com/simplepie/simplepie/pull/723
2022-02-28 20:22:43 +01:00
Alexandre Alapetite 1c5cf71859
Fix Fever 32 bit ID issue + more PHP type hints (#4201)
* Fix Fever 32 bit ID issue + more PHP type hints
#fix https://github.com/FreshRSS/FreshRSS/issues/4200
Follow up and fix regression from https://github.com/FreshRSS/FreshRSS/pull/4110

* More PHP type hints with PHPStan

* Fix pull problem

* Avoid more nulls
2022-02-06 14:31:36 +01:00
Alexandre Alapetite 1acd3ab09b
Use typographic quotes (#4133)
* Use typographic quotes

* A few fixes

* Fix

* Fix not saved

* Implement feedback

* Detail

* Revert spoken English fixes
Left for a future dedicated discussion

* More reverts

* Final reverts

* Final minor
2022-01-08 21:58:55 +01:00
Frans de Jonge d339b6dd45
[CI] PHPCS: check for opening brace on same line (#4122)
* [CI] PHPCS: check for opening brace on same line

* make fix-all

* Minor comments

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2022-01-05 00:52:24 +01:00
Alexandre Alapetite 00dbde68fb
Fix some PHPstan errors (#4019)
Fix some wrong variables found by https://github.com/FreshRSS/FreshRSS/issues/4016
2021-12-02 23:30:13 +01:00
Alexandre Alapetite a7aca6c0ab
Improved feed action filters (#3303)
* Re-order some feed options
* Option to auto mark as read existing titles
* Option to keep at max n unread articles per feed
2021-09-19 10:56:38 +02: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 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
Alexandre Alapetite f33e261163
Fix sanitize feed description (#3222)
* Fix sanitize feed description

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

* Simplification
2020-10-11 13:32:23 +02:00
Alexis Degrugillier ee31722072
Change feed order in a category (#3131)
Before, the sorting was not human readable. Lower-cased feed names were
displayed after upper-cased feed names.
Now, the sorting is human readable. The sorting is done without taking into
account the name case.

See #3128
2020-08-05 09:40:58 +02:00
Alexandre Alapetite 857f588790
Fix fetch preview (#2993)
* Fix fetch preview

#fix https://github.com/FreshRSS/FreshRSS/issues/2923
In MariaDB / MySQL, we cannot start a new query if we have not consumed
the previous buffered query fully.

* Fix for reload

* Typo in comment
2020-05-21 20:55:06 +02:00
Alexandre Alapetite 5858aaf7fc
API return proper newestItemTimestampUsec (#2854)
* API return proper newestItemTimestampUsec

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

* Minor naming

* Add newestItemTimestampUsec for labels

* Do not use t.name after all
2020-04-01 02:08:45 +02:00
Alexandre Alapetite cedbbff582
Allow feed to be actualized after being truncated (#2862)
Before, on had to wait for the cache to expire before being able to
refresh a feed that had been truncated via the Web interface.
Now, one can "delete all articles" and hit "actualize" imediately after
without problem.
Useful for testing filters, debugging e.g.
https://github.com/FreshRSS/FreshRSS/issues/2806
2020-03-31 14:15:51 +02:00