Switch to more recent Laravel route definition methods

This commit is contained in:
DaneEveritt 2022-05-14 15:51:05 -04:00
parent 62b178ed02
commit 65f27d41a2
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 278 additions and 308 deletions

View file

@ -2,9 +2,9 @@
namespace Pterodactyl\Http; namespace Pterodactyl\Http;
use Illuminate\Http\Middleware\TrustProxies;
use Pterodactyl\Models\ApiKey; use Pterodactyl\Models\ApiKey;
use Illuminate\Auth\Middleware\Authorize; use Illuminate\Auth\Middleware\Authorize;
use Illuminate\Http\Middleware\TrustProxies;
use Illuminate\Auth\Middleware\Authenticate; use Illuminate\Auth\Middleware\Authenticate;
use Pterodactyl\Http\Middleware\TrimStrings; use Pterodactyl\Http\Middleware\TrimStrings;
use Illuminate\Session\Middleware\StartSession; use Illuminate\Session\Middleware\StartSession;
@ -72,21 +72,18 @@ class Kernel extends HttpKernel
IsValidJson::class, IsValidJson::class,
StartSession::class, StartSession::class,
AuthenticateSession::class, AuthenticateSession::class,
VerifyCsrfToken::class,
],
'application-api' => [
ApiSubstituteBindings::class, ApiSubstituteBindings::class,
'api..key:' . ApiKey::TYPE_APPLICATION, 'api..key:' . ApiKey::TYPE_APPLICATION,
AuthenticateApplicationUser::class, AuthenticateApplicationUser::class,
VerifyCsrfToken::class,
AuthenticateIPAccess::class, AuthenticateIPAccess::class,
], ],
'client-api' => [ 'client-api' => [
HandleStatelessRequest::class,
IsValidJson::class,
StartSession::class,
AuthenticateSession::class,
SubstituteClientApiBindings::class, SubstituteClientApiBindings::class,
'api..key:' . ApiKey::TYPE_ACCOUNT, 'api..key:' . ApiKey::TYPE_ACCOUNT,
AuthenticateIPAccess::class, AuthenticateIPAccess::class,
VerifyCsrfToken::class,
// This is perhaps a little backwards with the Client API, but logically you'd be unable // This is perhaps a little backwards with the Client API, but logically you'd be unable
// to create/get an API key without first enabling 2FA on the account, so I suppose in the // to create/get an API key without first enabling 2FA on the account, so I suppose in the
// end it makes sense. // end it makes sense.

View file

@ -10,15 +10,6 @@ use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvi
class RouteServiceProvider extends ServiceProvider class RouteServiceProvider extends ServiceProvider
{ {
/**
* This namespace is applied to the controller routes in your routes file.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'Pterodactyl\Http\Controllers';
/** /**
* Define your route model bindings, pattern filters, etc. * Define your route model bindings, pattern filters, etc.
*/ */
@ -27,35 +18,23 @@ class RouteServiceProvider extends ServiceProvider
$this->configureRateLimiting(); $this->configureRateLimiting();
$this->routes(function () { $this->routes(function () {
Route::middleware(['web', 'auth', 'csrf']) Route::middleware(['web', 'csrf'])->group(function () {
->namespace("$this->namespace\\Base") Route::middleware('auth')->group(base_path('routes/base.php'));
->group(base_path('routes/base.php')); Route::middleware('guest')->prefix('/auth')->group(base_path('routes/auth.php'));
Route::middleware(['auth', 'admin'])->prefix('/admin')->group(base_path('routes/admin.php'));
});
Route::middleware(['web', 'auth', 'admin', 'csrf'])->prefix('/admin') Route::middleware('api')->group(function () {
->namespace("$this->namespace\\Admin") Route::middleware(['application-api', 'throttle:api.application'])
->group(base_path('routes/admin.php')); ->prefix('/api/application')
->group(base_path('routes/api-application.php'));
Route::middleware(['web', 'csrf'])->prefix('/auth') Route::middleware(['client-api', 'throttle:api.client'])
->namespace("$this->namespace\\Auth") ->prefix('/api/client')
->group(base_path('routes/auth.php')); ->group(base_path('routes/api-client.php'));
});
Route::middleware(['web', 'csrf', 'auth', 'server', 'node.maintenance']) Route::middleware('daemon')->prefix('/api/remote')
->prefix('/api/server/{server}')
->namespace("$this->namespace\\Server")
->group(base_path('routes/server.php'));
Route::middleware(['api', 'throttle:api.application'])
->prefix('/api/application')
->namespace("$this->namespace\\Api\\Application")
->group(base_path('routes/api-application.php'));
Route::middleware(['client-api', 'throttle:api.client'])
->prefix('/api/client')
->namespace("$this->namespace\\Api\\Client")
->group(base_path('routes/api-client.php'));
Route::middleware(['daemon'])->prefix('/api/remote')
->namespace("$this->namespace\\Api\\Remote")
->group(base_path('routes/api-remote.php')); ->group(base_path('routes/api-remote.php'));
}); });
} }

View file

@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use Pterodactyl\Http\Controllers\Admin;
use Pterodactyl\Http\Middleware\Admin\Servers\ServerInstalled; use Pterodactyl\Http\Middleware\Admin\Servers\ServerInstalled;
Route::get('/', 'BaseController@index')->name('admin.index'); Route::get('/', [Admin\BaseController::class, 'index'])->name('admin.index');
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -14,12 +15,12 @@ Route::get('/', 'BaseController@index')->name('admin.index');
| |
*/ */
Route::group(['prefix' => 'api'], function () { Route::group(['prefix' => 'api'], function () {
Route::get('/', 'ApiController@index')->name('admin.api.index'); Route::get('/', [Admin\ApiController::class, 'index'])->name('admin.api.index');
Route::get('/new', 'ApiController@create')->name('admin.api.new'); Route::get('/new', [Admin\ApiController::class, 'create'])->name('admin.api.new');
Route::post('/new', 'ApiController@store'); Route::post('/new', [Admin\ApiController::class, 'store']);
Route::delete('/revoke/{identifier}', 'ApiController@delete')->name('admin.api.delete'); Route::delete('/revoke/{identifier}', [Admin\ApiController::class, 'delete'])->name('admin.api.delete');
}); });
/* /*
@ -31,11 +32,11 @@ Route::group(['prefix' => 'api'], function () {
| |
*/ */
Route::group(['prefix' => 'locations'], function () { Route::group(['prefix' => 'locations'], function () {
Route::get('/', 'LocationController@index')->name('admin.locations'); Route::get('/', [Admin\LocationController::class, 'index'])->name('admin.locations');
Route::get('/view/{location}', 'LocationController@view')->name('admin.locations.view'); Route::get('/view/{location}', [Admin\LocationController::class, 'view'])->name('admin.locations.view');
Route::post('/', 'LocationController@create'); Route::post('/', [Admin\LocationController::class, 'create']);
Route::patch('/view/{location}', 'LocationController@update'); Route::patch('/view/{location}', [Admin\LocationController::class, 'update']);
}); });
/* /*
@ -47,12 +48,12 @@ Route::group(['prefix' => 'locations'], function () {
| |
*/ */
Route::group(['prefix' => 'databases'], function () { Route::group(['prefix' => 'databases'], function () {
Route::get('/', 'DatabaseController@index')->name('admin.databases'); Route::get('/', [Admin\DatabaseController::class, 'index'])->name('admin.databases');
Route::get('/view/{host}', 'DatabaseController@view')->name('admin.databases.view'); Route::get('/view/{host}', [Admin\DatabaseController::class, 'view'])->name('admin.databases.view');
Route::post('/', 'DatabaseController@create'); Route::post('/', [Admin\DatabaseController::class, 'create']);
Route::patch('/view/{host}', 'DatabaseController@update'); Route::patch('/view/{host}', [Admin\DatabaseController::class, 'update']);
Route::delete('/view/{host}', 'DatabaseController@delete'); Route::delete('/view/{host}', [Admin\DatabaseController::class, 'delete']);
}); });
/* /*
@ -64,14 +65,15 @@ Route::group(['prefix' => 'databases'], function () {
| |
*/ */
Route::group(['prefix' => 'settings'], function () { Route::group(['prefix' => 'settings'], function () {
Route::get('/', 'Settings\IndexController@index')->name('admin.settings'); Route::get('/', [Admin\Settings\IndexController::class, 'index'])->name('admin.settings');
Route::get('/mail', 'Settings\MailController@index')->name('admin.settings.mail'); Route::get('/mail', [Admin\Settings\MailController::class, 'index'])->name('admin.settings.mail');
Route::get('/advanced', 'Settings\AdvancedController@index')->name('admin.settings.advanced'); Route::get('/advanced', [Admin\Settings\AdvancedController::class, 'index'])->name('admin.settings.advanced');
Route::post('/mail/test', 'Settings\MailController@test')->name('admin.settings.mail.test');
Route::patch('/', 'Settings\IndexController@update'); Route::post('/mail/test', [Admin\Settings\MailController::class, 'test'])->name('admin.settings.mail.test');
Route::patch('/mail', 'Settings\MailController@update');
Route::patch('/advanced', 'Settings\AdvancedController@update'); Route::patch('/', [Admin\Settings\IndexController::class, 'update']);
Route::patch('/mail', [Admin\Settings\MailController::class, 'update']);
Route::patch('/advanced', [Admin\Settings\AdvancedController::class, 'update']);
}); });
/* /*
@ -83,15 +85,15 @@ Route::group(['prefix' => 'settings'], function () {
| |
*/ */
Route::group(['prefix' => 'users'], function () { Route::group(['prefix' => 'users'], function () {
Route::get('/', 'UserController@index')->name('admin.users'); Route::get('/', [Admin\UserController::class, 'index'])->name('admin.users');
Route::get('/accounts.json', 'UserController@json')->name('admin.users.json'); Route::get('/accounts.json', [Admin\UserController::class, 'json'])->name('admin.users.json');
Route::get('/new', 'UserController@create')->name('admin.users.new'); Route::get('/new', [Admin\UserController::class, 'create'])->name('admin.users.new');
Route::get('/view/{user}', 'UserController@view')->name('admin.users.view'); Route::get('/view/{user}', [Admin\UserController::class, 'view'])->name('admin.users.view');
Route::post('/new', 'UserController@store'); Route::post('/new', [Admin\UserController::class, 'store']);
Route::patch('/view/{user}', 'UserController@update');
Route::delete('/view/{user}', 'UserController@delete'); Route::patch('/view/{user}', [Admin\UserController::class, 'update']);
Route::delete('/view/{user}', [Admin\UserController::class, 'delete']);
}); });
/* /*
@ -103,37 +105,37 @@ Route::group(['prefix' => 'users'], function () {
| |
*/ */
Route::group(['prefix' => 'servers'], function () { Route::group(['prefix' => 'servers'], function () {
Route::get('/', 'Servers\ServerController@index')->name('admin.servers'); Route::get('/', [Admin\Servers\ServerController::class, 'index'])->name('admin.servers');
Route::get('/new', 'Servers\CreateServerController@index')->name('admin.servers.new'); Route::get('/new', [Admin\Servers\CreateServerController::class, 'index'])->name('admin.servers.new');
Route::get('/view/{server}', 'Servers\ServerViewController@index')->name('admin.servers.view'); Route::get('/view/{server}', [Admin\Servers\ServerViewController::class, 'index'])->name('admin.servers.view');
Route::group(['middleware' => [ServerInstalled::class]], function () { Route::group(['middleware' => [ServerInstalled::class]], function () {
Route::get('/view/{server}/details', 'Servers\ServerViewController@details')->name('admin.servers.view.details'); Route::get('/view/{server}/details', [Admin\Servers\ServerViewController::class, 'details'])->name('admin.servers.view.details');
Route::get('/view/{server}/build', 'Servers\ServerViewController@build')->name('admin.servers.view.build'); Route::get('/view/{server}/build', [Admin\Servers\ServerViewController::class, 'build'])->name('admin.servers.view.build');
Route::get('/view/{server}/startup', 'Servers\ServerViewController@startup')->name('admin.servers.view.startup'); Route::get('/view/{server}/startup', [Admin\Servers\ServerViewController::class, 'startup'])->name('admin.servers.view.startup');
Route::get('/view/{server}/database', 'Servers\ServerViewController@database')->name('admin.servers.view.database'); Route::get('/view/{server}/database', [Admin\Servers\ServerViewController::class, 'database'])->name('admin.servers.view.database');
Route::get('/view/{server}/mounts', 'Servers\ServerViewController@mounts')->name('admin.servers.view.mounts'); Route::get('/view/{server}/mounts', [Admin\Servers\ServerViewController::class, 'mounts'])->name('admin.servers.view.mounts');
}); });
Route::get('/view/{server}/manage', 'Servers\ServerViewController@manage')->name('admin.servers.view.manage'); Route::get('/view/{server}/manage', [Admin\Servers\ServerViewController::class, 'manage'])->name('admin.servers.view.manage');
Route::get('/view/{server}/delete', 'Servers\ServerViewController@delete')->name('admin.servers.view.delete'); Route::get('/view/{server}/delete', [Admin\Servers\ServerViewController::class, 'delete'])->name('admin.servers.view.delete');
Route::post('/new', 'Servers\CreateServerController@store'); Route::post('/new', [Admin\Servers\CreateServerController::class, 'store']);
Route::post('/view/{server}/build', 'ServersController@updateBuild'); Route::post('/view/{server}/build', [Admin\ServersController::class, 'updateBuild']);
Route::post('/view/{server}/startup', 'ServersController@saveStartup'); Route::post('/view/{server}/startup', [Admin\ServersController::class, 'saveStartup']);
Route::post('/view/{server}/database', 'ServersController@newDatabase'); Route::post('/view/{server}/database', [Admin\ServersController::class, 'newDatabase']);
Route::post('/view/{server}/mounts/{mount}', 'ServersController@addMount')->name('admin.servers.view.mounts.toggle'); Route::post('/view/{server}/mounts/{mount}', [Admin\ServersController::class, 'addMount'])->name('admin.servers.view.mounts.toggle');
Route::post('/view/{server}/manage/toggle', 'ServersController@toggleInstall')->name('admin.servers.view.manage.toggle'); Route::post('/view/{server}/manage/toggle', [Admin\ServersController::class, 'toggleInstall'])->name('admin.servers.view.manage.toggle');
Route::post('/view/{server}/manage/suspension', 'ServersController@manageSuspension')->name('admin.servers.view.manage.suspension'); Route::post('/view/{server}/manage/suspension', [Admin\ServersController::class, 'manageSuspension'])->name('admin.servers.view.manage.suspension');
Route::post('/view/{server}/manage/reinstall', 'ServersController@reinstallServer')->name('admin.servers.view.manage.reinstall'); Route::post('/view/{server}/manage/reinstall', [Admin\ServersController::class, 'reinstallServer'])->name('admin.servers.view.manage.reinstall');
Route::post('/view/{server}/manage/transfer', 'Servers\ServerTransferController@transfer')->name('admin.servers.view.manage.transfer'); Route::post('/view/{server}/manage/transfer', [Admin\Servers\ServerTransferController::class, 'transfer'])->name('admin.servers.view.manage.transfer');
Route::post('/view/{server}/delete', 'ServersController@delete'); Route::post('/view/{server}/delete', [Admin\ServersController::class, 'delete']);
Route::patch('/view/{server}/details', 'ServersController@setDetails'); Route::patch('/view/{server}/details', [Admin\ServersController::class, 'setDetails']);
Route::patch('/view/{server}/database', 'ServersController@resetDatabasePassword'); Route::patch('/view/{server}/database', [Admin\ServersController::class, 'resetDatabasePassword']);
Route::delete('/view/{server}/database/{database}/delete', 'ServersController@deleteDatabase')->name('admin.servers.view.database.delete'); Route::delete('/view/{server}/database/{database}/delete', [Admin\ServersController::class, 'deleteDatabase'])->name('admin.servers.view.database.delete');
Route::delete('/view/{server}/mounts/{mount}', 'ServersController@deleteMount'); Route::delete('/view/{server}/mounts/{mount}', [Admin\ServersController::class, 'deleteMount']);
}); });
/* /*
@ -145,26 +147,26 @@ Route::group(['prefix' => 'servers'], function () {
| |
*/ */
Route::group(['prefix' => 'nodes'], function () { Route::group(['prefix' => 'nodes'], function () {
Route::get('/', 'Nodes\NodeController@index')->name('admin.nodes'); Route::get('/', [Admin\Nodes\NodeController::class, 'index'])->name('admin.nodes');
Route::get('/new', 'NodesController@create')->name('admin.nodes.new'); Route::get('/new', [Admin\NodesController::class, 'create'])->name('admin.nodes.new');
Route::get('/view/{node}', 'Nodes\NodeViewController@index')->name('admin.nodes.view'); Route::get('/view/{node}', [Admin\Nodes\NodeViewController::class, 'index'])->name('admin.nodes.view');
Route::get('/view/{node}/settings', 'Nodes\NodeViewController@settings')->name('admin.nodes.view.settings'); Route::get('/view/{node}/settings', [Admin\Nodes\NodeViewController::class, 'settings'])->name('admin.nodes.view.settings');
Route::get('/view/{node}/configuration', 'Nodes\NodeViewController@configuration')->name('admin.nodes.view.configuration'); Route::get('/view/{node}/configuration', [Admin\Nodes\NodeViewController::class, 'configuration'])->name('admin.nodes.view.configuration');
Route::get('/view/{node}/allocation', 'Nodes\NodeViewController@allocations')->name('admin.nodes.view.allocation'); Route::get('/view/{node}/allocation', [Admin\Nodes\NodeViewController::class, 'allocations'])->name('admin.nodes.view.allocation');
Route::get('/view/{node}/servers', 'Nodes\NodeViewController@servers')->name('admin.nodes.view.servers'); Route::get('/view/{node}/servers', [Admin\Nodes\NodeViewController::class, 'servers'])->name('admin.nodes.view.servers');
Route::get('/view/{node}/system-information', 'Nodes\SystemInformationController'); Route::get('/view/{node}/system-information', Admin\Nodes\SystemInformationController::class);
Route::post('/new', 'NodesController@store'); Route::post('/new', [Admin\NodesController::class, 'store']);
Route::post('/view/{node}/allocation', 'NodesController@createAllocation'); Route::post('/view/{node}/allocation', [Admin\NodesController::class, 'createAllocation']);
Route::post('/view/{node}/allocation/remove', 'NodesController@allocationRemoveBlock')->name('admin.nodes.view.allocation.removeBlock'); Route::post('/view/{node}/allocation/remove', [Admin\NodesController::class, 'allocationRemoveBlock'])->name('admin.nodes.view.allocation.removeBlock');
Route::post('/view/{node}/allocation/alias', 'NodesController@allocationSetAlias')->name('admin.nodes.view.allocation.setAlias'); Route::post('/view/{node}/allocation/alias', [Admin\NodesController::class, 'allocationSetAlias'])->name('admin.nodes.view.allocation.setAlias');
Route::post('/view/{node}/settings/token', 'NodeAutoDeployController')->name('admin.nodes.view.configuration.token'); Route::post('/view/{node}/settings/token', Admin\NodeAutoDeployController::class)->name('admin.nodes.view.configuration.token');
Route::patch('/view/{node}/settings', 'NodesController@updateSettings'); Route::patch('/view/{node}/settings', [Admin\NodesController::class, 'updateSettings']);
Route::delete('/view/{node}/delete', 'NodesController@delete')->name('admin.nodes.view.delete'); Route::delete('/view/{node}/delete', [Admin\NodesController::class, 'delete'])->name('admin.nodes.view.delete');
Route::delete('/view/{node}/allocation/remove/{allocation}', 'NodesController@allocationRemoveSingle')->name('admin.nodes.view.allocation.removeSingle'); Route::delete('/view/{node}/allocation/remove/{allocation}', [Admin\NodesController::class, 'allocationRemoveSingle'])->name('admin.nodes.view.allocation.removeSingle');
Route::delete('/view/{node}/allocations', 'NodesController@allocationRemoveMultiple')->name('admin.nodes.view.allocation.removeMultiple'); Route::delete('/view/{node}/allocations', [Admin\NodesController::class, 'allocationRemoveMultiple'])->name('admin.nodes.view.allocation.removeMultiple');
}); });
/* /*
@ -176,17 +178,17 @@ Route::group(['prefix' => 'nodes'], function () {
| |
*/ */
Route::group(['prefix' => 'mounts'], function () { Route::group(['prefix' => 'mounts'], function () {
Route::get('/', 'MountController@index')->name('admin.mounts'); Route::get('/', [Admin\MountController::class, 'index'])->name('admin.mounts');
Route::get('/view/{mount}', 'MountController@view')->name('admin.mounts.view'); Route::get('/view/{mount}', [Admin\MountController::class, 'view'])->name('admin.mounts.view');
Route::post('/', 'MountController@create'); Route::post('/', [Admin\MountController::class, 'create']);
Route::post('/{mount}/eggs', 'MountController@addEggs')->name('admin.mounts.eggs'); Route::post('/{mount}/eggs', [Admin\MountController::class, 'addEggs'])->name('admin.mounts.eggs');
Route::post('/{mount}/nodes', 'MountController@addNodes')->name('admin.mounts.nodes'); Route::post('/{mount}/nodes', [Admin\MountController::class, 'addNodes'])->name('admin.mounts.nodes');
Route::patch('/view/{mount}', 'MountController@update'); Route::patch('/view/{mount}', [Admin\MountController::class, 'update']);
Route::delete('/{mount}/eggs/{egg_id}', 'MountController@deleteEgg'); Route::delete('/{mount}/eggs/{egg_id}', [Admin\MountController::class, 'deleteEgg']);
Route::delete('/{mount}/nodes/{node_id}', 'MountController@deleteNode'); Route::delete('/{mount}/nodes/{node_id}', [Admin\MountController::class, 'deleteNode']);
}); });
/* /*
@ -198,28 +200,28 @@ Route::group(['prefix' => 'mounts'], function () {
| |
*/ */
Route::group(['prefix' => 'nests'], function () { Route::group(['prefix' => 'nests'], function () {
Route::get('/', 'Nests\NestController@index')->name('admin.nests'); Route::get('/', [Admin\Nests\NestController::class, 'index'])->name('admin.nests');
Route::get('/new', 'Nests\NestController@create')->name('admin.nests.new'); Route::get('/new', [Admin\Nests\NestController::class, 'create'])->name('admin.nests.new');
Route::get('/view/{nest}', 'Nests\NestController@view')->name('admin.nests.view'); Route::get('/view/{nest}', [Admin\Nests\NestController::class, 'view'])->name('admin.nests.view');
Route::get('/egg/new', 'Nests\EggController@create')->name('admin.nests.egg.new'); Route::get('/egg/new', [Admin\Nests\EggController::class, 'create'])->name('admin.nests.egg.new');
Route::get('/egg/{egg}', 'Nests\EggController@view')->name('admin.nests.egg.view'); Route::get('/egg/{egg}', [Admin\Nests\EggController::class, 'view'])->name('admin.nests.egg.view');
Route::get('/egg/{egg}/export', 'Nests\EggShareController@export')->name('admin.nests.egg.export'); Route::get('/egg/{egg}/export', [Admin\Nests\EggShareController::class, 'export'])->name('admin.nests.egg.export');
Route::get('/egg/{egg}/variables', 'Nests\EggVariableController@view')->name('admin.nests.egg.variables'); Route::get('/egg/{egg}/variables', [Admin\Nests\EggVariableController::class, 'view'])->name('admin.nests.egg.variables');
Route::get('/egg/{egg}/scripts', 'Nests\EggScriptController@index')->name('admin.nests.egg.scripts'); Route::get('/egg/{egg}/scripts', [Admin\Nests\EggScriptController::class, 'index'])->name('admin.nests.egg.scripts');
Route::post('/new', 'Nests\NestController@store'); Route::post('/new', [Admin\Nests\NestController::class, 'store']);
Route::post('/import', 'Nests\EggShareController@import')->name('admin.nests.egg.import'); Route::post('/import', [Admin\Nests\EggShareController::class, 'import'])->name('admin.nests.egg.import');
Route::post('/egg/new', 'Nests\EggController@store'); Route::post('/egg/new', [Admin\Nests\EggController::class, 'store']);
Route::post('/egg/{egg}/variables', 'Nests\EggVariableController@store'); Route::post('/egg/{egg}/variables', [Admin\Nests\EggVariableController::class, 'store']);
Route::put('/egg/{egg}', 'Nests\EggShareController@update'); Route::put('/egg/{egg}', [Admin\Nests\EggShareController::class, 'update']);
Route::patch('/view/{nest}', 'Nests\NestController@update'); Route::patch('/view/{nest}', [Admin\Nests\NestController::class, 'update']);
Route::patch('/egg/{egg}', 'Nests\EggController@update'); Route::patch('/egg/{egg}', [Admin\Nests\EggController::class, 'update']);
Route::patch('/egg/{egg}/scripts', 'Nests\EggScriptController@update'); Route::patch('/egg/{egg}/scripts', [Admin\Nests\EggScriptController::class, 'update']);
Route::patch('/egg/{egg}/variables/{variable}', 'Nests\EggVariableController@update')->name('admin.nests.egg.variables.edit'); Route::patch('/egg/{egg}/variables/{variable}', [Admin\Nests\EggVariableController::class, 'update'])->name('admin.nests.egg.variables.edit');
Route::delete('/view/{nest}', 'Nests\NestController@destroy'); Route::delete('/view/{nest}', [Admin\Nests\NestController::class, 'destroy']);
Route::delete('/egg/{egg}', 'Nests\EggController@destroy'); Route::delete('/egg/{egg}', [Admin\Nests\EggController::class, 'destroy']);
Route::delete('/egg/{egg}/variables/{variable}', 'Nests\EggVariableController@destroy'); Route::delete('/egg/{egg}/variables/{variable}', [Admin\Nests\EggVariableController::class, 'destroy']);
}); });

View file

@ -1,6 +1,7 @@
<?php <?php
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use Pterodactyl\Http\Controllers\Api\Application;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -12,14 +13,14 @@ use Illuminate\Support\Facades\Route;
*/ */
Route::group(['prefix' => '/users'], function () { Route::group(['prefix' => '/users'], function () {
Route::get('/', 'Users\UserController@index')->name('api.application.users'); Route::get('/', [Application\Users\UserController::class, 'index'])->name('api.application.users');
Route::get('/{user}', 'Users\UserController@view')->name('api.application.users.view'); Route::get('/{user}', [Application\Users\UserController::class, 'view'])->name('api.application.users.view');
Route::get('/external/{external_id}', 'Users\ExternalUserController@index')->name('api.application.users.external'); Route::get('/external/{external_id}', [Application\Users\ExternalUserController::class, 'index'])->name('api.application.users.external');
Route::post('/', 'Users\UserController@store'); Route::post('/', [Application\Users\UserController::class, 'store']);
Route::patch('/{user}', 'Users\UserController@update'); Route::patch('/{user}', [Application\Users\UserController::class, 'update']);
Route::delete('/{user}', 'Users\UserController@delete'); Route::delete('/{user}', [Application\Users\UserController::class, 'delete']);
}); });
/* /*
@ -31,20 +32,20 @@ Route::group(['prefix' => '/users'], function () {
| |
*/ */
Route::group(['prefix' => '/nodes'], function () { Route::group(['prefix' => '/nodes'], function () {
Route::get('/', 'Nodes\NodeController@index')->name('api.application.nodes'); Route::get('/', [Application\Nodes\NodeController::class, 'index'])->name('api.application.nodes');
Route::get('/deployable', 'Nodes\NodeDeploymentController'); Route::get('/deployable', Application\Nodes\NodeDeploymentController::class);
Route::get('/{node}', 'Nodes\NodeController@view')->name('api.application.nodes.view'); Route::get('/{node}', [Application\Nodes\NodeController::class, 'view'])->name('api.application.nodes.view');
Route::get('/{node}/configuration', 'Nodes\NodeConfigurationController'); Route::get('/{node}/configuration', Application\Nodes\NodeConfigurationController::class);
Route::post('/', 'Nodes\NodeController@store'); Route::post('/', [Application\Nodes\NodeController::class, 'store']);
Route::patch('/{node}', 'Nodes\NodeController@update'); Route::patch('/{node}', [Application\Nodes\NodeController::class, 'update']);
Route::delete('/{node}', 'Nodes\NodeController@delete'); Route::delete('/{node}', [Application\Nodes\NodeController::class, 'delete']);
Route::group(['prefix' => '/{node}/allocations'], function () { Route::group(['prefix' => '/{node}/allocations'], function () {
Route::get('/', 'Nodes\AllocationController@index')->name('api.application.allocations'); Route::get('/', [Application\Nodes\AllocationController::class, 'index'])->name('api.application.allocations');
Route::post('/', 'Nodes\AllocationController@store'); Route::post('/', [Application\Nodes\AllocationController::class, 'store']);
Route::delete('/{allocation}', 'Nodes\AllocationController@delete')->name('api.application.allocations.view'); Route::delete('/{allocation}', [Application\Nodes\AllocationController::class, 'delete'])->name('api.application.allocations.view');
}); });
}); });
@ -57,13 +58,13 @@ Route::group(['prefix' => '/nodes'], function () {
| |
*/ */
Route::group(['prefix' => '/locations'], function () { Route::group(['prefix' => '/locations'], function () {
Route::get('/', 'Locations\LocationController@index')->name('api.applications.locations'); Route::get('/', [Application\Locations\LocationController::class, 'index'])->name('api.applications.locations');
Route::get('/{location}', 'Locations\LocationController@view')->name('api.application.locations.view'); Route::get('/{location}', [Application\Locations\LocationController::class, 'view'])->name('api.application.locations.view');
Route::post('/', 'Locations\LocationController@store'); Route::post('/', [Application\Locations\LocationController::class, 'store']);
Route::patch('/{location}', 'Locations\LocationController@update'); Route::patch('/{location}', [Application\Locations\LocationController::class, 'update']);
Route::delete('/{location}', 'Locations\LocationController@delete'); Route::delete('/{location}', [Application\Locations\LocationController::class, 'delete']);
}); });
/* /*
@ -75,31 +76,31 @@ Route::group(['prefix' => '/locations'], function () {
| |
*/ */
Route::group(['prefix' => '/servers'], function () { Route::group(['prefix' => '/servers'], function () {
Route::get('/', 'Servers\ServerController@index')->name('api.application.servers'); Route::get('/', [Application\Servers\ServerController::class, 'index'])->name('api.application.servers');
Route::get('/{server}', 'Servers\ServerController@view')->name('api.application.servers.view'); Route::get('/{server}', [Application\Servers\ServerController::class, 'view'])->name('api.application.servers.view');
Route::get('/external/{external_id}', 'Servers\ExternalServerController@index')->name('api.application.servers.external'); Route::get('/external/{external_id}', [Application\Servers\ExternalServerController::class, 'index'])->name('api.application.servers.external');
Route::patch('/{server}/details', 'Servers\ServerDetailsController@details')->name('api.application.servers.details'); Route::patch('/{server}/details', [Application\Servers\ServerDetailsController::class, 'details'])->name('api.application.servers.details');
Route::patch('/{server}/build', 'Servers\ServerDetailsController@build')->name('api.application.servers.build'); Route::patch('/{server}/build', [Application\Servers\ServerDetailsController::class, 'build'])->name('api.application.servers.build');
Route::patch('/{server}/startup', 'Servers\StartupController@index')->name('api.application.servers.startup'); Route::patch('/{server}/startup', [Application\Servers\StartupController::class, 'index'])->name('api.application.servers.startup');
Route::post('/', 'Servers\ServerController@store'); Route::post('/', [Application\Servers\ServerController::class, 'store']);
Route::post('/{server}/suspend', 'Servers\ServerManagementController@suspend')->name('api.application.servers.suspend'); Route::post('/{server}/suspend', [Application\Servers\ServerManagementController::class, 'suspend'])->name('api.application.servers.suspend');
Route::post('/{server}/unsuspend', 'Servers\ServerManagementController@unsuspend')->name('api.application.servers.unsuspend'); Route::post('/{server}/unsuspend', [Application\Servers\ServerManagementController::class, 'unsuspend'])->name('api.application.servers.unsuspend');
Route::post('/{server}/reinstall', 'Servers\ServerManagementController@reinstall')->name('api.application.servers.reinstall'); Route::post('/{server}/reinstall', [Application\Servers\ServerManagementController::class, 'reinstall'])->name('api.application.servers.reinstall');
Route::delete('/{server}', 'Servers\ServerController@delete'); Route::delete('/{server}', [Application\Servers\ServerController::class, 'delete']);
Route::delete('/{server}/{force?}', 'Servers\ServerController@delete'); Route::delete('/{server}/{force?}', [Application\Servers\ServerController::class, 'delete']);
// Database Management Endpoint // Database Management Endpoint
Route::group(['prefix' => '/{server}/databases'], function () { Route::group(['prefix' => '/{server}/databases'], function () {
Route::get('/', 'Servers\DatabaseController@index')->name('api.application.servers.databases'); Route::get('/', [Application\Servers\DatabaseController::class, 'index'])->name('api.application.servers.databases');
Route::get('/{database}', 'Servers\DatabaseController@view')->name('api.application.servers.databases.view'); Route::get('/{database}', [Application\Servers\DatabaseController::class, 'view'])->name('api.application.servers.databases.view');
Route::post('/', 'Servers\DatabaseController@store'); Route::post('/', [Application\Servers\DatabaseController::class, 'store']);
Route::post('/{database}/reset-password', 'Servers\DatabaseController@resetPassword'); Route::post('/{database}/reset-password', [Application\Servers\DatabaseController::class, 'resetPassword']);
Route::delete('/{database}', 'Servers\DatabaseController@delete'); Route::delete('/{database}', [Application\Servers\DatabaseController::class, 'delete']);
}); });
}); });
@ -112,12 +113,12 @@ Route::group(['prefix' => '/servers'], function () {
| |
*/ */
Route::group(['prefix' => '/nests'], function () { Route::group(['prefix' => '/nests'], function () {
Route::get('/', 'Nests\NestController@index')->name('api.application.nests'); Route::get('/', [Application\Nests\NestController::class, 'index'])->name('api.application.nests');
Route::get('/{nest}', 'Nests\NestController@view')->name('api.application.nests.view'); Route::get('/{nest}', [Application\Nests\NestController::class, 'view'])->name('api.application.nests.view');
// Egg Management Endpoint // Egg Management Endpoint
Route::group(['prefix' => '/{nest}/eggs'], function () { Route::group(['prefix' => '/{nest}/eggs'], function () {
Route::get('/', 'Nests\EggController@index')->name('api.application.nests.eggs'); Route::get('/', [Application\Nests\EggController::class, 'index'])->name('api.application.nests.eggs');
Route::get('/{egg}', 'Nests\EggController@view')->name('api.application.nests.eggs.view'); Route::get('/{egg}', [Application\Nests\EggController::class, 'view'])->name('api.application.nests.eggs.view');
}); });
}); });

View file

@ -1,6 +1,7 @@
<?php <?php
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use Pterodactyl\Http\Controllers\Api\Client;
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication; use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
use Pterodactyl\Http\Middleware\Api\Client\Server\ResourceBelongsToServer; use Pterodactyl\Http\Middleware\Api\Client\Server\ResourceBelongsToServer;
use Pterodactyl\Http\Middleware\Api\Client\Server\AuthenticateServerAccess; use Pterodactyl\Http\Middleware\Api\Client\Server\AuthenticateServerAccess;
@ -13,21 +14,21 @@ use Pterodactyl\Http\Middleware\Api\Client\Server\AuthenticateServerAccess;
| Endpoint: /api/client | Endpoint: /api/client
| |
*/ */
Route::get('/', 'ClientController@index')->name('api:client.index'); Route::get('/', [Client\ClientController::class, 'index'])->name('api:client.index');
Route::get('/permissions', 'ClientController@permissions'); Route::get('/permissions', [Client\ClientController::class, 'permissions']);
Route::group(['prefix' => '/account'], function () { Route::group(['prefix' => '/account'], function () {
Route::get('/', 'AccountController@index')->name('api:client.account')->withoutMiddleware(RequireTwoFactorAuthentication::class); Route::get('/', [Client\AccountController::class, 'index'])->name('api:client.account')->withoutMiddleware(RequireTwoFactorAuthentication::class);
Route::get('/two-factor', 'TwoFactorController@index')->withoutMiddleware(RequireTwoFactorAuthentication::class); Route::get('/two-factor', [Client\TwoFactorController::class, 'index'])->withoutMiddleware(RequireTwoFactorAuthentication::class);
Route::post('/two-factor', 'TwoFactorController@store')->withoutMiddleware(RequireTwoFactorAuthentication::class); Route::post('/two-factor', [Client\TwoFactorController::class, 'store'])->withoutMiddleware(RequireTwoFactorAuthentication::class);
Route::delete('/two-factor', 'TwoFactorController@delete')->withoutMiddleware(RequireTwoFactorAuthentication::class); Route::delete('/two-factor', [Client\TwoFactorController::class, 'delete'])->withoutMiddleware(RequireTwoFactorAuthentication::class);
Route::put('/email', 'AccountController@updateEmail')->name('api:client.account.update-email'); Route::put('/email', [Client\AccountController::class, 'updateEmail'])->name('api:client.account.update-email');
Route::put('/password', 'AccountController@updatePassword')->name('api:client.account.update-password'); Route::put('/password', [Client\AccountController::class, 'updatePassword'])->name('api:client.account.update-password');
Route::get('/api-keys', 'ApiKeyController@index'); Route::get('/api-keys', [Client\ApiKeyController::class, 'index']);
Route::post('/api-keys', 'ApiKeyController@store'); Route::post('/api-keys', [Client\ApiKeyController::class, 'store']);
Route::delete('/api-keys/{identifier}', 'ApiKeyController@delete'); Route::delete('/api-keys/{identifier}', [Client\ApiKeyController::class, 'delete']);
}); });
/* /*
@ -39,83 +40,83 @@ Route::group(['prefix' => '/account'], function () {
| |
*/ */
Route::group(['prefix' => '/servers/{server}', 'middleware' => [AuthenticateServerAccess::class, ResourceBelongsToServer::class]], function () { Route::group(['prefix' => '/servers/{server}', 'middleware' => [AuthenticateServerAccess::class, ResourceBelongsToServer::class]], function () {
Route::get('/', 'Servers\ServerController@index')->name('api:client:server.view'); Route::get('/', [Client\Servers\ServerController::class, 'index'])->name('api:client:server.view');
Route::get('/websocket', 'Servers\WebsocketController')->name('api:client:server.ws'); Route::get('/websocket', Client\Servers\WebsocketController::class)->name('api:client:server.ws');
Route::get('/resources', 'Servers\ResourceUtilizationController')->name('api:client:server.resources'); Route::get('/resources', Client\Servers\ResourceUtilizationController::class)->name('api:client:server.resources');
Route::post('/command', 'Servers\CommandController@index'); Route::post('/command', [Client\Servers\CommandController::class, 'index']);
Route::post('/power', 'Servers\PowerController@index'); Route::post('/power', [Client\Servers\PowerController::class, 'index']);
Route::group(['prefix' => '/databases'], function () { Route::group(['prefix' => '/databases'], function () {
Route::get('/', 'Servers\DatabaseController@index'); Route::get('/', [Client\Servers\DatabaseController::class, 'index']);
Route::post('/', 'Servers\DatabaseController@store'); Route::post('/', [Client\Servers\DatabaseController::class, 'store']);
Route::post('/{database}/rotate-password', 'Servers\DatabaseController@rotatePassword'); Route::post('/{database}/rotate-password', [Client\Servers\DatabaseController::class, 'rotatePassword']);
Route::delete('/{database}', 'Servers\DatabaseController@delete'); Route::delete('/{database}', [Client\Servers\DatabaseController::class, 'delete']);
}); });
Route::group(['prefix' => '/files'], function () { Route::group(['prefix' => '/files'], function () {
Route::get('/list', 'Servers\FileController@directory'); Route::get('/list', [Client\Servers\FileController::class, 'directory']);
Route::get('/contents', 'Servers\FileController@contents'); Route::get('/contents', [Client\Servers\FileController::class, 'contents']);
Route::get('/download', 'Servers\FileController@download'); Route::get('/download', [Client\Servers\FileController::class, 'download']);
Route::put('/rename', 'Servers\FileController@rename'); Route::put('/rename', [Client\Servers\FileController::class, 'rename']);
Route::post('/copy', 'Servers\FileController@copy'); Route::post('/copy', [Client\Servers\FileController::class, 'copy']);
Route::post('/write', 'Servers\FileController@write'); Route::post('/write', [Client\Servers\FileController::class, 'write']);
Route::post('/compress', 'Servers\FileController@compress'); Route::post('/compress', [Client\Servers\FileController::class, 'compress']);
Route::post('/decompress', 'Servers\FileController@decompress'); Route::post('/decompress', [Client\Servers\FileController::class, 'decompress']);
Route::post('/delete', 'Servers\FileController@delete'); Route::post('/delete', [Client\Servers\FileController::class, 'delete']);
Route::post('/create-folder', 'Servers\FileController@create'); Route::post('/create-folder', [Client\Servers\FileController::class, 'create']);
Route::post('/chmod', 'Servers\FileController@chmod'); Route::post('/chmod', [Client\Servers\FileController::class, 'chmod']);
Route::post('/pull', 'Servers\FileController@pull')->middleware(['throttle:10,5']); Route::post('/pull', [Client\Servers\FileController::class, 'pull'])->middleware(['throttle:10,5']);
Route::get('/upload', 'Servers\FileUploadController'); Route::get('/upload', Client\Servers\FileUploadController::class);
}); });
Route::group(['prefix' => '/schedules'], function () { Route::group(['prefix' => '/schedules'], function () {
Route::get('/', 'Servers\ScheduleController@index'); Route::get('/', [Client\Servers\ScheduleController::class, 'index']);
Route::post('/', 'Servers\ScheduleController@store'); Route::post('/', [Client\Servers\ScheduleController::class, 'store']);
Route::get('/{schedule}', 'Servers\ScheduleController@view'); Route::get('/{schedule}', [Client\Servers\ScheduleController::class, 'view']);
Route::post('/{schedule}', 'Servers\ScheduleController@update'); Route::post('/{schedule}', [Client\Servers\ScheduleController::class, 'update']);
Route::post('/{schedule}/execute', 'Servers\ScheduleController@execute'); Route::post('/{schedule}/execute', [Client\Servers\ScheduleController::class, 'execute']);
Route::delete('/{schedule}', 'Servers\ScheduleController@delete'); Route::delete('/{schedule}', [Client\Servers\ScheduleController::class, 'delete']);
Route::post('/{schedule}/tasks', 'Servers\ScheduleTaskController@store'); Route::post('/{schedule}/tasks', [Client\Servers\ScheduleTaskController::class, 'store']);
Route::post('/{schedule}/tasks/{task}', 'Servers\ScheduleTaskController@update'); Route::post('/{schedule}/tasks/{task}', [Client\Servers\ScheduleTaskController::class, 'update']);
Route::delete('/{schedule}/tasks/{task}', 'Servers\ScheduleTaskController@delete'); Route::delete('/{schedule}/tasks/{task}', [Client\Servers\ScheduleTaskController::class, 'delete']);
}); });
Route::group(['prefix' => '/network'], function () { Route::group(['prefix' => '/network'], function () {
Route::get('/allocations', 'Servers\NetworkAllocationController@index'); Route::get('/allocations', [Client\Servers\NetworkAllocationController::class, 'index']);
Route::post('/allocations', 'Servers\NetworkAllocationController@store'); Route::post('/allocations', [Client\Servers\NetworkAllocationController::class, 'store']);
Route::post('/allocations/{allocation}', 'Servers\NetworkAllocationController@update'); Route::post('/allocations/{allocation}', [Client\Servers\NetworkAllocationController::class, 'update']);
Route::post('/allocations/{allocation}/primary', 'Servers\NetworkAllocationController@setPrimary'); Route::post('/allocations/{allocation}/primary', [Client\Servers\NetworkAllocationController::class, 'setPrimary']);
Route::delete('/allocations/{allocation}', 'Servers\NetworkAllocationController@delete'); Route::delete('/allocations/{allocation}', [Client\Servers\NetworkAllocationController::class, 'delete']);
}); });
Route::group(['prefix' => '/users'], function () { Route::group(['prefix' => '/users'], function () {
Route::get('/', 'Servers\SubuserController@index'); Route::get('/', [Client\Servers\SubuserController::class, 'index']);
Route::post('/', 'Servers\SubuserController@store'); Route::post('/', [Client\Servers\SubuserController::class, 'store']);
Route::get('/{user}', 'Servers\SubuserController@view'); Route::get('/{user}', [Client\Servers\SubuserController::class, 'view']);
Route::post('/{user}', 'Servers\SubuserController@update'); Route::post('/{user}', [Client\Servers\SubuserController::class, 'update']);
Route::delete('/{user}', 'Servers\SubuserController@delete'); Route::delete('/{user}', [Client\Servers\SubuserController::class, 'delete']);
}); });
Route::group(['prefix' => '/backups'], function () { Route::group(['prefix' => '/backups'], function () {
Route::get('/', 'Servers\BackupController@index'); Route::get('/', [Client\Servers\BackupController::class, 'index']);
Route::post('/', 'Servers\BackupController@store'); Route::post('/', [Client\Servers\BackupController::class, 'store']);
Route::get('/{backup}', 'Servers\BackupController@view'); Route::get('/{backup}', [Client\Servers\BackupController::class, 'view']);
Route::get('/{backup}/download', 'Servers\BackupController@download'); Route::get('/{backup}/download', [Client\Servers\BackupController::class, 'download']);
Route::post('/{backup}/lock', 'Servers\BackupController@toggleLock'); Route::post('/{backup}/lock', [Client\Servers\BackupController::class, 'toggleLock']);
Route::post('/{backup}/restore', 'Servers\BackupController@restore'); Route::post('/{backup}/restore', [Client\Servers\BackupController::class, 'restore']);
Route::delete('/{backup}', 'Servers\BackupController@delete'); Route::delete('/{backup}', [Client\Servers\BackupController::class, 'delete']);
}); });
Route::group(['prefix' => '/startup'], function () { Route::group(['prefix' => '/startup'], function () {
Route::get('/', 'Servers\StartupController@index'); Route::get('/', [Client\Servers\StartupController::class, 'index']);
Route::put('/variable', 'Servers\StartupController@update'); Route::put('/variable', [Client\Servers\StartupController::class, 'update']);
}); });
Route::group(['prefix' => '/settings'], function () { Route::group(['prefix' => '/settings'], function () {
Route::post('/rename', 'Servers\SettingsController@rename'); Route::post('/rename', [Client\Servers\SettingsController::class, 'rename']);
Route::post('/reinstall', 'Servers\SettingsController@reinstall'); Route::post('/reinstall', [Client\Servers\SettingsController::class, 'reinstall']);
Route::put('/docker-image', 'Servers\SettingsController@dockerImage'); Route::put('/docker-image', [Client\Servers\SettingsController::class, 'dockerImage']);
}); });
}); });

View file

@ -1,25 +1,26 @@
<?php <?php
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use Pterodactyl\Http\Controllers\Api\Remote;
// Routes for the Wings daemon. // Routes for the Wings daemon.
Route::post('/sftp/auth', 'SftpAuthenticationController'); Route::post('/sftp/auth', Remote\SftpAuthenticationController::class);
Route::get('/servers', 'Servers\ServerDetailsController@list'); Route::get('/servers', [Remote\Servers\ServerDetailsController::class, 'list']);
Route::post('/servers/reset', 'Servers\ServerDetailsController@resetState'); Route::post('/servers/reset', [Remote\Servers\ServerDetailsController::class, 'resetState']);
Route::group(['prefix' => '/servers/{uuid}'], function () { Route::group(['prefix' => '/servers/{uuid}'], function () {
Route::get('/', 'Servers\ServerDetailsController'); Route::get('/', Remote\Servers\ServerDetailsController::class);
Route::get('/install', 'Servers\ServerInstallController@index'); Route::get('/install', [Remote\Servers\ServerInstallController::class, 'index']);
Route::post('/install', 'Servers\ServerInstallController@store'); Route::post('/install', [Remote\Servers\ServerInstallController::class, 'store']);
Route::post('/archive', 'Servers\ServerTransferController@archive'); Route::post('/archive', [Remote\Servers\ServerTransferController::class, 'archive']);
Route::get('/transfer/failure', 'Servers\ServerTransferController@failure'); Route::get('/transfer/failure', [Remote\Servers\ServerTransferController::class, 'failure']);
Route::get('/transfer/success', 'Servers\ServerTransferController@success'); Route::get('/transfer/success', [Remote\Servers\ServerTransferController::class, 'success']);
}); });
Route::group(['prefix' => '/backups'], function () { Route::group(['prefix' => '/backups'], function () {
Route::get('/{backup}', 'Backups\BackupRemoteUploadController'); Route::get('/{backup}', Remote\Backups\BackupRemoteUploadController::class);
Route::post('/{backup}', 'Backups\BackupStatusController@index'); Route::post('/{backup}', [Remote\Backups\BackupStatusController::class, 'index']);
Route::post('/{backup}/restore', 'Backups\BackupStatusController@restore'); Route::post('/{backup}/restore', [Remote\Backups\BackupStatusController::class, 'restore']);
}); });

View file

@ -1,5 +1,7 @@
<?php <?php
use Pterodactyl\Http\Controllers\Auth;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Authentication Routes | Authentication Routes
@ -8,44 +10,40 @@
| Endpoint: /auth | Endpoint: /auth
| |
*/ */
Route::group(['middleware' => 'guest'], function () {
// These routes are defined so that we can continue to reference them programatically.
// They all route to the same controller function which passes off to Vuejs.
Route::get('/login', 'LoginController@index')->name('auth.login');
Route::get('/password', 'LoginController@index')->name('auth.forgot-password');
Route::get('/password/reset/{token}', 'LoginController@index')->name('auth.reset');
// Apply a throttle to authentication action endpoints, in addition to the // These routes are defined so that we can continue to reference them programatically.
// recaptcha endpoints to slow down manual attack spammers even more. 🤷‍ // They all route to the same controller function which passes off to React.
// Route::get('/login', [Auth\LoginController::class, 'index'])->name('auth.login');
// @see \Pterodactyl\Providers\RouteServiceProvider Route::get('/password', [Auth\LoginController::class, 'index'])->name('auth.forgot-password');
Route::middleware(['throttle:authentication'])->group(function () { Route::get('/password/reset/{token}', [Auth\LoginController::class, 'index'])->name('auth.reset');
// Login endpoints.
Route::post('/login', 'LoginController@login')->middleware('recaptcha');
Route::post('/login/checkpoint', 'LoginCheckpointController')->name('auth.login-checkpoint');
// Forgot password route. A post to this endpoint will trigger an // Apply a throttle to authentication action endpoints, in addition to the
// email to be sent containing a reset token. // recaptcha endpoints to slow down manual attack spammers even more. 🤷‍
Route::post('/password', 'ForgotPasswordController@sendResetLinkEmail') //
->name('auth.post.forgot-password') // @see \Pterodactyl\Providers\RouteServiceProvider
->middleware('recaptcha'); Route::middleware(['throttle:authentication'])->group(function () {
}); // Login endpoints.
Route::post('/login', [Auth\LoginController::class, 'login'])->middleware('recaptcha');
Route::post('/login/checkpoint', Auth\LoginCheckpointController::class)->name('auth.login-checkpoint');
// Password reset routes. This endpoint is hit after going through // Forgot password route. A post to this endpoint will trigger an
// the forgot password routes to acquire a token (or after an account // email to be sent containing a reset token.
// is created). Route::post('/password', [Auth\ForgotPasswordController::class, 'sendResetLinkEmail'])
Route::post('/password/reset', 'ResetPasswordController')->name('auth.reset-password'); ->name('auth.post.forgot-password')
->middleware('recaptcha');
// Catch any other combinations of routes and pass them off to the Vuejs component.
Route::fallback('LoginController@index');
}); });
/* // Password reset routes. This endpoint is hit after going through
|-------------------------------------------------------------------------- // the forgot password routes to acquire a token (or after an account
| Routes Accessible only when logged in // is created).
|-------------------------------------------------------------------------- Route::post('/password/reset', Auth\ResetPasswordController::class)->name('auth.reset-password');
|
| Endpoint: /auth // Remove the guest middleware and apply the authenticated middleware to this endpoint
| // so it cannot be used unless you're already logged in.
*/ Route::post('/logout', [Auth\LoginController::class, 'logout'])
Route::post('/logout', 'LoginController@logout')->name('auth.logout')->middleware('auth', 'csrf'); ->withoutMiddleware('guest')
->middleware('auth')
->name('auth.logout');
// Catch any other combinations of routes and pass them off to the Vuejs component.
Route::fallback([Auth\LoginController::class, 'index']);

View file

@ -1,15 +1,16 @@
<?php <?php
use Pterodactyl\Http\Controllers\Base;
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication; use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
Route::get('/', 'IndexController@index')->name('index')->fallback(); Route::get('/', [Base\IndexController::class, 'index'])->name('index')->fallback();
Route::get('/account', 'IndexController@index') Route::get('/account', [Base\IndexController::class, 'index'])
->withoutMiddleware(RequireTwoFactorAuthentication::class) ->withoutMiddleware(RequireTwoFactorAuthentication::class)
->name('account'); ->name('account');
Route::get('/locales/{locale}/{namespace}.json', 'LocaleController') Route::get('/locales/{locale}/{namespace}.json', Base\LocaleController::class)
->withoutMiddleware(RequireTwoFactorAuthentication::class) ->withoutMiddleware(['auth', RequireTwoFactorAuthentication::class])
->where('namespace', '.*'); ->where('namespace', '.*');
Route::get('/{react}', 'IndexController@index') Route::get('/{react}', [Base\IndexController::class, 'index'])
->where('react', '^(?!(\/)?(api|auth|admin|daemon)).+'); ->where('react', '^(?!(\/)?(api|auth|admin|daemon)).+');

View file

@ -1,10 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
Route::get('/')->name('server.index');
Route::get('/console')->name('server.console');