From c19d831da564bc23b0a6cba4f8d7489104883df7 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Sep 2023 22:21:49 +1000 Subject: [PATCH 1/6] Created migration for YABS geekbench 6 values Created migration for YABS geekbench 6 values --- ...023_09_20_121309_add_gb6_to_yabs_table.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 database/migrations/2023_09_20_121309_add_gb6_to_yabs_table.php diff --git a/database/migrations/2023_09_20_121309_add_gb6_to_yabs_table.php b/database/migrations/2023_09_20_121309_add_gb6_to_yabs_table.php new file mode 100644 index 00000000..c245fe3c --- /dev/null +++ b/database/migrations/2023_09_20_121309_add_gb6_to_yabs_table.php @@ -0,0 +1,25 @@ +integer('gb6_single')->nullable()->default(null)->after('gb5_id'); + $table->integer('gb6_multi')->nullable()->default(null)->after('gb5_id'); + $table->integer('gb6_id')->nullable()->default(null)->after('gb5_id'); + }); + } + + public function down(): void + { + Schema::table('yabs', function (Blueprint $table) { + $table->dropColumn('gb6_single'); + $table->dropColumn('gb6_multi'); + $table->dropColumn('gb6_id'); + }); + } +}; From cca325cf2d19d44cc61af370f4444c1a833c3f27 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 20 Sep 2023 22:26:00 +1000 Subject: [PATCH 2/6] Added geekbench 6 to Yabs Added geekbench 6 inserts and varaibles to Yabs model Updated JSON values accessor to include version 5 still --- app/Models/Yabs.php | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/app/Models/Yabs.php b/app/Models/Yabs.php index 4a9453b0..a6e01b41 100644 --- a/app/Models/Yabs.php +++ b/app/Models/Yabs.php @@ -20,7 +20,7 @@ class Yabs extends Model protected $table = 'yabs'; - protected $fillable = ['id', 'server_id', 'has_ipv6', 'aes', 'vm', 'output_date', 'cpu_cores', 'cpu_freq', 'cpu_model', 'ram', 'ram_type', 'ram_mb', 'disk', 'disk_type', 'disk_gb', 'gb5_single', 'gb5_multi', 'gb5_id', '4k', '4k_type', '4k_as_mbps', '64k', '64k_type', '64k_as_mbps', '512k', '512k_type', '512k_as_mbps', '1m', '1m_type', '1m_as_mbps', 'location', 'send', 'send_type', 'send_as_mbps', 'receive', 'receive_type', 'receive_as_mbps', 'uptime', 'distro', 'kernel', 'swap', 'swap_type', 'swap_mb']; + protected $fillable = ['id', 'server_id', 'has_ipv6', 'aes', 'vm', 'output_date', 'cpu_cores', 'cpu_freq', 'cpu_model', 'ram', 'ram_type', 'ram_mb', 'disk', 'disk_type', 'disk_gb', 'gb5_single', 'gb5_multi', 'gb5_id', 'gb6_single', 'gb6_multi', 'gb6_id', '4k', '4k_type', '4k_as_mbps', '64k', '64k_type', '64k_as_mbps', '512k', '512k_type', '512k_as_mbps', '1m', '1m_type', '1m_as_mbps', 'location', 'send', 'send_type', 'send_as_mbps', 'receive', 'receive_type', 'receive_as_mbps', 'uptime', 'distro', 'kernel', 'swap', 'swap_type', 'swap_mb']; public static function yabs(string $yabs_id) { @@ -153,6 +153,11 @@ public static function gb5IdFromURL(string $url): int return str_replace("https://browser.geekbench.com/v5/cpu/", "", $url); } + public static function gb6IdFromURL(string $url): int + { + return str_replace("https://browser.geekbench.com/v6/cpu/", "", $url); + } + public static function KBstoMBs(int $kbs): float { return $kbs / 1000; @@ -181,16 +186,18 @@ public static function insertFromJson($data, string $server_id): bool $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; + + $gb5_single = $gb5_multi = $gb5_id = $gb6_single = $gb6_multi = $gb6_id = null; + foreach ($data['geekbench'] as $gb) { + if ($gb['version'] === 5) { + $gb5_single = $gb['single']; + $gb5_multi = $gb['multi']; + $gb5_id = self::gb5IdFromURL($gb['url']); + } elseif ($gb['version'] === 6) { + $gb6_single = $gb['single']; + $gb6_multi = $gb['multi']; + $gb6_id = self::gb6IdFromURL($gb['url']); + } } $yabs_id = Str::random(8); @@ -235,7 +242,10 @@ public static function insertFromJson($data, string $server_id): bool 'output_date' => $date_ran, 'gb5_single' => $gb5_single, 'gb5_multi' => $gb5_multi, - 'gb5_id' => $gb5_id + 'gb5_id' => $gb5_id, + 'gb6_single' => $gb6_single, + 'gb6_multi' => $gb6_multi, + 'gb6_id' => $gb6_id ]); //fio From da14c2dde36c59c749866cdc1fb57b9ed3daebac Mon Sep 17 00:00:00 2001 From: cp6 Date: Thu, 21 Sep 2023 22:24:02 +1000 Subject: [PATCH 3/6] Added GB6 values to server show and public show Added GB6 values to server show and public show --- resources/views/servers/public-index.blade.php | 8 ++++---- resources/views/servers/show.blade.php | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/views/servers/public-index.blade.php b/resources/views/servers/public-index.blade.php index 3c41588c..c6db96a3 100644 --- a/resources/views/servers/public-index.blade.php +++ b/resources/views/servers/public-index.blade.php @@ -22,8 +22,8 @@ Provider Price Had since - GB5 S - GB5 M + GB6 S + GB6 M 4k 64k 512k @@ -76,12 +76,12 @@ {{ $s->owned_since }} @if(Session::get('show_server_value_yabs') === 1) - {{$s->yabs[0]->gb5_single ?? null}} + {{$s->yabs[0]->gb6_single ?? null}} @endif @if(Session::get('show_server_value_yabs') === 1) - {{$s->yabs[0]->gb5_multi ?? null}} + {{$s->yabs[0]->gb6_multi ?? null}} @endif diff --git a/resources/views/servers/show.blade.php b/resources/views/servers/show.blade.php index 8d713d5c..56936162 100644 --- a/resources/views/servers/show.blade.php +++ b/resources/views/servers/show.blade.php @@ -150,6 +150,10 @@ function showYabsCode() {
+ + + + From 76c7b0395d19b5090a6e37a9e942c021a145af97 Mon Sep 17 00:00:00 2001 From: cp6 Date: Fri, 22 Sep 2023 10:58:58 +1000 Subject: [PATCH 4/6] Updated details footer blade component Made Session check conditional 1 step --- resources/views/components/details-footer.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/components/details-footer.blade.php b/resources/views/components/details-footer.blade.php index c314195e..178332a4 100644 --- a/resources/views/components/details-footer.blade.php +++ b/resources/views/components/details-footer.blade.php @@ -1,4 +1,4 @@ -@if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1) +@if(Session::get('timer_version_footer', 1) === 0)

Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})

