diff --git a/app/Jobs/ProcessApps.php b/app/Jobs/ProcessApps.php index 2dda2116..135c7e62 100644 --- a/app/Jobs/ProcessApps.php +++ b/app/Jobs/ProcessApps.php @@ -34,11 +34,15 @@ class ProcessApps implements ShouldQueue $localapps = Application::all(); $list = json_decode(SupportedApps::getList()->getBody()); $validapps = []; + foreach($list->apps as $app) { $validapps[] = $app->appid; + $localapp = $localapps->where('appid', $app->appid)->first(); + + $application = ($localapp) ? $localapp : new Application; + 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 @@ -46,11 +50,10 @@ class ProcessApps implements ShouldQueue if($localapp) { if($localapp->sha !== $app->sha) { SupportedApps::getFiles($app); - SupportedApps::saveApp($app, $localapp); + SupportedApps::saveApp($app, $application); } } else { SupportedApps::getFiles($app); - $application = new Application; SupportedApps::saveApp($app, $application); } diff --git a/app/SupportedApps/Ghost/Ghost.php b/app/SupportedApps/Ghost/Ghost.php new file mode 100644 index 00000000..9e44ed7e --- /dev/null +++ b/app/SupportedApps/Ghost/Ghost.php @@ -0,0 +1,5 @@ + + +image/svg+xml \ No newline at end of file diff --git a/app/SupportedApps/Mattermost/Mattermost.php b/app/SupportedApps/Mattermost/Mattermost.php new file mode 100644 index 00000000..87a4b931 --- /dev/null +++ b/app/SupportedApps/Mattermost/Mattermost.php @@ -0,0 +1,5 @@ +url('status')); + echo $test->status; + } + + public function livestats() + { + $status = 'inactive'; + $res = parent::execute($this->url('status')); + $details = json_decode($res->getBody()); + + $data = []; + + if($details) { + $size = $details->result->RemainingSizeMB; + $rate = $details->result->DownloadRate; + $data['queue_size'] = format_bytes($size*1000*1000, false, ' ', ''); + $data['current_speed'] = format_bytes($rate, false, ' '); + $status = ($size > 0 || $rate > 0) ? 'active' : 'inactive'; + } + + 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.'/jsonrpc/'.$endpoint; + return $api_url; + } +} diff --git a/app/SupportedApps/Privatebin/Privatebin.php b/app/SupportedApps/Privatebin/Privatebin.php new file mode 100644 index 00000000..30a377a3 --- /dev/null +++ b/app/SupportedApps/Privatebin/Privatebin.php @@ -0,0 +1,5 @@ + + + + + + + + + + + diff --git a/app/SupportedApps/Snibox/Snibox.php b/app/SupportedApps/Snibox/Snibox.php new file mode 100644 index 00000000..ede5a734 --- /dev/null +++ b/app/SupportedApps/Snibox/Snibox.php @@ -0,0 +1,5 @@ +