Implement Favicons request

This commit is contained in:
Bruce Doan 2015-03-23 15:01:54 +07:00
parent 60aa689e84
commit cc859bab2d

View File

@ -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);