mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-12-02 13:32:43 -05:00
* 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>