From 39cc1c11ec596176e842cc98e6a54337e3c04d7e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 26 Feb 2024 09:01:03 +0100 Subject: New feature: shareable user query (#6052) * New feature: shareable user query Share the output of a user query by RSS / HTML / OPML with other people through unique URLs. Replaces the global admin token, which was the only option (but unsafe) to share RSS outputs with other people. Also add a new HTML output for people without an RSS reader. fix https://github.com/FreshRSS/FreshRSS/issues/3066#issuecomment-648977890 fix https://github.com/FreshRSS/FreshRSS/issues/3178#issuecomment-769435504 * Remove unused method * Fix token saving * Implement HTML view * Update i18n for master token * Revert i18n get_favorite * Fix missing i18n for user queries from before this PR * Remove irrelevant tests * Add link to RSS version * Fix getGet * Fix getState * Fix getSearch * Alternative getSearch * Default getOrder * Explicit default state * Fix test * Add OPML sharing * Remove many redundant SQL queries from original implementation of user queries * Fix article tags * Use default user settings * Prepare public search * Fixes * Allow user search on article tags * Implement user search * Revert filter bug * Revert wrong SQL left outer join change * Implement checkboxes * Safe check of OPML * Fix label * Remove RSS button to favour new sharing method That sharing button was using a global admin token * First version of HTTP 304 * Disallow some recusrivity fix https://github.com/FreshRSS/FreshRSS/issues/6086 * Draft of nav * Minor httpConditional * Add support for offset for pagination * Fix offset pagination * Fix explicit order ASC * Add documentation * Help links i18n * Note about deprecated master token * Typo * Doc about format --- app/views/helpers/configure/query.phtml | 67 ++++++++++--- app/views/helpers/export/articles.phtml | 2 +- app/views/helpers/feed/update.phtml | 3 - app/views/helpers/htmlPagination.phtml | 21 ++++ app/views/helpers/index/article.phtml | 117 ++++++++++++++++++++++ app/views/helpers/index/normal/entry_header.phtml | 3 - app/views/helpers/index/tags.phtml | 42 ++++++++ 7 files changed, 234 insertions(+), 21 deletions(-) create mode 100644 app/views/helpers/htmlPagination.phtml create mode 100644 app/views/helpers/index/article.phtml create mode 100644 app/views/helpers/index/tags.phtml (limited to 'app/views/helpers') diff --git a/app/views/helpers/configure/query.phtml b/app/views/helpers/configure/query.phtml index 145425271..49ffbad87 100644 --- a/app/views/helpers/configure/query.phtml +++ b/app/views/helpers/configure/query.phtml @@ -7,7 +7,6 @@ ?>

query->getName() ?>

-
@@ -18,15 +17,53 @@
- + +
- + +
+
+ + query->sharedUrlRss() !== ''): ?> + + +
+
+ + query->sharedUrlOpml() !== ''): ?> +
    +
  • +
+ +
+

+

+
+ +
+
+ +
+
+ +
+

@@ -58,22 +95,24 @@
@@ -83,8 +122,8 @@
diff --git a/app/views/helpers/export/articles.phtml b/app/views/helpers/export/articles.phtml index 6903c3c69..40390d832 100644 --- a/app/views/helpers/export/articles.phtml +++ b/app/views/helpers/export/articles.phtml @@ -24,7 +24,7 @@ foreach ($this->entries as $entry) { continue; } - $feed = $this->feed ?? FreshRSS_CategoryDAO::findFeed($this->categories, $entry->feedId()); + $feed = $this->feed ?? FreshRSS_Category::findFeed($this->categories, $entry->feedId()); $entry->_feed($feed); $article = $entry->toGReader('freshrss', $this->entryIdsTagNames['e_' . $entry->id()] ?? []); diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 13a751c09..9d3aa59fa 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -1,9 +1,6 @@ feed === null) { - throw new FreshRSS_Context_Exception('Feed not initialised!'); - } ?>

feed->name() ?>

diff --git a/app/views/helpers/htmlPagination.phtml b/app/views/helpers/htmlPagination.phtml new file mode 100644 index 000000000..d1f895425 --- /dev/null +++ b/app/views/helpers/htmlPagination.phtml @@ -0,0 +1,21 @@ + + diff --git a/app/views/helpers/index/article.phtml b/app/views/helpers/index/article.phtml new file mode 100644 index 000000000..caf06359d --- /dev/null +++ b/app/views/helpers/index/article.phtml @@ -0,0 +1,117 @@ +entry; + $feed = $this->feed; +?> +
+
+
+ 'entry', 'a' => 'bookmark', 'params' => ['id' => $entry->id()]]; + if ($entry->isFavorite()) { + $favoriteUrl['params']['is_favorite'] = 0; + } + $readUrl = ['c' => 'entry', 'a' => 'read', 'params' => ['id' => $entry->id()]]; + if ($entry->isRead()) { + $readUrl['params']['is_read'] = 0; + } + ?> +
+ + isRead() ? 'read' : 'unread') ?> + isFavorite() ? 'starred' : 'non-starred') ?> + + show_feed_name === 't') { ?> + + show_favicons): ?> + ✇name() ?> + +
+ + show_tags, ['b', 'h'], true)) { + $this->renderHelper('index/tags'); + } + ?> + +

title() ?>

+ show_author_date === 'h' || FreshRSS_Context::userConf()->show_author_date === 'b') { ?> +
+ show_feed_name === 'a') { ?> + + +
authors(); + if (is_array($authors)) { + if ($this->internal_rendering): + foreach ($authors as $author): ?> + + + + + + +
+
+ +
+
+ +
+ +
+ content(true) ?> +
+ show_author_date, ['b', 'f'], true); + $display_tags = in_array(FreshRSS_Context::userConf()->show_tags, ['b', 'f'], true); + + if ($display_authors_date || $display_tags) { + ?> +
+ +
+ show_feed_name === 'a') { ?> + + +
authors(); + if (is_array($authors)) { + foreach ($authors as $author) { + ?> + + + + +
+
+ +
+
+ renderHelper('index/tags'); + } + ?> +
+ +
+
diff --git a/app/views/helpers/index/normal/entry_header.phtml b/app/views/helpers/index/normal/entry_header.phtml index b324a5949..f550dfa21 100644 --- a/app/views/helpers/index/normal/entry_header.phtml +++ b/app/views/helpers/index/normal/entry_header.phtml @@ -1,9 +1,6 @@ feed === null) { - throw new FreshRSS_Context_Exception('Feed not initialised!'); - } $topline_read = FreshRSS_Context::userConf()->topline_read; $topline_favorite = FreshRSS_Context::userConf()->topline_favorite; $topline_website = FreshRSS_Context::userConf()->topline_website; diff --git a/app/views/helpers/index/tags.phtml b/app/views/helpers/index/tags.phtml new file mode 100644 index 000000000..8f67784dd --- /dev/null +++ b/app/views/helpers/index/tags.phtml @@ -0,0 +1,42 @@ +entry->tagsFormattingHelper(); +?> +
+ +
    + + +
  • #
  • + + + +
  • #
  • + + + + +
  • + +
  • + +
+ +
-- cgit v1.2.3