aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2019-01-15 10:17:11 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-01-15 10:17:11 +0100
commit3bd65991adc253715c6b74ab0ee19ff2cf3e6c69 (patch)
treefaf1b79e727db5a8fe1b092c75e0d8f2e67e3408 /src
parent3afc87426dade0eaeccf69d144a119c6f0c4534f (diff)
downloadwallabag-3bd65991adc253715c6b74ab0ee19ff2cf3e6c69.tar.gz
wallabag-3bd65991adc253715c6b74ab0ee19ff2cf3e6c69.tar.zst
wallabag-3bd65991adc253715c6b74ab0ee19ff2cf3e6c69.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/ApiBundle/Controller/WallabagRestController.php20
1 files changed, 20 insertions, 0 deletions
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
14 * 14 *
15 * @ApiDoc() 15 * @ApiDoc()
16 * 16 *
17 * @deprecated Should use info endpoint instead
18 *
17 * @return JsonResponse 19 * @return JsonResponse
18 */ 20 */
19 public function getVersionAction() 21 public function getVersionAction()
@@ -24,6 +26,24 @@ class WallabagRestController extends FOSRestController
24 return (new JsonResponse())->setJson($json); 26 return (new JsonResponse())->setJson($json);
25 } 27 }
26 28
29 /**
30 * Retrieve information about the wallabag instance.
31 *
32 * @ApiDoc()
33 *
34 * @return JsonResponse
35 */
36 public function getInfoAction()
37 {
38 $info = [
39 'appname' => 'wallabag',
40 'version' => $this->container->getParameter('wallabag_core.version'),
41 'allowed_registration' => $this->container->getParameter('wallabag_user.registration_enabled'),
42 ];
43
44 return (new JsonResponse())->setJson($this->get('jms_serializer')->serialize($info, 'json'));
45 }
46
27 protected function validateAuthentication() 47 protected function validateAuthentication()
28 { 48 {
29 if (false === $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) { 49 if (false === $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) {