This commit is contained in:
Ad Schellevis 2021-03-22 11:32:51 +01:00
parent dc1d703c5c
commit 6e50ef903a

View file

@ -57,7 +57,7 @@ class ServiceController extends ApiControllerBase
if ($this->request->isPost()) {
$device = $this->request->getPost('device');
$type = $this->request->getPost('type');
$json = $this->request->getPost('json');
$mode = empty($this->request->getPost('json')) ? "info" : "info_json";
if (!in_array($device, $this->getDevices())) {
return array("message" => "Invalid device name");
@ -71,13 +71,10 @@ class ServiceController extends ApiControllerBase
$backend = new Backend();
$params = array("info", $type, "/dev/" . $device);
if ($json != NULL) {
$params[0] = "info_json";
}
$params = array($mode, $type, "/dev/" . $device);
$output = $backend->configdpRun("smart", $params);
if ($json != NULL) {
if ($mode == 'info_json') {
$output = json_decode($output, true);
}