Cleanup routing mechanisms

This commit is contained in:
Dane Everitt 2017-04-01 21:01:10 -04:00
parent 0a95d97d7f
commit d80c59aad3
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
13 changed files with 468 additions and 879 deletions

201
routes/admin.php Normal file
View file

@ -0,0 +1,201 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* 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:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* 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.
*/
Route::get('/', 'BaseController@getIndex')->name('admin.index');
/*
|--------------------------------------------------------------------------
| Location Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /admin/locations
|
*/
Route::group(['prefix' => 'locations'], function () {
Route::get('/', 'LocationController@index')->name('admin.locations');
Route::get('/view/{id}', 'LocationController@view')->name('admin.locations.view');
Route::post('/', 'LocationController@create');
Route::post('/view/{id}', 'LocationController@update');
});
/*
|--------------------------------------------------------------------------
| Database Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /admin/databases
|
*/
Route::group(['prefix' => 'databases'], function () {
Route::get('/', 'DatabaseController@index')->name('admin.databases');
Route::get('/view/{id}', 'DatabaseController@view')->name('admin.databases.view');
Route::post('/', 'DatabaseController@create');
Route::post('/view/{id}', 'DatabaseController@update');
});
/*
|--------------------------------------------------------------------------
| Settings Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /admin/settings
|
*/
Route::group(['prefix' => 'settings'], function () {
Route::get('/', 'BaseController@getSettings')->name('admin.settings');
Route::post('/', 'BaseController@postSettings');
});
/*
|--------------------------------------------------------------------------
| User Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /admin/users
|
*/
Route::group(['prefix' => 'users'], function () {
Route::get('/', 'UserController@getIndex')->name('admin.users');
Route::get('/accounts.json', 'UserController@getJson')->name('admin.users.json');
Route::get('/new', 'UserController@getNew')->name('admin.users.new');
Route::get('/view/{id}', 'UserController@getView')->name('admin.users.view');
Route::post('/new', 'UserController@postNew');
Route::post('/view/{id}', 'UserController@updateUser');
Route::delete('/view/{id}', 'UserController@deleteUser');
});
/*
|--------------------------------------------------------------------------
| Server Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /admin/servers
|
*/
Route::group(['prefix' => 'servers'], function () {
Route::get('/', 'ServersController@index')->name('admin.servers');
Route::get('/new', 'ServersController@new')->name('admin.servers.new');
Route::get('/new/nodes', 'ServersController@newServerNodes')->name('admin.servers.new.nodes');
Route::get('/view/{id}', 'ServersController@viewIndex')->name('admin.servers.view');
Route::get('/view/{id}/details', 'ServersController@viewDetails')->name('admin.servers.view.details');
Route::get('/view/{id}/build', 'ServersController@viewBuild')->name('admin.servers.view.build');
Route::get('/view/{id}/startup', 'ServersController@viewStartup')->name('admin.servers.view.startup');
Route::get('/view/{id}/startup', 'ServersController@viewDatabase')->name('admin.servers.view.database');
Route::get('/view/{id}/manage', 'ServersController@viewManage')->name('admin.servers.view.manage');
Route::get('/view/{id}/delete', 'ServersController@viewDelete')->name('admin.servers.view.delete');
Route::post('/new', 'ServersController@create');
Route::post('/view/{id}/details', 'ServersController@setDetails');
Route::post('/view/{id}/details/container', 'ServersController@setContainer')->name('admin.servers.view.details.container');
Route::post('/view/{id}/build', 'ServersController@updateBuild');
Route::post('/view/{id}/build', 'ServersController@saveStartup');
Route::post('/view/{id}/database', 'ServersController@newDatabase');
Route::post('/view/{id}/manage/toggle', 'ServersController@toggleInstall')->name('admin.servers.view.manage.toggle');
Route::post('/view/{id}/manage/rebuild', 'ServersController@rebuildContainer')->name('admin.servers.view.manage.rebuild');
Route::post('/view/{id}/manage/suspension', 'ServersController@manageSuspension')->name('admin.servers.view.manage.suspension');
Route::post('/view/{id}/delete', 'ServersController@delete');
Route::patch('/view/{id}/database', 'ServersController@resetDatabasePassword');
Route::delete('/view/{id}/database/{database}/delete', 'ServersController@deleteDatabase')->name('admin.servers.view.database.delete');
});
/*
|--------------------------------------------------------------------------
| Node Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /admin/nodes
|
*/
Route::group(['prefix' => 'nodes'], function () {
Route::get('/', 'NodesController@index')->name('admin.nodes');
Route::get('/new', 'NodesController@new')->name('admin.nodes.new');
Route::get('/view/{id}', 'NodesController@viewIndex')->name('admin.nodes.view');
Route::get('/view/{id}/settings', 'NodesController@viewSettings')->name('admin.nodes.view.settings');
Route::get('/view/{id}/configuration', 'NodesController@viewConfiguration')->name('admin.nodes.view.configuration');
Route::get('/view/{id}/allocation', 'NodesController@viewAllocation')->name('admin.nodes.view.allocation');
Route::get('/view/{id}/servers', 'NodesController@viewServers')->name('admin.nodes.view.servers');
Route::get('/view/{id}/settings/token', 'NodesController@setToken')->name('admin.nodes.view.configuration.token');
Route::post('/new', 'NodesController@create');
Route::post('/view/{id}/settings', 'NodesController@updateSettings');
Route::post('/view/{id}/allocation', 'NodesController@createAllocation');
Route::post('/view/{id}/allocation/remove', 'NodesController@allocationRemoveBlock')->name('admin.nodes.view.allocation.removeBlock');
Route::post('/view/{id}/allocation/alias', 'NodesController@allocationSetAlias')->name('admin.nodes.view.allocation.setAlias');
Route::delete('/view/{id}/delete', 'NodesController@delete')->name('admin.nodes.view.delete');
Route::delete('/view/{id}/allocation/remove/{allocation}', 'NodesController@allocationRemoveSingle')->name('admin.nodes.view.allocation.removeSingle');
});
/*
|--------------------------------------------------------------------------
| Service Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /admin/services
|
*/
Route::group(['prefix' => 'services'], function () {
Route::get('/', 'ServiceController@index')->name('admin.services');
Route::get('/new', 'ServiceController@new')->name('admin.services.new');
Route::get('/view/{id}', 'ServiceController@view')->name('admin.services.view');
Route::get('/view/{id}/functions', 'ServiceController@viewFunctions')->name('admin.services.view.functions');
Route::get('/option/new', 'OptionController@new')->name('admin.services.option.new');
Route::get('/option/{id}', 'OptionController@viewConfiguration')->name('admin.services.option.view');
Route::get('/option/{id}/variables', 'OptionController@viewVariables')->name('admin.services.option.variables');
Route::post('/new', 'ServiceController@create');
Route::post('/view/{id}', 'ServiceController@edit');
Route::post('/option/new', 'OptionController@new');
Route::post('/option/{id}', 'OptionController@editConfiguration');
Route::post('/option/{id}/variables', 'OptionController@createVariable');
Route::post('/option/{id}/variables/{variable}', 'OptionController@editVariable')->name('admin.services.option.variables.edit');
Route::delete('/view/{id}', 'ServiceController@delete');
});
/*
|--------------------------------------------------------------------------
| Pack Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /admin/packs
|
*/
Route::group(['prefix' => 'packs'], function () {
Route::get('/', 'PackController@index')->name('admin.packs');
Route::get('/new', 'PackController@new')->name('admin.packs.new');
Route::get('/new/template', 'PackController@newTemplate')->name('admin.packs.new.template');
Route::get('/view/{id}', 'PackController@view')->name('admin.packs.view');
Route::post('/new', 'PackController@create');
Route::post('/view/{id}', 'PackController@update');
Route::post('/view/{id}/export/{files?}', 'PackController@export')->name('admin.packs.view.export');
});

