misc_pterodactyl-panel/app/Http/Routes/AdminRoutes.php

495 lines
17 KiB
PHP
Raw Normal View History

<?php
2016-01-20 00:10:39 +00:00
/**
2016-01-20 21:05:16 +00:00
* Pterodactyl - Panel
2017-01-24 22:57:08 +00:00
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>
2016-12-07 22:46:38 +00:00
* Some Modifications (c) 2015 Dylan Seidt <dylan.seidt@gmail.com>.
2016-01-20 00:10:39 +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
*
* 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
*
* 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
*/
2016-12-07 22:46:38 +00:00
namespace Pterodactyl\Http\Routes;
use Illuminate\Routing\Router;
2016-12-07 22:46:38 +00:00
class AdminRoutes
{
public function map(Router $router)
{
// Admin Index
$router->get('admin', [
'as' => 'admin.index',
'middleware' => [
'auth',
2016-01-13 02:50:43 +00:00
'admin',
2016-12-07 22:46:38 +00:00
'csrf',
],
2016-12-07 22:46:38 +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',
2016-12-07 22:46:38 +00:00
'csrf',
],
2016-01-21 03:08:09 +00:00
], function () use ($router) {
$router->get('/', [
'as' => 'admin.settings',
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\BaseController@getSettings',
2016-01-21 03:08:09 +00:00
]);
$router->post('/', [
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\BaseController@postSettings',
2016-01-21 03:08:09 +00:00
]);
});
$router->group([
'prefix' => 'admin/users',
'middleware' => [
'auth',
2016-01-13 02:50:43 +00:00
'admin',
2016-12-07 22:46:38 +00:00
'csrf',
],
], function () use ($router) {
// View All Accounts on System
$router->get('/', [
'as' => 'admin.users',
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\UserController@getIndex',
]);
$router->get('/accounts.json', [
'as' => 'admin.users.json',
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\UserController@getJson',
]);
// View Specific Account
$router->get('/view/{id}', [
'as' => 'admin.users.view',
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\UserController@getView',
]);
// View Specific Account
$router->post('/view/{id}', [
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\UserController@updateUser',
]);
// Delete an Account Matching an ID
$router->delete('/view/{id}', [
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\UserController@deleteUser',
]);
// Show Create Account Page
$router->get('/new', [
'as' => 'admin.users.new',
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\UserController@getNew',
]);
2015-12-10 23:30:47 +00:00
// Handle Creating New Account
$router->post('/new', [
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\UserController@postNew',
]);
});
// Server Routes
$router->group([
'prefix' => 'admin/servers',
'middleware' => [
'auth',
2016-01-13 02:50:43 +00:00
'admin',
2016-12-07 22:46:38 +00:00
'csrf',
],
], function () use ($router) {
// View All Servers
$router->get('/', [
'as' => 'admin.servers',
2017-03-05 00:03:49 +00:00
'uses' => 'Admin\ServersController@index',
]);
// View Create Server Page
$router->get('/new', [
'as' => 'admin.servers.new',
2017-03-05 00:03:49 +00:00
'uses' => 'Admin\ServersController@new',
]);
// Handle POST Request for Creating Server
$router->post('/new', [
2017-03-05 00:03:49 +00:00
'uses' => 'Admin\ServersController@create',
]);
// Assorted Page Helpers
2017-03-05 00:03:49 +00:00
$router->post('/new/nodes', [
'as' => 'admin.servers.new.nodes',
'uses' => 'Admin\ServersController@newServerNodes',
2016-09-02 01:16:38 +00:00
]);
$router->get('/view/{id}', [
'as' => 'admin.servers.view',
2017-03-05 00:03:49 +00:00
'uses' => 'Admin\ServersController@viewIndex',
]);
2017-03-05 00:03:49 +00:00
$router->get('/view/{id}/details', [
'as' => 'admin.servers.view.details',
'uses' => 'Admin\ServersController@viewDetails',
]);
$router->post('/view/{id}/details', [
2017-03-05 00:03:49 +00:00
'uses' => 'Admin\ServersController@setDetails',
]);
2017-03-05 00:03:49 +00:00
$router->post('/view/{id}/details/container', [
'as' => 'admin.servers.view.details.container',
'uses' => 'Admin\ServersController@setContainer',
]);
2017-03-05 00:03:49 +00:00
$router->get('/view/{id}/build', [
'as' => 'admin.servers.view.build',
'uses' => 'Admin\ServersController@viewBuild',
]);
2017-03-05 00:03:49 +00:00
$router->post('/view/{id}/build', [
'uses' => 'Admin\ServersController@updateBuild',
]);
2017-03-05 00:03:49 +00:00
$router->get('/view/{id}/startup', [
'as' => 'admin.servers.view.startup',
'uses' => 'Admin\ServersController@viewStartup',
]);
$router->post('/view/{id}/startup', [
'uses' => 'Admin\ServersController@saveStartup',
]);
2017-03-05 00:03:49 +00:00
$router->get('/view/{id}/database', [
'as' => 'admin.servers.view.database',
'uses' => 'Admin\ServersController@viewDatabase',
]);
2015-12-10 23:30:47 +00:00
$router->post('/view/{id}/database', [
'uses' => 'Admin\ServersController@newDatabase',
]);
$router->patch('/view/{id}/database', [
'uses' => 'Admin\ServersController@resetDatabasePassword',
]);
$router->delete('/view/{id}/database/{database}/delete', [
'as' => 'admin.servers.view.database.delete',
'uses' => 'Admin\ServersController@deleteDatabase',
]);
2017-03-05 00:03:49 +00:00
$router->get('/view/{id}/manage', [
'as' => 'admin.servers.view.manage',
'uses' => 'Admin\ServersController@viewManage',
2016-09-02 01:16:38 +00:00
]);
2017-03-05 00:03:49 +00:00
$router->post('/view/{id}/manage/toggle', [
'as' => 'admin.servers.view.manage.toggle',
'uses' => 'Admin\ServersController@toggleInstall',
2016-09-02 01:16:38 +00:00
]);
2017-03-05 00:03:49 +00:00
$router->post('/view/{id}/manage/rebuild', [
'as' => 'admin.servers.view.manage.rebuild',
'uses' => 'Admin\ServersController@rebuildContainer',
2016-01-04 21:09:22 +00:00
]);
2017-03-05 00:03:49 +00:00
$router->post('/view/{id}/manage/suspension', [
'as' => 'admin.servers.view.manage.suspension',
'uses' => 'Admin\ServersController@manageSuspension',
]);
2017-03-05 00:03:49 +00:00
$router->get('/view/{id}/delete', [
'as' => 'admin.servers.view.delete',
'uses' => 'Admin\ServersController@viewDelete',
]);
2017-03-05 00:03:49 +00:00
$router->post('/view/{id}/delete', [
'uses' => 'Admin\ServersController@delete',
]);
$router->post('/view/{id}/delete/continue/{force?}', [
'as' => 'admin.servers.view.delete.continue',
'uses' => 'Admin\ServersController@continueDeletion',
]);
$router->post('/view/{id}/delete/cancel', [
'as' => 'admin.servers.view.delete.cancel',
'uses' => 'Admin\ServersController@cancelDeletion',
]);
});
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',
2016-12-07 22:46:38 +00:00
'csrf',
],
2016-01-05 04:59:45 +00:00
], function () use ($router) {
// View All Nodes
$router->get('/', [
'as' => 'admin.nodes',
2017-03-04 04:37:41 +00:00
'uses' => 'Admin\NodesController@index',
2016-01-05 04:59:45 +00:00
]);
// Add New Node
$router->get('/new', [
'as' => 'admin.nodes.new',
2017-03-04 04:37:41 +00:00
'uses' => 'Admin\NodesController@new',
2016-01-05 04:59:45 +00:00
]);
$router->post('/new', [
2017-03-04 04:37:41 +00:00
'uses' => 'Admin\NodesController@create',
2016-01-05 04:59:45 +00:00
]);
$router->get('/view/{id}', [
2016-01-05 04:59:45 +00:00
'as' => 'admin.nodes.view',
'uses' => 'Admin\NodesController@viewIndex',
2016-01-05 04:59:45 +00:00
]);
$router->get('/view/{id}/settings', [
'as' => 'admin.nodes.view.settings',
'uses' => 'Admin\NodesController@viewSettings',
]);
$router->post('/view/{id}/settings', [
'uses' => 'Admin\NodesController@updateSettings',
]);
$router->get('/view/{id}/configuration', [
'as' => 'admin.nodes.view.configuration',
'uses' => 'Admin\NodesController@viewConfiguration',
]);
$router->get('/view/{id}/allocation', [
'as' => 'admin.nodes.view.allocation',
'uses' => 'Admin\NodesController@viewAllocation',
]);
$router->post('/view/{id}/allocation', [
'uses' => 'Admin\NodesController@createAllocation',
]);
$router->get('/view/{id}/servers', [
'as' => 'admin.nodes.view.servers',
'uses' => 'Admin\NodesController@viewServers',
]);
$router->delete('/view/{id}/delete', [
'as' => 'admin.nodes.view.delete',
'uses' => 'Admin\NodesController@delete',
]);
$router->delete('/view/{id}/allocation/remove/{allocation}', [
'as' => 'admin.nodes.view.allocation.removeSingle',
'uses' => 'Admin\NodesController@allocationRemoveSingle',
]);
$router->post('/view/{id}/allocation/remove', [
'as' => 'admin.nodes.view.allocation.removeBlock',
'uses' => 'Admin\NodesController@allocationRemoveBlock',
]);
$router->post('/view/{id}/allocation/alias', [
'as' => 'admin.nodes.view.allocation.setAlias',
'uses' => 'Admin\NodesController@allocationSetAlias',
]);
$router->get('/view/{id}/settings/token', [
'as' => 'admin.nodes.view.configuration.token',
'uses' => 'Admin\NodesController@setToken',
]);
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',
2016-12-07 22:46:38 +00:00
'csrf',
],
2016-01-11 00:22:21 +00:00
], function () use ($router) {
$router->get('/', [
'as' => 'admin.locations',
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\LocationsController@getIndex',
2016-01-11 00:22:21 +00:00
]);
2016-01-17 03:29:35 +00:00
$router->delete('/{id}', [
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\LocationsController@deleteLocation',
2016-01-17 03:29:35 +00:00
]);
2016-01-17 03:57:28 +00:00
$router->patch('/{id}', [
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\LocationsController@patchLocation',
2016-01-17 03:57:28 +00:00
]);
$router->post('/', [
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\LocationsController@postLocation',
2016-01-17 03:57:28 +00:00
]);
2016-01-11 00:22:21 +00:00
});
// Database Routes
$router->group([
'prefix' => 'admin/databases',
'middleware' => [
'auth',
'admin',
2016-12-07 22:46:38 +00:00
'csrf',
],
], function () use ($router) {
$router->get('/', [
'as' => 'admin.databases',
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\DatabaseController@getIndex',
]);
$router->get('/new', [
'as' => 'admin.databases.new',
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\DatabaseController@getNew',
]);
$router->post('/new', [
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\DatabaseController@postNew',
]);
$router->delete('/delete/{id}', [
'as' => 'admin.databases.delete',
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\DatabaseController@deleteDatabase',
]);
$router->delete('/delete-server/{id}', [
'as' => 'admin.databases.delete-server',
2016-12-07 22:46:38 +00:00
'uses' => 'Admin\DatabaseController@deleteServer',
]);
});
// Service Routes
$router->group([
'prefix' => 'admin/services',
'middleware' => [
'auth',
'admin',
2016-12-07 22:46:38 +00:00
'csrf',
],
], function () use ($router) {
$router->get('/', [
'as' => 'admin.services',
'uses' => 'Admin\ServiceController@index',
]);
2016-02-20 21:02:49 +00:00
$router->get('/new', [
'as' => 'admin.services.new',
'uses' => 'Admin\ServiceController@new',
2016-02-20 21:02:49 +00:00
]);
$router->post('/new', [
'uses' => 'Admin\ServiceController@create',
2016-02-20 21:02:49 +00:00
]);
$router->get('/view/{id}', [
'as' => 'admin.services.view',
'uses' => 'Admin\ServiceController@view',
2016-02-20 21:23:04 +00:00
]);
$router->post('/view/{id}', 'Admin\ServiceController@edit');
$router->get('/view/{id}/functions', [
'as' => 'admin.services.view.functions',
'uses' => 'Admin\ServiceController@viewFunctions',
]);
$router->delete('/view/{id}', [
'uses' => 'Admin\ServiceController@delete',
]);
// ---------------------
// Service Option Routes
// ---------------------
$router->get('/option/new', [
'as' => 'admin.services.option.new',
'uses' => 'Admin\OptionController@new',
]);
$router->post('/option/new', 'Admin\OptionController@create');
$router->get('/option/{id}', [
'as' => 'admin.services.option.view',
'uses' => 'Admin\OptionController@viewConfiguration',
]);
$router->get('/option/{id}/variables', [
'as' => 'admin.services.option.variables',
'uses' => 'Admin\OptionController@viewVariables',
]);
$router->post('/option/{id}/variables/{variable}', [
'as' => 'admin.services.option.variables.edit',
'uses' => 'Admin\OptionController@editVariable',
]);
$router->post('/option/{id}', 'Admin\OptionController@editConfiguration');
});
// Service Packs
$router->group([
'prefix' => 'admin/packs',
'middleware' => [
'auth',
'admin',
2016-12-14 21:56:25 +00:00
'csrf',
],
], function () use ($router) {
// $router->get('/new/{option?}', [
// 'as' => 'admin.packs.new',
// 'uses' => 'Admin\PackController@new',
// ]);
// $router->post('/new', [
// 'uses' => 'Admin\PackController@create',
// ]);
// $router->get('/upload/{option?}', [
// 'as' => 'admin.packs.uploadForm',
// 'uses' => 'Admin\PackController@uploadForm',
// ]);
// $router->post('/upload', [
// 'uses' => 'Admin\PackController@postUpload',
// ]);
$router->get('/', [
'as' => 'admin.packs',
2016-12-14 21:56:25 +00:00
'uses' => 'Admin\PackController@listAll',
]);
// $router->get('/for/option/{option}', [
// 'as' => 'admin.packs.option',
// 'uses' => 'Admin\PackController@listByOption',
// ]);
// $router->get('/for/service/{service}', [
// 'as' => 'admin.packs.service',
// 'uses' => 'Admin\PackController@listByService',
// ]);
// $router->get('/edit/{pack}', [
// 'as' => 'admin.packs.edit',
// 'uses' => 'Admin\PackController@edit',
// ]);
// $router->post('/edit/{pack}', [
// 'uses' => 'Admin\PackController@update',
// ]);
// $router->get('/edit/{pack}/export/{archive?}', [
// 'as' => 'admin.packs.export',
// 'uses' => 'Admin\PackController@export',
// ]);
});
}
}