From cc859bab2d78f41de8a763d205ebf4ce32201e7b Mon Sep 17 00:00:00 2001 From: Bruce Doan Date: Mon, 23 Mar 2015 15:01:54 +0700 Subject: [PATCH] Implement Favicons request --- fever/index.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/fever/index.php b/fever/index.php index abb2b43..004f227 100644 --- a/fever/index.php +++ b/fever/index.php @@ -94,7 +94,7 @@ route('feeds', function() { foreach ($feeds as $feed) { $response['feeds'][] = array( 'id' => (int) $feed['id'], - 'favicon_id' => 1, + 'favicon_id' => (int) $feed['id'], 'title' => $feed['title'], 'url' => $feed['feed_url'], 'site_url' => $feed['site_url'], @@ -122,7 +122,22 @@ route('favicons', function() { $response = auth(); if ($response['auth']) { + + $favicons = Database::get('db') + ->table('favicons') + ->columns( + 'feed_id', + 'icon' + ) + ->findAll(); + $response['favicons'] = array(); + foreach ($favicons as $favicon) { + $response['favicons'][] = array( + 'id' => (int) $favicon['feed_id'], + 'data' => $favicon['icon'] + ); + } } response($response);