diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php
index b472caa4..78657390 100644
--- a/app/Http/Controllers/ItemController.php
+++ b/app/Http/Controllers/ItemController.php
@@ -302,5 +302,22 @@ class ItemController extends Controller
$app_details->testConfig();
}
+ public function getStats($id)
+ {
+ $item = Item::find($id);
+
+ $config = json_decode($item->description);
+ if(isset($config->type)) {
+ $config->url = $item->url;
+ if(isset($config->override_url) && !empty($config->override_url)) {
+ $config->url = $config->override_url;
+ }
+ $app_details = new $config->type;
+ $app_details->config = $config;
+ echo $app_details->executeConfig();
+ }
+
+ }
+
}
diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php
index bbdf6485..ae1893a9 100644
--- a/app/Http/Middleware/VerifyCsrfToken.php
+++ b/app/Http/Middleware/VerifyCsrfToken.php
@@ -15,6 +15,7 @@ class VerifyCsrfToken extends Middleware
//
'order',
'appload',
- 'test_config'
+ 'test_config',
+ //'get_stats'
];
}
diff --git a/app/SupportedApps/Nzbget.php b/app/SupportedApps/Nzbget.php
index e831c4f8..2280e00e 100644
--- a/app/SupportedApps/Nzbget.php
+++ b/app/SupportedApps/Nzbget.php
@@ -36,11 +36,19 @@ class Nzbget implements Contracts\Applications, Contracts\Livestats {
}
public function executeConfig()
{
- $config = json_decode($this->config);
- $url = $config->url;
- $user = $config->username;
- $pass = $config->password;
- return null;
+ $res = $this->buildRequest('status');
+ $data = json_decode($res->getBody());
+
+ $queue_size = $data->result->RemainingSizeMB;
+ $current_speed = $data->result->DownloadRate;
+
+ $output = '
+
+ - Remaining'.$queue_size.'
+ - Speed'.$current_speed.'
+
+ ';
+ return $output;
}
public function buildRequest($endpoint)
{
diff --git a/public/css/app.css b/public/css/app.css
index 266a72ac..5b0d901d 100644
--- a/public/css/app.css
+++ b/public/css/app.css
@@ -1095,6 +1095,31 @@ hr {
display: none;
}
+.livestats-container .livestats {
+ margin: 8px -10px 0;
+ padding: 0;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ list-style: none;
+ -webkit-box-pack: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+}
+
+.livestats-container .livestats li {
+ text-align: center;
+ margin: 0 10px -10px;
+}
+
+.livestats-container .livestats span {
+ display: block;
+ text-transform: uppercase;
+ font-size: 11px;
+ font-weight: 500;
+ opacity: 0.5;
+}
+
/*! Huebee v2.0.0
http://huebee.buzz
---------------------------------------------- */
diff --git a/public/js/app.js b/public/js/app.js
index dbdd764e..d48d7f1d 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -15,7 +15,18 @@ $.when( $.ready ).then(function() {
{
$('.message-container').fadeOut();
}, 3500);
+ }
+ if($('.livestats-container').length) {
+ $('.livestats-container').each(function(index){
+ var id = $(this).data('id');
+ var container = $(this);
+ $.get('/get_stats/'+id, function(data) {
+ //alert(data);
+ container.html(data);
+
+ })
+ });
}
diff --git a/public/mix-manifest.json b/public/mix-manifest.json
index 58d88904..0e5bb975 100644
--- a/public/mix-manifest.json
+++ b/public/mix-manifest.json
@@ -1,4 +1,4 @@
{
- "/css/app.css": "/css/app.css?id=d6ec6184a5279779b01a",
- "/js/app.js": "/js/app.js?id=67b9d3b008c0a8da2fd6"
+ "/css/app.css": "/css/app.css?id=a260268fab1591f47ea4",
+ "/js/app.js": "/js/app.js?id=418d36daefa7f7979d93"
}
\ No newline at end of file
diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js
index b72d5826..df4b598b 100644
--- a/resources/assets/js/app.js
+++ b/resources/assets/js/app.js
@@ -6,7 +6,18 @@ $.when( $.ready ).then(function() {
{
$('.message-container').fadeOut();
}, 3500);
+ }
+ if($('.livestats-container').length) {
+ $('.livestats-container').each(function(index){
+ var id = $(this).data('id');
+ var container = $(this);
+ $.get('/get_stats/'+id, function(data) {
+ //alert(data);
+ container.html(data);
+
+ })
+ });
}
diff --git a/resources/assets/sass/_app.scss b/resources/assets/sass/_app.scss
index 4dbf94d0..49c3c1c6 100644
--- a/resources/assets/sass/_app.scss
+++ b/resources/assets/sass/_app.scss
@@ -721,4 +721,26 @@ hr {
.ui-helper-hidden-accessible {
display: none;
+}
+
+.livestats-container {
+ .livestats {
+ margin: 8px -10px 0;
+ padding: 0;
+ display: flex;
+ list-style: none;
+ justify-content: center;
+ li {
+ text-align: center;
+ margin: 0 10px -10px;
+ }
+ span {
+ display: block;
+ text-transform: uppercase;
+ font-size: 11px;
+ font-weight: 500;
+ opacity: 0.5;
+ }
+
+ }
}
\ No newline at end of file
diff --git a/resources/views/item.blade.php b/resources/views/item.blade.php
index e1b67d86..4fe48669 100644
--- a/resources/views/item.blade.php
+++ b/resources/views/item.blade.php
@@ -5,8 +5,12 @@
@else
@endif
- {{ $app->title }}
-
+
+
{{ $app->title }}
+ @if(isset($app->description) && !empty($app->description))
+
+ @endif
+
diff --git a/routes/web.php b/routes/web.php
index 33efb28d..7986a920 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -24,6 +24,7 @@ Route::post('order', 'ItemController@setOrder')->name('items.order');
Route::post('appload', 'ItemController@appload')->name('appload');
Route::post('test_config', 'ItemController@testConfig')->name('test_config');
+Route::get('/get_stats/{id}', 'ItemController@getStats')->name('get_stats');
Route::get('view/{name_view}', function ($name_view) {
return view('supportedapps.'.$name_view);