diff --git a/Scrutiny/Scrutiny.php b/Scrutiny/Scrutiny.php index 190b8f8c91..aabf765485 100644 --- a/Scrutiny/Scrutiny.php +++ b/Scrutiny/Scrutiny.php @@ -2,6 +2,62 @@ namespace App\SupportedApps\Scrutiny; -class Scrutiny extends \App\SupportedApps +class Scrutiny extends \App\SupportedApps implements \App\EnhancedApps { + public $config; + + public function __construct() + { + } + + public function test() + { + $attrs = [ + "headers" => ["Accept" => "application/json"], + ]; + $test = parent::appTest($this->url("health"), $attrs); + echo $test->status; + } + + public function livestats() + { + $status = "inactive"; + $data = [ + "passed" => 0, + "failed" => 0, + ]; + + $attrs = [ + "headers" => ["Accept" => "application/json"], + ]; + + $response = json_decode( + parent::execute($this->url("summary"), $attrs)->getBody() + ); + + $summary = $response->data->summary; + + foreach ($summary as $entry) { + $device_status = $entry->device->device_status; + + if ($device_status == 0) { + $data["passed"]++; + } else { + $status = "active"; + $data["failed"]++; + } + } + + return parent::getLiveStats($status, $data); + } + + public function url($endpoint) + { + $api_url = + parent::normaliseurl($this->config->url) . + "api/" . + $endpoint; + + return $api_url; + } } diff --git a/Scrutiny/app.json b/Scrutiny/app.json index 2e396e8bad..5586a84096 100644 --- a/Scrutiny/app.json +++ b/Scrutiny/app.json @@ -4,7 +4,7 @@ "website": "https://github.com/AnalogJ/scrutiny", "license": "MIT License", "description": "Scrutiny is a Hard Drive Health Dashboard & Monitoring solution, merging manufacturer provided S.M.A.R.T metrics with real-world failure rates.", - "enhanced": false, + "enhanced": true, "tile_background": "light", "icon": "scrutiny.png" } diff --git a/Scrutiny/config.blade.php b/Scrutiny/config.blade.php new file mode 100644 index 0000000000..e1f4ce5eda --- /dev/null +++ b/Scrutiny/config.blade.php @@ -0,0 +1,23 @@ +