Show git version if panel is installed with git
This commit is contained in:
parent
e4c341795d
commit
801aae968c
5 changed files with 60 additions and 14 deletions
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Providers;
|
namespace Pterodactyl\Providers;
|
||||||
|
|
||||||
|
use View;
|
||||||
|
use Cache;
|
||||||
use Pterodactyl\Models;
|
use Pterodactyl\Models;
|
||||||
use Pterodactyl\Observers;
|
use Pterodactyl\Observers;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
@ -40,6 +42,9 @@ class AppServiceProvider extends ServiceProvider
|
||||||
Models\User::observe(Observers\UserObserver::class);
|
Models\User::observe(Observers\UserObserver::class);
|
||||||
Models\Server::observe(Observers\ServerObserver::class);
|
Models\Server::observe(Observers\ServerObserver::class);
|
||||||
Models\Subuser::observe(Observers\SubuserObserver::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);
|
$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,
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,17 +22,21 @@
|
||||||
*/
|
*/
|
||||||
@import 'checkbox.css';
|
@import 'checkbox.css';
|
||||||
|
|
||||||
.login-box, .register-box {
|
.login-page {
|
||||||
width: 40%;
|
height: auto;
|
||||||
margin: 7% auto
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width:768px) {
|
.login-box, .register-box {
|
||||||
.login-box, .register-box {
|
width: 40%;
|
||||||
width: 90%;
|
margin: 7% auto;
|
||||||
margin-top: 20px
|
}
|
||||||
}
|
|
||||||
}
|
@media (max-width:768px) {
|
||||||
|
.login-box, .register-box {
|
||||||
|
width: 90%;
|
||||||
|
margin-top: 20px
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.weight-100 {
|
.weight-100 {
|
||||||
font-weight: 100;
|
font-weight: 100;
|
||||||
|
@ -289,3 +293,9 @@ span[aria-labelledby="select2-pUserId-container"] {
|
||||||
tr:hover + tr.server-description {
|
tr:hover + tr.server-description {
|
||||||
background-color: #f5f5f5 !important;
|
background-color: #f5f5f5 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.login-corner-info {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 5px;
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
|
|
|
@ -170,8 +170,8 @@
|
||||||
</div>
|
</div>
|
||||||
<footer class="main-footer">
|
<footer class="main-footer">
|
||||||
<div class="pull-right small text-gray" style="margin-right:10px;margin-top:-7px;">
|
<div class="pull-right small text-gray" style="margin-right:10px;margin-top:-7px;">
|
||||||
<strong><i class="fa fa-code-fork"></i></strong> {{ config('app.version') }} <br />
|
<strong><i class="fa fa-fw {{ $appIsGit ? 'fa-git-square' : 'fa-code-fork' }}"></i></strong> {{ $appVersion }}<br />
|
||||||
<strong><i class="fa fa-clock-o"></i></strong> {{ round(microtime(true) - LARAVEL_START, 3) }}s
|
<strong><i class="fa fa-fw fa-clock-o"></i></strong> {{ round(microtime(true) - LARAVEL_START, 3) }}s
|
||||||
</div>
|
</div>
|
||||||
Copyright © 2015 - {{ date('Y') }} <a href="https://pterodactyl.io/">Pterodactyl Software</a>.
|
Copyright © 2015 - {{ date('Y') }} <a href="https://pterodactyl.io/">Pterodactyl Software</a>.
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -56,6 +56,10 @@
|
||||||
<p class="small text-muted">
|
<p class="small text-muted">
|
||||||
Copyright © 2015 - {{ date('Y') }} <a href="https://pterodactyl.io/" target="_blank">Pterodactyl Software</a>.<br />
|
Copyright © 2015 - {{ date('Y') }} <a href="https://pterodactyl.io/" target="_blank">Pterodactyl Software</a>.<br />
|
||||||
</p>
|
</p>
|
||||||
|
<div class="login-corner-info muted small">
|
||||||
|
<strong><i class="fa fa-fw {{ $appIsGit ? 'fa-git-square' : 'fa-code-fork' }}"></i></strong> {{ $appVersion }}<br />
|
||||||
|
<strong><i class="fa fa-fw fa-clock-o"></i></strong> {{ round(microtime(true) - LARAVEL_START, 3) }}s
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{!! Theme::js('vendor/jquery/jquery.min.js') !!}
|
{!! Theme::js('vendor/jquery/jquery.min.js') !!}
|
||||||
{!! Theme::js('vendor/bootstrap/bootstrap.min.js') !!}
|
{!! Theme::js('vendor/bootstrap/bootstrap.min.js') !!}
|
||||||
|
|
|
@ -233,8 +233,8 @@
|
||||||
</div>
|
</div>
|
||||||
<footer class="main-footer">
|
<footer class="main-footer">
|
||||||
<div class="pull-right small text-gray" style="margin-right:10px;margin-top:-7px;">
|
<div class="pull-right small text-gray" style="margin-right:10px;margin-top:-7px;">
|
||||||
<strong><i class="fa fa-code-fork"></i></strong> {{ config('app.version') }} <br />
|
<strong><i class="fa fa-fw {{ $appIsGit ? 'fa-git-square' : 'fa-code-fork' }}"></i></strong> {{ $appVersion }}<br />
|
||||||
<strong><i class="fa fa-clock-o"></i></strong> {{ round(microtime(true) - LARAVEL_START, 3) }}s
|
<strong><i class="fa fa-fw fa-clock-o"></i></strong> {{ round(microtime(true) - LARAVEL_START, 3) }}s
|
||||||
</div>
|
</div>
|
||||||
Copyright © 2015 - {{ date('Y') }} <a href="https://pterodactyl.io/">Pterodactyl Software</a>.
|
Copyright © 2015 - {{ date('Y') }} <a href="https://pterodactyl.io/">Pterodactyl Software</a>.
|
||||||
</footer>
|
</footer>
|
||||||
|
|
Loading…
Reference in a new issue