From a79228195fa75c1eb309a522a5083d94ffc16243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Fri, 9 Aug 2013 22:23:57 -0400 Subject: [PATCH] Add RSS feed for bookmarks --- feed.php | 46 +++++++++++++++++++++++++++++++ locales/fr_FR/translations.php | 1 + model.php | 4 +-- schema.php | 6 ++++ templates/config.php | 3 ++ vendor/PicoFeed/Writers/Atom.php | 8 +++++- vendor/PicoFeed/Writers/Rss20.php | 13 +++++++-- 7 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 feed.php diff --git a/feed.php b/feed.php new file mode 100644 index 0000000..8526aec --- /dev/null +++ b/feed.php @@ -0,0 +1,46 @@ +title = t('Bookmarks').' - Miniflux'; +$writer->site_url = Helper\get_current_base_url(); +$writer->feed_url = $writer->site_url.'feed.php?token='.urlencode($feed_token); + +$bookmarks = Model\get_bookmarks(); + +foreach ($bookmarks as $bookmark) { + + $article = Model\get_item($bookmark['id']); + + $writer->items[] = array( + 'id' => $article['id'], + 'title' => $article['title'], + 'updated' => $article['updated'], + 'url' => $article['url'], + 'content' => $article['content'], + ); +} + +Response\xml($writer->execute()); diff --git a/locales/fr_FR/translations.php b/locales/fr_FR/translations.php index 9a5771b..bd6f4c0 100644 --- a/locales/fr_FR/translations.php +++ b/locales/fr_FR/translations.php @@ -1,6 +1,7 @@ 'Flux RSS des favoris :', 'updated just now' => 'mis à jour à l\'instant', 'checked at' => 'vérifié le', 'never updated after creation' => 'jamais mis à jour après la création', diff --git a/model.php b/model.php index d0a6510..95b9fdf 100644 --- a/model.php +++ b/model.php @@ -25,7 +25,7 @@ use PicoFeed\Reader; use PicoFeed\Export; -const DB_VERSION = 13; +const DB_VERSION = 14; const HTTP_USERAGENT = 'Miniflux - http://miniflux.net'; const LIMIT_ALL = -1; @@ -752,7 +752,7 @@ function get_config() { return \PicoTools\singleton('db') ->table('config') - ->columns('username', 'language', 'autoflush', 'nocontent', 'items_per_page', 'theme', 'api_token') + ->columns('username', 'language', 'autoflush', 'nocontent', 'items_per_page', 'theme', 'api_token', 'feed_token') ->findOne(); } diff --git a/schema.php b/schema.php index 8ddf996..cf32332 100644 --- a/schema.php +++ b/schema.php @@ -3,6 +3,12 @@ namespace Schema; +function version_14($pdo) +{ + $pdo->exec('ALTER TABLE config ADD COLUMN feed_token TEXT DEFAULT "'.\Model\generate_api_token().'"'); +} + + function version_13($pdo) { $pdo->exec('ALTER TABLE feeds ADD COLUMN enabled INTEGER DEFAULT 1'); diff --git a/templates/config.php b/templates/config.php index f7fb151..184f607 100644 --- a/templates/config.php +++ b/templates/config.php @@ -40,6 +40,9 @@