Path: blob/1.0-develop/app/Http/Middleware/EnsureStatefulRequests.php
10276 views
<?php12namespace Pterodactyl\Http\Middleware;34use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful;56class EnsureStatefulRequests extends EnsureFrontendRequestsAreStateful7{8/**9* Determines if a request is stateful or not. This is determined using the default10* Sanctum "fromFrontend" helper method. However, we also check if the request includes11* a cookie value for the Pterodactyl session. If so, we assume this is a stateful12* request.13*14* We don't want to support API usage using the cookies, except for requests stemming15* from the front-end we control.16*/17public static function fromFrontend($request)18{19if (parent::fromFrontend($request)) {20return true;21}2223return $request->hasCookie(config('session.cookie'));24}25}262728