adds support for viewing server stats from 'Your Servers' page
http://s3.pterodactyl.io/bnSTK.png
This commit is contained in:
parent
69f0340c48
commit
09d28bf145
5 changed files with 65 additions and 38 deletions
|
@ -33,7 +33,7 @@ class IndexController extends Controller
|
|||
public function getIndex(Request $request)
|
||||
{
|
||||
return view('base.index', [
|
||||
'servers' => Server::getUserServers(),
|
||||
'servers' => Server::getUserServers(10),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,11 @@ class AjaxController extends Controller
|
|||
{
|
||||
|
||||
$server = Server::getByUUID($uuid);
|
||||
|
||||
if (!$server) {
|
||||
return response()->json([], 404);
|
||||
}
|
||||
|
||||
$client = Node::guzzleRequest($server->node);
|
||||
|
||||
try {
|
||||
|
@ -61,24 +66,19 @@ class AjaxController extends Controller
|
|||
]);
|
||||
|
||||
if($res->getStatusCode() === 200) {
|
||||
|
||||
$json = json_decode($res->getBody());
|
||||
|
||||
if (isset($json->status) && $json->status === 1) {
|
||||
return 'true';
|
||||
}
|
||||
|
||||
return response()->json(json_decode($res->getBody()));
|
||||
} else {
|
||||
return response()->json([]);
|
||||
}
|
||||
|
||||
} catch (RequestException $e) {
|
||||
Debugbar::error($e->getMessage());
|
||||
Log::notice('An exception was raised while attempting to contact a Scales instance to get server status information.', [
|
||||
Log::notice('An exception was raised while attempting to contact a daemon instance to get server status information.', [
|
||||
'exception' => $e->getMessage(),
|
||||
'path' => $request->path()
|
||||
]);
|
||||
}
|
||||
|
||||
return 'false';
|
||||
return response()->json([]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue