Commit Graph

859 Commits

Author SHA1 Message Date
maTh
1e8ef4bb72 Improve notifications: notificationName (#7287)
* notificationID

* 3 first examples

* fix

* notificationID -> notificationName

* Update lib/Minz/Request.php

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

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2025-02-02 19:15:03 +01:00
Alexandre Alapetite
22b74b0a57 Improve cURL proxy options (#7231)
3 is now used for CURLPROXY_HTTPS2
f07612cd9a/include/curl/curl.h (L789)
Related to https://github.com/FreshRSS/FreshRSS/issues/7209
2025-01-25 09:14:08 +01:00
Alexandre Alapetite
825ccf5556 Hide base theme (#7234) 2025-01-21 23:31:40 +01:00
Alexandre Alapetite
5368f38753 Reduce undeeded use of elvis operator ?: (#7204) 2025-01-10 08:13:09 +01:00
Alexandre Alapetite
3280ec617f Fix continuous mode (#7200)
fix https://github.com/FreshRSS/FreshRSS/issues/7199
2025-01-08 15:10:39 +01:00
Alexandre Alapetite
ca42b0b8cc Fix sharing integration (#7198)
fix https://github.com/FreshRSS/FreshRSS/issues/7192
2025-01-08 14:44:25 +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
1f466d7a2e Implement custom order-by (#7149)
Add option to sort results by received date (existing, default), publication date, title, URL (link), random.

fix https://github.com/FreshRSS/FreshRSS/issues/1771
fix https://github.com/FreshRSS/FreshRSS/issues/2083
fix https://github.com/FreshRSS/FreshRSS/issues/2119
fix https://github.com/FreshRSS/FreshRSS/issues/2596
fix https://github.com/FreshRSS/FreshRSS/issues/3204
fix https://github.com/FreshRSS/FreshRSS/issues/4405
fix https://github.com/FreshRSS/FreshRSS/issues/5529
fix https://github.com/FreshRSS/FreshRSS/issues/5864
fix https://github.com/FreshRSS/Extensions/issues/161

URL parameters:
* `&sort=id` (current behaviour, sorting according to newest received articles)
* `&sort=date` (publication date, which is not indicative of how new an article is)
* `&sort=title`
* `&sort=link`
* `&sort=rand` (random order - which disables infinite scrolling, at least for now)

combined with `&order=ASC` or `&order=DESC`

![image](https://github.com/user-attachments/assets/2de5aef1-604e-4a73-a147-569f6f42a1be)

## Implementation notes

The sorting criteria by *received date* (id), which is the default, and which was the only one before this PR, is the one that has the best sorting characteristics:
* *uniqueness*: no entries have the exact same received date
* *monotonicity*: new entries always have a higher received date
* *performance*: this field is efficiently indexed in database for fast usage, including for paging (indexing could also be done to other fields, but with lower effective performance)

In contrary, sorting criteria such as by *publication date*, by *title*, or by *link* are neither unique nor monotonic. In particular, multiple articles may share the same *publication date*, and we may receive articles with a *publication date* far in the future, and then later some new articles with a *publication date* far in the past.

To understand why sorting by *publication date* is problematic, it helps to think about sorting by *title* or by *link*, as sorting by *title* and by *publication date* share more or less the same characteristics.

### Problem 1: new articles

New articles may be received in the background after what is shown on screen, and before the next user action such as *mark all as read*. Due to the lack of *monotonicity* when sorting by e.g. *publication date* or *title*, users risk marking as read a batch of articles containing some fresh articles without seeing them.

Mitigation: A parameter `idMax` tracks the maximum ID related to a batch of actions such as *mark all as read* to exclude articles received after those that are displayed.

### Problem 2: paging / pagination

When navigating articles, only a few articles are displayed, and a new "page" of articles needs to be received from the database when scrolling down or when clicking the button to show more articles. When sorting by e.g. *publication date* or *title*, it is not trivial to show the next page without re-showing some of the same articles, and without skipping any. Indeed, views are often with additional criteria such as showing only unread articles, and users may mark some articles as read while viewing them, hereby removing some articles from the previous pages. And like for *Problem 1*, new articles may have been received in the background. Consequently, it is not possible to use `OFFSET` to implement pagination (so the patches suggested by a few users were wrong due to that, in particular).

Mitigation: `idMax` is also used (just like for *Problem 1*) and a *Keyset Pagination* approach is used, combining an unstable sorting criterion such as *publication date* or *title*, together with *id* to ensure stable sorting. (So, 2 sorting criteria + 1 filter criteria)

See e.g. https://www.alwaysdeveloping.net/dailydrop/2022/07/01-keyset-pagination/

### Problem 3: performance

Sorting by anything else than *received date* (id) is doomed to be slow(er) due to the combination of 3 criteria (see *Problem 2*). An `OFFSET` approach (which is not possible anyway as explained) would be even slower. Furthermore, we have no SQL index at the moment, but they would not necessarily help much due to the multiple sorting criteria needed and involving some `OR` logic which is difficult to optimise for databases.

The nicest syntax would be using tuples and corresponding indexes, but that is poorly supported by MySQL https://bugs.mysql.com/bug.php?id=104128

Mitigation: a compatibility SQL syntax is used to implement *Keyset Pagination*

### Problem 4: user confusion

Several users have shown that they do not fully understand the difference between *received date* and *publication date*, and particularly not the pitfalls of *publication date*.

Mitigation: the menus to mark-as-read *before 1 day* and *before 1 week* are disabled when sorting by anything else than *received date*. Likewise, the separation headers *Today* and *Yesterday* and *Before yesterday* are only shown when sorting by *received date*.

Again here, to better understand why, it helps to think about sorting by *title* or by *link*, as sorting by *title* and by *publication date* share more or less the same characteristics.

* [ ] We should write a Q&A and/or documentation about the problems associated to *sorting by publication date*: risks of not noticing new publication, of inadvertently marking them as read, of having some articles with a date in the future hanging at the top of the views (vice versa when sorting in ascending order), performance, etc.

### Problem 5: APIs

Sorting by anything else than *received date* breaks the guarantees needed for a successful synchronisation via API.

Mitigation: sorting by *received date* is ensured for all API calls.
2025-01-06 16:00:00 +01:00
Alexandre Alapetite
c29cbb7b8b Fix regressions on some array structures (#7155)
regressions from https://github.com/FreshRSS/FreshRSS/pull/7131
fix https://github.com/FreshRSS/FreshRSS/issues/7154
2024-12-28 23:58:00 +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
897e4a3f4a Search in all feeds (#7144)
* Search in all feeds
Search in PRIORITY_ARCHIVED with `&get=A`
fix https://github.com/FreshRSS/FreshRSS/discussions/7143

* Fix type

* Search in PRIORITY_ARCHIVED with `&get=Z`

* More

* Fixes

* One more fix

* Extra features in user queries

* Move i18n key

* Fix overview

* Enlarge query boxes

* Revert i18n spelling

* i18n: it

Thanks @UserRoot-Luca

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

---------

Co-authored-by: UserRoot-Luca <55756898+UserRoot-Luca@users.noreply.github.com>
2024-12-27 12:03:59 +01:00
Alexandre Alapetite
6c50190269 Allow privacy page to non admins (#7132)
fix https://github.com/FreshRSS/FreshRSS/issues/7123
2024-12-22 23:15:35 +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
33fd07f6f2 Conditional retrieval
fix https://github.com/FreshRSS/FreshRSS/issues/6149
2024-12-10 13:50:44 +01:00
Alexandre Alapetite
7fa4344c8b Fix invalid login message (#7066)
fix https://github.com/FreshRSS/FreshRSS/issues/7061
2024-12-05 21:04:42 +01:00
Alexandre Alapetite
2c7e5b829f New button to delete errored feeds from a category (#7030)
* New button to delete errored feeds from a category
fix https://github.com/FreshRSS/FreshRSS/issues/7025
fix https://github.com/FreshRSS/FreshRSS/issues/7026

* Remove English TODO

* in error state

* Feeds with errors
2024-12-03 12:59: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
Andriy Utkin
966f211202 Avoid race condition in users' homedir creation (#7000) 2024-11-18 10:57:50 +01:00
maTh
5b9248f45f New: Label menu in article row (#6984)
* configs

* add the icon in the entry header line

* rename comment

* Update main.js

* CSS

* comment typo fix

* fix gloabl view my labels menu

* improved: my labels dropdown with triangle now. yay!
2024-11-15 09:14:23 +01:00
Alexandre Alapetite
916987717e Fix redirect create user (#6995)
fix https://github.com/FreshRSS/FreshRSS/issues/6994
2024-11-14 00:15:39 +01:00
Alexandre Alapetite
7a5ce0fe20 Web export SQLite (#6931)
* Web export  SQLite
https://github.com/FreshRSS/FreshRSS/discussions/6930

* Implement download

* Fix operator precedence

* Set Last-Modified

* Sort by time, newest first

* Fix Last-Modified

* Use DateTimeInterface::RFC7231

* Add not_applicable message
2024-10-23 21:55:52 +02:00
Alexandre Alapetite
aea9ba0d62 New option mark article as read if identical title in category (#6922)
* New mark articles as read if identical title in category
fix https://github.com/FreshRSS/FreshRSS/issues/6143

* i18n todo forgotten
2024-10-21 13:41:16 +02:00
Alexis Degrugillier
ad2c6e6fbf Add privacy settings on extension list retrieval (#4603)
* Add privacy settings on extension list retrieval

There is a new privacy page to handle all configuration related to privacy. At
the moment, only privacy related to extensions can be configured.

The new settings allow to change the location of the extension list file and to
choose if the selected file is cached for a day or retrieved for each request.

Fix #4570

* Update code to pass PHPStan

* make fix-all

---------

Co-authored-by: maTh <math-home@web.de>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-10-20 20:51:49 +02:00
Mike
24a4fcb5c3 Add move to next unread Label on mark as read. (#6886)
* Add move to next unread Label on mark as read.

The Labels, unlike the Feeds and Categories, don't move to the next
unread when "move to next unread on mark all as read" user feature is
enabled.
Labels are more complex than Feeds and Categories because Entries can be
in more than Label at a time. So when marking all Entries in the Label
as read, it can cause other Labels to end up with all their Entries
marked as read as well. The calculation of what the next
Label/Feed/Category is to jump to normally happens when generating the
link for the "Mark as Read" buttons, but it can't for Labels.

To address the problem for Labels, use a placeholder value during the
pre-calculation of the "Mark as Read" button link. When that placeholder
value is encountered during the "Mark as Read" action, the next Label
with unread Entries will be calculated immediately after the mark as
read action has been processed.

Fix all the translations of the 'jump_next' text to remove the '(feed or
categories' part that no longer applies.
Attempt to fix the inconsistent Russian, Italian, and Polish
translations of 'jump_next' text, which phrased the '(feed or
categories)' part differently.

* Minor code formattting

* Fixes

* Optimize next label lookup.

Only get the tag list once, and actually error check that it returned successfully.
Fix a typo in a comment as well.

* Fix fallback when all Labels are read.

Fix the missing check for whether we're in the fallback case or not.

* Update app/i18n/ru/conf.php

* Update app/Controllers/entryController.php

* Minor changes

* One more minor

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-10-17 10:38:25 +02:00
Alexandre Alapetite
f77b45656d Fix add feed with MariaDB / MySQL (#6900)
* Fix add feed with MariaDB / MySQL
fix https://github.com/FreshRSS/FreshRSS/issues/6897
Regression from https://github.com/FreshRSS/FreshRSS/pull/4487

* Type fix
2024-10-15 17:14:50 +02:00
Alexandre Alapetite
b552d9f4bc Fix PHPCS ControlSignature (#6896)
Regression from https://github.com/FreshRSS/FreshRSS/pull/6666
We were not checking anymore for whitespace rules in e.g. `if (true) {`
2024-10-15 10:56:33 +02: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
Alexandre Alapetite
ccb132523a New feed mode: HTML + XPath + JSON dot notation (JSON in HTML) (#6888)
* New feed mode: HTML + XPath + JSON dot notation (JSON in HTML)
Same as `JSON+DotNotation` but first extracting the JSON string from an HTML document thanks to an XPath expression.
Example: `//script[@type='application/json']`
fix https://github.com/FreshRSS/FreshRSS/discussions/6876

* JavaScript UI to show/hide new field

* Casing xPathToJson

* Slight renaming
2024-10-13 15:28:45 +02:00
Alexandre Alapetite
1c09408c64 Fix HTML encodings in e.g. cURL options (#6821)
* Fix HTML encodings in e.g. cURL options

* Trim headers whitespace
2024-09-22 11:05:06 +02:00
Eugen Gorbunov
e9398f3f8c Add HTTP Headers option (#6820)
* Add new strings to lang files

* Add HTTP headers field to feed forms

* A few improvements

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-09-21 10:34:38 +02:00
Alexandre Alapetite
469a42d9c3 Rename param specialchars to plaintext (#6809)
https://github.com/FreshRSS/FreshRSS/pull/6800#discussion_r1756435762
2024-09-15 12:00:46 +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
fd1b5e9343 Fix inversed encoding logic in paramArray (#6800)
* Fix inversed encoding logic in paramArray
https://github.com/FreshRSS/FreshRSS/pull/6797#discussion_r1754661634
Also fix the possibility to use `<'&">` in shortcuts, and some minor encoding bugs in user queries

* Forgot paramArrayString
2024-09-12 11:04:49 +02:00
Alexandre Alapetite
d1f1e42c2b Fix unsafe login (#6797)
fix https://github.com/FreshRSS/FreshRSS/issues/6796
2024-09-11 21:45:40 +02:00
Alexandre Alapetite
dfac9f5813 PHPStan booleansInConditions (#6793)
* PHPStan booleansInConditions

* Uniformisation
2024-09-11 17:14:53 +02:00
Alexandre Alapetite
86f2cd24c5 Better import Inoreader (#6791)
fix https://github.com/FreshRSS/FreshRSS/discussions/6762
2024-09-09 13:33:36 +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
4f29b715ef Use curl to fetch extensions list (#6767)
fix https://github.com/FreshRSS/FreshRSS/issues/6744
2024-09-06 08:51:51 +02:00
Alexandre Alapetite
efa0a92171 Fix feed title option (#6771)
fix https://github.com/FreshRSS/FreshRSS/issues/6756
2024-09-04 21:12:56 +02:00
Alexandre Alapetite
7ba880ca1c Fix mark-as-read from user query (#6738)
fix https://github.com/FreshRSS/FreshRSS/issues/6732
2024-08-27 15:33:45 +02:00
Alexandre Alapetite
1fad724b95 Improve SQL transactions (#6713)
To avoid some locks.
Fix https://github.com/FreshRSS/FreshRSS/issues/6686
Might be some regressions since https://github.com/FreshRSS/FreshRSS/pull/6632
2024-08-15 21:39:33 +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
666e7b27ce Fix muted feeds for WebSub (#6671) 2024-07-31 22:11:01 +02:00
Alexandre Alapetite
6e01866845 Fix regression on mark duplicate titles as read for modified articles (#6664)
When the option *mark as read if an identical title already exists in the top n newest articles*, that should not apply to updated articles, as they risk being marked as read due to themselves having the same title.
Identifying the different sub-cases would require a more complicated logic, so disable for now.
Regression due to https://github.com/FreshRSS/FreshRSS/pull/6334
2024-07-30 15:23:46 +02:00
Alexandre Alapetite
5659b37948 Fix markAsReadUponGone regression (#6663)
Regression from https://github.com/FreshRSS/FreshRSS/pull/5470
Was not working anymore when the feed was empty.
Plus simplification of the logic when the feed is not empty
2024-07-30 12:01:59 +02:00
Alexandre Alapetite
5c8369ce38 Strong type array parameter helper (#6661)
Also useful for extensions (including one I am writing)
2024-07-29 14:48:17 +02:00
Alexandre Alapetite
a6d7bdc742 New global option to automatically add articles to favourites (#6648)
fix https://github.com/FreshRSS/FreshRSS/issues/6639
2024-07-24 19:37:30 +02:00
Alexandre Alapetite
0eeac4a669 Revisit keepMaxUnreads (#6632)
* Revisit keepMaxUnreads
Again, follow-up of https://github.com/FreshRSS/FreshRSS/pull/5905
fix https://github.com/FreshRSS/FreshRSS/issues/6620

* Refactoring to address buggy cases

* Fix minor test
2024-07-21 14:54:34 +02:00
maTh
7aa3d9f873 New: Sharing articles from the article title line (#6395)
* enable option

* Update entry_header.phtml

* frss.css

* fix print sharing

* Light refactoring

* fix

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-07-01 01:13:54 +02:00