From 592f8f0831c58c55318a6905df19258e28fc6bfb Mon Sep 17 00:00:00 2001 From: KodeStar Date: Tue, 13 Feb 2018 22:46:36 +0000 Subject: [PATCH] closes #75 and adds initial support for proxmox --- app/Http/Controllers/ItemController.php | 4 +- app/Item.php | 1 + app/SupportedApps/Proxmox.php | 80 ++++++++++++++++++ .../views/supportedapps/nzbget.blade.php | 2 +- .../views/supportedapps/proxmox.blade.php | 15 ++++ storage/app/public/supportedapps/proxmox.png | Bin 0 -> 3426 bytes 6 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 app/SupportedApps/Proxmox.php create mode 100644 resources/views/supportedapps/proxmox.blade.php create mode 100644 storage/app/public/supportedapps/proxmox.png diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index 92d8f5a4..70107558 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -129,7 +129,7 @@ class ItemController extends Controller // $validatedData = $request->validate([ 'title' => 'required|max:255', - 'url' => 'required', + 'url' => 'required|url', ]); if($request->hasFile('file')) { @@ -190,7 +190,7 @@ class ItemController extends Controller { $validatedData = $request->validate([ 'title' => 'required|max:255', - 'url' => 'required', + 'url' => 'required|url', ]); //die(print_r($request->all())); if($request->hasFile('file')) { diff --git a/app/Item.php b/app/Item.php index ce865fe7..14c23327 100644 --- a/app/Item.php +++ b/app/Item.php @@ -41,6 +41,7 @@ class Item extends Model 'Plexpy' => \App\SupportedApps\Plexpy::class, 'Plexrequests' => \App\SupportedApps\Plexrequests::class, 'Portainer' => \App\SupportedApps\Portainer::class, + 'Proxmox' => \App\SupportedApps\Proxmox::class, 'Radarr' => \App\SupportedApps\Radarr::class, 'Sabnzbd' => \App\SupportedApps\Sabnzbd::class, 'Sonarr' => \App\SupportedApps\Sonarr::class, diff --git a/app/SupportedApps/Proxmox.php b/app/SupportedApps/Proxmox.php new file mode 100644 index 00000000..0698f998 --- /dev/null +++ b/app/SupportedApps/Proxmox.php @@ -0,0 +1,80 @@ +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 = ' + + '; + 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; + + } + + +} \ No newline at end of file diff --git a/resources/views/supportedapps/nzbget.blade.php b/resources/views/supportedapps/nzbget.blade.php index e3c72652..1345954d 100644 --- a/resources/views/supportedapps/nzbget.blade.php +++ b/resources/views/supportedapps/nzbget.blade.php @@ -7,7 +7,7 @@
- {!! Form::text('config[password]', null, array('placeholder' => __('app.apps.password'), 'data-config' => 'password', 'class' => 'form-control config-item')) !!} +
diff --git a/resources/views/supportedapps/proxmox.blade.php b/resources/views/supportedapps/proxmox.blade.php new file mode 100644 index 00000000..7bce9b4b --- /dev/null +++ b/resources/views/supportedapps/proxmox.blade.php @@ -0,0 +1,15 @@ +

{{ __('app.apps.config') }} ({{ __('app.optional') }})

+
+ +
+ + {!! Form::text('config[username]', null, array('placeholder' => __('app.apps.username'), 'data-config' => 'username', 'class' => 'form-control config-item')) !!} +
+
+ + +
+
+ +
+
\ No newline at end of file diff --git a/storage/app/public/supportedapps/proxmox.png b/storage/app/public/supportedapps/proxmox.png new file mode 100644 index 0000000000000000000000000000000000000000..3310ce0dd9a2a1b356e99d8ba1f3a7b4faafc23e GIT binary patch literal 3426 zcmZ`+3p|s1A73Q7loFFUZWBU^&L)MBOB;#gb|%IV8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