From 49a3dd1623e41d802a661b49f30d87e1e5af91e7 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Mon, 17 Jan 2022 15:55:55 +0100 Subject: [PATCH] chg: [instance] Added support of API response for 2 endpoints --- src/Controller/InstanceController.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Controller/InstanceController.php b/src/Controller/InstanceController.php index 8479e5c..f136251 100644 --- a/src/Controller/InstanceController.php +++ b/src/Controller/InstanceController.php @@ -70,6 +70,12 @@ class InstanceController extends AppController usort($status, function($a, $b) { return strcmp($b['id'], $a['id']); }); + if ($this->ParamHandler->isRest()) { + return $this->RestResponse->viewData([ + 'status' => $status, + 'updateAvailables' => $migrationStatus['updateAvailables'], + ], 'json'); + } $this->set('status', $status); $this->set('updateAvailables', $migrationStatus['updateAvailables']); } @@ -140,6 +146,14 @@ class InstanceController extends AppController { $this->Settings = $this->getTableLocator()->get('Settings'); $all = $this->Settings->getSettings(true); + if ($this->ParamHandler->isRest()) { + return $this->RestResponse->viewData([ + 'settingsProvider' => $all['settingsProvider'], + 'settings' => $all['settings'], + 'settingsFlattened' => $all['settingsFlattened'], + 'notices' => $all['notices'], + ], 'json'); + } $this->set('settingsProvider', $all['settingsProvider']); $this->set('settings', $all['settings']); $this->set('settingsFlattened', $all['settingsFlattened']);