KodeStar
6 years ago
committed by
GitHub
521 changed files with 33624 additions and 8714 deletions
@ -0,0 +1,55 @@ |
|||
<?php |
|||
|
|||
namespace App; |
|||
|
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class Application extends Model |
|||
{ |
|||
public $incrementing = false; |
|||
|
|||
protected $primaryKey = 'appid'; |
|||
|
|||
// |
|||
public function icon() |
|||
{ |
|||
return $this->icon; |
|||
} |
|||
|
|||
public function iconView() |
|||
{ |
|||
return asset('storage/'.$this->icon); |
|||
} |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
// check if light or dark |
|||
if($this->tile_background == 'light') return '#fafbfc'; |
|||
return '#161b1f'; |
|||
} |
|||
|
|||
public function class() |
|||
{ |
|||
$name = $this->name; |
|||
$name = preg_replace('/\PL/u', '', $name); |
|||
|
|||
$class = '\App\SupportedApps\\'.$name.'\\'.$name; |
|||
return $class; |
|||
} |
|||
|
|||
public static function applist() |
|||
{ |
|||
$list = []; |
|||
$all = self::all(); |
|||
$list['null'] = 'None'; |
|||
foreach($all as $app) { |
|||
$name = $app->name; |
|||
$name = preg_replace('/\PL/u', '', $name); |
|||
|
|||
$list['\App\SupportedApps\\'.$name.'\\'.$name] = $app->name; |
|||
} |
|||
return $list; |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,61 @@ |
|||
<?php |
|||
|
|||
namespace App\Console\Commands; |
|||
|
|||
use Illuminate\Console\Command; |
|||
use App\Application; |
|||
use App\SupportedApps; |
|||
|
|||
class RegisterApp extends Command |
|||
{ |
|||
/** |
|||
* The name and signature of the console command. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $signature = 'register:app {folder}'; |
|||
|
|||
/** |
|||
* The console command description. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $description = 'Add a local app to the registry'; |
|||
|
|||
/** |
|||
* Create a new command instance. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
} |
|||
|
|||
/** |
|||
* Execute the console command. |
|||
* |
|||
* @return mixed |
|||
*/ |
|||
public function handle() |
|||
{ |
|||
$folder = $this->argument('folder'); |
|||
$json = app_path('SupportedApps/'.$folder.'/app.json'); |
|||
if(file_exists($json)) { |
|||
$app = json_decode(file_get_contents($json)); |
|||
$exists = Application::find($app->appid); |
|||
if($exists) { |
|||
$this->error('This app is already registered'); |
|||
exit; |
|||
} |
|||
// Doesn't exist so add it |
|||
SupportedApps::saveApp($app, new Application); |
|||
$this->info("Application Added - ".$app->name." - ".$app->appid); |
|||
|
|||
} else { |
|||
$this->error('Could not find '.$json); |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,12 @@ |
|||
<?php namespace App; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
interface EnhancedApps |
|||
{ |
|||
public function test(); |
|||
public function livestats(); |
|||
public function url($endpoint); |
|||
|
|||
} |
@ -0,0 +1,63 @@ |
|||
<?php |
|||
|
|||
namespace App\Jobs; |
|||
|
|||
use Illuminate\Bus\Queueable; |
|||
use Illuminate\Queue\SerializesModels; |
|||
use Illuminate\Queue\InteractsWithQueue; |
|||
use Illuminate\Contracts\Queue\ShouldQueue; |
|||
use Illuminate\Foundation\Bus\Dispatchable; |
|||
use App\Application; |
|||
use App\SupportedApps; |
|||
|
|||
class ProcessApps implements ShouldQueue |
|||
{ |
|||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
|||
|
|||
/** |
|||
* Create a new job instance. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
// |
|||
} |
|||
|
|||
/** |
|||
* Execute the job. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function handle() |
|||
{ |
|||
$localapps = Application::all(); |
|||
$list = json_decode(SupportedApps::getList()->getBody()); |
|||
$validapps = []; |
|||
foreach($list->apps as $app) { |
|||
$validapps[] = $app->appid; |
|||
if(!file_exists(app_path('SupportedApps/'.className($app->name)))) { |
|||
SupportedApps::getFiles($app); |
|||
$application = new Application; |
|||
SupportedApps::saveApp($app, $application); |
|||
} else { |
|||
// check if there has been an update for this app |
|||
$localapp = $localapps->where('appid', $app->appid)->first(); |
|||
if($localapp) { |
|||
if($localapp->sha !== $app->sha) { |
|||
SupportedApps::getFiles($app); |
|||
SupportedApps::saveApp($app, $localapp); |
|||
} |
|||
} else { |
|||
SupportedApps::getFiles($app); |
|||
$application = new Application; |
|||
SupportedApps::saveApp($app, $application); |
|||
|
|||
} |
|||
} |
|||
} |
|||
//$delete = Application::whereNotIn('appid', $validapps)->delete(); // delete any apps not in list |
|||
// removed the delete so local apps can be added |
|||
|
|||
} |
|||
} |
@ -0,0 +1,154 @@ |
|||
<?php namespace App; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
use Illuminate\Support\Facades\Log; |
|||
|
|||
abstract class SupportedApps |
|||
{ |
|||
|
|||
protected $jar = false; |
|||
protected $method = 'GET'; |
|||
protected $error; |
|||
|
|||
public function appTest($url, $attrs = [], $overridevars=false) |
|||
{ |
|||
$res = $this->execute($url, $attrs); |
|||
if($res == null) { |
|||
return (object)[ |
|||
'code' => null, |
|||
'status' => $this->error, |
|||
'response' => 'Connection failed', |
|||
]; |
|||
} |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
$status = 'Successfully communicated with the API'; |
|||
break; |
|||
case 401: |
|||
$status = 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
$status = 'Failed: Please make sure your URL is correct and that there is a trailing slash'; |
|||
break; |
|||
default: |
|||
$status = 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
} |
|||
return (object)[ |
|||
'code' => $res->getStatusCode(), |
|||
'status' => $status, |
|||
'response' => $res->getBody(), |
|||
]; |
|||
} |
|||
|
|||
public function execute($url, $attrs = [], $overridevars=false, $overridemethod=false) |
|||
{ |
|||
$res = null; |
|||
|
|||
$vars = ($overridevars !== false) ? |
|||
$overridevars : [ |
|||
'http_errors' => false, |
|||
'timeout' => 15, |
|||
'connect_timeout' => 15, |
|||
]; |
|||
|
|||
$client = new Client($vars); |
|||
|
|||
$method = ($overridemethod !== false) ? $overridemethod : $this->method; |
|||
|
|||
try { |
|||
return $client->request($method, $url, $attrs); |
|||
} catch (\GuzzleHttp\Exception\ConnectException $e) { |
|||
Log::error("Connection refused"); |
|||
Log::debug($e->getMessage()); |
|||
$this->error = "Connection refused - ".(string) $e->getMessage(); |
|||
} catch (\GuzzleHttp\Exception\ServerException $e) { |
|||
Log::debug($e->getMessage()); |
|||
$this->error = (string) $e->getResponse()->getBody(); |
|||
} |
|||
$this->error = 'General error connecting with API'; |
|||
return $res; |
|||
} |
|||
|
|||
public function login() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public function normaliseurl($url, $addslash=true) |
|||
{ |
|||
|
|||
$url = rtrim($url, '/'); |
|||
if($addslash) $url .= '/'; |
|||
|
|||
return $url; |
|||
|
|||
} |
|||
|
|||
|
|||
public function getLiveStats($status, $data) |
|||
{ |
|||
$className = get_class($this); |
|||
$explode = explode('\\', $className); |
|||
$name = end($explode); |
|||
|
|||
$html = view('SupportedApps::'.$name.'.livestats', $data)->with('data', $data)->render(); |
|||
return json_encode(['status' => $status, 'html' => $html]); |
|||
//return |
|||
} |
|||
|
|||
public static function getList() |
|||
{ |
|||
$list_url = 'https://apps.heimdall.site/list'; |
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
return $client->request('GET', $list_url); |
|||
} |
|||
|
|||
public static function getFiles($app) |
|||
{ |
|||
$zipurl = $app->files; |
|||
$client = new Client(['http_errors' => false, 'timeout' => 60, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $zipurl); |
|||
|
|||
if(!file_exists(app_path('SupportedApps'))) { |
|||
mkdir(app_path('SupportedApps'), 0777, true); |
|||
} |
|||
|
|||
$src = app_path('SupportedApps/'.className($app->name).'.zip'); |
|||
file_put_contents($src, $res->getBody()); |
|||
|
|||
$zip = new \ZipArchive(); |
|||
$x = $zip->open($src); // open the zip file to extract |
|||
if ($x === true) { |
|||
$zip->extractTo(app_path('SupportedApps')); // place in the directory with same name |
|||
$zip->close(); |
|||
unlink($src); //Deleting the Zipped file |
|||
} |
|||
} |
|||
|
|||
public static function saveApp($details, $app) |
|||
{ |
|||
$img_src = app_path('SupportedApps/'.className($details->name).'/'.$details->icon); |
|||
$img_dest = public_path('storage/supportedapps/'.$details->icon); |
|||
//die("i: ".$img_src); |
|||
copy($img_src, $img_dest); |
|||
|
|||
$app->appid = $details->appid; |
|||
$app->name = $details->name; |
|||
$app->sha = $details->sha ?? null; |
|||
$app->icon = 'supportedapps/'.$details->icon; |
|||
$app->website = $details->website; |
|||
$app->license = $details->license; |
|||
$app->description = $details->description; |
|||
|
|||
$appclass = $app->class(); |
|||
$application = new $appclass; |
|||
$enhanced = (bool)($application instanceof \App\EnhancedApps); |
|||
|
|||
$app->enhanced = $enhanced; |
|||
$app->tile_background = $details->tile_background; |
|||
$app->save(); |
|||
} |
|||
|
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class AirSonic implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#08F'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/airsonic.png'; |
|||
} |
|||
} |
@ -1,14 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Bazarr implements Contracts\Applications { |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#222'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/bazarr.png'; |
|||
} |
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Bitwarden implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#3c8dbc'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/bitwarden.png'; |
|||
} |
|||
} |
@ -1,14 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class BookStack implements Contracts\Applications { |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#02679E'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/bookstack.png'; |
|||
} |
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Booksonic implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#58a'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/booksonic.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class Cardigann implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#753'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/cardigann.png'; |
|||
} |
|||
} |
@ -1,9 +0,0 @@ |
|||
<?php namespace App\SupportedApps\Contracts; |
|||
|
|||
interface Applications { |
|||
|
|||
public function defaultColour(); |
|||
|
|||
public function icon(); |
|||
|
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps\Contracts; |
|||
|
|||
interface Livestats { |
|||
|
|||
public function configDetails(); |
|||
|
|||
public function testConfig(); |
|||
|
|||
public function executeConfig(); |
|||
|
|||
} |
@ -1,122 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
use Illuminate\Support\Facades\Log; |
|||
|
|||
class CouchPotato implements Contracts\Applications, Contracts\Livestats |
|||
{ |
|||
|
|||
private $_client; |
|||
|
|||
public function __construct() |
|||
{ |
|||
$this->_client = new Client( |
|||
['http_errors' => false, |
|||
'timeout' => 10] |
|||
); |
|||
} |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#363840'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/couchpotato.png'; |
|||
} |
|||
public function configDetails() |
|||
{ |
|||
return 'couchpotato'; |
|||
} |
|||
public function testConfig() |
|||
{ |
|||
$res = $this->sendRequest(); |
|||
if ($res == null) { |
|||
echo 'CouchPotato connection failed'; |
|||
return; |
|||
} |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
echo "Successfully connected to CouchPotato"; |
|||
break; |
|||
case 401: |
|||
echo 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
echo 'Failed: Please make sure your URL is correct and includes the port'; |
|||
break; |
|||
case 409: |
|||
echo 'Failed: Incorrect session id'; |
|||
break; |
|||
default: |
|||
echo 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
public function executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$res = $this->sendRequest(); |
|||
if ($res == null) { |
|||
Log::debug('CouchPotato connection failed'); |
|||
return ''; |
|||
} |
|||
$data = json_decode($res->getBody()); |
|||
if (! isset($data->movies)) { |
|||
Log::debug('Failed to fetch data from CouchPotato'); |
|||
return ''; |
|||
} |
|||
$movies = $data->movies; |
|||
$wantedMovies = $availableMovies = 0; |
|||
foreach ($movies as $v) { |
|||
switch ($v->status) { |
|||
case 'active': |
|||
$wantedMovies++; |
|||
break; |
|||
case 'done': |
|||
$availableMovies++; |
|||
break; |
|||
default: |
|||
Log::warning('Unexpected CouchPotato status received: '.$v['status']); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Wanted</span><sub>'.$wantedMovies.'</sub></li> |
|||
<li><span class="title">Available</span><sub>'.$availableMovies.'</sub></li> |
|||
</ul> |
|||
'; |
|||
return json_encode(['status' => 'inactive', 'html' => $html]); |
|||
} |
|||
|
|||
private function sendRequest() |
|||
{ |
|||
$res = null; |
|||
try{ |
|||
$res = $this->_client->request( |
|||
'GET', |
|||
$this->getApiUrl() |
|||
); |
|||
}catch(\GuzzleHttp\Exception\BadResponseException $e){ |
|||
Log::error("Connection to {$e->getRequest()->getUrl()} failed"); |
|||
Log::debug($e->getMessage()); |
|||
$res = $e->getRequest(); |
|||
}catch(\GuzzleHttp\Exception\ConnectException $e) { |
|||
Log::error("CouchPotato connection refused"); |
|||
Log::debug($e->getMessage()); |
|||
} |
|||
return $res; |
|||
} |
|||
|
|||
private function getApiUrl() |
|||
{ |
|||
$url = $this->config->url; |
|||
$url = rtrim($url, '/'); |
|||
$apiUrl = $url.'/api/'.$this->config->apikey.'/movie.list'; |
|||
return $apiUrl; |
|||
} |
|||
} |
@ -1,109 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
class Deluge implements Contracts\Applications, Contracts\Livestats { |
|||
public function defaultColour() |
|||
{ |
|||
return '#357'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/deluge.png'; |
|||
} |
|||
|
|||
public function configDetails() |
|||
{ |
|||
return 'deluge'; |
|||
} |
|||
|
|||
public function testConfig() |
|||
{ |
|||
$res = $this->login()[0]; |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
$data = json_decode($res->getBody()); |
|||
if(!isset($data->result) || is_null($data->result) || $data->result == false) { |
|||
echo 'Failed: Invalid Credentials'; |
|||
} else { |
|||
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 executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'active'; |
|||
$jar = $this->login()[1]; |
|||
$res = $this->getDetails($jar); |
|||
$data = json_decode($res->getBody()); |
|||
$download_rate = $data->result->stats->download_rate; |
|||
$upload_rate = $data->result->stats->upload_rate; |
|||
$seed_count = $data->result->filters->state[2]; |
|||
$leech_count = $data->result->filters->state[1]; |
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title"><i class="fas fa-arrow-down"></i> '.$this->formatBytes($download_rate).'</span></li> |
|||
<li><span class="title"><i class="fas fa-arrow-up"></i> '.$this->formatBytes($upload_rate).'</span></li> |
|||
</ul> |
|||
<ul class="livestats"> |
|||
<li><span class="title">Leech: '.$leech_count[1].'</span></li> |
|||
<li><span class="title">Seed: '.$seed_count[1].'</span></li> |
|||
</ul> |
|||
'; |
|||
return json_encode(['status' => $active, 'html' => $html]); |
|||
} |
|||
public function getDetails($jar) |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
$url = rtrim($url, '/'); |
|||
$api_url = $url.'/json'; |
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('POST', $api_url, [ |
|||
'body' => '{"method": "web.update_ui", "params": [["none"], {}], "id": 1}', |
|||
'cookies' => $jar, |
|||
'headers' => ['content-type' => 'application/json', 'Accept' => 'application/json'] |
|||
]); |
|||
return $res; |
|||
} |
|||
public function login() |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
$password = $config->password; |
|||
$url = rtrim($url, '/'); |
|||
$api_url = $url.'/json'; |
|||
$jar = new \GuzzleHttp\Cookie\CookieJar(); |
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('POST', $api_url, [ |
|||
'body' => '{"method": "auth.login", "params": ["'.$password.'"], "id": 1}', |
|||
'cookies' => $jar, |
|||
'headers' => ['content-type' => 'application/json', 'Accept' => 'application/json'] |
|||
]); |
|||
return array($res,$jar); |
|||
} |
|||
|
|||
function formatBytes($bytes, $precision = 2) { |
|||
$units = array('B', 'KB', 'MB', 'GB', 'TB'); |
|||
|
|||
$bytes = max($bytes, 0); |
|||
$pow = floor(($bytes ? log($bytes) : 0) / log(1024)); |
|||
$pow = min($pow, count($units) - 1); |
|||
|
|||
// Uncomment one of the following alternatives |
|||
$bytes /= pow(1024, $pow); |
|||
// $bytes /= (1 << (10 * $pow)); |
|||
|
|||
return round($bytes, $precision) . ' ' . $units[$pow] . 'ps'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Dokuwiki implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#9d7056'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/dokuwiki.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Duplicati implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#2c3744'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/duplicati.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Emby implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#222'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/emby.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Flood implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '##00D091'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/Flood.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class FreshRSS implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#003B73'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/freshrss.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Gitea implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#585e52'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/gitea.png'; |
|||
} |
|||
} |
@ -1,14 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Glances implements Contracts\Applications { |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#2c363f'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/glances.png'; |
|||
} |
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Grafana implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#a56e4d'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/grafana.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Graylog implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#158'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/graylog.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Headphones implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#185'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/headphones.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class HomeAssistant implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#073c52'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/homeassistant.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Jackett implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#484814'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/jackett.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Jdownloader implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#2b494f'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/jdownloader.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class Krusader implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#5A5'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/krusader.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Lidarr implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#183c18'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/lidarr.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Mailcow implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#161b1f'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/mailcow.svg'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Mcmyadmin implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#30404b'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/mcmyadmin.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Medusa implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#4b5e55'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/medusa.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Monica implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#fafbfc'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/monica.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class MusicBrainz implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#a0a'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/musicbrainz.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Mylar implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#aa0'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/mylar.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Netdata implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#543737'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/netdata.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Nextcloud implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#0e2c3e'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/nextcloud.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class NowShowing implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#690000'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/nowshowing.png'; |
|||
} |
|||
} |
@ -1,84 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Nzbget implements Contracts\Applications, Contracts\Livestats { |
|||
|
|||
public $config; |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#253827'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/nzbget.png'; |
|||
} |
|||
public function configDetails() |
|||
{ |
|||
return 'nzbget'; |
|||
} |
|||
public function testConfig() |
|||
{ |
|||
$res = $this->buildRequest('status'); |
|||
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 executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'inactive'; |
|||
$res = $this->buildRequest('status'); |
|||
$data = json_decode($res->getBody()); |
|||
//$data->result->RemainingSizeMB = '10000000'; |
|||
//$data->result->DownloadRate = '100000000'; |
|||
if($data) { |
|||
$size = $data->result->RemainingSizeMB; |
|||
$rate = $data->result->DownloadRate; |
|||
$queue_size = format_bytes($size*1000*1000, false, ' <span>', '</span>'); |
|||
$current_speed = format_bytes($rate, false, ' <span>'); |
|||
|
|||
$active = ($size > 0 || $rate > 0) ? 'active' : 'inactive'; |
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Queue</span><strong>'.$queue_size.'</strong></li> |
|||
<li><span class="title">Speed</span><strong>'.$current_speed.'/s</span></strong></li> |
|||
</ul> |
|||
'; |
|||
} |
|||
return json_encode(['status' => $active, 'html' => $html]); |
|||
} |
|||
public function buildRequest($endpoint) |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
$username = $config->username; |
|||
$password = $config->password; |
|||
|
|||
$rebuild_url = str_replace('http://', 'http://'.$username.':'.$password.'@', $url); |
|||
$rebuild_url = str_replace('https://', 'https://'.$username.':'.$password.'@', $rebuild_url); |
|||
$rebuild_url = rtrim($rebuild_url, '/'); |
|||
|
|||
|
|||
$api_url = $rebuild_url.'/jsonrpc/'.$endpoint; |
|||
|
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Nzbhydra implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#53644d'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/nzbhydra.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Ombi implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#150f09'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/ombi.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class OpenMediaVault implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#5AF'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/openmediavault.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Openhab implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#2b2525'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/openhab.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Opnsense implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#211914'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/opnsense.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Pfsense implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#243699'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/pfsense.png'; |
|||
} |
|||
} |
@ -1,73 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Pihole implements Contracts\Applications, Contracts\Livestats { |
|||
public function defaultColour() |
|||
{ |
|||
return '#352222'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/pihole.png'; |
|||
} |
|||
|
|||
public function configDetails() |
|||
{ |
|||
return 'pihole'; |
|||
} |
|||
|
|||
public function testConfig() |
|||
{ |
|||
$res = $this->buildRequest(); |
|||
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 executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'active'; |
|||
$res = $this->buildRequest(); |
|||
$data = json_decode($res->getBody()); |
|||
|
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Domains<br />Blocked</span><strong>'.$data->domains_being_blocked.'</strong></li> |
|||
<li><span class="title">Blocked<br />Today</span><strong>'.$data->ads_blocked_today.'</span></strong></li> |
|||
</ul> |
|||
'; |
|||
return json_encode(['status' => $active, 'html' => $html]); |
|||
} |
|||
|
|||
public function buildRequest() |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
|
|||
$url = rtrim($url, '/'); |
|||
|
|||
$api_url = $url.'/api.php'; |
|||
//die( $api_url.' --- '); |
|||
|
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Plex implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#222'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/plex.png'; |
|||
} |
|||
} |
@ -1,77 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Plexpy implements Contracts\Applications, Contracts\Livestats { |
|||
|
|||
public $config; |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#2d2208'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/plexpy.png'; |
|||
} |
|||
public function configDetails() |
|||
{ |
|||
return 'plexpy'; |
|||
} |
|||
public function testConfig() |
|||
{ |
|||
$res = $this->buildRequest('arnold'); |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
$data = json_decode($res->getBody()); |
|||
if(isset($data->error) && !empty($data->error)) { |
|||
echo 'Failed: '.$data->error; |
|||
} else { |
|||
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 executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'active'; |
|||
$res = $this->buildRequest('get_activity'); |
|||
$data = json_decode($res->getBody()); |
|||
$stream_count = $data->response->data->stream_count; |
|||
|
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Stream Count</span><strong>'.$stream_count.'</strong></li> |
|||
</ul> |
|||
'; |
|||
|
|||
return json_encode(['status' => $active, 'html' => $html]); |
|||
} |
|||
public function buildRequest($endpoint) |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
$apikey = $config->apikey; |
|||
|
|||
$url = rtrim($url, '/'); |
|||
|
|||
$api_url = $url.'/api/v2?apikey='.$apikey.'&cmd='.$endpoint; |
|||
|
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Plexrequests implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#3c2d1c'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/plexrequests.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Portainer implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#283f44'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/portainer.png'; |
|||
} |
|||
} |
@ -1,80 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Proxmox implements Contracts\Applications, Contracts\Livestats { |
|||
public function defaultColour() |
|||
{ |
|||
return '#542e0a'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/proxmox.png'; |
|||
} |
|||
|
|||
public function configDetails() |
|||
{ |
|||
//return 'proxmox'; |
|||
return null; |
|||
} |
|||
|
|||
public function testConfig() |
|||
{ |
|||
/*$res = $this->buildRequest(); |
|||
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; |
|||
}*/ |
|||
return null; |
|||
} |
|||
|
|||
public function executeConfig() |
|||
{ |
|||
/* |
|||
$output = ''; |
|||
$res = $this->buildRequest(); |
|||
$data = json_decode($res->getBody()); |
|||
|
|||
$output = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Domains<br />Blocked</span><strong>'.$data->domains_being_blocked.'</strong></li> |
|||
<li><span class="title">Blocked<br />Today</span><strong>'.$data->ads_blocked_today.'</span></strong></li> |
|||
</ul> |
|||
'; |
|||
return $output; |
|||
*/ |
|||
return null; |
|||
} |
|||
|
|||
public function buildRequest($endpoint='') |
|||
{ |
|||
$config = $this->config; |
|||
|
|||
$username = $config->username; |
|||
$password = $config->password; |
|||
|
|||
$url = $config->url; |
|||
$url = rtrim($url, '/'); |
|||
|
|||
$api_url = $url.'/api2/json/'.$endpoint.'?username='.$username.'&password='.$password; |
|||
//die( $api_url.' --- '); |
|||
|
|||
$client = new Client(['http_errors' => false, 'verify' => false ]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Radarr implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#3e3726'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/radarr.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Rancher implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#78c9cf'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/rancher.png'; |
|||
} |
|||
} |
@ -1,95 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Runeaudio implements Contracts\Applications, Contracts\Livestats { |
|||
public function defaultColour() |
|||
{ |
|||
return '#05A'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/runeaudio.png'; |
|||
} |
|||
|
|||
public function configDetails() |
|||
{ |
|||
return 'runeaudio'; |
|||
} |
|||
|
|||
public function testConfig() |
|||
{ |
|||
$res = $this->buildRequest('status'); |
|||
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 executeConfig() |
|||
{ |
|||
$output = ''; |
|||
$active = 'active'; |
|||
$artist = ''; |
|||
$song_title = ''; |
|||
$res = $this->buildRequest('currentsong'); |
|||
$array = explode("\n", $res->getBody()); |
|||
foreach($array as $item) { |
|||
$item_array = explode(": ", $item); |
|||
if ($item_array[0] == 'Artist') { |
|||
$artist = $item_array[1]; |
|||
} elseif ($item_array[0] == 'Title') { |
|||
$song_title = $item_array[1]; |
|||
} |
|||
} |
|||
|
|||
$output = '<ul class="livestats">'; |
|||
|
|||
if (strlen($artist) > 12) { |
|||
$output = $output.'<li><span class="title-marquee"><span>'.$artist.'</span></span></li>'; |
|||
} else { |
|||
$output = $output.'<li><span class="title">'.$artist.'</span></li>'; |
|||
} |
|||
|
|||
$output = $output.'</ul><ul class="livestats">'; |
|||
|
|||
if (strlen($song_title) > 12) { |
|||
$output = $output.'<li><span class="title-marquee"><span>'.$song_title.'</span></span></li>'; |
|||
} else { |
|||
$output = $output.'<li><span class="title">'.$song_title.'</span></li>'; |
|||
} |
|||
|
|||
$output = $output.'</ul>'; |
|||
|
|||
return json_encode(['status' => $active, 'html' => $output]); |
|||
} |
|||
|
|||
public function buildRequest($endpoint) |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
|
|||
$url = rtrim($url, '/'); |
|||
|
|||
$api_url = $url.'/command/?cmd='.$endpoint; |
|||
//die( $api_url.' --- '); |
|||
|
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -1,89 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Sabnzbd implements Contracts\Applications, Contracts\Livestats { |
|||
|
|||
public $config; |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#3e3924'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/sabnzbd.png'; |
|||
} |
|||
public function configDetails() |
|||
{ |
|||
return 'sabnzbd'; |
|||
} |
|||
public function testConfig() |
|||
{ |
|||
$res = $this->buildRequest('queue'); |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
$data = json_decode($res->getBody()); |
|||
if(isset($data->error) && !empty($data->error)) { |
|||
echo 'Failed: '.$data->error; |
|||
} else { |
|||
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 executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'inactive'; |
|||
$res = $this->buildRequest('queue'); |
|||
$data = json_decode($res->getBody()); |
|||
//$data->result->RemainingSizeMB = '10000000'; |
|||
//$data->result->DownloadRate = '100000000'; |
|||
if($data) { |
|||
$size = $data->queue->mbleft; |
|||
$rate = $data->queue->kbpersec; |
|||
$queue_size = format_bytes($size*1000*1000, false, ' <span>', '</span>'); |
|||
$current_speed = format_bytes($rate*1000, false, ' <span>'); |
|||
|
|||
$active = ($size > 0 || $rate > 0) ? 'active' : 'inactive'; |
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Queue</span><strong>'.$queue_size.'</strong></li> |
|||
<li><span class="title">Speed</span><strong>'.$current_speed.'/s</span></strong></li> |
|||
</ul> |
|||
'; |
|||
} |
|||
return json_encode(['status' => $active, 'html' => $html]); |
|||
} |
|||
public function buildRequest($endpoint) |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
$apikey = $config->apikey; |
|||
|
|||
//print_r($config); |
|||
//die(); |
|||
|
|||
$url = rtrim($url, '/'); |
|||
|
|||
$api_url = $url.'/api?output=json&apikey='.$apikey.'&mode='.$endpoint; |
|||
//die( $api_url.' --- '); |
|||
|
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Sickrage implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#6185a6'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/sickrage.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Sonarr implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#163740'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/sonarr.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class Syncthing implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#888'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/syncthing.png'; |
|||
} |
|||
} |
@ -1,14 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class TVheadend implements Contracts\Applications { |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#006080'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/tvheadend.png'; |
|||
} |
|||
|
|||
} |
@ -1,77 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
|
|||
class Tautulli implements Contracts\Applications, Contracts\Livestats { |
|||
|
|||
public $config; |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#2d2208'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/tautulli.png'; |
|||
} |
|||
public function configDetails() |
|||
{ |
|||
return 'tautulli'; |
|||
} |
|||
public function testConfig() |
|||
{ |
|||
$res = $this->buildRequest('arnold'); |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
$data = json_decode($res->getBody()); |
|||
if(isset($data->error) && !empty($data->error)) { |
|||
echo 'Failed: '.$data->error; |
|||
} else { |
|||
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 executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'active'; |
|||
$res = $this->buildRequest('get_activity'); |
|||
$data = json_decode($res->getBody()); |
|||
$stream_count = $data->response->data->stream_count; |
|||
|
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Stream Count</span><strong>'.$stream_count.'</strong></li> |
|||
</ul> |
|||
'; |
|||
|
|||
return json_encode(['status' => $active, 'html' => $html]); |
|||
} |
|||
public function buildRequest($endpoint) |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
$apikey = $config->apikey; |
|||
|
|||
$url = rtrim($url, '/'); |
|||
|
|||
$api_url = $url.'/api/v2?apikey='.$apikey.'&cmd='.$endpoint; |
|||
|
|||
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|||
$res = $client->request('GET', $api_url); |
|||
return $res; |
|||
|
|||
} |
|||
|
|||
} |
@ -1,78 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Client; |
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
|
|||
class Traefik implements Contracts\Applications, Contracts\Livestats |
|||
{ |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#28434a'; |
|||
} |
|||
|
|||
public function icon() |
|||
{ |
|||
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; |
|||
} |
|||
} |
@ -1,169 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
use GuzzleHttp\Exception\GuzzleException; |
|||
use GuzzleHttp\Client; |
|||
use Illuminate\Support\Facades\Log; |
|||
|
|||
class Transmission implements Contracts\Applications, Contracts\Livestats |
|||
{ |
|||
|
|||
private $_client; |
|||
private $_clientOptions = array(); |
|||
|
|||
public function __construct() |
|||
{ |
|||
$body = array(); |
|||
$body["method"] = "torrent-get"; |
|||
$body["arguments"] = array("fields" => ["percentDone","status","rateDownload","rateUpload"]); |
|||
$this->_client = new Client( |
|||
['http_errors' => false, |
|||
'timeout' => 10, |
|||
'body' => json_encode($body)] |
|||
); |
|||
} |
|||
|
|||
public function defaultColour() |
|||
{ |
|||
return '#950003'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/transmission.png'; |
|||
} |
|||
public function configDetails() |
|||
{ |
|||
return 'transmission'; |
|||
} |
|||
public function testConfig() |
|||
{ |
|||
$res = $this->sendRequest(); |
|||
if ($res == null) { |
|||
echo 'Transmission connection failed'; |
|||
return; |
|||
} |
|||
switch($res->getStatusCode()) { |
|||
case 200: |
|||
$data = json_decode($res->getBody()); |
|||
echo "Successfully connected with status: ".$data->result."\n"; |
|||
break; |
|||
case 401: |
|||
echo 'Failed: Invalid credentials'; |
|||
break; |
|||
case 404: |
|||
echo 'Failed: Please make sure your URL is correct and includes the port'; |
|||
break; |
|||
case 409: |
|||
echo 'Failed: Incorrect session id'; |
|||
break; |
|||
default: |
|||
echo 'Something went wrong... Code: '.$res->getStatusCode(); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
public function executeConfig() |
|||
{ |
|||
$html = ''; |
|||
$active = 'active'; |
|||
$res = $this->sendRequest(); |
|||
if ($res == null) { |
|||
Log::debug('Transmission connection failed'); |
|||
return ''; |
|||
} |
|||
$data = json_decode($res->getBody()); |
|||
if (! isset($data->arguments)) { |
|||
Log::debug('Failed to fetch data from Transmission'); |
|||
return ''; |
|||
} |
|||
$torrents = $data->arguments->torrents; |
|||
$torrentCount = count($torrents); |
|||
$rateDownload = $rateUpload = $completedTorrents = 0; |
|||
foreach ($torrents as $thisTorrent) { |
|||
$rateDownload += $thisTorrent->rateDownload; |
|||
$rateUpload += $thisTorrent->rateUpload; |
|||
if ($thisTorrent->percentDone == 1) { |
|||
$completedTorrents += 1; |
|||
} |
|||
} |
|||
if ($torrentCount - $completedTorrents == 0) { |
|||
// Don't poll as frequently if we don't have any active torrents |
|||
$active = 'inactive'; |
|||
} |
|||
|
|||
$html = ' |
|||
<ul class="livestats"> |
|||
<li><span class="title">Done</span><sub>'.$completedTorrents.' / '.$torrentCount.'</sub></li> |
|||
<li><span class="title">Down</span><sub>'.format_bytes($rateDownload).'</sub></li> |
|||
<li><span class="title">Up</span><sub>'.format_bytes($rateUpload).'</sub></li> |
|||
</ul> |
|||
'; |
|||
return json_encode(['status' => $active, 'html' => $html]);; |
|||
} |
|||
|
|||
private function sendRequest() |
|||
{ |
|||
$optionsSet = $this->setClientOptions(); |
|||
if (! $optionsSet) { |
|||
// Pass the failed response back up the chain |
|||
return null; |
|||
} |
|||
$res = $this->torrentGet(); |
|||
if ($res->getStatusCode() == 409) { |
|||
$this->setClientOptions(); |
|||
$res = $this->torrentGet(); |
|||
} |
|||
return $res; |
|||
} |
|||
|
|||
private function torrentGet() |
|||
{ |
|||
$res = null; |
|||
try{ |
|||
$res = $this->_client->request( |
|||
'POST', |
|||
$this->getApiUrl(), |
|||
$this->_clientOptions |
|||
); |
|||
}catch(\GuzzleHttp\Exception\BadResponseException $e){ |
|||
Log::error("Connection to {$e->getRequest()->getUrl()} failed"); |
|||
Log::debug($e->getMessage()); |
|||
$res = $e->getRequest(); |
|||
}catch(\GuzzleHttp\Exception\ConnectException $e) { |
|||
Log::error("Transmission connection refused"); |
|||
Log::debug($e->getMessage()); |
|||
} |
|||
return $res; |
|||
} |
|||
|
|||
private function setClientOptions() |
|||
{ |
|||
if ($this->config->username != '' || $this->config->password != '') { |
|||
$this->_clientOptions = ['auth'=> [$this->config->username, $this->config->password, 'Basic']]; |
|||
} |
|||
try{ |
|||
$res = $this->_client->request('HEAD', $this->getApiUrl(), $this->_clientOptions); |
|||
$xtId = $res->getHeaderLine('X-Transmission-Session-Id'); |
|||
if ($xtId != null) { |
|||
$this->_clientOptions['headers'] = ['X-Transmission-Session-Id' => $xtId]; |
|||
} else { |
|||
Log::error("Unable to get Transmission session information"); |
|||
Log::debug("Status Code: ".$res->getStatusCode()); |
|||
} |
|||
}catch(\GuzzleHttp\Exception\ConnectException $e){ |
|||
Log::error("Failed connection to Transmission"); |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
private function getApiUrl() |
|||
{ |
|||
$config = $this->config; |
|||
$url = $config->url; |
|||
|
|||
$url = rtrim($url, '/'); |
|||
$api_url = $url.'/transmission/rpc'; |
|||
|
|||
return $api_url; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Ttrss implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#9d704c'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/tt-rss.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Unifi implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#363840'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/unifi.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Unraid implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#A12624'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/unraid.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Virtualmin implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#161b1f'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/virtualmin.svg'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class Watcher3 implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#500'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/watcher3.png'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class WebTools implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#555'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/webtools.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class Webmin implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#161b1f'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/webmin.svg'; |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
class pyLoad implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#881'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/pyload.png'; |
|||
} |
|||
} |
@ -1,12 +0,0 @@ |
|||
<?php namespace App\SupportedApps; |
|||
|
|||
class ruTorrent implements Contracts\Applications { |
|||
public function defaultColour() |
|||
{ |
|||
return '#004'; |
|||
} |
|||
public function icon() |
|||
{ |
|||
return 'supportedapps/rutorrent.png'; |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,91 @@ |
|||
<?php |
|||
|
|||
declare(strict_types=1); |
|||
|
|||
/* |
|||
* This file is part of Laravel GitHub. |
|||
* |
|||
* (c) Graham Campbell <graham@alt-three.com> |
|||
* |
|||
* For the full copyright and license information, please view the LICENSE |
|||
* file that was distributed with this source code. |
|||
*/ |
|||
|
|||
return [ |
|||
|
|||
/* |
|||
|-------------------------------------------------------------------------- |
|||
| Default Connection Name |
|||
|-------------------------------------------------------------------------- |
|||
| |
|||
| Here you may specify which of the connections below you wish to use as |
|||
| your default connection for all work. Of course, you may use many |
|||
| connections at once using the manager class. |
|||
| |
|||
*/ |
|||
|
|||
'default' => 'main', |
|||
|
|||
/* |
|||
|-------------------------------------------------------------------------- |
|||
| GitHub Connections |
|||
|-------------------------------------------------------------------------- |
|||
| |
|||
| Here are each of the connections setup for your application. Example |
|||
| configuration has been included, but you may add as many connections as |
|||
| you would like. Note that the 5 supported authentication methods are: |
|||
| "application", "jwt", "none", "password", and "token". |
|||
| |
|||
*/ |
|||
|
|||
'connections' => [ |
|||
|
|||
'main' => [ |
|||
'token' => 'your-token', |
|||
'method' => 'token', |
|||
// 'backoff' => false, |
|||
// 'cache' => false, |
|||
// 'version' => 'v3', |
|||
// 'enterprise' => false, |
|||
], |
|||
|
|||
'app' => [ |
|||
'clientId' => 'your-client-id', |
|||
'clientSecret' => 'your-client-secret', |
|||
'method' => 'application', |
|||
// 'backoff' => false, |
|||
// 'cache' => false, |
|||
// 'version' => 'v3', |
|||
// 'enterprise' => false, |
|||
], |
|||
|
|||
'jwt' => [ |
|||
'token' => 'your-jwt-token', |
|||
'method' => 'jwt', |
|||
// 'backoff' => false, |
|||
// 'cache' => false, |
|||
// 'version' => 'v3', |
|||
// 'enterprise' => false, |
|||
], |
|||
|
|||
'other' => [ |
|||
'username' => 'your-username', |
|||
'password' => 'your-password', |
|||
'method' => 'password', |
|||
// 'backoff' => false, |
|||
// 'cache' => false, |
|||
// 'version' => 'v3', |
|||
// 'enterprise' => false, |
|||
], |
|||
|
|||
'none' => [ |
|||
'method' => 'none', |
|||
// 'backoff' => false, |
|||
// 'cache' => false, |
|||
// 'version' => 'v3', |
|||
// 'enterprise' => false, |
|||
], |
|||
|
|||
], |
|||
|
|||
]; |
@ -0,0 +1,41 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class CreateApplicationsTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('applications', function (Blueprint $table) { |
|||
|
|||
$table->string('appid')->unique(); |
|||
$table->string('name')->unique(); |
|||
$table->string('sha')->unique()->nullable(); |
|||
$table->string('icon')->nullable(); |
|||
$table->string('website')->nullable(); |
|||
$table->string('license')->nullable(); |
|||
$table->mediumText('description')->nullable(); |
|||
$table->boolean('enhanced')->default(false); |
|||
$table->string('tile_background')->default('dark'); |
|||
|
|||
$table->timestamps(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('applications'); |
|||
} |
|||
} |
@ -0,0 +1,32 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class AddClassToItemsTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::table('items', function (Blueprint $table) { |
|||
$table->string('class')->nullable(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::table('items', function (Blueprint $table) { |
|||
$table->dropColumn(['class']); |
|||
}); |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class CreateJobsTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('jobs', function (Blueprint $table) { |
|||
$table->bigIncrements('id'); |
|||
$table->string('queue')->index(); |
|||
$table->longText('payload'); |
|||
$table->unsignedTinyInteger('attempts'); |
|||
$table->unsignedInteger('reserved_at')->nullable(); |
|||
$table->unsignedInteger('available_at'); |
|||
$table->unsignedInteger('created_at'); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('jobs'); |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -1,4 +1,4 @@ |
|||
{ |
|||
"/css/app.css": "/css/app.css?id=24e9bb4fa993b66f0572", |
|||
"/js/app.js": "/js/app.js?id=f18d23b8fc7a094a2c66" |
|||
"/css/app.css": "/css/app.css?id=286d5fcf1350566c1475", |
|||
"/js/app.js": "/js/app.js?id=0db2e72b5cd42d83e306" |
|||
} |
|||
|
@ -0,0 +1,13 @@ |
|||
<div class="toggleinput"> |
|||
<label class="name">{{ __('app.apps.enable') }}</label> |
|||
{!! Form::hidden('config[enabled]', '0') !!} |
|||
<label class="switch"> |
|||
<?php |
|||
$checked = false; |
|||
if(isset($item) && !empty($item)) $checked = $item->enabled(); |
|||
$set_checked = ($checked) ? ' checked="checked"' : ''; |
|||
?> |
|||
<input type="checkbox" name="config[enabled]" value="1"<?php echo $set_checked;?> /> |
|||
<span class="slider round"></span> |
|||
</label> |
|||
</div> |
@ -0,0 +1,21 @@ |
|||
<?php |
|||
$item = $item ?? new App\Item; |
|||
?> |
|||
<section class="item-container" data-id=""> |
|||
<div class="item set-bg-elem" style="background-color: {{ $item->colour ?? '#222' }}"> |
|||
@if(isset($item->icon) && !empty($item->icon)) |
|||
<img class="app-icon" src="{{ asset('/storage/'.$item->icon) }}" /> |
|||
@else |
|||
<img class="app-icon" src="{{ asset('/img/heimdall-icon-small.png') }}" /> |
|||
@endif |
|||
<div class="details"> |
|||
<div class="title{{ title_color($item->colour) ?? 'white' }}">{{ $item->title ?? '' }}</div> |
|||
@if($item->enhanced()) |
|||
<div data-id="{{ $item->id }}" data-dataonly="{{ $item->getconfig()->dataonly ?? '0' }}" class="no-livestats-container"></div> |
|||
@endif |
|||
</div> |
|||
<a class="link{{ title_color($item->colour) }}"{!! $item->link_target !!} href="{{ $item->link }}"><i class="fas {{ $item->link_icon }}"></i></a> |
|||
</div> |
|||
<a class="item-edit" href="{{ route($item->link_type.'.edit', [ $item->id ], false) }}"><i class="fas fa-pencil"></i></a> |
|||
|
|||
</section> |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue