Switch to more recent Laravel route definition methods
This commit is contained in:
parent
62b178ed02
commit
65f27d41a2
9 changed files with 278 additions and 308 deletions
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace Pterodactyl\Http;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies;
|
||||
use Pterodactyl\Models\ApiKey;
|
||||
use Illuminate\Auth\Middleware\Authorize;
|
||||
use Illuminate\Http\Middleware\TrustProxies;
|
||||
use Illuminate\Auth\Middleware\Authenticate;
|
||||
use Pterodactyl\Http\Middleware\TrimStrings;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
|
@ -72,21 +72,18 @@ class Kernel extends HttpKernel
|
|||
IsValidJson::class,
|
||||
StartSession::class,
|
||||
AuthenticateSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
],
|
||||
'application-api' => [
|
||||
ApiSubstituteBindings::class,
|
||||
'api..key:' . ApiKey::TYPE_APPLICATION,
|
||||
AuthenticateApplicationUser::class,
|
||||
VerifyCsrfToken::class,
|
||||
AuthenticateIPAccess::class,
|
||||
],
|
||||
'client-api' => [
|
||||
HandleStatelessRequest::class,
|
||||
IsValidJson::class,
|
||||
StartSession::class,
|
||||
AuthenticateSession::class,
|
||||
SubstituteClientApiBindings::class,
|
||||
'api..key:' . ApiKey::TYPE_ACCOUNT,
|
||||
AuthenticateIPAccess::class,
|
||||
VerifyCsrfToken::class,
|
||||
// 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
|
||||
// end it makes sense.
|
||||
|
|
|
@ -10,15 +10,6 @@ use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvi
|
|||
|
||||
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.
|
||||
*/
|
||||
|
@ -27,35 +18,23 @@ class RouteServiceProvider extends ServiceProvider
|
|||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
Route::middleware(['web', 'auth', 'csrf'])
|
||||
->namespace("$this->namespace\\Base")
|
||||
->group(base_path('routes/base.php'));
|
||||
Route::middleware(['web', 'csrf'])->group(function () {
|
||||
Route::middleware('auth')->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')
|
||||
->namespace("$this->namespace\\Admin")
|
||||
->group(base_path('routes/admin.php'));
|
||||
Route::middleware('api')->group(function () {
|
||||
Route::middleware(['application-api', 'throttle:api.application'])
|
||||
->prefix('/api/application')
|
||||
->group(base_path('routes/api-application.php'));
|
||||
|
||||
Route::middleware(['web', 'csrf'])->prefix('/auth')
|
||||
->namespace("$this->namespace\\Auth")
|
||||
->group(base_path('routes/auth.php'));
|
||||
Route::middleware(['client-api', 'throttle:api.client'])
|
||||
->prefix('/api/client')
|
||||
->group(base_path('routes/api-client.php'));
|
||||
});
|
||||
|
||||
Route::middleware(['web', 'csrf', 'auth', 'server', 'node.maintenance'])
|
||||
->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")
|
||||
Route::middleware('daemon')->prefix('/api/remote')
|
||||
->group(base_path('routes/api-remote.php'));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue