An integer literal above PHP_INT_MAX is a float on x86, and _id() only
accepted int|string, so the export test failed there with "must be of type
string|int, float given".
* Build entry IDs as strings in the tests
1700000000000000 + $i is a float on 32-bit platforms, where it exceeds
PHP_INT_MAX, and FreshRSS_Entry::_id() rejects it. Entry IDs are strings
everywhere else, since uTimeString() and the DAO layer both produce
numeric strings, so keep the ID a string in the test instead of accepting
a float. A test now pins that contract.
Refs #9569
---------
Co-authored-by: Raed <Raed2180416@users.noreply.github.com>
* Add option to open articles on their original website
Clicking an article title can now open the original website instead of the article in FreshRSS. The link icon then opens the article in FreshRSS.
fix https://github.com/FreshRSS/FreshRSS/issues/1954
* i18n: fr
---------
Co-authored-by: Eduardo Coronell <eduardo.coronell@aspsols.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
* feat: add the <enclosure/> field to enhance compatibility with BitTorrent downloaders
Closes#6227
Changes proposed in this pull request:
- Emit an additional RSS 2.0 `<enclosure>` element for BitTorrent attachments in the
generated RSS output (`p/api/query.php?...&f=rss` and the per-feed RSS view).
The existing `<media:content>` output is unchanged.
- Emit it only for `application/x-bittorrent`, `magnet:` and `.torrent` URLs, and skip
images / audio / video. Since 1.24 thumbnails are prepended to the enclosure list, a
naive implementation would duplicate cover images (and podcast media) as attachments.
- Always set `type="application/x-bittorrent"`, and copy `length` when the feed provides it.
- Add unit tests in `tests/app/Views/rssViewTest.php`: torrent, magnet without type,
image attachment skipped.
* fix(rss): emit <enclosure> only for BitTorrent attachments
The previous patch emitted <enclosure> for every enclosure. Since FreshRSS
1.24, thumbnails are prepended to the enclosures list, so cover images and
podcast audio were also duplicated as RSS attachments. Emit the tag only for
application/x-bittorrent, magnet: or .torrent URLs, and always set
type="application/x-bittorrent" so clients such as qBittorrent can use it.
Add three rssViewTest cases: torrent, magnet without type, image skipped.
* Improve regex
* Minor whitespace
---------
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
* Preserve explicit sort overrides when searching
Closes#9466
Changes proposed in this pull request:
- Keep an explicit sort override when submitting the header search form, including `c.name`, `f.name` and `lastUserModified`.
- Continue using the already validated `FreshRSS_Context::$sort` value; omit the hidden field when no non-empty override was requested.
- Add header-rendering regression tests for all nine supported sorts, absent/empty overrides and invalid input.
* A bit more fixing
* Fix line mistake
* Forgotten plaintext
* Fix test
---------
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Contributes to #6139 (export part; the import will follow in another PR)
Exporting favourites was collecting the whole file in memory. With many articles, it fails with the default PHP memory limit.
## Changes
- New `Minz_View::helperToFile()`, similar to `helperToString()`, writing the output of a helper into a file by chunks of 64 KiB instead of keeping it in memory.
- `FreshRSS_Export_Service`: the `generate*()` methods now return the path of a temporary file instead of the content, and `zip()` builds the archive from those files (`ZipArchive::addFile()` instead of `addFromString()`). Temporary files are created in `TMP_PATH` (already required to be writable) and deleted at the end of the script.
- The export is sent with `readfile()`: Web UI, `cli/export-zip-for-user.php`, `cli/export-opml-for-user.php` and the OPML export of the Google Reader API.
- Note: this changes what `FreshRSS_Export_Service` returns (a path instead of the content). All callers in the repository are updated, and I could not find any public extension using this service.
## Measurements
Peak PHP memory (`memory_get_peak_usage(true)`), SQLite database with synthetic starred articles:
| Scenario | Before | After |
|---|---|---|
| Web, export your favourites, 10,000 articles (69 MB JSON) | 136 MB (fails with the default `memory_limit` of 128 MB) | 6 MB |
| Web, ZIP (OPML + favourites + labelled articles + 4 feeds), 10,000 articles | 152 MB | 6 MB |
| CLI `export-zip-for-user.php`, 10,000 articles | 189 MB (fails with 128 MB) | 8 MB |
| Web, export your favourites, 30,000 articles (208 MB JSON) | 404 MB | 10 MB |
Co-authored-by: Alejandro Borrego <210245044+abp002@users.noreply.github.com>
Closes#9288
Changes proposed in this pull request:
The mark-as-read links contain the resolved state, so the automatic reading preference becomes an explicit `state=2` filter after the redirect. Once the last unread article is marked read, the page stays empty instead of showing all articles.
- Keep the requested state separately from the resolved state used by the action. A redirect state of `0` reapplies the reading preference; explicit filters still survive the redirect as intended by #9007.
- Carry that value through the menu, footer and “Load more” link. This matters with oldest-first pagination, where the last footer supplies the menu button's action.
- Add request-state and rendered-pagination tests, plus a changelog entry.
How to test the feature manually:
1. With both read and unread articles, choose “Show unreads if any, all articles otherwise”. Mark all as read from the footer, then repeat using the top button. The resulting page should show the read articles.
2. Set one article per page and oldest-first sorting. Load the remaining articles before marking all as read; the same fallback should work.
3. Select an explicit unread filter: marking everything read should still leave an empty unread view. Also check a favourite filter with a search term, including “Mark selection unread”; the search and favourite scope should remain intact.
Validation: `make NO_DOCKER=1 fix-all` and `make NO_DOCKER=1 test-all` pass with PHP 8.5.9 (719 PHPUnit tests, 1,378 assertions). Browser checks passed against SQLite in Chromium (desktop and mobile viewport) and Firefox. The original footer fails three of the six new rendered-pagination cases.
The loop building the media credits assigned instead of appending, so an enclosure with several credits only kept the last one.
`app/views/index/rss.phtml` builds the `<media:credit>` elements for an enclosure in a loop, but assigns instead of appends:
```php
$mediaCredits = '';
foreach ($credits as $credit) {
$mediaCredits = '<media:credit>' . $credit . '</media:credit>';
}
```
So an enclosure with three credits emits only the last one. Every iteration throws away what the previous one built.
This came in with #6272 ("Allow multiple authors on enclosures", which closed#5066). Parsing and display got multi-credit support, but FreshRSS's own generated RSS still passes on a single credit, so a downstream reader subscribing to a FreshRSS feed sees the same symptom #5066 described.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>