including some more dashboard components
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\SupportedApps\NginxProxyManager;
|
||||
|
||||
class NginxProxyManager 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"));
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = "inactive";
|
||||
$auth_attrs = [
|
||||
"headers" => [
|
||||
"Accept" => "application/json",
|
||||
"Content-Type" => "application/json",
|
||||
],
|
||||
"body" => json_encode([
|
||||
"identity" => $this->config->email,
|
||||
"secret" => $this->config->password,
|
||||
]),
|
||||
];
|
||||
$auth_res = parent::execute(
|
||||
$this->url("api/tokens"),
|
||||
$auth_attrs,
|
||||
null,
|
||||
"POST"
|
||||
);
|
||||
$auth_data = json_decode($auth_res->getBody(), true);
|
||||
$token = $auth_data["token"];
|
||||
|
||||
$attrs = [
|
||||
"headers" => [
|
||||
"Accept" => "application/json",
|
||||
"Authorization" => "Bearer " . $token,
|
||||
],
|
||||
];
|
||||
$res = parent::execute($this->url("api/reports/hosts"), $attrs);
|
||||
$data = json_decode($res->getBody(), true);
|
||||
|
||||
return parent::getLiveStats($status, $data);
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url) . $endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "cbfad988a16a9fbcc1812bc206afcc1f73dd36de",
|
||||
"name": "Nginx Proxy Manager",
|
||||
"website": "https://nginxproxymanager.jc21.com",
|
||||
"license": "MIT License",
|
||||
"description": "This project comes as a pre-built docker image that enables you to easily forward to your websites running at home or otherwise, including free SSL, without having to know too much about Nginx or Letsencrypt.",
|
||||
"enhanced": true,
|
||||
"tile_background": "light",
|
||||
"icon": "nginxproxymanager.png"
|
||||
}
|
||||
@@ -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]', isset($item) ? $item->getconfig()->override_url : null, ['placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control']) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label>Email address</label>
|
||||
{!! Form::text('config[email]', isset($item) ? $item->getconfig()->email : null, ['placeholder' => __('Email address'), 'data-config' => 'email', 'class' => 'form-control config-item']) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label>{{ __('app.apps.password') }}</label>
|
||||
{!! Form::input('password', 'config[password]', '', ['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>
|
||||
@@ -0,0 +1,10 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Proxy Hosts</span>
|
||||
<strong>{!! $proxy !!}</strong>
|
||||
</li>
|
||||
<li>
|
||||
<span class="title">Redirection Hosts</span>
|
||||
<strong>{!! $redirection !!}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
Reference in New Issue
Block a user