2015-12-06 18:58:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Routes;
|
|
|
|
|
|
|
|
use Illuminate\Routing\Router;
|
|
|
|
|
|
|
|
class AdminRoutes {
|
|
|
|
|
|
|
|
public function map(Router $router) {
|
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
// Admin Index
|
|
|
|
$router->get('admin', [
|
|
|
|
'as' => 'admin.index',
|
|
|
|
'middleware' => [
|
|
|
|
'auth',
|
|
|
|
'admin'
|
|
|
|
],
|
|
|
|
'uses' => 'Admin\BaseController@getIndex'
|
|
|
|
]);
|
2015-12-12 06:21:17 +00:00
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
$router->group([
|
|
|
|
'prefix' => 'admin/accounts',
|
|
|
|
'middleware' => [
|
|
|
|
'auth',
|
|
|
|
'admin'
|
|
|
|
]
|
|
|
|
], function () use ($router) {
|
2016-01-02 05:25:41 +00:00
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
// View All Accounts on System
|
|
|
|
$router->get('/', [
|
|
|
|
'as' => 'admin.accounts',
|
|
|
|
'uses' => 'Admin\AccountsController@getIndex'
|
|
|
|
]);
|
|
|
|
|
|
|
|
// View Specific Account
|
|
|
|
$router->get('/view/{id}', [
|
|
|
|
'as' => 'admin.accounts.view',
|
|
|
|
'uses' => 'Admin\AccountsController@getView'
|
|
|
|
]);
|
|
|
|
|
|
|
|
// Show Create Account Page
|
|
|
|
$router->get('/new', [
|
|
|
|
'as' => 'admin.accounts.new',
|
|
|
|
'uses' => 'Admin\AccountsController@getNew'
|
|
|
|
]);
|
2016-01-02 05:25:41 +00:00
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
// Handle Creating New Account
|
|
|
|
$router->post('/new', [
|
|
|
|
'uses' => 'Admin\AccountsController@postNew'
|
|
|
|
]);
|
2015-12-06 18:58:49 +00:00
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
// Update A Specific Account
|
|
|
|
$router->post('/update', [
|
|
|
|
'uses' => 'Admin\AccountsController@postUpdate'
|
|
|
|
]);
|
2015-12-10 23:30:47 +00:00
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
// Delete an Account Matching an ID
|
2016-01-04 21:22:57 +00:00
|
|
|
$router->delete('/view/{id}', [
|
|
|
|
'uses' => 'Admin\AccountsController@deleteView'
|
2016-01-04 21:09:39 +00:00
|
|
|
]);
|
2015-12-06 18:58:49 +00:00
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Server Routes
|
|
|
|
$router->group([
|
|
|
|
'prefix' => 'admin/servers',
|
|
|
|
'middleware' => [
|
|
|
|
'auth',
|
|
|
|
'admin'
|
|
|
|
]
|
|
|
|
], function () use ($router) {
|
|
|
|
|
|
|
|
// View All Servers
|
|
|
|
$router->get('/', [
|
|
|
|
'as' => 'admin.servers',
|
|
|
|
'uses' => 'Admin\ServersController@getIndex' ]);
|
|
|
|
|
|
|
|
// View Create Server Page
|
|
|
|
$router->get('/new', [
|
|
|
|
'as' => 'admin.servers.new',
|
|
|
|
'uses' => 'Admin\ServersController@getNew'
|
|
|
|
]);
|
|
|
|
|
|
|
|
// Handle POST Request for Creating Server
|
|
|
|
$router->post('/new', [
|
|
|
|
'uses' => 'Admin\ServersController@postNewServer'
|
|
|
|
]);
|
2016-01-02 23:04:18 +00:00
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
// Assorted Page Helpers
|
|
|
|
$router->post('/new/get-nodes', [
|
|
|
|
'uses' => 'Admin\ServersController@postNewServerGetNodes'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('/new/get-ips', [
|
|
|
|
'uses' => 'Admin\ServersController@postNewServerGetIps'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('/new/service-options', [
|
|
|
|
'uses' => 'Admin\ServersController@postNewServerServiceOptions'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('/new/service-variables', [
|
|
|
|
'uses' => 'Admin\ServersController@postNewServerServiceVariables'
|
|
|
|
]);
|
|
|
|
// End Assorted Page Helpers
|
|
|
|
|
|
|
|
// View Specific Server
|
|
|
|
$router->get('/view/{id}', [
|
|
|
|
'as' => 'admin.servers.view',
|
|
|
|
'uses' => 'Admin\ServersController@getView'
|
|
|
|
]);
|
|
|
|
|
|
|
|
// Change Server Details
|
|
|
|
$router->post('/view/{id}/details', [
|
|
|
|
'uses' => 'Admin\ServersController@postUpdateServerDetails'
|
|
|
|
]);
|
|
|
|
|
|
|
|
// Rebuild Server
|
|
|
|
$router->post('/view/{id}/rebuild', [
|
|
|
|
'uses' => 'Admin\ServersController@postUpdateServerToggleBuild'
|
|
|
|
]);
|
|
|
|
|
|
|
|
// Change Build Details
|
|
|
|
$router->post('/view/{id}/build', [
|
|
|
|
'uses' => 'Admin\ServersController@postUpdateServerUpdateBuild'
|
|
|
|
]);
|
2015-12-10 23:30:47 +00:00
|
|
|
|
2016-01-04 21:09:22 +00:00
|
|
|
// Change Install Status
|
|
|
|
$router->post('/view/{id}/installed', [
|
|
|
|
'uses' => 'Admin\ServersController@postToggleInstall'
|
|
|
|
]);
|
2015-12-07 05:47:19 +00:00
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
// Delete [force delete]
|
|
|
|
$router->delete('/view/{id}/{force?}', [
|
|
|
|
'uses' => 'Admin\ServersController@deleteServer'
|
|
|
|
]);
|
|
|
|
|
2015-12-06 18:58:49 +00:00
|
|
|
});
|
2016-01-04 21:09:39 +00:00
|
|
|
|
2016-01-05 04:59:45 +00:00
|
|
|
// Node Routes
|
|
|
|
$router->group([
|
|
|
|
'prefix' => 'admin/nodes',
|
|
|
|
'middleware' => [
|
|
|
|
'auth',
|
|
|
|
'admin'
|
|
|
|
]
|
|
|
|
], function () use ($router) {
|
|
|
|
|
|
|
|
// View All Nodes
|
|
|
|
$router->get('/', [
|
|
|
|
'as' => 'admin.nodes',
|
|
|
|
'uses' => 'Admin\NodesController@getIndex'
|
|
|
|
]);
|
|
|
|
|
|
|
|
// Add New Node
|
|
|
|
$router->get('/new', [
|
|
|
|
'as' => 'admin.nodes.new',
|
|
|
|
'uses' => 'Admin\NodesController@getNew'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('/new', [
|
|
|
|
'uses' => 'Admin\NodesController@postNew'
|
|
|
|
]);
|
|
|
|
|
|
|
|
// View Node
|
|
|
|
$router->get('/view/{id}', [
|
|
|
|
'as' => 'admin.nodes.view',
|
|
|
|
'uses' => 'Admin\NodesController@getView'
|
|
|
|
]);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-12-06 18:58:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|