]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ApiBundle/Controller/WallabagRestController.php
Move fetching content in a separate class
[github/wallabag/wallabag.git] / src / Wallabag / ApiBundle / Controller / WallabagRestController.php
index 7452c82af6b86f0b4e65a6e11a59a7feeb36cc70..349229f384524fd7c4bd03b6b13c52886ec48409 100644 (file)
@@ -146,16 +146,10 @@ class WallabagRestController extends Controller
     {
         $url = $request->request->get('url');
 
-        $content = $this->get('wallabag_core.graby')->fetchContent($url);
-
-        $entry = new Entry($this->getUser());
-        $entry->setUrl($content['url'] ?: $url);
-        $entry->setTitle($request->request->get('title') ?: $content['title']);
-        $entry->setContent($content['html']);
-        $entry->setMimetype($content['content_type']);
-        if (isset($content['open_graph']['og_image'])) {
-            $entry->setPreviewPicture($content['open_graph']['og_image']);
-        }
+        $entry = $this->get('wallabag_core.content_proxy')->updateEntry(
+            new Entry($this->getUser()),
+            $url
+        );
 
         $tags = $request->request->get('tags', '');
         if (!empty($tags)) {