ajout heimdall
This commit is contained in:
52
heimdall/config/www/SupportedApps/AdGuardHome/AdGuardHome.php
Executable file
52
heimdall/config/www/SupportedApps/AdGuardHome/AdGuardHome.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php namespace App\SupportedApps\AdGuardHome;
|
||||
|
||||
class AdGuardHome 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('/control/stats'));
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = 'inactive';
|
||||
$res = parent::execute($this->url('/control/stats'));
|
||||
$details = json_decode($res->getBody());
|
||||
|
||||
$data = [];
|
||||
if($details) {
|
||||
// format has been changed in AdguardHome v0.99.0
|
||||
if (is_array($details->dns_queries)) {
|
||||
$data['dns_queries'] = number_format(array_sum($details->dns_queries));
|
||||
$data['blocked_filtering'] = number_format(array_sum($details->blocked_filtering));
|
||||
} else {
|
||||
$data['dns_queries'] = number_format($details->dns_queries);
|
||||
$data['blocked_filtering'] = number_format($details->blocked_filtering);
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getLiveStats($status, $data);
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url);
|
||||
$username = $this->config->username;
|
||||
$password = $this->config->password;
|
||||
$rebuild_url = str_replace('http://', 'http://'.$username.':'.$password.'@', $api_url);
|
||||
$rebuild_url = str_replace('https://', 'https://'.$username.':'.$password.'@', $rebuild_url);
|
||||
$rebuild_url = rtrim($rebuild_url, '/');
|
||||
|
||||
$api_url = $rebuild_url.$endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
}
|
||||
BIN
heimdall/config/www/SupportedApps/AdGuardHome/adguardhome.png
Executable file
BIN
heimdall/config/www/SupportedApps/AdGuardHome/adguardhome.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
10
heimdall/config/www/SupportedApps/AdGuardHome/app.json
Executable file
10
heimdall/config/www/SupportedApps/AdGuardHome/app.json
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "140902edbcc424c09736af28ab2de604c3bde936",
|
||||
"name": "AdGuard Home",
|
||||
"website": "https://github.com/AdguardTeam/AdGuardHome",
|
||||
"license": "GNU General Public License v3.0 only",
|
||||
"description": "AdGuard Home is a network-wide software for blocking ads & tracking. After you set it up, it'll cover ALL your home devices, and you don't need any client-side software for that.\r\n\r\nIt operates as a DNS server that re-routes tracking domains to a \"black hole,\" thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code.",
|
||||
"enhanced": true,
|
||||
"tile_background": "light",
|
||||
"icon": "adguardhome.png"
|
||||
}
|
||||
18
heimdall/config/www/SupportedApps/AdGuardHome/config.blade.php
Executable file
18
heimdall/config/www/SupportedApps/AdGuardHome/config.blade.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<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">
|
||||
<label>{{ __('app.apps.username') }}</label>
|
||||
{!! Form::text('config[username]', null, array('placeholder' => __('app.apps.username'), 'data-config' => 'username', 'class' => 'form-control config-item')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label>{{ __('app.apps.password') }}</label>
|
||||
{!! Form::password('config[password]', array('placeholder' => __('app.apps.password'), 'data-config' => 'password', 'class' => 'form-control config-item')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
10
heimdall/config/www/SupportedApps/AdGuardHome/livestats.blade.php
Executable file
10
heimdall/config/www/SupportedApps/AdGuardHome/livestats.blade.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Queries</span>
|
||||
<strong>{!! $dns_queries !!}</strong>
|
||||
</li>
|
||||
<li>
|
||||
<span class="title">Blocked</span>
|
||||
<strong>{!! $blocked_filtering !!}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
Reference in New Issue
Block a user