From 7975395d10bb381de8cd15b5ee15198318af6d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Viande?= Date: Wed, 11 Apr 2018 11:42:52 +0200 Subject: Entry: add archived_at property and updateArchived method --- src/Wallabag/ApiBundle/Controller/EntryRestController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 0b4e74a0..dc63b98d 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -358,7 +358,7 @@ class EntryRestController extends WallabagRestController } if (null !== $data['isArchived']) { - $entry->setArchived((bool) $data['isArchived']); + $entry->updateArchived((bool) $data['isArchived']); } if (null !== $data['isStarred']) { @@ -474,7 +474,7 @@ class EntryRestController extends WallabagRestController } if (null !== $data['isArchived']) { - $entry->setArchived((bool) $data['isArchived']); + $entry->updateArchived((bool) $data['isArchived']); } if (null !== $data['isStarred']) { -- cgit v1.2.3 From 0e70e812274a4e13b02e821e8a64a3206c7688ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Viande?= Date: Thu, 26 Apr 2018 07:20:52 +0200 Subject: Entry: add sort parameter archived --- src/Wallabag/ApiBundle/Controller/EntryRestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index dc63b98d..5882aaee 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -79,7 +79,7 @@ class EntryRestController extends WallabagRestController * parameters={ * {"name"="archive", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by archived status."}, * {"name"="starred", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by starred status."}, - * {"name"="sort", "dataType"="string", "required"=false, "format"="'created' or 'updated', default 'created'", "description"="sort entries by date."}, + * {"name"="sort", "dataType"="string", "required"=false, "format"="'created' or 'updated' or 'archived', default 'created'", "description"="sort entries by date."}, * {"name"="order", "dataType"="string", "required"=false, "format"="'asc' or 'desc', default 'desc'", "description"="order of sort."}, * {"name"="page", "dataType"="integer", "required"=false, "format"="default '1'", "description"="what page you want."}, * {"name"="perPage", "dataType"="integer", "required"=false, "format"="default'30'", "description"="results per page."}, -- cgit v1.2.3 From 115de64e5bb9d7f9151ecf15e15a0d988563528e Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 4 Oct 2018 14:07:20 +0200 Subject: Jump to Symfony 3.4 Thanks to the BC compatibility, almost nothing have to be changed. All changes are related to new bundle version of: - SensioFrameworkExtraBundle - DoctrineFixturesBundle --- src/Wallabag/ApiBundle/Controller/DeveloperController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/DeveloperController.php b/src/Wallabag/ApiBundle/Controller/DeveloperController.php index c7178017..ae7e83da 100644 --- a/src/Wallabag/ApiBundle/Controller/DeveloperController.php +++ b/src/Wallabag/ApiBundle/Controller/DeveloperController.php @@ -2,9 +2,9 @@ namespace Wallabag\ApiBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; use Wallabag\ApiBundle\Entity\Client; use Wallabag\ApiBundle\Form\Type\ClientType; -- cgit v1.2.3 From 877787e5fe6a6545105616968939949b4db81347 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 28 Nov 2018 20:26:18 +0100 Subject: Fix utf8mb4 on vendor tables When creating the schema for test these tables use default length for string: 255. Which fail when using utf8mb4. > Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes Also move the `setKeepStaticConnections` in before and after class to avoid: > SAVEPOINT DOCTRINE2_SAVEPOINT_2 does not exist See https://github.com/dmaicher/doctrine-test-bundle#troubleshooting --- src/Wallabag/ApiBundle/Entity/AccessToken.php | 16 ++++++++++++++++ src/Wallabag/ApiBundle/Entity/AuthCode.php | 16 ++++++++++++++++ src/Wallabag/ApiBundle/Entity/RefreshToken.php | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Entity/AccessToken.php b/src/Wallabag/ApiBundle/Entity/AccessToken.php index c09a0c80..5e4099dd 100644 --- a/src/Wallabag/ApiBundle/Entity/AccessToken.php +++ b/src/Wallabag/ApiBundle/Entity/AccessToken.php @@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\AccessToken as BaseAccessToken; /** * @ORM\Table("oauth2_access_tokens") * @ORM\Entity + * @ORM\AttributeOverrides({ + * @ORM\AttributeOverride(name="token", + * column=@ORM\Column( + * name = "token", + * type = "string", + * length = 191 + * ) + * ), + * @ORM\AttributeOverride(name="scope", + * column=@ORM\Column( + * name = "scope", + * type = "string", + * length = 191 + * ) + * ) + * }) */ class AccessToken extends BaseAccessToken { diff --git a/src/Wallabag/ApiBundle/Entity/AuthCode.php b/src/Wallabag/ApiBundle/Entity/AuthCode.php index 4d4b09fe..5fa205ac 100644 --- a/src/Wallabag/ApiBundle/Entity/AuthCode.php +++ b/src/Wallabag/ApiBundle/Entity/AuthCode.php @@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\AuthCode as BaseAuthCode; /** * @ORM\Table("oauth2_auth_codes") * @ORM\Entity + * @ORM\AttributeOverrides({ + * @ORM\AttributeOverride(name="token", + * column=@ORM\Column( + * name = "token", + * type = "string", + * length = 191 + * ) + * ), + * @ORM\AttributeOverride(name="scope", + * column=@ORM\Column( + * name = "scope", + * type = "string", + * length = 191 + * ) + * ) + * }) */ class AuthCode extends BaseAuthCode { diff --git a/src/Wallabag/ApiBundle/Entity/RefreshToken.php b/src/Wallabag/ApiBundle/Entity/RefreshToken.php index 822a02d8..dd8e9c63 100644 --- a/src/Wallabag/ApiBundle/Entity/RefreshToken.php +++ b/src/Wallabag/ApiBundle/Entity/RefreshToken.php @@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\RefreshToken as BaseRefreshToken; /** * @ORM\Table("oauth2_refresh_tokens") * @ORM\Entity + * @ORM\AttributeOverrides({ + * @ORM\AttributeOverride(name="token", + * column=@ORM\Column( + * name = "token", + * type = "string", + * length = 191 + * ) + * ), + * @ORM\AttributeOverride(name="scope", + * column=@ORM\Column( + * name = "scope", + * type = "string", + * length = 191 + * ) + * ) + * }) */ class RefreshToken extends BaseRefreshToken { -- cgit v1.2.3 From 3bd65991adc253715c6b74ab0ee19ff2cf3e6c69 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 15 Jan 2019 10:17:11 +0100 Subject: Add a new endpoint to retrieve information from the wallabag instance Useful for api client which required some information. We might add more inside them in the future. The endpoint /api/version should be avoided now as it contains not so much information rather the version. --- .../ApiBundle/Controller/WallabagRestController.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 7d8cfbba..3c7ad0cf 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -14,6 +14,8 @@ class WallabagRestController extends FOSRestController * * @ApiDoc() * + * @deprecated Should use info endpoint instead + * * @return JsonResponse */ public function getVersionAction() @@ -24,6 +26,24 @@ class WallabagRestController extends FOSRestController return (new JsonResponse())->setJson($json); } + /** + * Retrieve information about the wallabag instance. + * + * @ApiDoc() + * + * @return JsonResponse + */ + public function getInfoAction() + { + $info = [ + 'appname' => 'wallabag', + 'version' => $this->container->getParameter('wallabag_core.version'), + 'allowed_registration' => $this->container->getParameter('wallabag_user.registration_enabled'), + ]; + + return (new JsonResponse())->setJson($this->get('jms_serializer')->serialize($info, 'json')); + } + protected function validateAuthentication() { if (false === $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) { -- cgit v1.2.3 From b32057980e33e7ddd93480017496a589006b8260 Mon Sep 17 00:00:00 2001 From: Craig Roberts Date: Mon, 9 Apr 2018 17:24:45 +0800 Subject: Fixes [wallabag/wallabag#2611] Add a basic Search REST endpoint - Adds a new `search` key to `src/Wallabag/ApiBundle/Resources/config/routing_rest.yml` - Reuses the `getBuilderForSearchByUser` method from the EntryRepository - Supports, `term`, `page`, and `perPage` query parameters - Some very basic tests --- .../ApiBundle/Controller/SearchRestController.php | 91 ++++++++++++++++++++++ .../ApiBundle/Resources/config/routing_rest.yml | 5 ++ 2 files changed, 96 insertions(+) create mode 100644 src/Wallabag/ApiBundle/Controller/SearchRestController.php (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/SearchRestController.php b/src/Wallabag/ApiBundle/Controller/SearchRestController.php new file mode 100644 index 00000000..c0b2cb24 --- /dev/null +++ b/src/Wallabag/ApiBundle/Controller/SearchRestController.php @@ -0,0 +1,91 @@ +validateAuthentication(); + + $term = $request->query->get('term'); + $page = (int) $request->query->get('page', 1); + $perPage = (int) $request->query->get('perPage', 30); + + $qb = $this->get('wallabag_core.entry_repository') + ->getBuilderForSearchByUser( + $this->getUser()->getId(), + $term, + null + ); + + $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); + $pager = new Pagerfanta($pagerAdapter); + + $pager->setMaxPerPage($perPage); + $pager->setCurrentPage($page); + + $pagerfantaFactory = new PagerfantaFactory('page', 'perPage'); + $paginatedCollection = $pagerfantaFactory->createRepresentation( + $pager, + new Route( + 'api_get_search', + [ + 'term' => $term, + 'page' => $page, + 'perPage' => $perPage, + ], + UrlGeneratorInterface::ABSOLUTE_URL + ) + ); + + return $this->sendResponse($paginatedCollection); + } + + /** + * Shortcut to send data serialized in json. + * + * @param mixed $data + * + * @return JsonResponse + */ + private function sendResponse($data) + { + // https://github.com/schmittjoh/JMSSerializerBundle/issues/293 + $context = new SerializationContext(); + $context->setSerializeNull(true); + + $json = $this->get('jms_serializer')->serialize($data, 'json', $context); + + return (new JsonResponse())->setJson($json); + } +} diff --git a/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml b/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml index c0283e71..06e62c37 100644 --- a/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml +++ b/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml @@ -3,6 +3,11 @@ entry: resource: "WallabagApiBundle:EntryRest" name_prefix: api_ +search: + type: rest + resource: "WallabagApiBundle:SearchRest" + name_prefix: api_ + tag: type: rest resource: "WallabagApiBundle:TagRest" -- cgit v1.2.3 From 9133bd02d11c37c98b2c7c979e363cc7bff8f914 Mon Sep 17 00:00:00 2001 From: Craig Roberts Date: Tue, 10 Apr 2018 19:50:26 +0800 Subject: [wallabag/wallabag#2611] Fix PHPCS lint errors --- src/Wallabag/ApiBundle/Controller/SearchRestController.php | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/SearchRestController.php b/src/Wallabag/ApiBundle/Controller/SearchRestController.php index c0b2cb24..6620107d 100644 --- a/src/Wallabag/ApiBundle/Controller/SearchRestController.php +++ b/src/Wallabag/ApiBundle/Controller/SearchRestController.php @@ -10,13 +10,7 @@ use Pagerfanta\Adapter\DoctrineORMAdapter; use Pagerfanta\Pagerfanta; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Wallabag\CoreBundle\Entity\Entry; -use Wallabag\CoreBundle\Entity\Tag; -use Wallabag\CoreBundle\Event\EntryDeletedEvent; -use Wallabag\CoreBundle\Event\EntrySavedEvent; class SearchRestController extends WallabagRestController { -- cgit v1.2.3 From 019e1acc4962229a538421b6f2b0643d03c1d72c Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 24 Oct 2018 20:11:45 +0200 Subject: Factorize sendResponse between Api controllers And run newer cs fixer --- .../ApiBundle/Controller/EntryRestController.php | 19 ------------------- .../ApiBundle/Controller/SearchRestController.php | 19 ------------------- .../ApiBundle/Controller/WallabagRestController.php | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+), 38 deletions(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index f792aaf2..a79e852c 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -4,7 +4,6 @@ namespace Wallabag\ApiBundle\Controller; use Hateoas\Configuration\Route; use Hateoas\Representation\Factory\PagerfantaFactory; -use JMS\Serializer\SerializationContext; use Nelmio\ApiDocBundle\Annotation\ApiDoc; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -773,24 +772,6 @@ class EntryRestController extends WallabagRestController return $this->sendResponse($results); } - /** - * Shortcut to send data serialized in json. - * - * @param mixed $data - * - * @return JsonResponse - */ - private function sendResponse($data) - { - // https://github.com/schmittjoh/JMSSerializerBundle/issues/293 - $context = new SerializationContext(); - $context->setSerializeNull(true); - - $json = $this->get('jms_serializer')->serialize($data, 'json', $context); - - return (new JsonResponse())->setJson($json); - } - /** * Retrieve value from the request. * Used for POST & PATCH on a an entry. diff --git a/src/Wallabag/ApiBundle/Controller/SearchRestController.php b/src/Wallabag/ApiBundle/Controller/SearchRestController.php index 6620107d..f8da0ad4 100644 --- a/src/Wallabag/ApiBundle/Controller/SearchRestController.php +++ b/src/Wallabag/ApiBundle/Controller/SearchRestController.php @@ -4,7 +4,6 @@ namespace Wallabag\ApiBundle\Controller; use Hateoas\Configuration\Route; use Hateoas\Representation\Factory\PagerfantaFactory; -use JMS\Serializer\SerializationContext; use Nelmio\ApiDocBundle\Annotation\ApiDoc; use Pagerfanta\Adapter\DoctrineORMAdapter; use Pagerfanta\Pagerfanta; @@ -64,22 +63,4 @@ class SearchRestController extends WallabagRestController return $this->sendResponse($paginatedCollection); } - - /** - * Shortcut to send data serialized in json. - * - * @param mixed $data - * - * @return JsonResponse - */ - private function sendResponse($data) - { - // https://github.com/schmittjoh/JMSSerializerBundle/issues/293 - $context = new SerializationContext(); - $context->setSerializeNull(true); - - $json = $this->get('jms_serializer')->serialize($data, 'json', $context); - - return (new JsonResponse())->setJson($json); - } } diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 3c7ad0cf..f18b0910 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -3,6 +3,7 @@ namespace Wallabag\ApiBundle\Controller; use FOS\RestBundle\Controller\FOSRestController; +use JMS\Serializer\SerializationContext; use Nelmio\ApiDocBundle\Annotation\ApiDoc; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Security\Core\Exception\AccessDeniedException; @@ -64,4 +65,22 @@ class WallabagRestController extends FOSRestController throw $this->createAccessDeniedException('Access forbidden. Entry user id: ' . $requestUserId . ', logged user id: ' . $user->getId()); } } + + /** + * Shortcut to send data serialized in json. + * + * @param mixed $data + * + * @return JsonResponse + */ + protected function sendResponse($data) + { + // https://github.com/schmittjoh/JMSSerializerBundle/issues/293 + $context = new SerializationContext(); + $context->setSerializeNull(true); + + $json = $this->get('jms_serializer')->serialize($data, 'json', $context); + + return (new JsonResponse())->setJson($json); + } } -- cgit v1.2.3 From 801042544444d58580d87d04d5602797027153fc Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 24 Oct 2018 20:29:33 +0200 Subject: Fix third argument to Route --- src/Wallabag/ApiBundle/Controller/EntryRestController.php | 3 +-- src/Wallabag/ApiBundle/Controller/SearchRestController.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index a79e852c..16d8a40b 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -10,7 +10,6 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\HttpException; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Event\EntryDeletedEvent; @@ -140,7 +139,7 @@ class EntryRestController extends WallabagRestController 'tags' => $tags, 'since' => $since, ], - UrlGeneratorInterface::ABSOLUTE_URL + true ) ); diff --git a/src/Wallabag/ApiBundle/Controller/SearchRestController.php b/src/Wallabag/ApiBundle/Controller/SearchRestController.php index f8da0ad4..d9f99844 100644 --- a/src/Wallabag/ApiBundle/Controller/SearchRestController.php +++ b/src/Wallabag/ApiBundle/Controller/SearchRestController.php @@ -9,7 +9,6 @@ use Pagerfanta\Adapter\DoctrineORMAdapter; use Pagerfanta\Pagerfanta; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class SearchRestController extends WallabagRestController { @@ -57,7 +56,7 @@ class SearchRestController extends WallabagRestController 'page' => $page, 'perPage' => $perPage, ], - UrlGeneratorInterface::ABSOLUTE_URL + true ) ); -- cgit v1.2.3 From baa5ee2d4292460425ca7f6572425f1fb1100d9d Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 8 Feb 2019 15:03:52 +0100 Subject: Force default_protocol to generate an url input --- src/Wallabag/ApiBundle/Form/Type/ClientType.php | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Form/Type/ClientType.php b/src/Wallabag/ApiBundle/Form/Type/ClientType.php index fc22538f..14dc5c44 100644 --- a/src/Wallabag/ApiBundle/Form/Type/ClientType.php +++ b/src/Wallabag/ApiBundle/Form/Type/ClientType.php @@ -20,6 +20,7 @@ class ClientType extends AbstractType 'required' => false, 'label' => 'developer.client.form.redirect_uris_label', 'property_path' => 'redirectUris', + 'default_protocol' => null, ]) ->add('save', SubmitType::class, ['label' => 'developer.client.form.save_label']) ; -- cgit v1.2.3 From bfe02a0b481055bb4e799200c8daa9a0ad987c71 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 28 May 2017 14:53:04 +0200 Subject: Hash the urls to check if they exist Signed-off-by: Thomas Citharel --- .../ApiBundle/Controller/EntryRestController.php | 36 +++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 5c850091..26746f7d 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -29,6 +29,8 @@ class EntryRestController extends WallabagRestController * {"name"="return_id", "dataType"="string", "required"=false, "format"="1 or 0", "description"="Set 1 if you want to retrieve ID in case entry(ies) exists, 0 by default"}, * {"name"="url", "dataType"="string", "required"=true, "format"="An url", "description"="Url to check if it exists"}, * {"name"="urls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="Urls (as an array) to check if it exists"} + * {"name"="hashedurl", "dataType"="string", "required"=true, "format"="An url", "description"="Md5 url to check if it exists"}, + * {"name"="hashedurls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="Md5 urls (as an array) to check if it exists"} * } * ) * @@ -41,34 +43,46 @@ class EntryRestController extends WallabagRestController $returnId = (null === $request->query->get('return_id')) ? false : (bool) $request->query->get('return_id'); $urls = $request->query->get('urls', []); + $hashedUrls = $request->query->get('hashedurls', []); + // handle multiple urls first - if (!empty($urls)) { + if (!empty($hashedUrls)) { $results = []; - foreach ($urls as $url) { + foreach ($hashedUrls as $hashedUrl) { $res = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') - ->findByUrlAndUserId($url, $this->getUser()->getId()); + ->findOneBy([ + 'hashedUrl' => $hashedUrl, + 'user' => $this->getUser()->getId(), + ]); - $results[$url] = $this->returnExistInformation($res, $returnId); + // $results[$url] = $this->returnExistInformation($res, $returnId); + $results[$hashedUrl] = $this->returnExistInformation($res, $returnId); } return $this->sendResponse($results); } // let's see if it is a simple url? - $url = $request->query->get('url', ''); + $hashedUrl = $request->query->get('hashedurl', ''); + + // if (empty($url)) { + // throw $this->createAccessDeniedException('URL is empty?, logged user id: ' . $this->getUser()->getId()); + // } - if (empty($url)) { - throw $this->createAccessDeniedException('URL is empty?, logged user id: ' . $this->getUser()->getId()); + if (empty($hashedUrl)) { + throw $this->createAccessDeniedException('URL is empty?, logged user id: '.$this->getUser()->getId()); } $res = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') - ->findByUrlAndUserId($url, $this->getUser()->getId()); - - $exists = $this->returnExistInformation($res, $returnId); + // ->findByUrlAndUserId($url, $this->getUser()->getId()); + ->findOneBy([ + 'hashedUrl' => $hashedUrl, + 'user' => $this->getUser()->getId(), + ]); - return $this->sendResponse(['exists' => $exists]); + return $this->sendResponse(['exists' => $this->returnExistInformation($res, $returnId)]); } /** -- cgit v1.2.3 From 9c2b2aae70b06411336e6eb6ac43b3ebd30dc38c Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 Apr 2019 11:50:33 +0200 Subject: Keep url in exists endpoint - Add migration - Use md5 instead of sha512 (we don't need security here, just a hash) - Update tests --- .../ApiBundle/Controller/EntryRestController.php | 55 ++++++++++++---------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 26746f7d..0ecf1a0e 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -27,10 +27,10 @@ class EntryRestController extends WallabagRestController * @ApiDoc( * parameters={ * {"name"="return_id", "dataType"="string", "required"=false, "format"="1 or 0", "description"="Set 1 if you want to retrieve ID in case entry(ies) exists, 0 by default"}, - * {"name"="url", "dataType"="string", "required"=true, "format"="An url", "description"="Url to check if it exists"}, - * {"name"="urls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="Urls (as an array) to check if it exists"} - * {"name"="hashedurl", "dataType"="string", "required"=true, "format"="An url", "description"="Md5 url to check if it exists"}, - * {"name"="hashedurls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="Md5 urls (as an array) to check if it exists"} + * {"name"="url", "dataType"="string", "required"=true, "format"="An url", "description"="DEPRECATED, use hashed_url instead"}, + * {"name"="urls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="DEPRECATED, use hashed_urls instead"}, + * {"name"="hashed_url", "dataType"="string", "required"=true, "format"="An url", "description"="Md5 url to check if it exists"}, + * {"name"="hashed_urls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="Md5 urls (as an array) to check if it exists"} * } * ) * @@ -39,22 +39,18 @@ class EntryRestController extends WallabagRestController public function getEntriesExistsAction(Request $request) { $this->validateAuthentication(); + $repo = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry'); $returnId = (null === $request->query->get('return_id')) ? false : (bool) $request->query->get('return_id'); - $urls = $request->query->get('urls', []); - $hashedUrls = $request->query->get('hashedurls', []); + $urls = $request->query->get('urls', []); + $hashedUrls = $request->query->get('hashed_urls', []); // handle multiple urls first if (!empty($hashedUrls)) { $results = []; foreach ($hashedUrls as $hashedUrl) { - $res = $this->getDoctrine() - ->getRepository('WallabagCoreBundle:Entry') - ->findOneBy([ - 'hashedUrl' => $hashedUrl, - 'user' => $this->getUser()->getId(), - ]); + $res = $repo->findByHashedUrlAndUserId($hashedUrl, $this->getUser()->getId()); // $results[$url] = $this->returnExistInformation($res, $returnId); $results[$hashedUrl] = $this->returnExistInformation($res, $returnId); @@ -63,24 +59,33 @@ class EntryRestController extends WallabagRestController return $this->sendResponse($results); } + // @deprecated, to be remove in 3.0 + if (!empty($urls)) { + $results = []; + foreach ($urls as $url) { + $res = $repo->findByUrlAndUserId($url, $this->getUser()->getId()); + + $results[$url] = $this->returnExistInformation($res, $returnId); + } + + return $this->sendResponse($results); + } + // let's see if it is a simple url? - $hashedUrl = $request->query->get('hashedurl', ''); + $url = $request->query->get('url', ''); + $hashedUrl = $request->query->get('hashed_url', ''); - // if (empty($url)) { - // throw $this->createAccessDeniedException('URL is empty?, logged user id: ' . $this->getUser()->getId()); - // } + if (empty($url) && empty($hashedUrl)) { + throw $this->createAccessDeniedException('URL is empty?, logged user id: ' . $this->getUser()->getId()); + } - if (empty($hashedUrl)) { - throw $this->createAccessDeniedException('URL is empty?, logged user id: '.$this->getUser()->getId()); + $method = 'findByUrlAndUserId'; + if (!empty($hashedUrl)) { + $method = 'findByHashedUrlAndUserId'; + $url = $hashedUrl; } - $res = $this->getDoctrine() - ->getRepository('WallabagCoreBundle:Entry') - // ->findByUrlAndUserId($url, $this->getUser()->getId()); - ->findOneBy([ - 'hashedUrl' => $hashedUrl, - 'user' => $this->getUser()->getId(), - ]); + $res = $repo->$method($url, $this->getUser()->getId()); return $this->sendResponse(['exists' => $this->returnExistInformation($res, $returnId)]); } -- cgit v1.2.3 From c579ce2306297674c56376a2ab5c8ba66a272253 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 Apr 2019 14:34:20 +0200 Subject: Some cleanup Also, do not run the hashed_url migration into a Doctrine migration --- src/Wallabag/ApiBundle/Controller/EntryRestController.php | 1 - 1 file changed, 1 deletion(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 0ecf1a0e..ad43b1d4 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -52,7 +52,6 @@ class EntryRestController extends WallabagRestController foreach ($hashedUrls as $hashedUrl) { $res = $repo->findByHashedUrlAndUserId($hashedUrl, $this->getUser()->getId()); - // $results[$url] = $this->returnExistInformation($res, $returnId); $results[$hashedUrl] = $this->returnExistInformation($res, $returnId); } -- cgit v1.2.3 From 76bc05ebc02408b213b536fec44e94b092889118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Benoist?= Date: Tue, 2 Apr 2019 22:59:50 +0200 Subject: Fix ApiDoc about md5/sha1 --- src/Wallabag/ApiBundle/Controller/EntryRestController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index ad43b1d4..06520af9 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -29,8 +29,8 @@ class EntryRestController extends WallabagRestController * {"name"="return_id", "dataType"="string", "required"=false, "format"="1 or 0", "description"="Set 1 if you want to retrieve ID in case entry(ies) exists, 0 by default"}, * {"name"="url", "dataType"="string", "required"=true, "format"="An url", "description"="DEPRECATED, use hashed_url instead"}, * {"name"="urls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="DEPRECATED, use hashed_urls instead"}, - * {"name"="hashed_url", "dataType"="string", "required"=true, "format"="An url", "description"="Md5 url to check if it exists"}, - * {"name"="hashed_urls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="Md5 urls (as an array) to check if it exists"} + * {"name"="hashed_url", "dataType"="string", "required"=false, "format"="A hashed url", "description"="Hashed url using SHA1 to check if it exists"}, + * {"name"="hashed_urls", "dataType"="string", "required"=false, "format"="An array of hashed urls (?hashed_urls[]=xxx...&hashed_urls[]=xxx...)", "description"="An array of hashed urls using SHA1 to check if they exist"} * } * ) * -- cgit v1.2.3 From 637f0df9760b50b56c8ffb200719907032fdd885 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 10 May 2019 16:49:19 +0200 Subject: Cascade delete on oauth2 table when deleting a user --- src/Wallabag/ApiBundle/Entity/AccessToken.php | 1 + src/Wallabag/ApiBundle/Entity/AuthCode.php | 1 + src/Wallabag/ApiBundle/Entity/RefreshToken.php | 1 + 3 files changed, 3 insertions(+) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Entity/AccessToken.php b/src/Wallabag/ApiBundle/Entity/AccessToken.php index 5e4099dd..98e0af3e 100644 --- a/src/Wallabag/ApiBundle/Entity/AccessToken.php +++ b/src/Wallabag/ApiBundle/Entity/AccessToken.php @@ -42,6 +42,7 @@ class AccessToken extends BaseAccessToken /** * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User") + * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") */ protected $user; } diff --git a/src/Wallabag/ApiBundle/Entity/AuthCode.php b/src/Wallabag/ApiBundle/Entity/AuthCode.php index 5fa205ac..7c9c8539 100644 --- a/src/Wallabag/ApiBundle/Entity/AuthCode.php +++ b/src/Wallabag/ApiBundle/Entity/AuthCode.php @@ -42,6 +42,7 @@ class AuthCode extends BaseAuthCode /** * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User") + * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") */ protected $user; } diff --git a/src/Wallabag/ApiBundle/Entity/RefreshToken.php b/src/Wallabag/ApiBundle/Entity/RefreshToken.php index dd8e9c63..55a507e1 100644 --- a/src/Wallabag/ApiBundle/Entity/RefreshToken.php +++ b/src/Wallabag/ApiBundle/Entity/RefreshToken.php @@ -42,6 +42,7 @@ class RefreshToken extends BaseRefreshToken /** * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User") + * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") */ protected $user; } -- cgit v1.2.3 From 2c290747cb0d235392f6e5d22205a706c6474168 Mon Sep 17 00:00:00 2001 From: Kevin Decherf Date: Sun, 12 May 2019 00:00:00 +0200 Subject: api/entries: add parameter detail to exclude or include content in response detail=metadata will nullify the content field of entries in order to make smaller responses. detail=full keeps the former behavior, it sends the content of entries. It's the default, for backward compatibility. Fixes #2817 Signed-off-by: Kevin Decherf --- src/Wallabag/ApiBundle/Controller/EntryRestController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 06520af9..aff0534a 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -103,6 +103,7 @@ class EntryRestController extends WallabagRestController * {"name"="tags", "dataType"="string", "required"=false, "format"="api,rest", "description"="a list of tags url encoded. Will returns entries that matches ALL tags."}, * {"name"="since", "dataType"="integer", "required"=false, "format"="default '0'", "description"="The timestamp since when you want entries updated."}, * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by entries with a public link"}, + * {"name"="detail", "dataType"="string", "required"=false, "format"="metadata or full, metadata by default", "description"="include content field if 'full'. 'full' by default for backward compatibility."}, * } * ) * @@ -121,6 +122,7 @@ class EntryRestController extends WallabagRestController $perPage = (int) $request->query->get('perPage', 30); $tags = \is_array($request->query->get('tags')) ? '' : (string) $request->query->get('tags', ''); $since = $request->query->get('since', 0); + $detail = strtolower($request->query->get('detail', 'full')); try { /** @var \Pagerfanta\Pagerfanta $pager */ @@ -132,7 +134,8 @@ class EntryRestController extends WallabagRestController $sort, $order, $since, - $tags + $tags, + $detail ); } catch (\Exception $e) { throw new BadRequestHttpException($e->getMessage()); @@ -156,6 +159,7 @@ class EntryRestController extends WallabagRestController 'perPage' => $perPage, 'tags' => $tags, 'since' => $since, + 'detail' => $detail, ], true ) -- cgit v1.2.3 From 31e276fc1636b41b03b7c29127681de257c16b06 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Thu, 2 May 2019 21:19:20 +1000 Subject: EntryRestController::getEntriesExistsAction: always find by hashed url Simplify the logic from #3158 by hashing all the urls from the request, and only doing a search by hash. This allows to get performance benefits from the new indexed hash column even when using older clients that do not hash the URL in the request. Fixes: #3158, #3919 Signed-off-by: Olivier Mehani --- .../ApiBundle/Controller/EntryRestController.php | 71 ++++++++++++---------- 1 file changed, 40 insertions(+), 31 deletions(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index aff0534a..17b53a01 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -43,50 +43,59 @@ class EntryRestController extends WallabagRestController $returnId = (null === $request->query->get('return_id')) ? false : (bool) $request->query->get('return_id'); - $urls = $request->query->get('urls', []); $hashedUrls = $request->query->get('hashed_urls', []); + $hashedUrl = $request->query->get('hashed_url', ''); + if (!empty($hashedUrl)) { + $hashedUrls[] = $hashedUrl; + } - // handle multiple urls first - if (!empty($hashedUrls)) { - $results = []; - foreach ($hashedUrls as $hashedUrl) { - $res = $repo->findByHashedUrlAndUserId($hashedUrl, $this->getUser()->getId()); - - $results[$hashedUrl] = $this->returnExistInformation($res, $returnId); - } + $urls = $request->query->get('urls', []); + $url = $request->query->get('url', ''); + if (!empty($url)) { + $urls[] = $url; + } - return $this->sendResponse($results); + $urlHashMap = []; + foreach($urls as $urlToHash) { + $urlHash = hash('sha1', $urlToHash); // XXX: the hash logic would better be in a separate util to avoid duplication with GenerateUrlHashesCommand::generateHashedUrls + $hashedUrls[] = $urlHash; + $urlHashMap[$urlHash] = $urlToHash; } - // @deprecated, to be remove in 3.0 - if (!empty($urls)) { - $results = []; - foreach ($urls as $url) { - $res = $repo->findByUrlAndUserId($url, $this->getUser()->getId()); + if (empty($hashedUrls)) { + throw $this->createAccessDeniedException('URL is empty?, logged user id: ' . $this->getUser()->getId()); + } - $results[$url] = $this->returnExistInformation($res, $returnId); - } + $results = []; + foreach ($hashedUrls as $hashedUrlToSearch) { + $res = $repo->findByHashedUrlAndUserId($hashedUrlToSearch, $this->getUser()->getId()); - return $this->sendResponse($results); + $results[$hashedUrlToSearch] = $this->returnExistInformation($res, $returnId); } - // let's see if it is a simple url? - $url = $request->query->get('url', ''); - $hashedUrl = $request->query->get('hashed_url', ''); + $results = $this->replaceUrlHashes($results, $urlHashMap); - if (empty($url) && empty($hashedUrl)) { - throw $this->createAccessDeniedException('URL is empty?, logged user id: ' . $this->getUser()->getId()); + if (!empty($url) || !empty($hashedUrl)) { + $hu = array_keys($results)[0]; + return $this->sendResponse(['exists' => $results[$hu]]); } + return $this->sendResponse($results); + } - $method = 'findByUrlAndUserId'; - if (!empty($hashedUrl)) { - $method = 'findByHashedUrlAndUserId'; - $url = $hashedUrl; + /** + * Replace the hashedUrl keys in $results with the unhashed URL from the + * request, as recorded in $urlHashMap. + */ + private function replaceUrlHashes(array $results, array $urlHashMap) { + $newResults = []; + foreach($results as $hash => $res) { + if (isset($urlHashMap[$hash])) { + $newResults[$urlHashMap[$hash]] = $res; + } else { + $newResults[$hash] = $res; + } } - - $res = $repo->$method($url, $this->getUser()->getId()); - - return $this->sendResponse(['exists' => $this->returnExistInformation($res, $returnId)]); + return $newResults; } /** -- cgit v1.2.3 From 4a5516376bf4c8b0cdc1e81d24ce1cca68425785 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Fri, 10 May 2019 22:07:55 +1000 Subject: Add Wallabag\CoreBundle\Helper\UrlHasher Signed-off-by: Olivier Mehani --- .../ApiBundle/Controller/EntryRestController.php | 41 ++++++++++++---------- 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 17b53a01..77eb489e 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -14,6 +14,7 @@ use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Event\EntryDeletedEvent; use Wallabag\CoreBundle\Event\EntrySavedEvent; +use Wallabag\CoreBundle\Helper\UrlHasher; class EntryRestController extends WallabagRestController { @@ -56,8 +57,8 @@ class EntryRestController extends WallabagRestController } $urlHashMap = []; - foreach($urls as $urlToHash) { - $urlHash = hash('sha1', $urlToHash); // XXX: the hash logic would better be in a separate util to avoid duplication with GenerateUrlHashesCommand::generateHashedUrls + foreach ($urls as $urlToHash) { + $urlHash = UrlHasher::hashUrl($urlToHash); $hashedUrls[] = $urlHash; $urlHashMap[$urlHash] = $urlToHash; } @@ -77,25 +78,11 @@ class EntryRestController extends WallabagRestController if (!empty($url) || !empty($hashedUrl)) { $hu = array_keys($results)[0]; + return $this->sendResponse(['exists' => $results[$hu]]); } - return $this->sendResponse($results); - } - /** - * Replace the hashedUrl keys in $results with the unhashed URL from the - * request, as recorded in $urlHashMap. - */ - private function replaceUrlHashes(array $results, array $urlHashMap) { - $newResults = []; - foreach($results as $hash => $res) { - if (isset($urlHashMap[$hash])) { - $newResults[$urlHashMap[$hash]] = $res; - } else { - $newResults[$hash] = $res; - } - } - return $newResults; + return $this->sendResponse($results); } /** @@ -815,6 +802,24 @@ class EntryRestController extends WallabagRestController return $this->sendResponse($results); } + /** + * Replace the hashedUrl keys in $results with the unhashed URL from the + * request, as recorded in $urlHashMap. + */ + private function replaceUrlHashes(array $results, array $urlHashMap) + { + $newResults = []; + foreach ($results as $hash => $res) { + if (isset($urlHashMap[$hash])) { + $newResults[$urlHashMap[$hash]] = $res; + } else { + $newResults[$hash] = $res; + } + } + + return $newResults; + } + /** * Retrieve value from the request. * Used for POST & PATCH on a an entry. -- cgit v1.2.3 From 629a3797bcef33943df8ef5631328e05d12634ed Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 24 May 2019 15:43:30 +0200 Subject: Remove useless methods Also fix a phpdoc block --- src/Wallabag/ApiBundle/Controller/EntryRestController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 77eb489e..bdd02129 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -848,8 +848,8 @@ class EntryRestController extends WallabagRestController /** * Return information about the entry if it exist and depending on the id or not. * - * @param Entry|null $entry - * @param bool $returnId + * @param Entry|bool|null $entry + * @param bool $returnId * * @return bool|int */ -- cgit v1.2.3 From 5f08426201c336f96d593954fb45b284d7e60f4a Mon Sep 17 00:00:00 2001 From: adev Date: Sat, 11 Nov 2017 20:04:15 +0100 Subject: Fix because of some breaking changes of Graby 2.0 --- src/Wallabag/ApiBundle/Controller/EntryRestController.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/Wallabag/ApiBundle') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index aff0534a..d9d99c85 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -369,9 +369,7 @@ class EntryRestController extends WallabagRestController 'language' => !empty($data['language']) ? $data['language'] : $entry->getLanguage(), 'date' => !empty($data['publishedAt']) ? $data['publishedAt'] : $entry->getPublishedAt(), // faking the open graph preview picture - 'open_graph' => [ - 'og_image' => !empty($data['picture']) ? $data['picture'] : $entry->getPreviewPicture(), - ], + 'image' => !empty($data['picture']) ? $data['picture'] : $entry->getPreviewPicture(), 'authors' => \is_string($data['authors']) ? explode(',', $data['authors']) : $entry->getPublishedBy(), ] ); -- cgit v1.2.3