34
routes/auth.php Normal file
View file

@ -0,0 +1,34 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* 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:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* 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.
*/
Route::get('/logout', 'LoginController@logout')->name('auth.logout');
Route::get('/login', 'LoginController@showLoginForm')->name('auth.login');
Route::get('/login/totp', 'LoginController@totp')->name('auth.totp');
Route::get('/password', 'ForgotPasswordController@showLinkRequestForm')->name('auth.password');
Route::get('/password/reset/{token}', 'ForgotPasswordController@showResetForm')->name('auth.reset');
Route::post('/login', 'LoginController@login')->middleware('recaptcha');
Route::post('/login', 'LoginController@totpCheckpoint');
Route::post('/password/reset', 'ResetPasswordController@reset')->name('auth.reset.post')->middleware('recaptcha');
Route::post('/password/reset/{token}', 'ForgotPasswordController@sendResetLinkEmail')->middleware('recaptcha');

78
routes/base.php Normal file
View file

@ -0,0 +1,78 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* 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:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* 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.
*/
Route::get('/', 'IndexController@getIndex')->name('index');
Route::get('/index', function () {
redirect()->route('index');
});
/*
|--------------------------------------------------------------------------
| Account Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /account
|
*/
Route::group(['prefix' => 'account'], function () {
Route::get('/', 'AccountController@index')->name('account');
Route::post('/', 'AccountController@update');
});
/*
|--------------------------------------------------------------------------
| Account API Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /account/api
|
*/
Route::group(['prefix' => 'account/api'], function () {
Route::get('/', 'APIController@index')->name('account.api');
Route::get('/new', 'APIController@new')->name('account.api.new');
Route::post('/new', 'APIController@save');
Route::delete('/revoke/{key}', 'APIController@revoke')->name('account.api.revoke');
});
/*
|--------------------------------------------------------------------------
| Account Security Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /account/security
|
*/
Route::group(['prefix' => 'account/security'], function () {
Route::get('/', 'SecurityController@index')->name('account.security');
Route::get('/revoke/{id}', 'SecurityController@revoke')->name('account.security.revoke');
Route::put('/totp', 'SecurityController@generateTotp')->name('account.security.totp');
Route::post('/totp', 'SecurityController@setTotp');
Route::delete('/api/security/totp', 'SecurityController@disableTotp');
});

