A free, self-hostable news aggregator…
Share in GReader JSON format (#6655)
Alexandre Alapetite5267db88abf7
diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.phpindex 3058483d3..dcd17393e 100644--- a/app/Models/UserQuery.php+++ b/app/Models/UserQuery.php@@ -278,6 +278,13 @@ class FreshRSS_UserQuery {return '';}+ public function sharedUrlGreader(bool $xmlEscaped = true): string {+ if ($this->shareRss && $this->token !== '') {+ return $this->sharedUrl($xmlEscaped) . ($xmlEscaped ? '&' : '&') . 'f=greader';+ }+ return '';+ }+public function sharedUrlHtml(bool $xmlEscaped = true): string {if ($this->shareRss && $this->token !== '') {return $this->sharedUrl($xmlEscaped) . ($xmlEscaped ? '&' : '&') . 'f=html';diff --git a/app/i18n/cs/conf.php b/app/i18n/cs/conf.phpindex ec4c21616..a16d06553 100644--- a/app/i18n/cs/conf.php+++ b/app/i18n/cs/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Hledat „%s“','share' => array('_' => 'Sdílet tento dotaz pomocí odkazu',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Pokud chcete tento dotaz s někým sdílet, uveďte tento odkaz.','html' => 'Odkaz na stránku HTML, který lze sdílet','opml' => 'Odkaz na seznam kanálů OPML, který lze sdílet',diff --git a/app/i18n/de/conf.php b/app/i18n/de/conf.phpindex dadea9736..ba69d4414 100644--- a/app/i18n/de/conf.php+++ b/app/i18n/de/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Suche nach „%s“','share' => array('_' => 'Diese Benutzerabfrage per Link teilen',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Diesen Link verteilen, um in mit Jedem zu teilen','html' => 'Verteilbarer Link zur HTML-Seite','opml' => 'Verteilbarer Link zur OPML Liste der Feeds',diff --git a/app/i18n/el/conf.php b/app/i18n/el/conf.phpindex d1008730a..d74e7a9b1 100644--- a/app/i18n/el/conf.php+++ b/app/i18n/el/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Search for “%s”', // TODO'share' => array('_' => 'Share this query by link', // TODO+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Give this link if you want to share this query with anyone', // TODO'html' => 'Shareable link to the HTML page', // TODO'opml' => 'Shareable link to the OPML list of feeds', // TODOdiff --git a/app/i18n/en-us/conf.php b/app/i18n/en-us/conf.phpindex 4d46d21da..0f3c5e402 100644--- a/app/i18n/en-us/conf.php+++ b/app/i18n/en-us/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Search for “%s”', // IGNORE'share' => array('_' => 'Share this query by link', // IGNORE+ 'greader' => 'Shareable link to the GReader JSON', // IGNORE'help' => 'Give this link if you want to share this query with anyone', // IGNORE'html' => 'Shareable link to the HTML page', // IGNORE'opml' => 'Shareable link to the OPML list of feeds', // IGNOREdiff --git a/app/i18n/en/conf.php b/app/i18n/en/conf.phpindex 66c776bf0..79a69a44d 100644--- a/app/i18n/en/conf.php+++ b/app/i18n/en/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Search for “%s”','share' => array('_' => 'Share this query by link',+ 'greader' => 'Shareable link to the GReader JSON','help' => 'Give this link if you want to share this query with anyone','html' => 'Shareable link to the HTML page','opml' => 'Shareable link to the OPML list of feeds',diff --git a/app/i18n/es/conf.php b/app/i18n/es/conf.phpindex 4612752b5..760bbd513 100644--- a/app/i18n/es/conf.php+++ b/app/i18n/es/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Buscar “%s”','share' => array('_' => 'Comparte esta consulta por enlace',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Dale este enlace si quieres compartir esta consulta con alguien','html' => 'Enlace para compartir a la página HTML','opml' => 'Enlace para compartir a la lista de fuentes de OPML',diff --git a/app/i18n/fa/conf.php b/app/i18n/fa/conf.phpindex 93ecf1a76..0ad91cca1 100644--- a/app/i18n/fa/conf.php+++ b/app/i18n/fa/conf.php@@ -145,6 +145,7 @@ return array('search' => ' «%s» را جستجو کنید','share' => array('_' => 'Share this query by link', // TODO+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Give this link if you want to share this query with anyone', // TODO'html' => 'Shareable link to the HTML page', // TODO'opml' => 'Shareable link to the OPML list of feeds', // TODOdiff --git a/app/i18n/fr/conf.php b/app/i18n/fr/conf.phpindex b821414bf..542bcc700 100644--- a/app/i18n/fr/conf.php+++ b/app/i18n/fr/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Recherche de « %s »','share' => array('_' => 'Partager ce filtre par lien',+ 'greader' => 'Lien partageable au format JSON GReader','help' => 'Donner ce lien pour partager le contenu du filtre avec d’autres personnes','html' => 'Lien partageable de la page HTML','opml' => 'Lien partageable de la liste des flux au format OPML',diff --git a/app/i18n/he/conf.php b/app/i18n/he/conf.phpindex e78c4261c..1e2542019 100644--- a/app/i18n/he/conf.php+++ b/app/i18n/he/conf.php@@ -145,6 +145,7 @@ return array('search' => 'חיפוש “%s”','share' => array('_' => 'Share this query by link', // TODO+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Give this link if you want to share this query with anyone', // TODO'html' => 'Shareable link to the HTML page', // TODO'opml' => 'Shareable link to the OPML list of feeds', // TODOdiff --git a/app/i18n/hu/conf.php b/app/i18n/hu/conf.phpindex b99ec4144..fc489cd3f 100644--- a/app/i18n/hu/conf.php+++ b/app/i18n/hu/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Keresés erre „%s”','share' => array('_' => 'Lekérdezés megosztása linkkel',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Ezt a linket küldd el hogy megoszd a lekérdezést bárkivel','html' => 'Megosztható link a HTML oldalhoz','opml' => 'Megosztható link az OPML hírforrás listához',diff --git a/app/i18n/id/conf.php b/app/i18n/id/conf.phpindex 6fb20c1f4..02f0ba4e6 100644--- a/app/i18n/id/conf.php+++ b/app/i18n/id/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Cari untuk "%s"','share' => array('_' => 'Bagikan permintaan ini melalui tautan',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Berikan tautan ini jika Anda ingin berbagi permintaan ini dengan siapa pun','html' => 'Tautan dapat dibagikan ke halaman HTML','opml' => 'Tautan dapat dibagikan ke daftar OPML dari feed',diff --git a/app/i18n/it/conf.php b/app/i18n/it/conf.phpindex 5e529501b..446111c66 100644--- a/app/i18n/it/conf.php+++ b/app/i18n/it/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Cerca per “%s”','share' => array('_' => 'Condividi questa query tramite un link',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Fornisci questo link se vuoi condividere questa query con altre persone','html' => 'Link condivisibile alla pagina HTML','opml' => 'Link condivisibile alla lista OPML dei feed',diff --git a/app/i18n/ja/conf.php b/app/i18n/ja/conf.phpindex 839384380..fca438862 100644--- a/app/i18n/ja/conf.php+++ b/app/i18n/ja/conf.php@@ -145,6 +145,7 @@ return array('search' => '“%s”で検索する','share' => array('_' => 'このクエリをリンクで共有する',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'このクエリを誰かと共有したい場合は、このリンクを提供してください','html' => 'HTMLページへの共有リンク','opml' => 'フィードのOPMLリストへの共有リンク',diff --git a/app/i18n/ko/conf.php b/app/i18n/ko/conf.phpindex 493f68241..ddbb8cb02 100644--- a/app/i18n/ko/conf.php+++ b/app/i18n/ko/conf.php@@ -145,6 +145,7 @@ return array('search' => '“%s”의 검색 결과','share' => array('_' => '링크로 쿼리 공유',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => '링크를 사용해서 쿼리를 공유하세요','html' => 'HTML 공유 링크','opml' => 'OPML 피드 목록 공유 링크',diff --git a/app/i18n/lv/conf.php b/app/i18n/lv/conf.phpindex dd920acba..a2993ecea 100644--- a/app/i18n/lv/conf.php+++ b/app/i18n/lv/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Meklēt “%s”','share' => array('_' => 'Share this query by link', // TODO+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Give this link if you want to share this query with anyone', // TODO'html' => 'Shareable link to the HTML page', // TODO'opml' => 'Shareable link to the OPML list of feeds', // TODOdiff --git a/app/i18n/nl/conf.php b/app/i18n/nl/conf.phpindex 78d64d293..59eaa38aa 100644--- a/app/i18n/nl/conf.php+++ b/app/i18n/nl/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Zoek naar „%s”','share' => array('_' => 'Deze query delen via een link',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Geef deze link als je deze query met iemand wilt delen','html' => 'Deelbare link naar de HTML-pagina','opml' => 'Deelbare link naar de OPML-lijst van feeds',diff --git a/app/i18n/oc/conf.php b/app/i18n/oc/conf.phpindex c798cc77d..dcdbf2ff2 100644--- a/app/i18n/oc/conf.php+++ b/app/i18n/oc/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Recèrca de « %s »','share' => array('_' => 'Share this query by link', // TODO+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Give this link if you want to share this query with anyone', // TODO'html' => 'Shareable link to the HTML page', // TODO'opml' => 'Shareable link to the OPML list of feeds', // TODOdiff --git a/app/i18n/pl/conf.php b/app/i18n/pl/conf.phpindex db9990dd8..b02442bef 100644--- a/app/i18n/pl/conf.php+++ b/app/i18n/pl/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Szukaj “%s”','share' => array('_' => 'Udostępnij to zapytanie',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Posłuż się tym odnośnikiem, aby podzielić się zapytaniem','html' => 'Odnośnik do strony HTML','opml' => 'Odnośnik do listy kanałów (OPML)',diff --git a/app/i18n/pt-br/conf.php b/app/i18n/pt-br/conf.phpindex a8b88391c..c5f43146f 100644--- a/app/i18n/pt-br/conf.php+++ b/app/i18n/pt-br/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Busca por “%s”','share' => array('_' => 'Compartilhar esta consulta por link',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Forneça este link se quiser compartilhar esta consulta com alguém','html' => 'Link compartilhável para a página HTML','opml' => 'Link compartilhável para a lista de feeds OPML',diff --git a/app/i18n/ru/conf.php b/app/i18n/ru/conf.phpindex edbcf060f..7443c1d40 100644--- a/app/i18n/ru/conf.php+++ b/app/i18n/ru/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Искать “%s”','share' => array('_' => 'Поделиться запросом по ссылке',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Дайте эту ссылку, если хотите поделиться этим запросом с кем-либо','html' => 'Ссылка доступа на HTML-страницу','opml' => 'Ссылка доступа на список лент в формате OPML',diff --git a/app/i18n/sk/conf.php b/app/i18n/sk/conf.phpindex c1280a6a7..bc95a7468 100644--- a/app/i18n/sk/conf.php+++ b/app/i18n/sk/conf.php@@ -145,6 +145,7 @@ return array('search' => 'Vyhľadáva sa: “%s”','share' => array('_' => 'Zdieľať odkaz pre tento dopyt',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Pošlite tento odkaz ak chcete zdielať dopyt s kýmkoľvek','html' => 'Zdielateľný odkaz na HTML stránku','opml' => 'Zdielateľný odkaz na OPML zoznam kanálov',diff --git a/app/i18n/tr/conf.php b/app/i18n/tr/conf.phpindex f853bca40..aeb85a974 100644--- a/app/i18n/tr/conf.php+++ b/app/i18n/tr/conf.php@@ -145,6 +145,7 @@ return array('search' => '“%s” için arama','share' => array('_' => 'Bu aramayı linkle paylaşın',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => 'Bu aramayı herhangi biriyle paylaşmak istiyorsanız bu bağlantıyı verin','html' => 'HTML sayfasına paylaşılabilir bağlantı','opml' => 'OMPL listesine paylaşılabilir bağlantı',diff --git a/app/i18n/zh-cn/conf.php b/app/i18n/zh-cn/conf.phpindex 304e08020..3e63d7485 100644--- a/app/i18n/zh-cn/conf.php+++ b/app/i18n/zh-cn/conf.php@@ -145,6 +145,7 @@ return array('search' => '搜索 “%s”','share' => array('_' => '分享您的自定义查询',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => '获取此自定义查询的分享链接','html' => 'HTML 页面的分享链接','opml' => '订阅源 OPML 的分享链接',diff --git a/app/i18n/zh-tw/conf.php b/app/i18n/zh-tw/conf.phpindex bae9325ca..5b2efd001 100644--- a/app/i18n/zh-tw/conf.php+++ b/app/i18n/zh-tw/conf.php@@ -145,6 +145,7 @@ return array('search' => '搜尋 “%s”','share' => array('_' => '透過連結分享此查詢',+ 'greader' => 'Shareable link to the GReader JSON', // TODO'help' => '如果您想與任何人分享此查詢,請提供此連結','html' => 'HTML 頁面的可共享連結','opml' => 'OPML 源列表的可共享連結',diff --git a/app/views/helpers/configure/query.phtml b/app/views/helpers/configure/query.phtmlindex d23a5adfb..c32bf1e85 100644--- a/app/views/helpers/configure/query.phtml+++ b/app/views/helpers/configure/query.phtml@@ -42,6 +42,7 @@<ul><li><a href="<?= $this->query->sharedUrlHtml() ?>"><?= _i('link') ?> <?= _t('conf.query.share.html') ?></a></li><li><a href="<?= $this->query->sharedUrlRss() ?>"><?= _i('link') ?> <?= _t('conf.query.share.rss') ?></a></li>+ <li><a href="<?= $this->query->sharedUrlGreader() ?>"><?= _i('link') ?> <?= _t('conf.query.share.greader') ?></a></li></ul><?php endif; ?></div>diff --git a/app/views/helpers/export/articles.phtml b/app/views/helpers/export/articles.phtmlindex 40390d832..f62573dd4 100644--- a/app/views/helpers/export/articles.phtml+++ b/app/views/helpers/export/articles.phtml@@ -20,6 +20,10 @@ if (empty($this->entryIdsTagNames)) {}foreach ($this->entries as $entry) {+ if (!$this->internal_rendering) {+ /** @var FreshRSS_Entry */+ $entry = Minz_ExtensionManager::callHook('entry_before_display', $entry);+ }if ($entry == null) {continue;}diff --git a/p/api/query.php b/p/api/query.phpindex 7d74f2313..8fe3c44b0 100644--- a/p/api/query.php+++ b/p/api/query.php@@ -13,7 +13,7 @@ if (!ctype_alnum($token)) {}$format = Minz_Request::paramString('f');-if (!in_array($format, ['atom', 'html', 'opml', 'rss'], true)) {+if (!in_array($format, ['atom', 'greader', 'html', 'json', 'opml', 'rss'], true)) {header('HTTP/1.1 422 Unprocessable Entity');header('Content-Type: text/plain; charset=UTF-8');die('Invalid format `f`!');@@ -63,7 +63,9 @@ foreach (FreshRSS_Context::userConf()->queries as $raw_query) {if (!empty($raw_query['token']) && $raw_query['token'] === $token) {switch ($format) {case 'atom':+ case 'greader':case 'html':+ case 'json':case 'rss':if (empty($raw_query['shareRss'])) {continue 2;@@ -161,6 +163,13 @@ if (in_array($format, ['rss', 'atom'], true)) {header('Content-Type: application/rss+xml; charset=utf-8');$view->_layout(null);$view->_path('index/rss.phtml');+} elseif (in_array($format, ['greader', 'json'], true)) {+ header('Content-Type: application/json; charset=utf-8');+ $view->_layout(null);+ $view->type = 'query/' . $token;+ $view->list_title = $query->getName();+ $view->entryIdsTagNames = []; // Do not export user labels for privacy+ $view->_path('helpers/export/articles.phtml');} elseif ($format === 'opml') {if (!$query->safeForOpml()) {Minz_Error::error(404, 'OPML not allowed for this user query!');