aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle/Controller
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2015-09-10 21:57:25 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2015-09-10 21:57:25 +0200
commit558d9aabab7e01c2e2b506aa362c70a568b953aa (patch)
treee3fd1fee2ab5f8104edff10dc1d16b86146f9dba /src/Wallabag/ApiBundle/Controller
parent75c3478a0c308c96bccd871f3bc1343356aafb6b (diff)
downloadwallabag-558d9aabab7e01c2e2b506aa362c70a568b953aa.tar.gz
wallabag-558d9aabab7e01c2e2b506aa362c70a568b953aa.tar.zst
wallabag-558d9aabab7e01c2e2b506aa362c70a568b953aa.zip
Move fetching content in a separate class
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller')
-rw-r--r--src/Wallabag/ApiBundle/Controller/WallabagRestController.php14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
index 7452c82a..349229f3 100644
--- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
@@ -146,16 +146,10 @@ class WallabagRestController extends Controller
146 { 146 {
147 $url = $request->request->get('url'); 147 $url = $request->request->get('url');
148 148
149 $content = $this->get('wallabag_core.graby')->fetchContent($url); 149 $entry = $this->get('wallabag_core.content_proxy')->updateEntry(
150 150 new Entry($this->getUser()),
151 $entry = new Entry($this->getUser()); 151 $url
152 $entry->setUrl($content['url'] ?: $url); 152 );
153 $entry->setTitle($request->request->get('title') ?: $content['title']);
154 $entry->setContent($content['html']);
155 $entry->setMimetype($content['content_type']);
156 if (isset($content['open_graph']['og_image'])) {
157 $entry->setPreviewPicture($content['open_graph']['og_image']);
158 }
159 153
160 $tags = $request->request->get('tags', ''); 154 $tags = $request->request->get('tags', '');
161 if (!empty($tags)) { 155 if (!empty($tags)) {