Skip to content

Commit 7b45498

Browse files
committed
Fix version display in node list
1 parent 0e37298 commit 7b45498

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/*
3+
* Pterodactyl - Panel
4+
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
namespace Pterodactyl\Http\ViewComposers;
26+
27+
use Illuminate\View\View;
28+
use Pterodactyl\Services\Helpers\SoftwareVersionService;
29+
30+
class VersionComposer
31+
{
32+
/**
33+
* @var \Pterodactyl\Services\Helpers\SoftwareVersionService
34+
*/
35+
protected $version;
36+
37+
/**
38+
* VersionComposer constructor.
39+
*
40+
* @param \Pterodactyl\Services\Helpers\SoftwareVersionService $version
41+
*/
42+
public function __construct(SoftwareVersionService $version)
43+
{
44+
$this->version = $version;
45+
}
46+
47+
/**
48+
* Attach server data to a view automatically.
49+
*
50+
* @param \Illuminate\View\View $view
51+
*/
52+
public function compose(View $view)
53+
{
54+
$view->with('version', $this->version);
55+
}
56+
}

app/Providers/ViewComposerServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
namespace Pterodactyl\Providers;
2626

2727
use Illuminate\Support\ServiceProvider;
28+
use Pterodactyl\Http\ViewComposers\VersionComposer;
2829
use Pterodactyl\Http\ViewComposers\Server\ServerDataComposer;
2930

3031
class ViewComposerServiceProvider extends ServiceProvider
@@ -35,5 +36,6 @@ class ViewComposerServiceProvider extends ServiceProvider
3536
public function boot()
3637
{
3738
$this->app->make('view')->composer('server.*', ServerDataComposer::class);
39+
$this->app->make('view')->composer('*', VersionComposer::class);
3840
}
3941
}

resources/themes/pterodactyl/admin/nodes/view/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<table class="table table-hover">
5959
<tr>
6060
<td>Daemon Version</td>
61-
<td><code data-attr="info-version"><i class="fa fa-refresh fa-fw fa-spin"></i></code> (Latest: <code>{{ Version::getDaemon() }}</code>)</td>
61+
<td><code data-attr="info-version"><i class="fa fa-refresh fa-fw fa-spin"></i></code> (Latest: <code>{{ $version->getDaemon() }}</code>)</td>
6262
</tr>
6363
<tr>
6464
<td>System Information</td>

0 commit comments

Comments
 (0)