aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-11-24 22:01:46 +0100
committerGravatar GitHub <noreply@github.com> 2025-11-24 22:01:46 +0100
commit06d34f9b8ed81854baaaea3a4a7f4e247cab31a0 (patch)
treee189fd1d1e6cfa6416ab4d698eef3975eb1a814b /app
parenta2f309a80097a71402385db29f3b0de5ad040431 (diff)
OPML export/import of unicity criteria (#8243)
Found during https://github.com/FreshRSS/FreshRSS/discussions/8242#discussioncomment-15052838
Diffstat (limited to 'app')
-rw-r--r--app/Services/ImportService.php9
-rw-r--r--app/views/helpers/export/opml.phtml8
2 files changed, 17 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') ?? [];