mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-11-03 06:22:39 +09:00
Fix test button
This commit is contained in:
@@ -313,14 +313,14 @@ class ItemController extends Controller
|
||||
|
||||
$app_details = new $app();
|
||||
$app_details->config = (object)$data;
|
||||
$app_details->testConfig();
|
||||
$app_details->test();
|
||||
}
|
||||
|
||||
public function getStats($id)
|
||||
{
|
||||
$item = Item::find($id);
|
||||
|
||||
$config = $item->config();
|
||||
$config = $item->getconfig();
|
||||
if(isset($config->type)) {
|
||||
$application = new $config->type;
|
||||
$application->config = $config;
|
||||
|
||||
@@ -140,16 +140,20 @@ class Item extends Model
|
||||
|
||||
public function enhanced()
|
||||
{
|
||||
$details = $this->config();
|
||||
$details = $this->getconfig();
|
||||
$class = $details->type;
|
||||
$app = new $class;
|
||||
return (bool)($app instanceof \App\EnhancedApps);
|
||||
}
|
||||
|
||||
public function config()
|
||||
public function getconfig()
|
||||
{
|
||||
$config = json_decode($this->description);
|
||||
|
||||
$explode = explode('\\', $config->type);
|
||||
$config->name = end($explode);
|
||||
|
||||
|
||||
$config->url = $this->url;
|
||||
if(isset($config->override_url) && !empty($config->override_url)) {
|
||||
$config->url = $config->override_url;
|
||||
|
||||
@@ -6,9 +6,23 @@ use GuzzleHttp\Client;
|
||||
abstract class SupportedApps
|
||||
{
|
||||
|
||||
public function test($url, $requiresLoginFirst=false)
|
||||
public function appTest($url, $requiresLoginFirst=false)
|
||||
{
|
||||
|
||||
$res = $this->execute($url, $requiresLoginFirst);
|
||||
switch($res->getStatusCode()) {
|
||||
case 200:
|
||||
echo 'Successfully connected to the API';
|
||||
break;
|
||||
case 401:
|
||||
echo 'Failed: Invalid credentials';
|
||||
break;
|
||||
case 404:
|
||||
echo 'Failed: Please make sure your URL is correct and that there is a trailing slash';
|
||||
break;
|
||||
default:
|
||||
echo 'Something went wrong... Code: '.$res->getStatusCode();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function execute($url, $requiresLoginFirst=false)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="details">
|
||||
<div class="title{{ title_color($app->colour) }}">{{ $app->title }}</div>
|
||||
@if($app->enhanced())
|
||||
<div data-id="{{ $app->id }}" data-dataonly="{{ $app->config()->dataonly ?? '0' }}" class="livestats-container"></div>
|
||||
<div data-id="{{ $app->id }}" data-dataonly="{{ $app->getconfig()->dataonly ?? '0' }}" class="livestats-container"></div>
|
||||
@endif
|
||||
</div>
|
||||
<a class="link{{ title_color($app->colour) }}"{!! $app->link_target !!} href="{{ $app->link }}"><i class="fas {{ $app->link_icon }}"></i></a>
|
||||
|
||||
@@ -58,10 +58,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if(isset($item) && isset($item->config->view))
|
||||
@if($item->enhanced())
|
||||
<div id="sapconfig" style="display: block;">
|
||||
@if(isset($item))
|
||||
@include('supportedapps.'.$item->config->view)
|
||||
@include('SupportedApps::'.$item->getconfig()->name.'.config')
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
|
||||
Reference in New Issue
Block a user