From 801aae968c3d6297eefc4ec17752257844647d78 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Thu, 27 Apr 2017 22:28:01 -0400 Subject: [PATCH] Show git version if panel is installed with git --- app/Providers/AppServiceProvider.php | 32 +++++++++++++++++++ public/themes/pterodactyl/css/pterodactyl.css | 30 +++++++++++------ .../pterodactyl/layouts/admin.blade.php | 4 +-- .../themes/pterodactyl/layouts/auth.blade.php | 4 +++ .../pterodactyl/layouts/master.blade.php | 4 +-- 5 files changed, 60 insertions(+), 14 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index dac07eb20..03fafc49c 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -24,6 +24,8 @@ namespace Pterodactyl\Providers; +use View; +use Cache; use Pterodactyl\Models; use Pterodactyl\Observers; use Illuminate\Support\ServiceProvider; @@ -40,6 +42,9 @@ class AppServiceProvider extends ServiceProvider Models\User::observe(Observers\UserObserver::class); Models\Server::observe(Observers\ServerObserver::class); Models\Subuser::observe(Observers\SubuserObserver::class); + + View::share('appVersion', $this->versionData()['version'] ?? 'undefined'); + View::share('appIsGit', $this->versionData()['is_git'] ?? false); } /** @@ -57,4 +62,31 @@ class AppServiceProvider extends ServiceProvider $this->app->register(\DaneEveritt\LoginNotifications\NotificationServiceProvider::class); } } + + /** + * Return version information for the footer. + * + * @return array + */ + protected function versionData() + { + return Cache::remember('git-version', 5, function () { + if (file_exists(base_path('.git/HEAD'))) { + $head = explode(' ', file_get_contents(base_path('.git/HEAD'))); + $path = base_path('.git/' . trim($head[1])); + } + + if (isset($path) && file_exists($path)) { + return [ + 'version' => substr(file_get_contents($path), 0, 8), + 'is_git' => true, + ]; + } + + return [ + 'version' => config('app.version'), + 'is_git' => false, + ]; + }); + } } diff --git a/public/themes/pterodactyl/css/pterodactyl.css b/public/themes/pterodactyl/css/pterodactyl.css index e0c34798f..9c4f69c44 100644 --- a/public/themes/pterodactyl/css/pterodactyl.css +++ b/public/themes/pterodactyl/css/pterodactyl.css @@ -22,17 +22,21 @@ */ @import 'checkbox.css'; - .login-box, .register-box { - width: 40%; - margin: 7% auto - } +.login-page { + height: auto; +} - @media (max-width:768px) { - .login-box, .register-box { - width: 90%; - margin-top: 20px - } - } +.login-box, .register-box { + width: 40%; + margin: 7% auto; +} + +@media (max-width:768px) { + .login-box, .register-box { + width: 90%; + margin-top: 20px + } +} .weight-100 { font-weight: 100; @@ -289,3 +293,9 @@ span[aria-labelledby="select2-pUserId-container"] { tr:hover + tr.server-description { background-color: #f5f5f5 !important; } + +.login-corner-info { + position: absolute; + bottom: 5px; + right: 10px; +} diff --git a/resources/themes/pterodactyl/layouts/admin.blade.php b/resources/themes/pterodactyl/layouts/admin.blade.php index db9e13550..7d140fa87 100644 --- a/resources/themes/pterodactyl/layouts/admin.blade.php +++ b/resources/themes/pterodactyl/layouts/admin.blade.php @@ -170,8 +170,8 @@ diff --git a/resources/themes/pterodactyl/layouts/auth.blade.php b/resources/themes/pterodactyl/layouts/auth.blade.php index 15f6eb8a3..920c399f1 100644 --- a/resources/themes/pterodactyl/layouts/auth.blade.php +++ b/resources/themes/pterodactyl/layouts/auth.blade.php @@ -56,6 +56,10 @@

Copyright © 2015 - {{ date('Y') }} Pterodactyl Software.

+
+ {{ $appVersion }}
+ {{ round(microtime(true) - LARAVEL_START, 3) }}s +
{!! Theme::js('vendor/jquery/jquery.min.js') !!} {!! Theme::js('vendor/bootstrap/bootstrap.min.js') !!} diff --git a/resources/themes/pterodactyl/layouts/master.blade.php b/resources/themes/pterodactyl/layouts/master.blade.php index 8b236149e..fc6656c6d 100644 --- a/resources/themes/pterodactyl/layouts/master.blade.php +++ b/resources/themes/pterodactyl/layouts/master.blade.php @@ -233,8 +233,8 @@