<feed xmlns='http://www.w3.org/2005/Atom'>
<title>FreshRSS (Customized)/app/Controllers/indexController.php, branch 1.27.1</title>
<subtitle>Customized version of FreshRSS, a self-hosted RSS feed aggregator</subtitle>
<id>https://git.rdnlsmith.com/fresh-rss-custom/atom?h=1.27.1</id>
<link rel='self' href='https://git.rdnlsmith.com/fresh-rss-custom/atom?h=1.27.1'/>
<link rel='alternate' type='text/html' href='https://git.rdnlsmith.com/fresh-rss-custom/'/>
<updated>2025-09-21T11:29:58+00:00</updated>
<entry>
<title>Add option for CSP frame-ancestors (#7857)</title>
<updated>2025-09-21T11:29:58+00:00</updated>
<author>
<name>Alexandre Alapetite</name>
<email>alexandre@alapetite.fr</email>
</author>
<published>2025-09-21T11:29:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rdnlsmith.com/fresh-rss-custom/commit/?id=bc3e4c8fa4bae9591166e12caa3fb6bf73893102'/>
<id>urn:sha1:bc3e4c8fa4bae9591166e12caa3fb6bf73893102</id>
<content type='text'>
* Add option for CSP frame-ancestors
https://github.com/FreshRSS/FreshRSS/discussions/7856

* Revert contentSelectorPreviewAction

* Same for f.php and api

* Fix double init in f.php

* No sandbox for API page</content>
</entry>
<entry>
<title>Clarify: Visibility hidden vs. archived (#7970)</title>
<updated>2025-09-15T21:43:46+00:00</updated>
<author>
<name>Alexandre Alapetite</name>
<email>alexandre@alapetite.fr</email>
</author>
<published>2025-09-15T21:43:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rdnlsmith.com/fresh-rss-custom/commit/?id=f8310a587c26b0965bab71abfeb2d018e414f572'/>
<id>urn:sha1:f8310a587c26b0965bab71abfeb2d018e414f572</id>
<content type='text'>
fix https://github.com/FreshRSS/FreshRSS/issues/7887
We have two concepts: how much a feed is shown or not (controlled by priority), and how often a feed is refreshed (or not, in which case it is archived).
This PR removes the wording *Archived* from the *visibility* parameter, since this is not what it does.</content>
</entry>
<entry>
<title>Sort by category title, feed title (#7702)</title>
<updated>2025-07-15T10:39:51+00:00</updated>
<author>
<name>Alexandre Alapetite</name>
<email>alexandre@alapetite.fr</email>
</author>
<published>2025-07-15T10:39:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rdnlsmith.com/fresh-rss-custom/commit/?id=5f61e426dc90b7b697a46da009af2fc88eed3ad0'/>
<id>urn:sha1:5f61e426dc90b7b697a46da009af2fc88eed3ad0</id>
<content type='text'>
* Sort by category name, feed name
fix https://github.com/FreshRSS/FreshRSS/issues/7698
Note that sorting is done with the default SQL collation for now, meaning that lower-case vs. upper-case and diacritics are influencing the sorting order. Improvements left for future work.
Watch out that those sorting criteria are slower due to additional joins, additional requests, and poorer indexes.

* i18n:pl

Co-authored-by: Inverle &lt;inverle@proton.me&gt;

* i18n: nl

Co-authored-by: Frans de Jonge &lt;fransdejonge@gmail.com&gt;

* Fix preserve sort

---------

Co-authored-by: Inverle &lt;inverle@proton.me&gt;
Co-authored-by: Frans de Jonge &lt;fransdejonge@gmail.com&gt;</content>
</entry>
<entry>
<title>Implement custom feed favicons (#7646)</title>
<updated>2025-06-30T10:01:56+00:00</updated>
<author>
<name>Inverle</name>
<email>inverle@proton.me</email>
</author>
<published>2025-06-30T10:01:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rdnlsmith.com/fresh-rss-custom/commit/?id=7915abd833e1ab7a72ad27b3ec52020ac9ab7051'/>
<id>urn:sha1:7915abd833e1ab7a72ad27b3ec52020ac9ab7051</id>
<content type='text'>
Closes #3789, #6503

Icon setting when no custom icon is set yet:

![image](https://github.com/user-attachments/assets/28b07dd0-7dac-4c76-b1d7-77035f91a87a)

- `Change...` button opens a file dialog, and after selecting a file shows the chosen icon in the preview on the left. `Submit` must be clicked after selecting the icon.
- `Reset to default` changes the preview icon to the default one, and also requires `Submit` to be clicked to apply the changes.

Full list of changes:
- CSP now includes `blob:` in `img-src` for
   - `indexAction()` and `feedAction()` in `subscriptionController.php`
   - all of the view actions in `indexController.php`
- Introduce new attribute `customFavicon (boolean)` for feeds that indicates if the feed has a custom favicon
   - `hashFavicon()` in `Feed.php` is dependent on this attribute
      - `hashFavicon()` has a new parameter called `skipCache (boolean)` that allows the reset of the favicon hash for the Feed object
      - `resetFaviconHash()` just calls `hashFavicon(skipCache: true)`
- `f.php` URLs now have the format of `/f.php?h=XXXXX&amp;t=cachebuster`, where the `t` parameter is only used for serving custom favicons
   - if `t` parameter is set, `f.php` returns a `Cache-Control: immutable` header
- `stripos` and `strpos` were changed to `str_contains` in various places (refactor)
- JS for handling the custom favicon configuration logic is in `extra.js` inside `init_update_feed()` which is called when feed configuration is opened from the aside or when the subscription management page with the feed is loaded
   - Server-side code for uploading the icon in `subscriptionController.php` under `feedAction()`
   - Errors that may occur during the setting of a custom favicon:
      - Unsupported image file type (handled only server-side with `isImgMime()`)
      - When the file is bigger than 1 MiB (default), handled both client-side and server-side
      - Standard feed error when `updateFeed()` fails
- JS vars `javascript_vars.phtml` are no longer escaped with `htmlspecialchars()`, instead with json encoding,
- CSS for disabled buttons was added
- Max favicon file size is configurable with the `max_favicon_upload_size` option in `config.php` (not exposed via UI)
- Custom favicons are currently deleted only when they are either reset to the default icon, or the feed gets deleted. They do not get deleted when the user deletes their account without removing their feeds first.
- ` faviconPrepare()` and `faviconRebuild()` are not allowed to be called when the `customFavicon` attribute is `true`
- New i18n strings:
   - `'sub.feed.icon' =&gt; 'Icon'`
   - `'sub.feed.change_favicon' =&gt; 'Change…'`
   - `'sub.feed.reset_favicon' =&gt; 'Reset to default'`
   - `'sub.feed.favicon_changed_by_ext' =&gt; 'The icon has been set by the &lt;b&gt;%s&lt;/b&gt; extension.'`
   - `'feedback.sub.feed.favicon.too_large' =&gt; 'Uploaded icon is too large. The maximum file size is &lt;em&gt;%s&lt;/em&gt;.'`
   - `'feedback.sub.feed.favicon.unsupported_format' =&gt; 'Unsupported image file format!'`
- Extension hook `custom_favicon_hash`
   - `setCustomFavicon()` method
   - `resetCustomFavicon()` method
   - `customFaviconExt` and `customFaviconDisallowDel` attributes
   - example of usage: https://github.com/FreshRSS/Extensions/pull/337
- Extension hook `custom_favicon_btn_url`
   - Allows extensions to implement a button for setting a custom favicon for individual feeds by providing an URL. The URL will be sent a POST request with the `extAction` field set to either `query_icon_info` or `update_icon`, along with an `id` field which describes the feed's ID.
</content>
</entry>
<entry>
<title>Exposed the reading modes for extensions through Minz (#7668)</title>
<updated>2025-06-21T22:36:32+00:00</updated>
<author>
<name>Stefan</name>
<email>11146296+tryallthethings@users.noreply.github.com</email>
</author>
<published>2025-06-21T22:36:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rdnlsmith.com/fresh-rss-custom/commit/?id=51298cd6bc100b1cc6508abb602a59c01a9e2c04'/>
<id>urn:sha1:51298cd6bc100b1cc6508abb602a59c01a9e2c04</id>
<content type='text'>
* + Exposed the reading modes for extensions through Minz. Now extensions can add a custom view mode. Graceful fallback to normal view in case the extension was disabled without resetting the view_mode through the uninstall method. In that case the user will be informed via Minz_Request::setBadNotification that the view has been reset to normal.
+ Added translation strings for de, en and en-us for the notification

* + Added missing, generated translations

* Simplify indexAction, performance

* Minor settings htmlspecialchars

* i18n: fr

* Minor wording

* Doc

* Fix i18n

---------

Co-authored-by: Alexandre Alapetite &lt;alexandre@alapetite.fr&gt;</content>
</entry>
<entry>
<title>frame-ancestors CSP (#7677)</title>
<updated>2025-06-18T20:20:17+00:00</updated>
<author>
<name>Inverle</name>
<email>inverle@proton.me</email>
</author>
<published>2025-06-18T20:20:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rdnlsmith.com/fresh-rss-custom/commit/?id=a6948218fb1c66fe146c7651555e5a1f791c8112'/>
<id>urn:sha1:a6948218fb1c66fe146c7651555e5a1f791c8112</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix newest articles not shown (#7577)</title>
<updated>2025-05-10T21:17:25+00:00</updated>
<author>
<name>Alexandre Alapetite</name>
<email>alexandre@alapetite.fr</email>
</author>
<published>2025-05-10T21:17:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rdnlsmith.com/fresh-rss-custom/commit/?id=532d229d3396817f702c1ecae79fb7f9bdad9a64'/>
<id>urn:sha1:532d229d3396817f702c1ecae79fb7f9bdad9a64</id>
<content type='text'>
* Fix newest articles not shown
Case when processing was faster than 1 second.
fix https://github.com/FreshRSS/FreshRSS/issues/7412
Regression from https://github.com/FreshRSS/FreshRSS/pull/7149

* Simplify uTimeString()
PHPStan has become a bit smarter</content>
</entry>
<entry>
<title>Fix continuous mode (#7200)</title>
<updated>2025-01-08T14:10:39+00:00</updated>
<author>
<name>Alexandre Alapetite</name>
<email>alexandre@alapetite.fr</email>
</author>
<published>2025-01-08T14:10:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rdnlsmith.com/fresh-rss-custom/commit/?id=3280ec617f8081bf0d5349e441ae564a42fdc500'/>
<id>urn:sha1:3280ec617f8081bf0d5349e441ae564a42fdc500</id>
<content type='text'>
fix https://github.com/FreshRSS/FreshRSS/issues/7199</content>
</entry>
<entry>
<title>Implement custom order-by (#7149)</title>
<updated>2025-01-06T15:00:00+00:00</updated>
<author>
<name>Alexandre Alapetite</name>
<email>alexandre@alapetite.fr</email>
</author>
<published>2025-01-06T15:00:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rdnlsmith.com/fresh-rss-custom/commit/?id=1f466d7a2e6c8488d69012b40b40a5c1ed6ff4aa'/>
<id>urn:sha1:1f466d7a2e6c8488d69012b40b40a5c1ed6ff4aa</id>
<content type='text'>
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:
* `&amp;sort=id` (current behaviour, sorting according to newest received articles)
* `&amp;sort=date` (publication date, which is not indicative of how new an article is)
* `&amp;sort=title`
* `&amp;sort=link`
* `&amp;sort=rand` (random order - which disables infinite scrolling, at least for now)

combined with `&amp;order=ASC` or `&amp;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&amp;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.
</content>
</entry>
<entry>
<title>Fix regressions on some array structures (#7155)</title>
<updated>2024-12-28T22:58:00+00:00</updated>
<author>
<name>Alexandre Alapetite</name>
<email>alexandre@alapetite.fr</email>
</author>
<published>2024-12-28T22:58:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rdnlsmith.com/fresh-rss-custom/commit/?id=c29cbb7b8be95fee249ed1a21dce98a4772d92e2'/>
<id>urn:sha1:c29cbb7b8be95fee249ed1a21dce98a4772d92e2</id>
<content type='text'>
regressions from https://github.com/FreshRSS/FreshRSS/pull/7131
fix https://github.com/FreshRSS/FreshRSS/issues/7154</content>
</entry>
</feed>
