Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion WatchYourLAN/WatchYourLAN.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,47 @@

namespace App\SupportedApps\WatchYourLAN;

class WatchYourLAN extends \App\SupportedApps
class WatchYourLAN extends \App\SupportedApps implements \App\EnhancedApps
{

public $config;

//protected $login_first = true; // Uncomment if api requests need to be authed first
//protected $method = 'POST'; // Uncomment if requests to the API should be set by POST

public function __construct()
{
//$this->jar = new \GuzzleHttp\Cookie\CookieJar; // Uncomment if cookies need to be set
}

public function test()
{
$test = parent::appTest($this->url('api/all/'));
echo $test->status;
}

public function livestats()
{
$status = 'inactive';
$res = parent::execute($this->url('api/all/'));
$hosts = json_decode($res->getBody());
$unknown_count = 0;

if (is_array($hosts)) {
foreach ($hosts as $key => $host) {
if (isset($host->Known) && $host->Known == 0) {
$unknown_count += 1;
}
}
}

$data['unknown_count'] = $unknown_count;
return parent::getLiveStats($status, $data);
}

public function url($endpoint)
{
$api_url = parent::normaliseurl($this->config->url) . $endpoint;
return $api_url;
}
}
2 changes: 1 addition & 1 deletion WatchYourLAN/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"website": "https://github.com/aceberg/WatchYourLAN",
"license": "MIT License",
"description": "Lightweight network IP scanner with web GUI https://github.com/aceberg/WatchYourLAN",
"enhanced": false,
"enhanced": true,
"tile_background": "dark",
"icon": "watchyourlan.png"
}
10 changes: 10 additions & 0 deletions WatchYourLAN/config.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
<div class="items">
<div class="input">
<label>{{ strtoupper(__('app.url')) }}</label>
{!! Form::text('config[override_url]', null, array('placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control')) !!}
</div>
<div class="input">
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
</div>
</div>
6 changes: 6 additions & 0 deletions WatchYourLAN/livestats.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<ul class="livestats">
<li>
<span class="title">Unknown</span>
<strong>{!! $unknown_count !!}</strong>
</li>
</ul>