mirror of
https://github.com/opnsense/plugins.git
synced 2026-06-09 00:42:34 -04:00
os-smart: simplify https://github.com/opnsense/plugins/pull/2289 a bit.
This commit is contained in:
parent
dc1d703c5c
commit
6e50ef903a
1 changed files with 3 additions and 6 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue