Commit Graph

895 Commits

Author SHA1 Message Date
maTh
7de384bf9c Mark as read button: config for the size (#7314)
* settings

* i18n: mark_read_button

* big, small, none

* fix

* Fixes

* make fix-all

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2025-03-13 23:10:48 +01:00
Annika Backstrom
f40acd78cb Use case-insensitive sort for categories (#7402)
Changes proposed in this pull request:

- Use `strnatcasecmp()` inside `listSortedCategories()`

How to test the feature manually:

1. Create categories `A`, `b`, and `C`
2. Observe that categories are sorted case-insensitively on the feed index and Subscription Management pages
2025-03-05 14:40:26 +01:00
Alexandre Alapetite
03aec8b54e Fix dynamic OPML (#7394)
Regression from https://github.com/FreshRSS/FreshRSS/pull/7155
Fix https://github.com/FreshRSS/FreshRSS/issues/7385
2025-03-03 23:05:39 +01: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
Zihao Diao
b0b75dd635 fix: properly set the priority field of feeds when adding new feed. (#7354)
Signed-off-by: Zihao Diao <hi@ericdiao.com>
2025-02-23 16:35:17 +01:00
Alexandre Alapetite
a518ecb39e Fix regression XPath XML encoding (#7345)
* Fix regression XPath XML encoding
fix https://github.com/FreshRSS/FreshRSS/discussions/7325
The categories (tags) were not correctly XML-escaped due to being an array
https://github.com/FreshRSS/FreshRSS/pull/5305/files#r1964316119

* Improve typing
2025-02-20 22:12:10 +01:00
maTh
a697ca54ad Shortcuts for adding labels (#7274)
* add shortcut in config

* open my labels menu with shortcut

* the first 9 items are selectable + input field

* i18n

* Update app/i18n/nl/conf.php

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>

* index.menu.mylabels

* order fixed

---------

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
2025-02-03 08:47:25 +01:00
Alexandre Alapetite
e749490693 Pass PHPStan checkBenevolentUnionTypes (#7270) 2025-01-31 13:59:51 +01:00
Alexandre Alapetite
d1eb85e374 Fix unwanted feed description updates (#7269)
fix https://github.com/FreshRSS/FreshRSS/discussions/7265
2025-01-29 22:32:03 +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
825ccf5556 Hide base theme (#7234) 2025-01-21 23:31:40 +01:00
Alexandre Alapetite
a8ef1c3c10 Fix stats for MySQL (#7212)
fix https://github.com/FreshRSS/FreshRSS/issues/7210
MySQL returns decimal for some columns, which get converted to string instead of integer in PHP
2025-01-11 15:33:57 +01:00
Alexandre Alapetite
7a79717e10 Fix sqlite_version (#7205)
* Fix sqlite_version
for https://github.com/FreshRSS/FreshRSS/pull/7161

* Fix PostgreSQL
2025-01-10 08:47:52 +01:00
Alexandre Alapetite
5368f38753 Reduce undeeded use of elvis operator ?: (#7204) 2025-01-10 08:13:09 +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
bbd81b3e7e Fix regression labels (#7150)
Regression from https://github.com/FreshRSS/FreshRSS/pull/7131
2024-12-27 13:02:10 +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
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
b5bf5760bf Avoid Unicode escape of authors in HTML UI (#7056)
fix https://github.com/FreshRSS/FreshRSS/issues/2770
2024-12-05 16:20:15 +01:00
Alexandre Alapetite
3b15f8a5c9 Parentheses in quoted search (#7055)
* Parentheses in quoted search
Allow parentheses in quoted search like `author:"Bob (Team1)"`
Related to https://github.com/FreshRSS/FreshRSS/pull/7054

* Doc
2024-12-05 16:19:57 +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
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
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
278181572e Add extension hook simplepie_after_init (#7007)
* Add extension hook simplepie_after_init
fix https://github.com/FreshRSS/FreshRSS/issues/7006

* Add documentation note

* fix doc get_headers

* Syntax void

* Forgotten code
2024-11-21 08:22:13 +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
df28324c34 Fix regex search for tags (#6972)
https://github.com/FreshRSS/FreshRSS/issues/6949#issuecomment-2452363378
2024-11-02 01:02:12 +01:00
Patrick Hyatt
df86cbb361 Rebuild Feed .ico and .txt on cache clear (#6961)
* - Modify Feed.faviconPrepare signature to allow forced retrieval of the favicon   - Add faviconRebuild which clears file cache and re-retrieves icons   - Call faviconRebuild when clearCache is fired

* Update app/Models/Feed.php

* - PHPStan fix : Use static method call vs dynamic

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-11-01 16:22:54 +01:00
Alexandre Alapetite
493b8d5ce2 Fix regex parentheses of referenced search (#6950)
fix https://github.com/FreshRSS/FreshRSS/issues/6949
2024-10-29 08:12:30 +01:00
Alexandre Alapetite
6c58b90518 Fix regex for references to user queries (#6936)
https://github.com/FreshRSS/FreshRSS/pull/6926#issuecomment-2432712495
2024-10-24 22:34:29 +02: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
60dd22d3b3 Allow regex parentheses (#6926)
* Allow regex parentheses
While waiting for a new better search parser, auto-escape parentheses in regex expressions to allow them like in `/^(ab|cd)/`

* Allow escaped parenthesis in regex

* A couple more tests
2024-10-22 16:00:07 +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
df763eb8b3 Add hook entries_favorite (#6880)
Called when entries are starred or unstarred
2024-10-14 09:35:41 +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