Skip to content

A free, self-hostable news aggregator…

OPML: include each feed's refresh interval (TTL) in export/import (#8982)

Jam Balayacf2ceafca167
diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php
index 739c217c2..5eddbd972 100644
--- a/app/Services/ImportService.php
+++ b/app/Services/ImportService.php
@@ -195,6 +195,11 @@ class FreshRSS_Import_Service {
$feed->_attribute('unicityCriteriaForced', true);
}
+ if (isset($feed_elt['frss:ttl'])) {
+ // Signed refresh interval (TTL); a negative value indicates a muted feed
+ $feed->_ttl((int)$feed_elt['frss:ttl']);
+ }
+
if (isset($feed_elt['frss:cssFullContent'])) {
$feed->_pathEntries(Minz_Helper::htmlspecialchars_utf8($feed_elt['frss:cssFullContent']));
}
diff --git a/app/views/helpers/export/opml.phtml b/app/views/helpers/export/opml.phtml
index 176c1fb84..45d7e1d29 100644
--- a/app/views/helpers/export/opml.phtml
+++ b/app/views/helpers/export/opml.phtml
@@ -55,6 +55,11 @@ function feedsToOutlines(array $feeds, bool $excludeMutedFeeds = false): array {
$outline['frss:unicityCriteriaForced'] = 'true';
}
+ // Refresh interval (TTL), signed: a negative value indicates a muted feed
+ if ($feed->ttl(raw: true) !== FreshRSS_Feed::TTL_DEFAULT) {
+ $outline['frss:ttl'] = (string)$feed->ttl(raw: true);
+ }
+
if ($feed->kind() === FreshRSS_Feed::KIND_HTML_XPATH || $feed->kind() === FreshRSS_Feed::KIND_XML_XPATH) {
/** @var array<string,string> */
$xPathSettings = $feed->attributeArray('xpath') ?? [];
diff --git a/docs/en/developers/OPML.md b/docs/en/developers/OPML.md
index e2dc85eb7..1fbfa0408 100644
--- a/docs/en/developers/OPML.md
+++ b/docs/en/developers/OPML.md
@@ -92,6 +92,7 @@ A number of [cURL options](https://curl.se/libcurl/c/curl_easy_setopt.html) are
* `frss:priority`: Used for priority / visibility of the articles of that feed. Can be: `important`, `main` (default), `category`, `feed`, `hidden`.
* `frss:unicityCriteria`: Criteria used for the unicity of articles. E.g. `id` (default), `link`, `sha1:link_published`, `sha1:link_published_title`, `sha1:title`, [etc](https://github.com/FreshRSS/FreshRSS/blob/1c92d55917029d291d00009b674d8552934a69ec/app/Models/Feed.php#L652-L666).
* `frss:unicityCriteriaForced`: Boolean to force the usage of the selected unicity criterion even in the case of many duplicates (otherwise, the default behaviour is to fall back to a more precise unicity criteria).
+* `frss:ttl`: Refresh interval of the feed, in seconds. A negative value indicates a muted feed (automatic refresh disabled). When absent, the importing instance’s default refresh interval is used.
* `frss:cssFullContent`: [CSS Selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) to enable the download and extraction of the matching HTML section of each articles’ Web address.
* Example: `div.main, .summary`
* `frss:cssContentFilter`: [CSS Selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) to remove the matching HTML elements from the article content or from the full content retrieved by `frss:cssFullContent`.