A free, self-hostable news aggregator…
Add per-feed option to show or hide enclosures (#9015)
Gerard Alvear Porras1b8eb17858b1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 490ef76e6..552601a10 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -18,6 +18,7 @@ See also [the FreshRSS releases](https://github.com/FreshRSS/FreshRSS/releases).* Features* New option to hide badges showing number of unread articles (*Phantom Obligation*) [#8844](https://github.com/FreshRSS/FreshRSS/pull/8844)* New option to keep or not the custom sort order when navigating between categories and feeds [#8969](https://github.com/FreshRSS/FreshRSS/pull/8969)+ * New per-feed option to show or hide enclosures (attachments) [#4999](https://github.com/FreshRSS/FreshRSS/issues/4999)* Bug fixing* Fix lost elements while parsing search query [#8884](https://github.com/FreshRSS/FreshRSS/pull/8884)* CLIdiff --git a/README.fr.md b/README.fr.mdindex 8e34154e3..ff49dd131 100644--- a/README.fr.md+++ b/README.fr.md@@ -234,7 +234,7 @@ Voir le [dépôt dédié à ces extensions](https://github.com/FreshRSS/Extensio| English (United States) (en-US) | ■■■■■■■■■■ 100% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fen-US+%2F%28TODO%7CDIRTY%29%24%2F) || Español (es) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fes+%2F%28TODO%7CDIRTY%29%24%2F) || فارسی (fa) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffa+%2F%28TODO%7CDIRTY%29%24%2F) |-| Suomi (fi) | ■■■■■■■■■・ 92% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffi+%2F%28TODO%7CDIRTY%29%24%2F) |+| Suomi (fi) | ■■■■■■■■■・ 91% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffi+%2F%28TODO%7CDIRTY%29%24%2F) || Français (fr) | ■■■■■■■■■■ 100% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffr+%2F%28TODO%7CDIRTY%29%24%2F) || עברית (he) | ■■■■・・・・・・ 41% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fhe+%2F%28TODO%7CDIRTY%29%24%2F) || Magyar (hu) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fhu+%2F%28TODO%7CDIRTY%29%24%2F) |diff --git a/README.md b/README.mdindex a302e3db8..6d35cae3f 100644--- a/README.md+++ b/README.md@@ -130,7 +130,7 @@ See the [repository dedicated to those extensions](https://github.com/FreshRSS/E| English (United States) (en-US) | ■■■■■■■■■■ 100% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fen-US+%2F%28TODO%7CDIRTY%29%24%2F) || Español (es) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fes+%2F%28TODO%7CDIRTY%29%24%2F) || فارسی (fa) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffa+%2F%28TODO%7CDIRTY%29%24%2F) |-| Suomi (fi) | ■■■■■■■■■・ 92% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffi+%2F%28TODO%7CDIRTY%29%24%2F) |+| Suomi (fi) | ■■■■■■■■■・ 91% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffi+%2F%28TODO%7CDIRTY%29%24%2F) || Français (fr) | ■■■■■■■■■■ 100% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffr+%2F%28TODO%7CDIRTY%29%24%2F) || עברית (he) | ■■■■・・・・・・ 41% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fhe+%2F%28TODO%7CDIRTY%29%24%2F) || Magyar (hu) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fhu+%2F%28TODO%7CDIRTY%29%24%2F) |diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.phpindex 2bb206563..4c15ee19e 100644--- a/app/Controllers/subscriptionController.php+++ b/app/Controllers/subscriptionController.php@@ -153,6 +153,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {if (Minz_Request::hasParam('show_unread_count')) {$feed->_attribute('show_unread_count', Minz_Request::paramTernary('show_unread_count'));}+ $feed->_attribute('display_enclosures', Minz_Request::paramTernary('display_enclosures'));$keep_max_n_unread = Minz_Request::paramTernary('keep_max_n_unread') === true ? Minz_Request::paramInt('keep_max_n_unread') : null;$feed->_attribute('keep_max_n_unread', $keep_max_n_unread >= 0 ? $keep_max_n_unread : null);diff --git a/app/Models/Entry.php b/app/Models/Entry.phpindex bce9fc00b..515f39892 100644--- a/app/Models/Entry.php+++ b/app/Models/Entry.php@@ -1249,7 +1249,7 @@ class FreshRSS_Entry extends Minz_Model {$item['title'] = escapeToUnicodeAlternative($this->title(), false);unset($item['alternate'][0]['type']);$item['summary'] = [- 'content' => mb_strcut($this->content(true), 0, self::API_MAX_COMPAT_CONTENT_LENGTH, 'UTF-8'),+ 'content' => mb_strcut($this->content($feed?->attributeBoolean('display_enclosures') ?? true), 0, self::API_MAX_COMPAT_CONTENT_LENGTH, 'UTF-8'),];} else {$item['content'] = [diff --git a/app/i18n/cs/conf.php b/app/i18n/cs/conf.phpindex c3f2ba365..fa5119bd4 100644--- a/app/i18n/cs/conf.php+++ b/app/i18n/cs/conf.php@@ -38,6 +38,7 @@ return array('help' => 'For compatible themes only', // TODO'no' => 'Ne',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Spodní řádek','display_authors' => 'Autoři',diff --git a/app/i18n/de/conf.php b/app/i18n/de/conf.phpindex b6890e7d7..3fc66c3a0 100644--- a/app/i18n/de/conf.php+++ b/app/i18n/de/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Nur für kompatible Themes','no' => 'Nein',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Fußzeile','display_authors' => 'Autoren',diff --git a/app/i18n/el/conf.php b/app/i18n/el/conf.phpindex 85b41ab6c..de8120843 100644--- a/app/i18n/el/conf.php+++ b/app/i18n/el/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Μόνο για συμβατά θέματα','no' => 'Όχι',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Κάτω γραμμή','display_authors' => 'Συντάκτες',diff --git a/app/i18n/en-US/conf.php b/app/i18n/en-US/conf.phpindex 7fc6bc2dc..6ff926773 100644--- a/app/i18n/en-US/conf.php+++ b/app/i18n/en-US/conf.php@@ -38,6 +38,7 @@ return array('help' => 'For compatible themes only', // IGNORE'no' => 'No', // IGNORE),+ 'display_enclosures' => 'Show enclosures', // IGNORE'icon' => array('bottom_line' => 'Bottom line', // IGNORE'display_authors' => 'Authors', // IGNOREdiff --git a/app/i18n/en/conf.php b/app/i18n/en/conf.phpindex b6f580e6b..4e1fa7a43 100644--- a/app/i18n/en/conf.php+++ b/app/i18n/en/conf.php@@ -38,6 +38,7 @@ return array('help' => 'For compatible themes only','no' => 'No',),+ 'display_enclosures' => 'Show enclosures','icon' => array('bottom_line' => 'Bottom line','display_authors' => 'Authors',diff --git a/app/i18n/es/conf.php b/app/i18n/es/conf.phpindex f5b7e3342..f7540396e 100644--- a/app/i18n/es/conf.php+++ b/app/i18n/es/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Solo para temas compatibles','no' => 'No', // IGNORE),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Línea inferior','display_authors' => 'Autores',diff --git a/app/i18n/fa/conf.php b/app/i18n/fa/conf.phpindex 80e6ee880..a13d4f98b 100644--- a/app/i18n/fa/conf.php+++ b/app/i18n/fa/conf.php@@ -38,6 +38,7 @@ return array('help' => 'کمک','no' => 'خیر',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => ' خط پایین','display_authors' => ' نویسندگان',diff --git a/app/i18n/fi/conf.php b/app/i18n/fi/conf.phpindex 789c5ecd3..82681613e 100644--- a/app/i18n/fi/conf.php+++ b/app/i18n/fi/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Toimii vain yhteensopivissa teemoissa','no' => 'Ei',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Alin rivi','display_authors' => 'Kirjoittajat',diff --git a/app/i18n/fr/conf.php b/app/i18n/fr/conf.phpindex 19609bbed..a1d5d31e9 100644--- a/app/i18n/fr/conf.php+++ b/app/i18n/fr/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Seulement pour les thèmes compatibles','no' => 'Non',),+ 'display_enclosures' => 'Afficher les pièces jointes','icon' => array('bottom_line' => 'Ligne du bas','display_authors' => 'Auteurs',diff --git a/app/i18n/he/conf.php b/app/i18n/he/conf.phpindex acf340529..e4834a107 100644--- a/app/i18n/he/conf.php+++ b/app/i18n/he/conf.php@@ -38,6 +38,7 @@ return array('help' => 'For compatible themes only', // TODO'no' => 'No', // TODO),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'שורה תחתונה','display_authors' => 'Authors', // TODOdiff --git a/app/i18n/hu/conf.php b/app/i18n/hu/conf.phpindex 7e41e716f..c4c6cc8c2 100644--- a/app/i18n/hu/conf.php+++ b/app/i18n/hu/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Csak kompatibilis témákhoz','no' => 'Nem',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Alsó sor','display_authors' => 'Szerzők',diff --git a/app/i18n/id/conf.php b/app/i18n/id/conf.phpindex c5f551dd5..262bd783a 100644--- a/app/i18n/id/conf.php+++ b/app/i18n/id/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Hanya untuk tema yang kompatibel','no' => 'Tidak',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Baris bawah','display_authors' => 'Penulis',diff --git a/app/i18n/it/conf.php b/app/i18n/it/conf.phpindex 4d37ee571..85a894f83 100644--- a/app/i18n/it/conf.php+++ b/app/i18n/it/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Solo per i temi compatibili','no' => 'No', // IGNORE),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Barra in fondo','display_authors' => 'Autori',diff --git a/app/i18n/ja/conf.php b/app/i18n/ja/conf.phpindex 4076f50a3..28c6d4d1b 100644--- a/app/i18n/ja/conf.php+++ b/app/i18n/ja/conf.php@@ -38,6 +38,7 @@ return array('help' => '対応テーマのみ','no' => '無効',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => '下段','display_authors' => '著者',diff --git a/app/i18n/ko/conf.php b/app/i18n/ko/conf.phpindex 662deb914..d18683002 100644--- a/app/i18n/ko/conf.php+++ b/app/i18n/ko/conf.php@@ -38,6 +38,7 @@ return array('help' => 'For compatible themes only', // TODO'no' => '끄기',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => '하단','display_authors' => '저자',diff --git a/app/i18n/lv/conf.php b/app/i18n/lv/conf.phpindex 758b51eff..b1d27af31 100644--- a/app/i18n/lv/conf.php+++ b/app/i18n/lv/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Tikai saderīgām tēmām','no' => 'Nē',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Apakšējā līnija','display_authors' => 'Autori',diff --git a/app/i18n/nl/conf.php b/app/i18n/nl/conf.phpindex bd6b34552..f08ef6b2b 100644--- a/app/i18n/nl/conf.php+++ b/app/i18n/nl/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Alleen voor compatibele thema’s','no' => 'Nee',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Onderaan','display_authors' => 'Auteurs',diff --git a/app/i18n/oc/conf.php b/app/i18n/oc/conf.phpindex 3e4d609a8..43aa3bff3 100644--- a/app/i18n/oc/conf.php+++ b/app/i18n/oc/conf.php@@ -38,6 +38,7 @@ return array('help' => 'For compatible themes only', // TODO'no' => 'No', // TODO),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Linha enbàs','display_authors' => 'Autors',diff --git a/app/i18n/pl/conf.php b/app/i18n/pl/conf.phpindex c4c0abf42..7b3a75315 100644--- a/app/i18n/pl/conf.php+++ b/app/i18n/pl/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Wyłącznie dla kompatybilnych wyglądów','no' => 'Wyłączony',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Dolny margines','display_authors' => 'Autorzy',diff --git a/app/i18n/pt-BR/conf.php b/app/i18n/pt-BR/conf.phpindex be13a5b71..d3b9e6b3c 100644--- a/app/i18n/pt-BR/conf.php+++ b/app/i18n/pt-BR/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Somente para temas compatíveis','no' => 'Não',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Linha inferior','display_authors' => 'Autores',diff --git a/app/i18n/pt-PT/conf.php b/app/i18n/pt-PT/conf.phpindex 98d0f09a8..485d0908d 100644--- a/app/i18n/pt-PT/conf.php+++ b/app/i18n/pt-PT/conf.php@@ -38,6 +38,7 @@ return array('help' => 'For compatible themes only', // TODO'no' => 'Não',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Linha inferior','display_authors' => 'Autores',diff --git a/app/i18n/ru/conf.php b/app/i18n/ru/conf.phpindex ef67099d3..4ec070a74 100644--- a/app/i18n/ru/conf.php+++ b/app/i18n/ru/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Только для совместимых тем','no' => 'Нет',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Нижняя линия','display_authors' => 'Авторы',diff --git a/app/i18n/sk/conf.php b/app/i18n/sk/conf.phpindex d6ac27f94..fc4257ff8 100644--- a/app/i18n/sk/conf.php+++ b/app/i18n/sk/conf.php@@ -38,6 +38,7 @@ return array('help' => 'For compatible themes only', // TODO'no' => 'Nie',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Spodný riadok','display_authors' => 'Autori',diff --git a/app/i18n/tr/conf.php b/app/i18n/tr/conf.phpindex 5004ea342..aa33be7eb 100644--- a/app/i18n/tr/conf.php+++ b/app/i18n/tr/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Yalnızca uyumlu temalar için','no' => 'Hayır',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Alt satır','display_authors' => 'Yazarlar',diff --git a/app/i18n/uk/conf.php b/app/i18n/uk/conf.phpindex cc0ae8f2a..3a040055a 100644--- a/app/i18n/uk/conf.php+++ b/app/i18n/uk/conf.php@@ -38,6 +38,7 @@ return array('help' => 'Лише для підтримуваних тем','no' => 'Вимкнено',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => 'Нижній рядок','display_authors' => 'Автори',diff --git a/app/i18n/zh-CN/conf.php b/app/i18n/zh-CN/conf.phpindex 5ec60ce3e..1d7675925 100644--- a/app/i18n/zh-CN/conf.php+++ b/app/i18n/zh-CN/conf.php@@ -38,6 +38,7 @@ return array('help' => '仅适用于兼容性主题','no' => '关闭',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => '底栏','display_authors' => '作者',diff --git a/app/i18n/zh-TW/conf.php b/app/i18n/zh-TW/conf.phpindex 72a98bcb9..4bd8f6bdb 100644--- a/app/i18n/zh-TW/conf.php+++ b/app/i18n/zh-TW/conf.php@@ -38,6 +38,7 @@ return array('help' => '僅適用於相容主題','no' => '否',),+ 'display_enclosures' => 'Show enclosures', // TODO'icon' => array('bottom_line' => '底部','display_authors' => '作者',diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtmlindex c3b0e5082..2e4fc1ac2 100644--- a/app/views/helpers/feed/update.phtml+++ b/app/views/helpers/feed/update.phtml@@ -173,6 +173,17 @@</div></div>+ <div class="form-group">+ <label class="group-name" for="display_enclosures"><?= _t('conf.display.display_enclosures') ?></label>+ <div class="group-controls">+ <select name="display_enclosures" id="display_enclosures" class="w50">+ <option value=""<?= $this->feed->attributeBoolean('display_enclosures') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>+ <option value="0"<?= $this->feed->attributeBoolean('display_enclosures') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>+ <option value="1"<?= $this->feed->attributeBoolean('display_enclosures') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>+ </select>+ </div>+ </div>+<?php$feedDefaultSort = $this->feed->defaultSort();$feedDefaultOrder = $this->feed->defaultOrder();diff --git a/app/views/helpers/index/article.phtml b/app/views/helpers/index/article.phtmlindex 535f10dda..5510989b0 100644--- a/app/views/helpers/index/article.phtml+++ b/app/views/helpers/index/article.phtml@@ -99,7 +99,7 @@</header><div class="text">- <?= $entry->content(true) ?>+ <?= $entry->content($feed->attributeBoolean('display_enclosures') ?? true) ?></div><?php$display_authors_date = in_array(FreshRSS_Context::userConf()->show_author_date, ['b', 'f'], true);diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtmlindex 5cfa2a774..b7fa0f21b 100644--- a/app/views/index/normal.phtml+++ b/app/views/index/normal.phtml@@ -128,7 +128,9 @@ $today = @strtotime('today');<?php } ?></header><div class="text"><?=- FreshRSS_Context::userConf()->lazyload && !FreshRSS_Context::userConf()->display_posts ? lazyimg($this->entry->content(true)) : $this->entry->content(true)+ FreshRSS_Context::userConf()->lazyload && !FreshRSS_Context::userConf()->display_posts ?+ lazyimg($this->entry->content($this->feed->attributeBoolean('display_enclosures') ?? true)) :+ $this->entry->content($this->feed->attributeBoolean('display_enclosures') ?? true)?></div><?php$display_authors_date = FreshRSS_Context::userConf()->show_author_date === 'f' || FreshRSS_Context::userConf()->show_author_date === 'b';diff --git a/p/api/fever.php b/p/api/fever.phpindex 5d4791851..7a6dcc290 100644--- a/p/api/fever.php+++ b/p/api/fever.php@@ -553,7 +553,8 @@ final class FeverAPI'feed_id' => $entry->feedId(),'title' => escapeToUnicodeAlternative($entry->title(), false),'author' => escapeToUnicodeAlternative(trim($entry->authors(true), '; '), false),- 'html' => $entry->content(), 'url' => htmlspecialchars_decode($entry->link(), ENT_QUOTES),+ 'html' => $entry->content($entry->feed()?->attributeBoolean('display_enclosures') ?? true),+ 'url' => htmlspecialchars_decode($entry->link(), ENT_QUOTES),'is_saved' => $entry->isFavorite() ? 1 : 0,'is_read' => $entry->isRead() ? 1 : 0,'created_on_time' => $entry->date(true),