parent
e9762b4277
commit
99497adcb2
3 changed files with 23 additions and 7 deletions
|
@ -73,6 +73,14 @@ class AjaxController extends Controller
|
|||
return response()->json([], 404);
|
||||
}
|
||||
|
||||
if (! $server->installed) {
|
||||
return response()->json(['status' => 20]);
|
||||
}
|
||||
|
||||
if ($server->suspended) {
|
||||
return response()->json(['status' => 30]);
|
||||
}
|
||||
|
||||
try {
|
||||
$res = $server->guzzleClient()->request('GET', '/server');
|
||||
if ($res->getStatusCode() === 200) {
|
||||
|
|
|
@ -30,6 +30,13 @@ class ServerRoutes
|
|||
{
|
||||
public function map(Router $router)
|
||||
{
|
||||
// Returns Server Status
|
||||
$router->get('/server/{server}/ajax/status', [
|
||||
'middleware' => ['auth', 'csrf'],
|
||||
'as' => 'server.ajax.status',
|
||||
'uses' => 'Server\AjaxController@getStatus',
|
||||
]);
|
||||
|
||||
$router->group([
|
||||
'prefix' => 'server/{server}',
|
||||
'middleware' => [
|
||||
|
@ -164,12 +171,6 @@ class ServerRoutes
|
|||
|
||||
// Assorted AJAX Routes
|
||||
$router->group(['prefix' => 'ajax'], function ($server) use ($router) {
|
||||
// Returns Server Status
|
||||
$router->get('status', [
|
||||
'as' => 'server.ajax.status',
|
||||
'uses' => 'Server\AjaxController@getStatus',
|
||||
]);
|
||||
|
||||
// Sets the Default Connection for the Server
|
||||
$router->post('set-primary', [
|
||||
'uses' => 'Server\AjaxController@postSetPrimary',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue