ajout heimdall
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
<?php namespace App\SupportedApps\Pihole;
|
||||
|
||||
class Pihole 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('/api.php'));
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = 'inactive';
|
||||
$res = parent::execute($this->url('/api.php'));
|
||||
$details = json_decode($res->getBody());
|
||||
|
||||
$data = [];
|
||||
|
||||
if($details) {
|
||||
$data['ads_blocked_today'] = number_format($details->ads_blocked_today);
|
||||
$data['ads_percentage_today'] = number_format($details->ads_percentage_today,1);
|
||||
}
|
||||
|
||||
return parent::getLiveStats($status, $data);
|
||||
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url).$endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "b89920409bdce40e08ba1023480b0546061cd577",
|
||||
"name": "Pi-hole",
|
||||
"website": "https://pi-hole.net/",
|
||||
"license": "European Union Public License 1.2",
|
||||
"description": "Pi-hole is a Linux network-level advertisement and internet tracker blocking application which acts as a DNS sinkhole, intended for use on a private network.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "pihole.png"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
|
||||
<div class="items">
|
||||
<input type="hidden" data-config="dataonly" class="config-item" name="config[dataonly]" value="1" />
|
||||
<div class="input">
|
||||
<label>{{ strtoupper(__('app.url')) }}</label>
|
||||
{!! Form::text('config[override_url]', (isset($item) ? $item->getconfig()->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>
|
||||
@@ -0,0 +1,10 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Queries<br />Blocked</span>
|
||||
<strong>{!! $ads_blocked_today !!}</strong>
|
||||
</li>
|
||||
<li>
|
||||
<span class="title">Percent<br /> Blocked</span>
|
||||
<strong>{!! $ads_percentage_today !!}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
Reference in New Issue
Block a user