ajout heimdall
This commit is contained in:
46
heimdall/config/www/SupportedApps/PiAware/PiAware.php
Executable file
46
heimdall/config/www/SupportedApps/PiAware/PiAware.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php namespace App\SupportedApps\PiAware;
|
||||
|
||||
class PiAware 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
|
||||
|
||||
function __construct() {
|
||||
//$this->jar = new \GuzzleHttp\Cookie\CookieJar; // Uncomment if cookies need to be set
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
$test = parent::appTest($this->url('data/aircraft.json'));
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = 'inactive';
|
||||
$res = parent::execute($this->url('data/aircraft.json'));
|
||||
$details = json_decode($res->getBody(), true);
|
||||
|
||||
$data = [];
|
||||
|
||||
if($details) {
|
||||
$filtered_total = array_filter($details['aircraft'], function($element) {
|
||||
return $element['seen'] <= 58;
|
||||
});
|
||||
$data['total'] = count($filtered_total);
|
||||
$filtered_positions = array_filter($filtered_total, function($element) {
|
||||
return array_key_exists('seen_pos', $element) && $element['seen_pos'] < 60;
|
||||
});
|
||||
$data['positions'] = count($filtered_positions);
|
||||
}
|
||||
|
||||
return parent::getLiveStats($status, $data);
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url).$endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
}
|
||||
10
heimdall/config/www/SupportedApps/PiAware/app.json
Executable file
10
heimdall/config/www/SupportedApps/PiAware/app.json
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "b897f0f558bc83256a49d5c7e8f1658d87cfe820",
|
||||
"name": "PiAware",
|
||||
"website": "https://github.com/flightaware/piaware",
|
||||
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
|
||||
"description": "Client-side package and programs for forwarding ADS-B data to FlightAware",
|
||||
"enhanced": true,
|
||||
"tile_background": "light",
|
||||
"icon": "piaware.png"
|
||||
}
|
||||
10
heimdall/config/www/SupportedApps/PiAware/config.blade.php
Executable file
10
heimdall/config/www/SupportedApps/PiAware/config.blade.php
Executable file
@@ -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>
|
||||
11
heimdall/config/www/SupportedApps/PiAware/livestats.blade.php
Executable file
11
heimdall/config/www/SupportedApps/PiAware/livestats.blade.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Aircraft</span>
|
||||
<strong>{!! $total !!}</strong>
|
||||
</li>
|
||||
<li>
|
||||
<span class="title">Positions</span>
|
||||
<strong>{!! $positions !!}</strong>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
BIN
heimdall/config/www/SupportedApps/PiAware/piaware.png
Executable file
BIN
heimdall/config/www/SupportedApps/PiAware/piaware.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 9.3 KiB |
Reference in New Issue
Block a user