From 3a444c96b2c590292e87447bf4c5c94971484d7a Mon Sep 17 00:00:00 2001 From: purple Date: Mon, 6 Nov 2023 21:05:12 +0100 Subject: [PATCH] feat(bpview): make version tag red if version is outdated --- .../Extensions/Blueprint/BlueprintExtensionController.php | 6 +++++- blueprint.sh | 2 +- resources/views/admin/extensions/blueprint/index.blade.php | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Admin/Extensions/Blueprint/BlueprintExtensionController.php b/app/Http/Controllers/Admin/Extensions/Blueprint/BlueprintExtensionController.php index 319fc04..2c29f3a 100644 --- a/app/Http/Controllers/Admin/Extensions/Blueprint/BlueprintExtensionController.php +++ b/app/Http/Controllers/Admin/Extensions/Blueprint/BlueprintExtensionController.php @@ -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", ] diff --git a/blueprint.sh b/blueprint.sh index 832d4b1..14ea5fa 100644 --- a/blueprint.sh +++ b/blueprint.sh @@ -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 diff --git a/resources/views/admin/extensions/blueprint/index.blade.php b/resources/views/admin/extensions/blueprint/index.blade.php index 3866fde..99f8dd8 100644 --- a/resources/views/admin/extensions/blueprint/index.blade.php +++ b/resources/views/admin/extensions/blueprint/index.blade.php @@ -9,7 +9,7 @@ -

Blueprint{{ $bp->version() }}

+

Blueprintversion()) red @else blue @endif>{{ $bp->version() }}

@endsection @section('content') @@ -25,7 +25,7 @@

Overview

-

You are currently using version {{ $bp->version() }}@if($versionLatest != $bp->version()) which is outdated. Please update to a newer release shortly. @else. @endif

+

You are currently using version {{ $bp->version() }}@if($versionLatest != $bp->version()) which is outdated. @else. @endif