From db7b741b286b3c44d6c3435a0593f87dd3293ab5 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 21 Jan 2017 13:49:14 -0500 Subject: [PATCH] Show server status in sidebar properly on subuser views --- .../Controllers/Server/SubuserController.php | 25 ++++++++++++++++--- .../pterodactyl/server/users/index.blade.php | 5 ++++ .../pterodactyl/server/users/new.blade.php | 1 + .../pterodactyl/server/users/view.blade.php | 1 + 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Server/SubuserController.php b/app/Http/Controllers/Server/SubuserController.php index 69db75bf7..97c4e5ab8 100644 --- a/app/Http/Controllers/Server/SubuserController.php +++ b/app/Http/Controllers/Server/SubuserController.php @@ -28,6 +28,7 @@ use DB; use Log; use Auth; use Alert; +use Javascript; use Pterodactyl\Models; use Illuminate\Http\Request; use Pterodactyl\Exceptions\DisplayException; @@ -51,10 +52,16 @@ class SubuserController extends Controller { $server = Models\Server::getByUUID($uuid); $this->authorize('list-subusers', $server); + $node = Models\Node::find($server->node); + + Javascript::put([ + 'server' => collect($server->makeVisible('daemonSecret'))->only(['uuid', 'uuidShort', 'daemonSecret', 'username']), + 'node' => collect($node)->only('fqdn', 'scheme', 'daemonListen'), + ]); return view('server.users.index', [ 'server' => $server, - 'node' => Models\Node::find($server->node), + 'node' => $node, 'subusers' => Models\Subuser::select('subusers.*', 'users.email', 'users.username') ->join('users', 'users.id', '=', 'subusers.user_id') ->where('server_id', $server->id) @@ -66,6 +73,12 @@ class SubuserController extends Controller { $server = Models\Server::getByUUID($uuid); $this->authorize('view-subuser', $server); + $node = Models\Node::find($server->node); + + Javascript::put([ + 'server' => collect($server->makeVisible('daemonSecret'))->only(['uuid', 'uuidShort', 'daemonSecret', 'username']), + 'node' => collect($node)->only('fqdn', 'scheme', 'daemonListen'), + ]); $subuser = Models\Subuser::select('subusers.*', 'users.email as a_userEmail') ->join('users', 'users.id', '=', 'subusers.user_id') @@ -87,7 +100,7 @@ class SubuserController extends Controller return view('server.users.view', [ 'server' => $server, - 'node' => Models\Node::find($server->node), + 'node' => $node, 'subuser' => $subuser, 'permissions' => $permissions, ]); @@ -137,10 +150,16 @@ class SubuserController extends Controller { $server = Models\Server::getByUUID($uuid); $this->authorize('create-subuser', $server); + $node = Models\Node::find($server->node); + + Javascript::put([ + 'server' => collect($server->makeVisible('daemonSecret'))->only(['uuid', 'uuidShort', 'daemonSecret', 'username']), + 'node' => collect($node)->only('fqdn', 'scheme', 'daemonListen'), + ]); return view('server.users.new', [ 'server' => $server, - 'node' => Models\Node::find($server->node), + 'node' => $node, ]); } diff --git a/resources/themes/pterodactyl/server/users/index.blade.php b/resources/themes/pterodactyl/server/users/index.blade.php index 6e63bd10d..ebb675d20 100644 --- a/resources/themes/pterodactyl/server/users/index.blade.php +++ b/resources/themes/pterodactyl/server/users/index.blade.php @@ -84,3 +84,8 @@ @endsection + +@section('footer-scripts') + @parent + {!! Theme::js('js/frontend/server.socket.js') !!} +@endsection diff --git a/resources/themes/pterodactyl/server/users/new.blade.php b/resources/themes/pterodactyl/server/users/new.blade.php index 6236be984..5bec326b7 100644 --- a/resources/themes/pterodactyl/server/users/new.blade.php +++ b/resources/themes/pterodactyl/server/users/new.blade.php @@ -400,6 +400,7 @@ @section('footer-scripts') @parent + {!! Theme::js('js/frontend/server.socket.js') !!}