28
routes/daemon.php Normal file
View file

@ -0,0 +1,28 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* 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:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* 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.
*/
Route::get('/services', 'ServiceController@list')->name('daemon.services');
Route::get('/services/pull/{service}/{file}', 'ServiceController@pull')->name('daemon.pull');
Route::get('/packs/pull/{uuid}', 'PackController@pull')->name('daemon.pack.pull');
Route::get('/packs/pull/{uuid}/hash', 'PackController@hash')->name('daemon.pack.hash');

28
routes/remote.php Normal file
View file

@ -0,0 +1,28 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* 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:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* 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.
*/
Route::get('/configuration/{token}', 'RemoteController@getConfiguration')->name('remote.configuration');
Route::post('/download', 'RemoteController@postDownload')->name('remote.download');
Route::post('/install', 'RemoteController@postInstall')->name('remote.install');

117
routes/server.php Normal file
View file

@ -0,0 +1,117 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* 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:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* 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.
*/
Route::get('/', 'ServerController@getIndex')->name('server.index');
/*
|--------------------------------------------------------------------------
| Server Settings Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /server/{server}/settings
|
*/
Route::group(['prefix' => 'settings'], function () {
Route::get('/databases', 'ServerController@getDatabases')->name('server.settings.databases');
Route::get('/sftp', 'ServerController@getSFTP')->name('server.settings.sftp');
Route::get('/startup', 'ServerController@getStartup')->name('server.settings.startup');
Route::get('/allocation', 'ServerController@getAllocation')->name('server.settings.allocation');
Route::post('/sftp', 'ServerController@postSettingsSFTP');
Route::post('/startup', 'ServerController@postSettingsStartup');
});
/*
|--------------------------------------------------------------------------
| Server File Manager Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /server/{server}/files
|
*/
Route::group(['prefix' => 'files'], function () {
Route::get('/', 'ServerController@getFiles')->name('server.files.index');
Route::get('/add', 'ServerController@getAddFile')->name('server.files.add');
Route::get('/edit/{file}', 'ServerController@getEditFile')->name('server.files.edit');
Route::get('/download/{file}', 'ServerController@getDownloadFile')
->name('server.files.edit')
->where('file', '.*');
Route::post('/directory-list', 'AjaxController@postDirectoryList')->name('server.files.directory-list');
Route::post('/save', 'AjaxController@postSaveFile')->name('server.files.save');
});
/*
|--------------------------------------------------------------------------
| Server Subuser Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /server/{server}/users
|
*/
Route::group(['prefix' => 'users'], function () {
Route::get('/', 'SubuserController@getIndex')->name('server.subusers');
Route::get('/new', 'SubuserController@getNew')->name('server.subusers.new');
Route::get('/view/{id}', 'SubuserController@getView')->name('server.subusers.view');
Route::post('/new', 'SubuserController@postNew');
Route::post('/view/{id}', 'SubuserController@postView');
Route::delete('/delete/{id}', 'SubuserController@deleteSubuser')->name('server.subusers.delete');
});
/*
|--------------------------------------------------------------------------
| Server Task Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /server/{server}/tasks
|
*/
Route::group(['prefix' => 'tasks'], function () {
Route::get('/', 'TaskController@getIndex')->name('server.tasks');
Route::get('/new', 'TaskController@getNew')->name('server.tasks.new');
Route::get('/view/{id}', 'TaskController@getView')->name('server.tasks.view');
Route::post('/new', 'TaskController@postNew');
Route::post('/view/{id}', 'SubuserController@postView');
Route::post('/toggle/{id}', 'TaskController@toggleTask')->name('server.tasks.toggle');
Route::delete('/delete/{id}', 'TaskController@deleteTask')->name('server.tasks.delete');
});
/*
|--------------------------------------------------------------------------
| Server Ajax Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /server/{server}/ajax
|
*/
Route::group(['prefix' => 'ajax'], function () {
Route::get('/status', 'Server\AjaxController@getStatus')->name('server.ajax.status');
Route::post('/set-primary', 'AjaxController@postSetPrimary')->name('server.ajax.set-primary');
Route::post('/settings/reset-database-password', 'AjaxController@postResetDatabasePassword')->name('server.ajax.reset-database-password');
});