2015-12-06 18:58:49 +00:00
|
|
|
<?php
|
2016-01-20 00:10:39 +00:00
|
|
|
/**
|
2016-01-20 21:05:16 +00:00
|
|
|
* Pterodactyl - Panel
|
2016-01-20 00:10:39 +00:00
|
|
|
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
|
2016-01-20 20:56:40 +00:00
|
|
|
* Some Modifications (c) 2015 Dylan Seidt <dylan.seidt@gmail.com>
|
2016-01-20 00:10:39 +00:00
|
|
|
*
|
2016-01-20 20:56:40 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2016-01-20 00:10:39 +00:00
|
|
|
*
|
2016-01-20 20:56:40 +00:00
|
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
|
|
* copies or substantial portions of the Software.
|
2016-01-20 00:10:39 +00:00
|
|
|
*
|
2016-01-20 20:56:40 +00:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
2016-01-20 00:10:39 +00:00
|
|
|
*/
|
2015-12-06 18:58:49 +00:00
|
|
|
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',
|
2016-01-13 02:50:43 +00:00
|
|
|
'admin',
|
|
|
|
'csrf'
|
2016-01-04 21:09:39 +00:00
|
|
|
],
|
|
|
|
'uses' => 'Admin\BaseController@getIndex'
|
|
|
|
]);
|
2015-12-12 06:21:17 +00:00
|
|
|
|
2016-01-21 03:08:09 +00:00
|
|
|
$router->group([
|
|
|
|
'prefix' => 'admin/settings',
|
|
|
|
'middleware' => [
|
|
|
|
'auth',
|
|
|
|
'admin',
|
|
|
|
'csrf'
|
|
|
|
]
|
|
|
|
], function () use ($router) {
|
|
|
|
$router->get('/', [
|
|
|
|
'as' => 'admin.settings',
|
|
|
|
'uses' => 'Admin\BaseController@getSettings'
|
|
|
|
]);
|
|
|
|
$router->post('/', [
|
|
|
|
'uses' => 'Admin\BaseController@postSettings'
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
$router->group([
|
|
|
|
'prefix' => 'admin/accounts',
|
|
|
|
'middleware' => [
|
|
|
|
'auth',
|
2016-01-13 02:50:43 +00:00
|
|
|
'admin',
|
|
|
|
'csrf'
|
2016-01-04 21:09:39 +00:00
|
|
|
]
|
|
|
|
], 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',
|
2016-01-13 02:50:43 +00:00
|
|
|
'admin',
|
|
|
|
'csrf'
|
2016-01-04 21:09:39 +00:00
|
|
|
]
|
|
|
|
], 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'
|
|
|
|
]);
|
|
|
|
|
2016-02-08 23:03:02 +00:00
|
|
|
// Database Stuffs
|
|
|
|
$router->post('/view/{id}/database', [
|
|
|
|
'as' => 'admin.servers.database',
|
|
|
|
'uses' => 'Admin\ServersController@postDatabase'
|
|
|
|
]);
|
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
// Change Server Details
|
|
|
|
$router->post('/view/{id}/details', [
|
|
|
|
'uses' => 'Admin\ServersController@postUpdateServerDetails'
|
|
|
|
]);
|
|
|
|
|
2016-01-10 23:57:22 +00:00
|
|
|
// Change Server Details
|
|
|
|
$router->post('/view/{id}/startup', [
|
|
|
|
'as' => 'admin.servers.post.startup',
|
|
|
|
'uses' => 'Admin\ServersController@postUpdateServerStartup'
|
|
|
|
]);
|
|
|
|
|
2016-01-04 21:09:39 +00:00
|
|
|
// 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',
|
2016-01-13 02:50:43 +00:00
|
|
|
'admin',
|
|
|
|
'csrf'
|
2016-01-05 04:59:45 +00:00
|
|
|
]
|
|
|
|
], 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'
|
|
|
|
]);
|
|
|
|
|
2016-01-05 23:31:25 +00:00
|
|
|
$router->post('/view/{id}', [
|
|
|
|
'uses' => 'Admin\NodesController@postView'
|
|
|
|
]);
|
|
|
|
|
2016-01-10 05:38:16 +00:00
|
|
|
$router->delete('/view/{id}/allocation/{ip}/{port?}', [
|
|
|
|
'uses' => 'Admin\NodesController@deleteAllocation'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->get('/view/{id}/allocations.json', [
|
|
|
|
'as' => 'admin.nodes.view.allocations',
|
|
|
|
'uses' => 'Admin\NodesController@getAllocationsJson'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('/view/{id}/allocations', [
|
|
|
|
'as' => 'admin.nodes.post.allocations',
|
|
|
|
'uses' => 'Admin\NodesController@postAllocations'
|
2016-01-09 01:01:18 +00:00
|
|
|
]);
|
|
|
|
|
2016-02-06 04:41:16 +00:00
|
|
|
// View Deploy
|
|
|
|
$router->get('/view/{id}/deploy', [
|
|
|
|
'as' => 'admin.nodes.deply',
|
|
|
|
'uses' => 'Admin\NodesController@getScript'
|
|
|
|
]);
|
|
|
|
|
2016-01-10 21:59:19 +00:00
|
|
|
$router->delete('/view/{id}', [
|
|
|
|
'as' => 'admin.nodes.delete',
|
|
|
|
'uses' => 'Admin\NodesController@deleteNode'
|
|
|
|
]);
|
|
|
|
|
2016-01-05 04:59:45 +00:00
|
|
|
});
|
|
|
|
|
2016-01-16 06:20:27 +00:00
|
|
|
// Location Routes
|
2016-01-11 00:22:21 +00:00
|
|
|
$router->group([
|
|
|
|
'prefix' => 'admin/locations',
|
|
|
|
'middleware' => [
|
|
|
|
'auth',
|
2016-01-13 02:50:43 +00:00
|
|
|
'admin',
|
|
|
|
'csrf'
|
2016-01-11 00:22:21 +00:00
|
|
|
]
|
|
|
|
], function () use ($router) {
|
|
|
|
$router->get('/', [
|
|
|
|
'as' => 'admin.locations',
|
|
|
|
'uses' => 'Admin\LocationsController@getIndex'
|
|
|
|
]);
|
2016-01-17 03:29:35 +00:00
|
|
|
$router->delete('/{id}', [
|
|
|
|
'uses' => 'Admin\LocationsController@deleteLocation'
|
|
|
|
]);
|
2016-01-17 03:57:28 +00:00
|
|
|
$router->patch('/{id}', [
|
|
|
|
'uses' => 'Admin\LocationsController@patchLocation'
|
|
|
|
]);
|
|
|
|
$router->post('/', [
|
|
|
|
'uses' => 'Admin\LocationsController@postLocation'
|
|
|
|
]);
|
2016-01-11 00:22:21 +00:00
|
|
|
});
|
|
|
|
|
2016-01-16 06:20:27 +00:00
|
|
|
// API Routes
|
|
|
|
$router->group([
|
|
|
|
'prefix' => 'admin/api',
|
|
|
|
'middleware' => [
|
|
|
|
'auth',
|
|
|
|
'admin',
|
|
|
|
'csrf'
|
|
|
|
]
|
|
|
|
], function () use ($router) {
|
|
|
|
$router->get('/', [
|
|
|
|
'as' => 'admin.api',
|
|
|
|
'uses' => 'Admin\APIController@getIndex'
|
|
|
|
]);
|
|
|
|
$router->get('/new', [
|
|
|
|
'as' => 'admin.api.new',
|
|
|
|
'uses' => 'Admin\APIController@getNew'
|
|
|
|
]);
|
2016-01-17 00:56:48 +00:00
|
|
|
$router->post('/new', [
|
|
|
|
'uses' => 'Admin\APIController@postNew'
|
|
|
|
]);
|
2016-01-16 06:20:27 +00:00
|
|
|
$router->delete('/revoke/{key?}', [
|
|
|
|
'as' => 'admin.api.revoke',
|
2016-01-17 00:56:48 +00:00
|
|
|
'uses' => 'Admin\APIController@deleteRevokeKey'
|
2016-01-16 06:20:27 +00:00
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2016-02-13 05:18:32 +00:00
|
|
|
// Database Routes
|
|
|
|
$router->group([
|
|
|
|
'prefix' => 'admin/databases',
|
|
|
|
'middleware' => [
|
|
|
|
'auth',
|
|
|
|
'admin',
|
|
|
|
'csrf'
|
|
|
|
]
|
|
|
|
], function () use ($router) {
|
|
|
|
$router->get('/', [
|
|
|
|
'as' => 'admin.databases',
|
|
|
|
'uses' => 'Admin\DatabaseController@getIndex'
|
|
|
|
]);
|
|
|
|
$router->get('/new', [
|
|
|
|
'as' => 'admin.databases.new',
|
|
|
|
'uses' => 'Admin\DatabaseController@getNew'
|
|
|
|
]);
|
|
|
|
$router->post('/new', [
|
|
|
|
'uses' => 'Admin\DatabaseController@postNew'
|
|
|
|
]);
|
2016-02-15 02:43:20 +00:00
|
|
|
$router->delete('/delete/{id}', [
|
|
|
|
'as' => 'admin.databases.delete',
|
|
|
|
'uses' => 'Admin\DatabaseController@deleteDatabase'
|
|
|
|
]);
|
|
|
|
$router->delete('/delete-server/{id}', [
|
|
|
|
'as' => 'admin.databases.delete-server',
|
|
|
|
'uses' => 'Admin\DatabaseController@deleteServer'
|
|
|
|
]);
|
2016-02-13 05:18:32 +00:00
|
|
|
});
|
|
|
|
|
2016-02-15 20:21:28 +00:00
|
|
|
// Service Routes
|
|
|
|
$router->group([
|
|
|
|
'prefix' => 'admin/services',
|
|
|
|
'middleware' => [
|
|
|
|
'auth',
|
|
|
|
'admin',
|
|
|
|
'csrf'
|
|
|
|
]
|
|
|
|
], function () use ($router) {
|
|
|
|
$router->get('/', [
|
|
|
|
'as' => 'admin.services',
|
|
|
|
'uses' => 'Admin\ServiceController@getIndex'
|
|
|
|
]);
|
|
|
|
|
2016-02-20 21:02:49 +00:00
|
|
|
$router->get('/new', [
|
|
|
|
'as' => 'admin.services.new',
|
|
|
|
'uses' => 'Admin\ServiceController@getNew'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('/new', [
|
|
|
|
'uses' => 'Admin\ServiceController@postNew'
|
|
|
|
]);
|
|
|
|
|
2016-02-15 20:21:28 +00:00
|
|
|
$router->get('/service/{id}', [
|
|
|
|
'as' => 'admin.services.service',
|
|
|
|
'uses' => 'Admin\ServiceController@getService'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('/service/{id}', [
|
|
|
|
'uses' => 'Admin\ServiceController@postService'
|
|
|
|
]);
|
|
|
|
|
2016-02-20 21:23:04 +00:00
|
|
|
$router->delete('/service/{id}', [
|
|
|
|
'uses' => 'Admin\ServiceController@deleteService'
|
|
|
|
]);
|
|
|
|
|
2016-02-15 20:21:28 +00:00
|
|
|
$router->get('/option/{id}', [
|
|
|
|
'as' => 'admin.services.option',
|
|
|
|
'uses' => 'Admin\ServiceController@getOption'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('/option/{id}', [
|
|
|
|
'uses' => 'Admin\ServiceController@postOption'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('/option/{option}/{variable}', [
|
|
|
|
'as' => 'admin.services.option.variable',
|
|
|
|
'uses' => 'Admin\ServiceController@postOptionVariable'
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2015-12-06 18:58:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|