aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Services/ImportService.php9
-rw-r--r--app/views/helpers/export/opml.phtml8
-rw-r--r--docs/en/developers/OPML.md2
3 files changed, 19 insertions, 0 deletions
diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php
index 26d07faae..22865f873 100644
--- a/app/Services/ImportService.php
+++ b/app/Services/ImportService.php
@@ -186,6 +186,15 @@ class FreshRSS_Import_Service {
default => FreshRSS_Feed::PRIORITY_MAIN_STREAM,
});
+ if (isset($feed_elt['frss:unicityCriteria']) && $feed_elt['frss:unicityCriteria'] !== 'id'
+ && preg_match('/^[a-z:_-]{2,64}$/', $feed_elt['frss:unicityCriteria'])) {
+ $feed->_attribute('unicityCriteria', $feed_elt['frss:unicityCriteria']);
+ }
+
+ if (filter_var($feed_elt['frss:unicityCriteriaForced'] ?? '', FILTER_VALIDATE_BOOLEAN)) {
+ $feed->_attribute('unicityCriteriaForced', true);
+ }
+
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 de044332e..feeb409a5 100644
--- a/app/views/helpers/export/opml.phtml
+++ b/app/views/helpers/export/opml.phtml
@@ -47,6 +47,14 @@ function feedsToOutlines(array $feeds, bool $excludeMutedFeeds = false): array {
default => null,
};
+ if ($feed->attributeString('unicityCriteria') != '' && $feed->attributeString('unicityCriteria') !== 'id') {
+ $outline['frss:unicityCriteria'] = $feed->attributeString('unicityCriteria');
+ }
+
+ if ($feed->attributeBoolean('unicityCriteriaForced')) {
+ $outline['frss:unicityCriteriaForced'] = '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 cc93bfa4f..fba27db79 100644
--- a/docs/en/developers/OPML.md
+++ b/docs/en/developers/OPML.md
@@ -90,6 +90,8 @@ A number of [cURL options](https://curl.se/libcurl/c/curl_easy_setopt.html) are
### Miscellaneous
* `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: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`.