Merge pull request #99 from cp6/dev

Added Geekbench 6
This commit is contained in:
corbpie 2023-09-26 22:42:11 +10:00 committed by GitHub
commit b8f5ee223d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 57 additions and 18 deletions

View File

@ -20,7 +20,7 @@ class Yabs extends Model
protected $table = 'yabs'; 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) public static function yabs(string $yabs_id)
{ {
@ -153,6 +153,11 @@ class Yabs extends Model
return str_replace("https://browser.geekbench.com/v5/cpu/", "", $url); 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 public static function KBstoMBs(int $kbs): float
{ {
return $kbs / 1000; return $kbs / 1000;
@ -181,16 +186,18 @@ class Yabs extends Model
$ram = $data['mem']['ram']; $ram = $data['mem']['ram'];
$swap = $data['mem']['swap']; $swap = $data['mem']['swap'];
$disk = $data['mem']['disk']; $disk = $data['mem']['disk'];
if (isset($data['geekbench'][0]) && $data['geekbench'][0]['version'] === 5) {
$gb5_single = $data['geekbench'][0]['single']; $gb5_single = $gb5_multi = $gb5_id = $gb6_single = $gb6_multi = $gb6_id = null;
$gb5_multi = $data['geekbench'][0]['multi']; foreach ($data['geekbench'] as $gb) {
$gb5_id = self::gb5IdFromURL($data['geekbench'][0]['url']); if ($gb['version'] === 5) {
} elseif (isset($data['geekbench'][1]) && $data['geekbench'][1]['version'] === 5) { $gb5_single = $gb['single'];
$gb5_single = $data['geekbench'][1]['single']; $gb5_multi = $gb['multi'];
$gb5_multi = $data['geekbench'][1]['multi']; $gb5_id = self::gb5IdFromURL($gb['url']);
$gb5_id = self::gb5IdFromURL($data['geekbench'][1]['url']); } elseif ($gb['version'] === 6) {
} else { $gb6_single = $gb['single'];
$gb5_single = $gb5_multi = $gb5_id = null; $gb6_multi = $gb['multi'];
$gb6_id = self::gb6IdFromURL($gb['url']);
}
} }
$yabs_id = Str::random(8); $yabs_id = Str::random(8);
@ -235,7 +242,10 @@ class Yabs extends Model
'output_date' => $date_ran, 'output_date' => $date_ran,
'gb5_single' => $gb5_single, 'gb5_single' => $gb5_single,
'gb5_multi' => $gb5_multi, '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 //fio

View File

@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('yabs', function (Blueprint $table) {
$table->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');
});
}
};

View File

@ -1,4 +1,4 @@
@if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1) @if(Session::get('timer_version_footer', 0) === 1)
<p class="text-muted mt-4 text-end"><small>Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP <p class="text-muted mt-4 text-end"><small>Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP
v{{ PHP_VERSION }})</small></p> v{{ PHP_VERSION }})</small></p>
@endif @endif

View File

@ -289,7 +289,7 @@
@endif @endif
@endif @endif
@if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1) @if(Session::get('timer_version_footer', 0) === 1)
<p class="text-muted mt-4 text-end"><small>Page took {{$information['execution_time']}} seconds, <p class="text-muted mt-4 text-end"><small>Page took {{$information['execution_time']}} seconds,
Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }}), Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }}),
Rates By <a href="https://www.exchangerate-api.com">Exchange Rate API</a> Rates By <a href="https://www.exchangerate-api.com">Exchange Rate API</a>

View File

@ -22,8 +22,8 @@
<th class="text-nowrap">Provider</th> <th class="text-nowrap">Provider</th>
<th class="text-nowrap">Price</th> <th class="text-nowrap">Price</th>
<th class="text-nowrap">Had since</th> <th class="text-nowrap">Had since</th>
<th class="text-nowrap">GB5 S</th> <th class="text-nowrap">GB6 S</th>
<th class="text-nowrap">GB5 M</th> <th class="text-nowrap">GB6 M</th>
<th class="text-nowrap">4k</th> <th class="text-nowrap">4k</th>
<th class="text-nowrap">64k</th> <th class="text-nowrap">64k</th>
<th class="text-nowrap">512k</th> <th class="text-nowrap">512k</th>
@ -76,12 +76,12 @@
<td class="text-nowrap"> {{ $s->owned_since }}</td> <td class="text-nowrap"> {{ $s->owned_since }}</td>
<td class="text-nowrap"> <td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1) @if(Session::get('show_server_value_yabs') === 1)
{{$s->yabs[0]->gb5_single ?? null}} {{$s->yabs[0]->gb6_single ?? null}}
@endif @endif
</td> </td>
<td class="text-nowrap"> <td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1) @if(Session::get('show_server_value_yabs') === 1)
{{$s->yabs[0]->gb5_multi ?? null}} {{$s->yabs[0]->gb6_multi ?? null}}
@endif @endif
</td> </td>
<td class="text-nowrap"> <td class="text-nowrap">

View File

@ -150,6 +150,10 @@
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-borderless text-nowrap"> <table class="table table-borderless text-nowrap">
<tbody> <tbody>
<tr>
<td class="px-2 py-2 font-bold text-muted">GB6 S/M</td>
<td>{{$server_data->yabs[0]->gb6_single ?? null}} / {{$server_data->yabs[0]->gb6_multi ?? null}}</td>
</tr>
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">CPU</td> <td class="px-2 py-2 font-bold text-muted">CPU</td>
<td>{{$server_data->yabs[0]->cpu_model}}</td> <td>{{$server_data->yabs[0]->cpu_model}}</td>