diff options
| author | 2025-10-26 15:07:38 +0100 | |
|---|---|---|
| committer | 2025-10-26 15:07:38 +0100 | |
| commit | 1217b6de34cc5f23cc73d8d37a51c4616a3780ab (patch) | |
| tree | 193f43d5c654a2dbd5a9da1703956ee97a15fb17 /app | |
| parent | e18ac172db58b66b50c21dc03fcb157768f8fd8a (diff) | |
OPML export/import frss:priority (#8158)
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/7583
Diffstat (limited to 'app')
| -rw-r--r-- | app/Services/ExportService.php | 6 | ||||
| -rw-r--r-- | app/Services/ImportService.php | 9 | ||||
| -rw-r--r-- | app/views/helpers/export/opml.phtml | 9 |
3 files changed, 24 insertions, 0 deletions
diff --git a/app/Services/ExportService.php b/app/Services/ExportService.php index 69f0b3d2b..14f0a3f5c 100644 --- a/app/Services/ExportService.php +++ b/app/Services/ExportService.php @@ -23,6 +23,12 @@ class FreshRSS_Export_Service { final public const TYPE_JSONFEED = 'JSONFeed'; final public const TYPE_HTML_XPATH_JSON_DOTNOTATION = 'HTML+XPath+JSON+DotNotation'; + final public const PRIORITY_IMPORTANT = 'important'; + final public const PRIORITY_MAIN_STREAM = 'main'; + final public const PRIORITY_CATEGORY = 'category'; + final public const PRIORITY_FEED = 'feed'; + final public const PRIORITY_HIDDEN = 'hidden'; + /** * Initialize the service for the given user. */ diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index b567544b3..1ab2b8d69 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -177,6 +177,15 @@ class FreshRSS_Import_Service { break; } + $feed->_priority(match (strtolower($feed_elt['frss:priority'] ?? '')) { + FreshRSS_Export_Service::PRIORITY_IMPORTANT => FreshRSS_Feed::PRIORITY_IMPORTANT, + FreshRSS_Export_Service::PRIORITY_MAIN_STREAM => FreshRSS_Feed::PRIORITY_MAIN_STREAM, + FreshRSS_Export_Service::PRIORITY_CATEGORY => FreshRSS_Feed::PRIORITY_CATEGORY, + FreshRSS_Export_Service::PRIORITY_FEED => FreshRSS_Feed::PRIORITY_FEED, + FreshRSS_Export_Service::PRIORITY_HIDDEN => FreshRSS_Feed::PRIORITY_HIDDEN, + default => FreshRSS_Feed::PRIORITY_MAIN_STREAM, + }); + 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 fba6d2498..de044332e 100644 --- a/app/views/helpers/export/opml.phtml +++ b/app/views/helpers/export/opml.phtml @@ -38,6 +38,15 @@ function feedsToOutlines(array $feeds, bool $excludeMutedFeeds = false): array { break; } + $outline['frss:priority'] = match ($feed->priority()) { + FreshRSS_Feed::PRIORITY_IMPORTANT => FreshRSS_Export_Service::PRIORITY_IMPORTANT, + FreshRSS_Feed::PRIORITY_MAIN_STREAM => null, // Default + FreshRSS_Feed::PRIORITY_CATEGORY => FreshRSS_Export_Service::PRIORITY_CATEGORY, + FreshRSS_Feed::PRIORITY_FEED => FreshRSS_Export_Service::PRIORITY_FEED, + FreshRSS_Feed::PRIORITY_HIDDEN => FreshRSS_Export_Service::PRIORITY_HIDDEN, + default => null, + }; + if ($feed->kind() === FreshRSS_Feed::KIND_HTML_XPATH || $feed->kind() === FreshRSS_Feed::KIND_XML_XPATH) { /** @var array<string,string> */ $xPathSettings = $feed->attributeArray('xpath') ?? []; |