@endif From c296bd6be4d94bf5127fa3acd43c589348121bbb Mon Sep 17 00:00:00 2001 From: cp6 Date: Fri, 22 Sep 2023 10:59:51 +1000 Subject: [PATCH 5/6] Updated details footer blade --- resources/views/components/details-footer.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/components/details-footer.blade.php b/resources/views/components/details-footer.blade.php index 178332a4..048e7ae6 100644 --- a/resources/views/components/details-footer.blade.php +++ b/resources/views/components/details-footer.blade.php @@ -1,4 +1,4 @@ -@if(Session::get('timer_version_footer', 1) === 0) +@if(Session::get('timer_version_footer', 0) === 1)

Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})

@endif From 4179f70a4fb5681cd86f37464a709d07cac46393 Mon Sep 17 00:00:00 2001 From: cp6 Date: Fri, 22 Sep 2023 11:01:56 +1000 Subject: [PATCH 6/6] Update home blade Made Session conditional for showing details in footer to be 1 step --- resources/views/home.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index c9ed798e..9054886e 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -289,7 +289,7 @@ class="text-body mx-1">Page took {{$information['execution_time']}} seconds, Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }}), Rates By Exchange Rate API
GB6 S/M{{$server_data->yabs[0]->gb6_single ?? null}} / {{$server_data->yabs[0]->gb6_multi ?? null}}
CPU {{$server_data->yabs[0]->cpu_model}}