feat(bpview): make version tag red if version is outdated

This commit is contained in:
purple 2023-11-06 21:05:12 +01:00
parent a0c0bc8ca7
commit 3a444c96b2
3 changed files with 8 additions and 4 deletions

View file

@ -45,6 +45,10 @@ class BlueprintExtensionController extends Controller
public function index(): View
{
Artisan::call("bp:sync");
$latestVersion = $this->bp->latestVersion();
if(str_starts_with($latestVersion, "Error: ")) {
$latestVersion = $this->bp->version();
}
return $this->view->make(
'admin.extensions.blueprint.index', [
'version' => $this->version,
@ -52,7 +56,7 @@ class BlueprintExtensionController extends Controller
'bp' => $this->bp,
'bplib' => $this->bplib,
'telemetry' => $this->telemetry,
'versionLatest' => $this->bp->latestVersion(),
'versionLatest' => $latestVersion,
'root' => "/admin/extensions/blueprint",
]

View file

@ -19,7 +19,7 @@
# Allow non-default Pterodactyl installation folders.
if [[ $_FOLDER != "" ]]; then
if [[ ( ! -f "$FOLDER/.blueprint/data/internal/db/version" ) && ( $FOLDER == "/var/www/pterodactyl" ) ]]; then
sed -i -E "s|FOLDER=\"$FOLDER\" #;|FOLDER=\"$_FOLDER\" #;|g" $_FOLDER/blueprint.sh
sed -i -E "s|FOLDER=\"/var/www/pterodactyl\" #;|FOLDER=\"$_FOLDER\" #;|g" $_FOLDER/blueprint.sh
else
echo "Variable cannot be replaced right now."
exit 1

View file

@ -9,7 +9,7 @@
<a href="https://ptero.shop" target="_blank">
<button class="btn btn-gray-alt pull-right" style="padding: 5px 10px;"><i class="bx bx-link-external"></i></button>
</a>
<h1 ext-title>Blueprint<tag mg-left blue>{{ $bp->version() }}</tag></h1>
<h1 ext-title>Blueprint<tag mg-left @if($versionLatest != $bp->version()) red @else blue @endif>{{ $bp->version() }}</tag></h1>
@endsection
@section('content')
@ -25,7 +25,7 @@
<h3 class="box-title"><i class='bx bxs-shapes' style='margin-right:5px;'></i></i>Overview</h3>
</div>
<div class="box-body">
<p>You are currently using version <code>{{ $bp->version() }}</code>@if($versionLatest != $bp->version()) which is outdated. Please update to a newer release shortly. @else. @endif</p>
<p>You are currently using version <code>{{ $bp->version() }}</code>@if($versionLatest != $bp->version()) which is outdated. @else. @endif</p>
</div>
</div>