From d1eb588b11d89074ca1210bf8aeece0197b2a993 Mon Sep 17 00:00:00 2001 From: cp6 Date: Tue, 30 Aug 2022 23:37:05 +1000 Subject: [PATCH 1/8] Updated pricing model insertPricing() func Updated pricing model insertPricing() function Move as_usd parameter into the function Updated is_active check as it is an int anyway --- app/Http/Controllers/ApiController.php | 5 +---- app/Http/Controllers/DomainsController.php | 3 +-- app/Http/Controllers/MiscController.php | 3 +-- app/Http/Controllers/ResellerController.php | 3 +-- app/Http/Controllers/SeedBoxesController.php | 3 +-- app/Http/Controllers/ServerController.php | 5 +---- app/Http/Controllers/SharedController.php | 3 +-- app/Models/Pricing.php | 5 +++-- 8 files changed, 10 insertions(+), 20 deletions(-) diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php index c67eb7b..16f3cac 100644 --- a/app/Http/Controllers/ApiController.php +++ b/app/Http/Controllers/ApiController.php @@ -307,10 +307,7 @@ class ApiController extends Controller $server_id = Str::random(8); $pricing = new Pricing(); - - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - - $pricing->insertPricing(1, $server_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); + $pricing->insertPricing(1, $server_id, $request->currency, $request->price, $request->payment_term, $request->next_due_date); if (!is_null($request->ip1)) { IPs::insertIP($server_id, $request->ip1); diff --git a/app/Http/Controllers/DomainsController.php b/app/Http/Controllers/DomainsController.php index 89b6ef7..06d172e 100644 --- a/app/Http/Controllers/DomainsController.php +++ b/app/Http/Controllers/DomainsController.php @@ -43,8 +43,7 @@ class DomainsController extends Controller $domain_id = Str::random(8); $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - $pricing->insertPricing(4, $domain_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); + $pricing->insertPricing(4, $domain_id, $request->currency, $request->price, $request->payment_term, $request->next_due_date); Domains::create([ 'id' => $domain_id, diff --git a/app/Http/Controllers/MiscController.php b/app/Http/Controllers/MiscController.php index 271e9d7..5100381 100644 --- a/app/Http/Controllers/MiscController.php +++ b/app/Http/Controllers/MiscController.php @@ -41,8 +41,7 @@ class MiscController extends Controller $misc_id = Str::random(8); $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - $pricing->insertPricing(5, $misc_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); + $pricing->insertPricing(5, $misc_id, $request->currency, $request->price, $request->payment_term, $request->next_due_date); Misc::create([ 'id' => $misc_id, diff --git a/app/Http/Controllers/ResellerController.php b/app/Http/Controllers/ResellerController.php index 399a3c6..f74949c 100644 --- a/app/Http/Controllers/ResellerController.php +++ b/app/Http/Controllers/ResellerController.php @@ -57,8 +57,7 @@ class ResellerController extends Controller $reseller_id = Str::random(8); $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - $pricing->insertPricing(3, $reseller_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); + $pricing->insertPricing(3, $reseller_id, $request->currency, $request->price, $request->payment_term, $request->next_due_date); if (!is_null($request->dedicated_ip)) { IPs::insertIP($reseller_id, $request->dedicated_ip); diff --git a/app/Http/Controllers/SeedBoxesController.php b/app/Http/Controllers/SeedBoxesController.php index 5a4ad2d..b6182f6 100644 --- a/app/Http/Controllers/SeedBoxesController.php +++ b/app/Http/Controllers/SeedBoxesController.php @@ -47,8 +47,7 @@ class SeedBoxesController extends Controller $seedbox_id = Str::random(8); $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - $pricing->insertPricing(6, $seedbox_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); + $pricing->insertPricing(6, $seedbox_id, $request->currency, $request->price, $request->payment_term, $request->next_due_date); Labels::deleteLabelsAssignedTo($seedbox_id); Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $seedbox_id); diff --git a/app/Http/Controllers/ServerController.php b/app/Http/Controllers/ServerController.php index 5185081..1058447 100644 --- a/app/Http/Controllers/ServerController.php +++ b/app/Http/Controllers/ServerController.php @@ -75,10 +75,7 @@ class ServerController extends Controller $server_id = Str::random(8); $pricing = new Pricing(); - - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - - $pricing->insertPricing(1, $server_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); + $pricing->insertPricing(1, $server_id, $request->currency, $request->price, $request->payment_term, $request->next_due_date); if (!is_null($request->ip1)) { IPs::insertIP($server_id, $request->ip1); diff --git a/app/Http/Controllers/SharedController.php b/app/Http/Controllers/SharedController.php index 6b824f9..4067bb9 100644 --- a/app/Http/Controllers/SharedController.php +++ b/app/Http/Controllers/SharedController.php @@ -52,8 +52,7 @@ class SharedController extends Controller $shared_id = Str::random(8); $pricing = new Pricing(); - $as_usd = $pricing->convertToUSD($request->price, $request->currency); - $pricing->insertPricing(2, $shared_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date); + $pricing->insertPricing(2, $shared_id, $request->currency, $request->price, $request->payment_term, $request->next_due_date); Labels::deleteLabelsAssignedTo($shared_id); Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $shared_id); diff --git a/app/Models/Pricing.php b/app/Models/Pricing.php index 31f578c..494cc23 100644 --- a/app/Models/Pricing.php +++ b/app/Models/Pricing.php @@ -103,8 +103,9 @@ class Pricing extends Model DB::table('pricings')->where('service_id', '=', $id)->delete(); } - public function insertPricing(int $type, string $service_id, string $currency, float $price, int $term, float $as_usd, string $next_due_date, int $is_active = 1) + public function insertPricing(int $type, string $service_id, string $currency, float $price, int $term, string $next_due_date, int $is_active = 1) { + $as_usd = $this->convertToUSD($price, $currency); return self::create([ 'service_type' => $type, 'service_id' => $service_id, @@ -114,7 +115,7 @@ class Pricing extends Model 'as_usd' => $as_usd, 'usd_per_month' => $this->costAsPerMonth($as_usd, $term), 'next_due_date' => $next_due_date, - 'active' => ($is_active) ? 1 : 0 + 'active' => $is_active ]); } From c79f67916e7205e05f5867e094af76aba0232863 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 7 Sep 2022 13:56:56 +1000 Subject: [PATCH 2/8] Added YABS from JSON parsing Added YABS from JSON parsing --- app/Models/Yabs.php | 219 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 219 insertions(+) diff --git a/app/Models/Yabs.php b/app/Models/Yabs.php index cb8c7d4..8ee2fe4 100644 --- a/app/Models/Yabs.php +++ b/app/Models/Yabs.php @@ -2,10 +2,14 @@ namespace App\Models; +use DateTime; +use Exception; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Str; class Yabs extends Model { @@ -101,4 +105,219 @@ class Yabs extends Model ); } + public static function speedAsMbps(string $string): float + { + $data = explode(" ", $string); + if ($data[0] === 'busy') { + return 0; + } + if ($data[1] === "Gbits/sec") { + return $data[0] * 1000; + } else if ($data[1] === "Mbits/sec") { + return $data[0]; + } else {//Kbps + return $data[0] / 1000; + } + } + + public static function speedType(string $string): string + { + $data = explode(" ", $string); + if ($data[0] === 'busy') { + return "MBps"; + } + if ($data[1] === "Gbits/sec") { + return "GBps"; + } else if ($data[1] === "Mbits/sec") { + return "MBps"; + } else {//Kbps + return "KBps"; + } + } + + public static function speedAsFloat(string $string): float + { + $data = explode(" ", $string); + if ($data[0] === 'busy') { + return 0; + } + return (float)$data[0]; + } + + public static function formatRunTime(string $date): string + { + return DateTime::createFromFormat('Ymd-His', $date)->format('Y-m-d H:i:s'); + } + + public static function gb5IdFromURL(string $url): int + { + return str_replace("https://browser.geekbench.com/v5/cpu/", "", $url); + } + + public static function KBstoMBs(int $kbs): float + { + return $kbs / 1000; + } + + public static function insertFromJson($data, string $server_id) + { + $data = (object)$data; + try { + $date_ran = self::formatRunTime($data->time); + $version = $data['version']; + $has_ipv4 = $data['net']['ipv4']; + $has_ipv6 = $data['net']['ipv6']; + //Os + $arch = $data['os']['arch']; + $distro = $data['os']['distro']; + $kernel = $data['os']['kernel']; + $uptime = $data['os']['uptime']; + //Cpu + $model = $data['cpu']['model']; + $cores = $data['cpu']['cores']; + $freq = $data['cpu']['freq']; + $aes = $data['cpu']['aes']; + $virt = $data['cpu']['virt']; + //Ram Disk + $ram = $data['mem']['ram']; + $swap = $data['mem']['swap']; + $disk = $data['mem']['disk']; + if (isset($data['geekbench'][0]) && $data['geekbench'][0]['version'] === 5) { + $gb5_single = $data['geekbench'][0]['single']; + $gb5_multi = $data['geekbench'][0]['multi']; + $gb5_id = self::gb5IdFromURL($data['geekbench'][0]['url']); + } elseif (isset($data['geekbench'][1]) && $data['geekbench'][1]['version'] === 5) { + $gb5_single = $data['geekbench'][1]['single']; + $gb5_multi = $data['geekbench'][1]['multi']; + $gb5_id = self::gb5IdFromURL($data['geekbench'][1]['url']); + } else { + $gb5_single = $gb5_multi = $gb5_id = null; + } + + $yabs_id = Str::random(8); + + if ($ram > 10) { + $ram_f = ($ram / 1024 / 1024); + $ram_type = 'GB'; + } else { + $ram_f = ($ram / 1024); + $ram_type = 'MB'; + } + + if ($disk > 10000) { + $disk_f = ($ram / 1024 / 1024); + $disk_type = 'TB'; + } else { + $disk_f = ($ram / 1024); + $disk_type = 'GB'; + } + + self::create([ + 'id' => $yabs_id, + 'server_id' => $server_id, + 'has_ipv6' => $has_ipv6, + 'aes' => $aes, + 'vm' => $virt, + 'distro' => $distro, + 'kernel' => $kernel, + 'uptime' => $uptime, + 'cpu_model' => $model, + 'cpu_cores' => $cores, + 'cpu_freq' => (float)$freq, + 'ram' => $ram_f, + 'ram_type' => $ram_type, + 'ram_mb' => ($ram / 1024), + 'swap' => $swap / 1024, + 'swap_mb' => ($swap / 1024), + 'swap_type' => 'MB', + 'disk' => $disk_f, + 'disk_gb' => ($disk / 1024 / 1024), + 'disk_type' => $disk_type, + 'output_date' => $date_ran, + 'gb5_single' => $gb5_single, + 'gb5_multi' => $gb5_multi, + 'gb5_id' => $gb5_id + ]); + + //Fio + foreach ($data['fio'] as $ds) { + if ($ds['bs'] === '4k') { + $d4k = ($ds['speed_rw'] > 1000000) ? ($ds['speed_rw'] / 1000) : $ds['speed_rw']; + $d4k_type = ($ds['speed_rw'] > 1000000) ? 'GB/s' : 'MB/s'; + $d4k_mbps = self::KBstoMBs($ds['speed_rw']); + } + if ($ds['bs'] === '64k') { + $d64k = ($ds['speed_rw'] > 1000000) ? ($ds['speed_rw'] / 1000) : $ds['speed_rw']; + $d64k_type = ($ds['speed_rw'] > 1000000) ? 'GB/s' : 'MB/s'; + $d64k_mbps = self::KBstoMBs($ds['speed_rw']); + } + if ($ds['bs'] === '512k') { + $d512k = ($ds['speed_rw'] > 1000000) ? ($ds['speed_rw'] / 1000) : $ds['speed_rw']; + $d512k_type = ($ds['speed_rw'] > 1000000) ? 'GB/s' : 'MB/s'; + $d512k_mbps = self::KBstoMBs($ds['speed_rw']); + } + if ($ds['bs'] === '1m') { + $d1m = ($ds['speed_rw'] > 1000000) ? ($ds['speed_rw'] / 1000) : $ds['speed_rw']; + $d1m_type = ($ds['speed_rw'] > 1000000) ? 'GB/s' : 'MB/s'; + $d1m_mbps = self::KBstoMBs($ds['speed_rw']); + } + } + + DiskSpeed::create([ + 'id' => $yabs_id, + 'server_id' => $server_id, + 'd_4k' => $d4k, + 'd_4k_type' => $d4k_type, + 'd_4k_as_mbps' => $d4k_mbps, + 'd_64k' => $d64k, + 'd_64k_type' => $d64k_type, + 'd_64k_as_mbps' => $d64k_mbps, + 'd_512k' => $d512k, + 'd_512k_type' => $d512k_type, + 'd_512k_as_mbps' => $d512k_mbps, + 'd_1m' => $d1m, + 'd_1m_type' => $d1m_type, + 'd_1m_as_mbps' => $d1m_mbps + ]); + + //Iperf + foreach ($data['iperf'] as $st) { + ($has_ipv4) ? $match = 'IPv4' : $match = 'IPv6'; + if ($st['mode'] === $match) { + if ($st['send'] !== "busy " || $st['recv'] !== "busy ") { + NetworkSpeed::create([ + 'id' => $yabs_id, + 'server_id' => $server_id, + 'location' => $st['loc'], + 'send' => self::speedAsFloat($st['send']), + 'send_type' => self::speedType($st['send']), + 'send_as_mbps' => self::speedAsMbps($st['send']), + 'receive' => self::speedAsFloat($st['recv']), + 'receive_type' => self::speedType($st['recv']), + 'receive_as_mbps' => self::speedAsMbps($st['recv']) + ]); + } + } + } + + //Update server + $update_server = DB::table('servers') + ->where('id', $server_id) + ->update([ + 'ram' => $ram_f, + 'ram_type' => $ram_type, + 'ram_as_mb' => ($ram / 1024), + 'disk' => $disk_f, + 'disk_as_gb' => ($disk / 1024 / 1024), + 'disk_type' => $disk_type, + 'cpu' => $cores, + 'has_yabs' => 1 + ]); + + } catch (Exception $e) {//Not valid JSON + return false; + } + return true; + } + } From badb640bd92c9494fcaa41c3375741244335f1e0 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 7 Sep 2022 13:57:43 +1000 Subject: [PATCH 3/8] Updated storeYabs API function Updated storeYabs API function Now used to insert YABS from the POST request -s flag --- app/Http/Controllers/ApiController.php | 113 +++---------------------- 1 file changed, 12 insertions(+), 101 deletions(-) diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php index b8290c6..98dc771 100644 --- a/app/Http/Controllers/ApiController.php +++ b/app/Http/Controllers/ApiController.php @@ -15,6 +15,7 @@ use App\Models\Reseller; use App\Models\SeedBoxes; use App\Models\Server; use App\Models\Shared; +use App\Models\User; use App\Models\Yabs; use App\Process; use DataTables; @@ -470,113 +471,23 @@ class ApiController extends Controller return response()->json(array('result' => 'fail', 'request' => $request->post()), 500); } - public function storeYabs(Request $request) + public function storeYabs(Request $request, Server $server, string $key): \Illuminate\Http\JsonResponse { - $rules = array( - 'server_id' => 'required|string|size:8', - 'yabs_output' => 'required|string', - ); - - $messages = array( - 'required' => ':attribute is required', - 'string' => ':attribute must be a string', - 'size' => ':attribute must be exactly :size characters' - ); - - $validator = Validator::make($request->all(), $rules, $messages); - - if ($validator->fails()) { - return response()->json(['result' => 'fail', 'messages' => $validator->messages()], 400); + $r = User::where('api_token', $key)->first(); + if (!isset($r->id)) { + return response()->json(['error' => 'Unauthenticated'], 401); } - //dd($request->all()); - $process = new Process(); - $yabs = $process->yabsOutputAsJson($request->server_id, $request->yabs_output); - //dd($yabs); + $insert = Yabs::insertFromJson($request, $server->id); - $yabs_id = Str::random(8); - - $yabs_insert = Yabs::create([ - 'id' => $yabs_id, - 'server_id' => $request->server_id, - 'has_ipv6' => $yabs['has_ipv6'], - 'aes' => $yabs['aes'], - 'vm' => $yabs['vm'], - 'output_date' => $yabs['output_date'], - 'cpu_cores' => $yabs['cpu_cores'], - 'cpu_freq' => $yabs['cpu_freq'], - 'cpu_model' => $yabs['cpu'], - 'ram' => $yabs['ram'], - 'ram_type' => $yabs['ram_type'], - 'ram_mb' => $yabs['ram_mb'], - 'swap' => $yabs['swap'], - 'swap_type' => $yabs['swap_type'], - 'swap_mb' => $yabs['swap_mb'], - 'disk' => $yabs['disk'], - 'disk_type' => $yabs['disk_type'], - 'disk_gb' => $yabs['disk_gb'], - 'gb5_single' => $yabs['GB5_single'], - 'gb5_multi' => $yabs['GB5_mult'], - 'gb5_id' => $yabs['GB5_id'], - 'uptime' => $yabs['uptime'], - 'distro' => $yabs['distro'], - 'kernel' => $yabs['kernel'] - ]); - - DiskSpeed::create([ - 'id' => $yabs_id, - 'server_id' => $request->server_id, - 'd_4k' => $yabs['disk_speed']['4k_total'], - 'd_4k_type' => $yabs['disk_speed']['4k_total_type'], - 'd_4k_as_mbps' => $yabs['disk_speed']['4k_total_mbps'], - 'd_64k' => $yabs['disk_speed']['64k_total'], - 'd_64k_type' => $yabs['disk_speed']['64k_total_type'], - 'd_64k_as_mbps' => $yabs['disk_speed']['64k_total_mbps'], - 'd_512k' => $yabs['disk_speed']['512k_total'], - 'd_512k_type' => $yabs['disk_speed']['512k_total_type'], - 'd_512k_as_mbps' => $yabs['disk_speed']['512k_total_mbps'], - 'd_1m' => $yabs['disk_speed']['1m_total'], - 'd_1m_type' => $yabs['disk_speed']['1m_total_type'], - 'd_1m_as_mbps' => $yabs['disk_speed']['1m_total_mbps'] - ]); - - foreach ($yabs['network_speed'] as $y) { - NetworkSpeed::create([ - 'id' => $yabs_id, - 'server_id' => $request->server_id, - 'location' => $y['location'], - 'send' => $y['send'], - 'send_type' => $y['send_type'], - 'send_as_mbps' => $y['send_type_mbps'], - 'receive' => $y['receive'], - 'receive_type' => $y['receive_type'], - 'receive_as_mbps' => $y['receive_type_mbps'] - ]); + if ($insert) { + Cache::forget('all_active_servers');//all servers cache + Cache::forget('non_active_servers');//all servers cache + Cache::forget('all_yabs');//Forget the all YABs cache + return response()->json(array('message' => 'Successfully added YABS'), 200); } - $update_server = DB::table('servers') - ->where('id', $request->server_id) - ->update([ - 'ram' => $yabs['ram'], - 'ram_type' => $yabs['ram_type'], - 'ram_as_mb' => ($yabs['ram_type'] === 'GB') ? ($yabs['ram'] * 1024) : $yabs['ram'], - 'disk' => $yabs['disk'], - 'disk_type' => $yabs['disk_type'], - 'disk_as_gb' => ($yabs['disk_type'] === 'TB') ? ($yabs['disk'] * 1024) : $yabs['disk'], - 'cpu' => $yabs['cpu_cores'], - 'has_yabs' => 1 - ]); - - Cache::forget('all_active_servers');//all servers cache - Cache::forget('non_active_servers');//all servers cache - Cache::forget('all_yabs');//Forget the all YABs cache - - if ($yabs_insert) { - return response()->json(array('result' => 'success', 'yabs_id' => $yabs_id), 200); - } - - return response()->json(array('result' => 'fail', 'request' => $request->post()), 500); - + return response()->json(array('error' => 'Server error'), 500); } public function getAllYabs() From 13a37242d2669e462669d13006bd5f6eaf16d717 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 7 Sep 2022 13:58:38 +1000 Subject: [PATCH 4/8] Updated yabs/ POST API request Needs the server for the YABS and users api key in the URL --- routes/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/api.php b/routes/api.php index d5307fe..c943d66 100644 --- a/routes/api.php +++ b/routes/api.php @@ -74,6 +74,6 @@ Route::middleware('auth:api')->get('online/{hostname}', 'App\Http\Controllers\Ap Route::middleware('auth:api')->get('dns/{domainName}/{type}', 'App\Http\Controllers\ApiController@getIpForDomain'); -Route::middleware('auth:api')->post('yabs/', 'App\Http\Controllers\ApiController@storeYabs'); +Route::middleware('throttle:4')->post('yabs/{server}/{key}', 'App\Http\Controllers\ApiController@storeYabs')->name('api.store-yabs'); Route::middleware('auth:api')->get('yabs/', 'App\Http\Controllers\ApiController@getAllYabs'); Route::middleware('auth:api')->get('yabs/{id}', 'App\Http\Controllers\ApiController@getYabs'); From a8a87a2e0f71b3bade6790767893ca6d19a3a6c5 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 7 Sep 2022 14:00:21 +1000 Subject: [PATCH 5/8] Updated server show page Updated server show page for a click reveal YABS command to automatically POST the result. e.g curl -sL yabs.sh | bash -s -- -s "http://domain.com/api/yabs/tnSJLyhz/THEUSERAPIKEYISHERE" --- resources/views/servers/show.blade.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/resources/views/servers/show.blade.php b/resources/views/servers/show.blade.php index b561031..249667d 100644 --- a/resources/views/servers/show.blade.php +++ b/resources/views/servers/show.blade.php @@ -1,6 +1,14 @@ @section('title') {{$server_data->hostname}} {{'server'}} @endsection +@section('scripts') + +@endsection {{ __('Server details') }} @@ -135,6 +143,9 @@ {{ route('servers.edit', $server_data->id) }} + + Show code to add a YABS +
@if($server_data->has_yabs) @@ -199,6 +210,7 @@ see Geekbench, disk and network speeds

@endif
+

curl -sL yabs.sh | bash -s -- -s "{{route('api.store-yabs', [$server_data->id, \Illuminate\Support\Facades\Auth::user()->api_token])}}"

@if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1) From 9e824e0cb67b8eca2e792eb93095792260e63c4c Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 7 Sep 2022 15:50:01 +1000 Subject: [PATCH 6/8] Added version v2022-08-20 to YABS parser Added version v2022-08-20 to YABS parser --- app/Process.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Process.php b/app/Process.php index 3205798..0d3e7a3 100644 --- a/app/Process.php +++ b/app/Process.php @@ -170,7 +170,7 @@ class Process public function yabsOutputAsJson(string $server_id, string $data_from_form): array { - $allowed_versions = ['v2021-12-28', 'v2022-02-18', 'v2022-04-30', 'v2022-05-06', 'v2022-06-11']; + $allowed_versions = ['v2021-12-28', 'v2022-02-18', 'v2022-04-30', 'v2022-05-06', 'v2022-06-11', 'v2022-08-20']; $file_name = date('Y') . '/' . date('m') . '/' . time() . '.txt'; From 49b9f4e4ad7f3ee3f27c668bcb4fec2c100ee5a5 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 7 Sep 2022 15:50:23 +1000 Subject: [PATCH 7/8] Updated readme for version 2.1.4 Updated readme for version 2.1.4 --- README.md | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6b568a6..f606104 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Despite what the name infers this self hosted web app isn't just for storing idl a [YABs](https://github.com/masonr/yet-another-bench-script) output you can get disk & network speed values along with GeekBench 5 scores to do easier comparing and sorting. -[![Generic badge](https://img.shields.io/badge/version-2.1.3-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Laravel-9.0-red.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/PHP-8.1-purple.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Bootstrap-5.1-pink.svg)](https://shields.io/) +[![Generic badge](https://img.shields.io/badge/version-2.1.4-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Laravel-9.0-red.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/PHP-8.1-purple.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Bootstrap-5.1-pink.svg)](https://shields.io/) @@ -20,26 +20,33 @@ GeekBench 5 scores to do easier comparing and sorting. [Cloud Five Limited](https://cloud-v.net/) for providing the hosting for demo installation. -## 2.1.3 changes (20th July 2022): +## 2.1.4 changes (7th September 2022): + +#### Note: +yabs.sh now has JSON formatted response and it is possible to POST the output directly from calling the script. + +This will become the only method to add YABS results but using the form method still works for now. + +This version updates the yabs/ POST API to include the server id and your api key: + +`http://domain.com/api/yabs/tnSJLyhz/USERAPIKEYISHERE` + +Example yabs.sh call to POST the result + +`curl -sL yabs.sh | bash -s -- -s "http://domain.com/api/yabs/tnSJLyhz/USERAPIKEYISHERE"` #### Please run the following if updating from existing install: ```shell -php artisan migrate php artisan route:cache php artisan cache:clear ``` -* Added YABs to JSON output page -* Added uptime, distro and kernel to YABs inserting -* Added memory swap values to YABs inserting -* Added save YABs as txt file (setting) -* Added back and edit button component with icon -* Updated Reseller model to use relationships + caching -* Updated Misc model to use relationships + caching -* Updated SeedBoxes model to use relationships + caching -* Updated ApiController to use the new model relationship calling (& caching) -* Updated container large screen max width from 1320px to 1420px +* Added YABS JSON parsing +* Updated store YABS API function (Uses yabs.sh JSON) +* Updated YABS POST API request (Uses yabs.sh JSON) +* Updated server show page to display code to run and post a YABS on server +* Updated pricing model insertPricing() func ## Requires From 5bf529661a0c8638ca263d7501d10fbecc76a22d Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 7 Sep 2022 16:01:33 +1000 Subject: [PATCH 8/8] Updated readme v 2.1.5 Updated readme v 2.1.5 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f606104..51cc44c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Despite what the name infers this self hosted web app isn't just for storing idl a [YABs](https://github.com/masonr/yet-another-bench-script) output you can get disk & network speed values along with GeekBench 5 scores to do easier comparing and sorting. -[![Generic badge](https://img.shields.io/badge/version-2.1.4-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Laravel-9.0-red.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/PHP-8.1-purple.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Bootstrap-5.1-pink.svg)](https://shields.io/) +[![Generic badge](https://img.shields.io/badge/version-2.1.5-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Laravel-9.0-red.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/PHP-8.1-purple.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Bootstrap-5.1-pink.svg)](https://shields.io/) @@ -20,7 +20,7 @@ GeekBench 5 scores to do easier comparing and sorting. [Cloud Five Limited](https://cloud-v.net/) for providing the hosting for demo installation. -## 2.1.4 changes (7th September 2022): +## 2.1.5 changes (7th September 2022): #### Note: yabs.sh now has JSON formatted response and it is possible to POST the output directly from calling the script.