mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-06 15:04:01 +09:00
Traefik: enhanced conversion
This commit is contained in:
@@ -1,12 +1,78 @@
|
|||||||
<?php namespace App\SupportedApps;
|
<?php namespace App\SupportedApps;
|
||||||
|
|
||||||
class Traefik implements Contracts\Applications {
|
use GuzzleHttp\Client;
|
||||||
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
|
|
||||||
|
class Traefik implements Contracts\Applications, Contracts\Livestats
|
||||||
|
{
|
||||||
|
|
||||||
public function defaultColour()
|
public function defaultColour()
|
||||||
{
|
{
|
||||||
return '#28434a';
|
return '#28434a';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function icon()
|
public function icon()
|
||||||
{
|
{
|
||||||
return 'supportedapps/traefik.png';
|
return 'supportedapps/traefik.png';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public function configDetails()
|
||||||
|
{
|
||||||
|
return 'traefik';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConfig()
|
||||||
|
{
|
||||||
|
$res = $this->sendRequest();
|
||||||
|
if ($res == null) {
|
||||||
|
echo 'Traefik connection failed';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch($res->getStatusCode()) {
|
||||||
|
case 200:
|
||||||
|
$data = json_decode($res->getBody());
|
||||||
|
echo "Successfully connected with status: ".$data->result."\n";
|
||||||
|
break;
|
||||||
|
case 404:
|
||||||
|
echo 'Failed: Please make sure your URL is correct and includes the port';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo 'Something went wrong... Code: '.$res->getStatusCode();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function executeConfig()
|
||||||
|
{
|
||||||
|
$html = '';
|
||||||
|
$active = 'inactive';
|
||||||
|
$res = $this->sendRequest();
|
||||||
|
$data = json_decode($res->getBody());
|
||||||
|
if ($data) {
|
||||||
|
$avg_response_time = $data->average_response_time_sec;
|
||||||
|
$time = $avg_response_time*1000;
|
||||||
|
$time_output = number_format($time, 2);
|
||||||
|
$active = ($time > 0) ? 'active' : 'inactive';
|
||||||
|
$html = '
|
||||||
|
<ul class="livestats">
|
||||||
|
<li><span class="title">Avg. Response Time</span><sub><i class="fas fa-heartbeat"></i> '.$time_output.' ms</sub></li>
|
||||||
|
</ul>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
return json_encode(['status' => $active, 'html' => $html]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendRequest()
|
||||||
|
{
|
||||||
|
$config = $this->config;
|
||||||
|
$url = $config->url;
|
||||||
|
|
||||||
|
$url = rtrim($url, '/');
|
||||||
|
$api_url = $url.'/health';
|
||||||
|
|
||||||
|
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]);
|
||||||
|
$res = $client->request('GET', $api_url);
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
12
readme.md
12
readme.md
@@ -1,6 +1,6 @@
|
|||||||

|

|
||||||
|
|
||||||
____
|
____
|
||||||
[](https://discord.gg/CCjHKn4)
|
[](https://discord.gg/CCjHKn4)
|
||||||
[](https://hub.docker.com/r/linuxserver/heimdall/)
|
[](https://hub.docker.com/r/linuxserver/heimdall/)
|
||||||
[](http://www.firsttimersonly.com/)
|
[](http://www.firsttimersonly.com/)
|
||||||
@@ -12,7 +12,7 @@ ___
|
|||||||
Visit the website - https://heimdall.site
|
Visit the website - https://heimdall.site
|
||||||
___
|
___
|
||||||
|
|
||||||
## About
|
## About
|
||||||
As the name suggests Heimdall Application Dashboard is a dashboard for all your web applications. It doesn't need to be limited to applications though, you can add links to anything you like.
|
As the name suggests Heimdall Application Dashboard is a dashboard for all your web applications. It doesn't need to be limited to applications though, you can add links to anything you like.
|
||||||
|
|
||||||
Heimdall is an elegant solution to organise all your web applications. It’s dedicated to this purpose so you won’t lose your links in a sea of bookmarks.
|
Heimdall is an elegant solution to organise all your web applications. It’s dedicated to this purpose so you won’t lose your links in a sea of bookmarks.
|
||||||
@@ -38,6 +38,7 @@ Supported applications are recognized by the title of the application as entered
|
|||||||
- Runeaudio
|
- Runeaudio
|
||||||
- Sabnzbd
|
- Sabnzbd
|
||||||
- Tautulli
|
- Tautulli
|
||||||
|
- Traefik
|
||||||
- Transmission
|
- Transmission
|
||||||
|
|
||||||
**Foundation**
|
**Foundation**
|
||||||
@@ -69,7 +70,6 @@ Supported applications are recognized by the title of the application as entered
|
|||||||
- SickRage
|
- SickRage
|
||||||
- Sonarr
|
- Sonarr
|
||||||
- TT-RSS
|
- TT-RSS
|
||||||
- Traefik
|
|
||||||
- UniFI
|
- UniFI
|
||||||
- unRAID
|
- unRAID
|
||||||
- pfSense
|
- pfSense
|
||||||
@@ -86,7 +86,7 @@ If you find you can't change the background make sure php_fileinfo is enabled in
|
|||||||
|
|
||||||
Installation is as simple as cloning the repository somewhere, or downloading and extracting the zip/tar and pointing your httpd document root to the `/public` folder. For simple testing you could just go to the folder and type `php artisan serve`
|
Installation is as simple as cloning the repository somewhere, or downloading and extracting the zip/tar and pointing your httpd document root to the `/public` folder. For simple testing you could just go to the folder and type `php artisan serve`
|
||||||
|
|
||||||
There are also dockers and instructions on how to use them at
|
There are also dockers and instructions on how to use them at
|
||||||
|
|
||||||
for x86-64: https://hub.docker.com/r/linuxserver/heimdall/
|
for x86-64: https://hub.docker.com/r/linuxserver/heimdall/
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ RewriteCond %{REQUEST_FILENAME} !-f
|
|||||||
RewriteRule ^ index.php [L]
|
RewriteRule ^ index.php [L]
|
||||||
```
|
```
|
||||||
#### More info
|
#### More info
|
||||||
More info about AllowOverride can be found here :
|
More info about AllowOverride can be found here :
|
||||||
https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride
|
https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride
|
||||||
|
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ location /webfonts {
|
|||||||
If there are any other locations which might interefere with any of the folders in the /public folder, you might have to do the same for those as well, but it's a super fringe case.
|
If there are any other locations which might interefere with any of the folders in the /public folder, you might have to do the same for those as well, but it's a super fringe case.
|
||||||
|
|
||||||
### Reverse proxy
|
### Reverse proxy
|
||||||
If you'd like to reverse proxy this app, we recommend using our letsencrypt/nginx docker image: [Letsencrypt/Nginx](https://hub.docker.com/r/linuxserver/letsencrypt/)
|
If you'd like to reverse proxy this app, we recommend using our letsencrypt/nginx docker image: [Letsencrypt/Nginx](https://hub.docker.com/r/linuxserver/letsencrypt/)
|
||||||
You can either reverse proxy from the root location, or from a subdomain (subfolder method is currently not supported). For https proxy, make sure you use the https port of Heimdall webserver, otherwise some links may break. You can add security through `.htpasswd`
|
You can either reverse proxy from the root location, or from a subdomain (subfolder method is currently not supported). For https proxy, make sure you use the https port of Heimdall webserver, otherwise some links may break. You can add security through `.htpasswd`
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
11
resources/views/supportedapps/traefik.blade.php
Normal file
11
resources/views/supportedapps/traefik.blade.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }})</h2>
|
||||||
|
<div class="items">
|
||||||
|
<input type="hidden" data-config="type" class="config-item" name="config[type]" value="\App\SupportedApps\Traefik" />
|
||||||
|
<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>
|
||||||
Reference in New Issue
Block a user