Apply php-cs-fixer changes

This commit is contained in:
Dane Everitt 2021-08-07 16:10:24 -07:00
parent cec96062e3
commit 436e686037
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
72 changed files with 91 additions and 196 deletions

View File

@ -7,8 +7,8 @@ use Throwable;
use PDOException; use PDOException;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Swift_TransportException;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Swift_TransportException;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Container\Container; use Illuminate\Container\Container;

View File

@ -33,7 +33,7 @@ class Fractal extends SpatieFractal
// If the resource name is not set attempt to pull it off the transformer // If the resource name is not set attempt to pull it off the transformer
// itself and set it automatically. // itself and set it automatically.
$class = is_string($this->transformer) ? new $this->transformer : $this->transformer; $class = is_string($this->transformer) ? new $this->transformer() : $this->transformer;
if (is_null($this->resourceName) && $class instanceof Transformer) { if (is_null($this->resourceName) && $class instanceof Transformer) {
$this->resourceName = $class->getResourceName(); $this->resourceName = $class->getResourceName();
} }

View File

@ -9,8 +9,6 @@ class BaseController extends Controller
{ {
/** /**
* Return the admin index view. * Return the admin index view.
*
* @return \Illuminate\View\View
*/ */
public function index(): View public function index(): View
{ {

View File

@ -2,8 +2,8 @@
namespace Pterodactyl\Http\Controllers\Api\Application\Mounts; namespace Pterodactyl\Http\Controllers\Api\Application\Mounts;
use Pterodactyl\Models\Mount;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Pterodactyl\Models\Mount;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Spatie\QueryBuilder\QueryBuilder; use Spatie\QueryBuilder\QueryBuilder;
use Pterodactyl\Transformers\Api\Application\MountTransformer; use Pterodactyl\Transformers\Api\Application\MountTransformer;

View File

@ -6,8 +6,8 @@ use Illuminate\Http\Response;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Pterodactyl\Models\AdminRole; use Pterodactyl\Models\AdminRole;
use Spatie\QueryBuilder\QueryBuilder; use Spatie\QueryBuilder\QueryBuilder;
use Pterodactyl\Transformers\Api\Application\AdminRoleTransformer;
use Pterodactyl\Exceptions\Http\QueryValueOutOfRangeHttpException; use Pterodactyl\Exceptions\Http\QueryValueOutOfRangeHttpException;
use Pterodactyl\Transformers\Api\Application\AdminRoleTransformer;
use Pterodactyl\Http\Requests\Api\Application\Roles\GetRoleRequest; use Pterodactyl\Http\Requests\Api\Application\Roles\GetRoleRequest;
use Pterodactyl\Http\Requests\Api\Application\Roles\GetRolesRequest; use Pterodactyl\Http\Requests\Api\Application\Roles\GetRolesRequest;
use Pterodactyl\Http\Requests\Api\Application\Roles\StoreRoleRequest; use Pterodactyl\Http\Requests\Api\Application\Roles\StoreRoleRequest;

View File

@ -4,7 +4,6 @@ namespace Pterodactyl\Http\Controllers\Api\Client;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
use Pterodactyl\Http\Requests\Api\Client\AccountApiRequest; use Pterodactyl\Http\Requests\Api\Client\AccountApiRequest;
use Pterodactyl\Http\Requests\Api\Client\Account\StoreApiKeyRequest; use Pterodactyl\Http\Requests\Api\Client\Account\StoreApiKeyRequest;
use Pterodactyl\Transformers\Api\Client\PersonalAccessTokenTransformer; use Pterodactyl\Transformers\Api\Client\PersonalAccessTokenTransformer;

View File

@ -26,7 +26,6 @@ class SSHKeyController extends ClientApiController
/** /**
* ? * ?
* *
* @return JsonResponse
* @throws \Illuminate\Contracts\Container\BindingResolutionException * @throws \Illuminate\Contracts\Container\BindingResolutionException
* @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException
*/ */

View File

@ -12,8 +12,8 @@ use Pterodactyl\Models\Permission;
use Illuminate\Auth\Access\AuthorizationException; use Illuminate\Auth\Access\AuthorizationException;
use Pterodactyl\Services\Backups\DeleteBackupService; use Pterodactyl\Services\Backups\DeleteBackupService;
use Pterodactyl\Services\Backups\DownloadLinkService; use Pterodactyl\Services\Backups\DownloadLinkService;
use Pterodactyl\Services\Backups\InitiateBackupService;
use Pterodactyl\Repositories\Eloquent\BackupRepository; use Pterodactyl\Repositories\Eloquent\BackupRepository;
use Pterodactyl\Services\Backups\InitiateBackupService;
use Pterodactyl\Repositories\Wings\DaemonBackupRepository; use Pterodactyl\Repositories\Wings\DaemonBackupRepository;
use Pterodactyl\Transformers\Api\Client\BackupTransformer; use Pterodactyl\Transformers\Api\Client\BackupTransformer;
use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController;

View File

@ -14,7 +14,6 @@ use Pterodactyl\Repositories\Eloquent\ScheduleRepository;
use Pterodactyl\Services\Schedules\ProcessScheduleService; use Pterodactyl\Services\Schedules\ProcessScheduleService;
use Pterodactyl\Transformers\Api\Client\ScheduleTransformer; use Pterodactyl\Transformers\Api\Client\ScheduleTransformer;
use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\ViewScheduleRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\ViewScheduleRequest;
use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreScheduleRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreScheduleRequest;

View File

@ -13,8 +13,8 @@ use Pterodactyl\Http\Controllers\Api\Client\ClientApiController;
use Pterodactyl\Exceptions\Service\ServiceLimitExceededException; use Pterodactyl\Exceptions\Service\ServiceLimitExceededException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreTaskRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreTaskRequest;
use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\UpdateScheduleRequest;
use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\DeleteScheduleRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\DeleteScheduleRequest;
use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\UpdateScheduleRequest;
class ScheduleTaskController extends ClientApiController class ScheduleTaskController extends ClientApiController
{ {

View File

@ -5,10 +5,8 @@ namespace Pterodactyl\Http\Controllers\Api\Client\Servers;
use Carbon\CarbonImmutable; use Carbon\CarbonImmutable;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Pterodactyl\Models\Permission;
use Pterodactyl\Services\Nodes\NodeJWTService; use Pterodactyl\Services\Nodes\NodeJWTService;
use Pterodactyl\Exceptions\Http\HttpForbiddenException; use Pterodactyl\Exceptions\Http\HttpForbiddenException;
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
use Pterodactyl\Services\Servers\GetUserPermissionsService; use Pterodactyl\Services\Servers\GetUserPermissionsService;
use Pterodactyl\Http\Requests\Api\Client\WebsocketTokenRequest; use Pterodactyl\Http\Requests\Api\Client\WebsocketTokenRequest;
use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController;

View File

@ -55,8 +55,6 @@ class TwoFactorController extends ClientApiController
/** /**
* Updates a user's account to have two-factor enabled. * Updates a user's account to have two-factor enabled.
* *
* @return \Illuminate\Http\JsonResponse
*
* @throws \Throwable * @throws \Throwable
* @throws \Illuminate\Validation\ValidationException * @throws \Illuminate\Validation\ValidationException
* @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException

View File

@ -5,8 +5,8 @@ namespace Pterodactyl\Http\Controllers\Api\Client;
use Exception; use Exception;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use LaravelWebauthn\Facades\Webauthn;
use Pterodactyl\Models\WebauthnKey; use Pterodactyl\Models\WebauthnKey;
use LaravelWebauthn\Facades\Webauthn;
use Webauthn\PublicKeyCredentialCreationOptions; use Webauthn\PublicKeyCredentialCreationOptions;
use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Database\Eloquent\ModelNotFoundException;
use Pterodactyl\Transformers\Api\Client\WebauthnKeyTransformer; use Pterodactyl\Transformers\Api\Client\WebauthnKeyTransformer;

View File

@ -17,7 +17,6 @@ class LoginCheckpointController extends AbstractLoginController
private Encrypter $encrypter; private Encrypter $encrypter;
private Google2FA $google2FA; private Google2FA $google2FA;
/** /**
* LoginCheckpointController constructor. * LoginCheckpointController constructor.
*/ */
@ -51,6 +50,7 @@ class LoginCheckpointController extends AbstractLoginController
{ {
if ($this->hasTooManyLoginAttempts($request)) { if ($this->hasTooManyLoginAttempts($request)) {
$this->sendLockoutResponse($request); $this->sendLockoutResponse($request);
return; return;
} }
@ -66,6 +66,7 @@ class LoginCheckpointController extends AbstractLoginController
null, null,
'The authentication token provided has expired, please refresh the page and try again.' 'The authentication token provided has expired, please refresh the page and try again.'
); );
return; return;
} }

View File

@ -69,6 +69,7 @@ class LoginController extends AbstractLoginController
if ($this->hasTooManyLoginAttempts($request)) { if ($this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request); $this->fireLockoutEvent($request);
$this->sendLockoutResponse($request); $this->sendLockoutResponse($request);
return; return;
} }
@ -77,6 +78,7 @@ class LoginController extends AbstractLoginController
$user = $this->repository->findFirstWhere([[$useColumn, '=', $username]]); $user = $this->repository->findFirstWhere([[$useColumn, '=', $username]]);
} catch (RecordNotFoundException $exception) { } catch (RecordNotFoundException $exception) {
$this->sendFailedLoginResponse($request); $this->sendFailedLoginResponse($request);
return; return;
} }
@ -86,12 +88,13 @@ class LoginController extends AbstractLoginController
// can proceed to the next step in the login process. // can proceed to the next step in the login process.
if (!password_verify($request->input('password'), $user->password)) { if (!password_verify($request->input('password'), $user->password)) {
$this->sendFailedLoginResponse($request, $user); $this->sendFailedLoginResponse($request, $user);
return; return;
} }
$webauthnKeys = $user->webauthnKeys()->get(); $webauthnKeys = $user->webauthnKeys()->get();
if (sizeof($webauthnKeys) > 0) { if (count($webauthnKeys) > 0) {
$token = Str::random(64); $token = Str::random(64);
$this->cache->put($token, $user->id, CarbonImmutable::now()->addMinutes(5)); $this->cache->put($token, $user->id, CarbonImmutable::now()->addMinutes(5));
@ -99,7 +102,7 @@ class LoginController extends AbstractLoginController
$request->session()->put(self::SESSION_PUBLICKEY_REQUEST, $publicKey); $request->session()->put(self::SESSION_PUBLICKEY_REQUEST, $publicKey);
$request->session()->save(); $request->session()->save();
$methods = [ self::METHOD_WEBAUTHN ]; $methods = [self::METHOD_WEBAUTHN];
if ($user->use_totp) { if ($user->use_totp) {
$methods[] = self::METHOD_TOTP; $methods[] = self::METHOD_TOTP;
} }
@ -112,13 +115,13 @@ class LoginController extends AbstractLoginController
'public_key' => $publicKey, 'public_key' => $publicKey,
], ],
]); ]);
} else if ($user->use_totp) { } elseif ($user->use_totp) {
$token = Str::random(64); $token = Str::random(64);
$this->cache->put($token, $user->id, CarbonImmutable::now()->addMinutes(5)); $this->cache->put($token, $user->id, CarbonImmutable::now()->addMinutes(5));
return new JsonResponse([ return new JsonResponse([
'complete' => false, 'complete' => false,
'methods' => [ self::METHOD_TOTP ], 'methods' => [self::METHOD_TOTP],
'confirmation_token' => $token, 'confirmation_token' => $token,
]); ]);
} }

View File

@ -3,8 +3,8 @@
namespace Pterodactyl\Http\Controllers\Auth; namespace Pterodactyl\Http\Controllers\Auth;
use Exception; use Exception;
use Pterodactyl\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\User;
use Illuminate\Auth\AuthManager; use Illuminate\Auth\AuthManager;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use LaravelWebauthn\Facades\Webauthn; use LaravelWebauthn\Facades\Webauthn;
@ -36,6 +36,7 @@ class WebauthnController extends AbstractLoginController
{ {
if ($this->hasTooManyLoginAttempts($request)) { if ($this->hasTooManyLoginAttempts($request)) {
$this->sendLockoutResponse($request); $this->sendLockoutResponse($request);
return; return;
} }
@ -51,6 +52,7 @@ class WebauthnController extends AbstractLoginController
null, null,
'The authentication token provided has expired, please refresh the page and try again.' 'The authentication token provided has expired, please refresh the page and try again.'
); );
return; return;
} }
$this->auth->guard()->onceUsingId($user->id); $this->auth->guard()->onceUsingId($user->id);

View File

@ -20,8 +20,6 @@ class SubstituteApplicationApiBindings
/** /**
* Mappings to automatically assign route parameters to a model. * Mappings to automatically assign route parameters to a model.
*
* @var array
*/ */
protected static array $mappings = [ protected static array $mappings = [
'allocation' => Allocation::class, 'allocation' => Allocation::class,

View File

@ -26,7 +26,7 @@ class SubstituteClientApiBindings
* Perform substitution of route parameters for the Client API. * Perform substitution of route parameters for the Client API.
* *
* @param \Illuminate\Http\Request * @param \Illuminate\Http\Request
* @param \Closure $next *
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
@ -73,7 +73,7 @@ class SubstituteClientApiBindings
}); });
try { try {
/** @var \Illuminate\Routing\Route $route */ /* @var \Illuminate\Routing\Route $route */
$this->router->substituteBindings($route = $request->route()); $this->router->substituteBindings($route = $request->route());
} catch (ModelNotFoundException $exception) { } catch (ModelNotFoundException $exception) {
if (isset($route) && $route->getMissing()) { if (isset($route) && $route->getMissing()) {

View File

@ -17,7 +17,7 @@ class PreventUnboundModels
* added but not properly defined in the substitution middleware. * added but not properly defined in the substitution middleware.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next *
* @return mixed * @return mixed
* *
* @throws \Exception * @throws \Exception
@ -36,9 +36,7 @@ class PreventUnboundModels
} }
if (!$parameters[$signature->getName()] instanceof Model) { if (!$parameters[$signature->getName()] instanceof Model) {
throw new Exception( throw new Exception(sprintf('No parameter binding has been defined for model [%s] using route parameter key "%s".', $class, $signature->getName()));
sprintf('No parameter binding has been defined for model [%s] using route parameter key "%s".', $class, $signature->getName())
);
} }
} }

View File

@ -3,7 +3,6 @@
namespace Pterodactyl\Http\Requests\Api; namespace Pterodactyl\Http\Requests\Api;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Auth\Access\AuthorizationException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/** /**

View File

@ -9,8 +9,6 @@ abstract class ApplicationApiRequest extends ApiRequest
/** /**
* This will eventually be replaced with per-request permissions checking * This will eventually be replaced with per-request permissions checking
* on the API key and for the user. * on the API key and for the user.
*
* @return bool
*/ */
public function authorize(): bool public function authorize(): bool
{ {

View File

@ -26,7 +26,7 @@ class SftpAuthenticationFormRequest extends FormRequest
return [ return [
'username' => 'required|string', 'username' => 'required|string',
'password' => 'required|string', 'password' => 'required|string',
'type' => 'required|in:password,publicKey' 'type' => 'required|in:password,publicKey',
]; ];
} }

View File

@ -45,9 +45,6 @@ class AdminRole extends Model
'permissions' => 'array', 'permissions' => 'array',
]; ];
/**
* @var array
*/
public static array $validationRules = [ public static array $validationRules = [
'name' => 'required|string|max:64', 'name' => 'required|string|max:64',
'description' => 'nullable|string|max:255', 'description' => 'nullable|string|max:255',

View File

@ -50,9 +50,6 @@ class Allocation extends Model
'server_id' => 'integer', 'server_id' => 'integer',
]; ];
/**
* @var array
*/
public static array $validationRules = [ public static array $validationRules = [
'node_id' => 'required|exists:nodes,id', 'node_id' => 'required|exists:nodes,id',
'ip' => 'required|ip', 'ip' => 'required|ip',

View File

@ -61,9 +61,6 @@ class AuditLog extends Model
*/ */
protected $table = 'audit_logs'; protected $table = 'audit_logs';
/**
* @var bool
*/
protected bool $immutableDates = true; protected bool $immutableDates = true;
/** /**

View File

@ -37,9 +37,6 @@ class Backup extends Model
*/ */
protected $table = 'backups'; protected $table = 'backups';
/**
* @var bool
*/
protected bool $immutableDates = true; protected bool $immutableDates = true;
/** /**
@ -76,9 +73,6 @@ class Backup extends Model
*/ */
protected $guarded = ['id', 'created_at', 'updated_at', 'deleted_at']; protected $guarded = ['id', 'created_at', 'updated_at', 'deleted_at'];
/**
* @var array
*/
public static array $validationRules = [ public static array $validationRules = [
'server_id' => 'bail|required|numeric|exists:servers,id', 'server_id' => 'bail|required|numeric|exists:servers,id',
'uuid' => 'required|uuid', 'uuid' => 'required|uuid',

View File

@ -58,9 +58,6 @@ class Database extends Model
'max_connections' => 'integer', 'max_connections' => 'integer',
]; ];
/**
* @var array
*/
public static array $validationRules = [ public static array $validationRules = [
'server_id' => 'required|numeric|exists:servers,id', 'server_id' => 'required|numeric|exists:servers,id',
'database_host_id' => 'required|exists:database_hosts,id', 'database_host_id' => 'required|exists:database_hosts,id',

View File

@ -21,9 +21,6 @@ class DatabaseHost extends Model
*/ */
public const RESOURCE_NAME = 'database_host'; public const RESOURCE_NAME = 'database_host';
/**
* @var bool
*/
protected bool $immutableDates = true; protected bool $immutableDates = true;
/** /**
@ -61,8 +58,6 @@ class DatabaseHost extends Model
/** /**
* Validation rules to assign to this model. * Validation rules to assign to this model.
*
* @var array
*/ */
public static array $validationRules = [ public static array $validationRules = [
'name' => 'required|string|max:191', 'name' => 'required|string|max:191',

View File

@ -108,9 +108,6 @@ class Egg extends Model
'file_denylist' => 'array', 'file_denylist' => 'array',
]; ];
/**
* @var array
*/
public static array $validationRules = [ public static array $validationRules = [
'nest_id' => 'required|bail|numeric|exists:nests,id', 'nest_id' => 'required|bail|numeric|exists:nests,id',
'uuid' => 'required|string|size:36', 'uuid' => 'required|string|size:36',

View File

@ -37,9 +37,6 @@ class EggVariable extends Model
*/ */
public const RESERVED_ENV_NAMES = 'SERVER_MEMORY,SERVER_IP,SERVER_PORT,ENV,HOME,USER,STARTUP,SERVER_UUID,UUID'; public const RESERVED_ENV_NAMES = 'SERVER_MEMORY,SERVER_IP,SERVER_PORT,ENV,HOME,USER,STARTUP,SERVER_UUID,UUID';
/**
* @var bool
*/
protected bool $immutableDates = true; protected bool $immutableDates = true;
/** /**
@ -67,9 +64,6 @@ class EggVariable extends Model
'user_editable' => 'bool', 'user_editable' => 'bool',
]; ];
/**
* @var array
*/
public static array $validationRules = [ public static array $validationRules = [
'egg_id' => 'exists:eggs,id', 'egg_id' => 'exists:eggs,id',
'name' => 'required|string|between:1,191', 'name' => 'required|string|between:1,191',

View File

@ -35,8 +35,6 @@ class Location extends Model
/** /**
* Rules ensuring that the raw data stored in the database meets expectations. * Rules ensuring that the raw data stored in the database meets expectations.
*
* @var array
*/ */
public static array $validationRules = [ public static array $validationRules = [
'short' => 'required|string|between:1,60|unique:locations,short', 'short' => 'required|string|between:1,60|unique:locations,short',

View File

@ -17,8 +17,6 @@ abstract class Model extends IlluminateModel
/** /**
* Set to true to return immutable Carbon date instances from the model. * Set to true to return immutable Carbon date instances from the model.
*
* @var bool
*/ */
protected bool $immutableDates = false; protected bool $immutableDates = false;
@ -42,9 +40,6 @@ abstract class Model extends IlluminateModel
*/ */
protected static $validatorFactory; protected static $validatorFactory;
/**
* @var array
*/
public static array $validationRules = []; public static array $validationRules = [];
/** /**
@ -82,8 +77,6 @@ abstract class Model extends IlluminateModel
/** /**
* Returns the validator instance used by this model. * Returns the validator instance used by this model.
*
* @return \Illuminate\Validation\Validator
*/ */
public function getValidator(): Validator public function getValidator(): Validator
{ {

View File

@ -152,6 +152,7 @@ class Node extends Model
* Returns the configuration as an array. * Returns the configuration as an array.
* *
* @return array * @return array
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException * @throws \Illuminate\Contracts\Container\BindingResolutionException
*/ */
public function getConfiguration() public function getConfiguration()
@ -186,6 +187,7 @@ class Node extends Model
* Returns the configuration in Yaml format. * Returns the configuration in Yaml format.
* *
* @return string * @return string
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException * @throws \Illuminate\Contracts\Container\BindingResolutionException
*/ */
public function getYamlConfiguration() public function getYamlConfiguration()
@ -197,6 +199,7 @@ class Node extends Model
* Returns the configuration in JSON format. * Returns the configuration in JSON format.
* *
* @return string * @return string
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException * @throws \Illuminate\Contracts\Container\BindingResolutionException
*/ */
public function getJsonConfiguration(bool $pretty = false) public function getJsonConfiguration(bool $pretty = false)

View File

@ -93,9 +93,6 @@ class Permission extends Model
'subuser_id' => 'integer', 'subuser_id' => 'integer',
]; ];
/**
* @var array
*/
public static array $validationRules = [ public static array $validationRules = [
'subuser_id' => 'required|numeric|min:1', 'subuser_id' => 'required|numeric|min:1',
'permission' => 'required|string', 'permission' => 'required|string',

View File

@ -36,9 +36,6 @@ class PersonalAccessToken extends Model implements HasAbilities
'abilities', 'abilities',
]; ];
/**
* @var array
*/
public static array $validationRules = [ public static array $validationRules = [
'token' => 'required|string', 'token' => 'required|string',
'token_id' => 'required|string|size:16', 'token_id' => 'required|string|size:16',
@ -58,6 +55,7 @@ class PersonalAccessToken extends Model implements HasAbilities
* Required for support with Laravel Sanctum. * Required for support with Laravel Sanctum.
* *
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*
* @see \Laravel\Sanctum\Guard::supportsTokens() * @see \Laravel\Sanctum\Guard::supportsTokens()
*/ */
public function tokenable() public function tokenable()
@ -69,6 +67,7 @@ class PersonalAccessToken extends Model implements HasAbilities
* Determine if the token has a given ability. * Determine if the token has a given ability.
* *
* @param string $ability * @param string $ability
*
* @return bool * @return bool
*/ */
public function can($ability) public function can($ability)
@ -81,6 +80,7 @@ class PersonalAccessToken extends Model implements HasAbilities
* Determine if the token is missing a given ability. * Determine if the token is missing a given ability.
* *
* @param string $ability * @param string $ability
*
* @return bool * @return bool
*/ */
public function cant($ability) public function cant($ability)
@ -92,6 +92,7 @@ class PersonalAccessToken extends Model implements HasAbilities
* Find the token instance matching the given token. * Find the token instance matching the given token.
* *
* @param string $token * @param string $token
*
* @return \Pterodactyl\Models\PersonalAccessToken|null * @return \Pterodactyl\Models\PersonalAccessToken|null
*/ */
public static function findToken($token) public static function findToken($token)
@ -108,8 +109,6 @@ class PersonalAccessToken extends Model implements HasAbilities
/** /**
* Generates a new identifier for a personal access token. * Generates a new identifier for a personal access token.
*
* @return string
*/ */
public static function generateTokenIdentifier(): string public static function generateTokenIdentifier(): string
{ {

View File

@ -58,9 +58,6 @@ class ServerTransfer extends Model
'archived' => 'bool', 'archived' => 'bool',
]; ];
/**
* @var array
*/
public static array $validationRules = [ public static array $validationRules = [
'server_id' => 'required|numeric|exists:servers,id', 'server_id' => 'required|numeric|exists:servers,id',
'old_node' => 'required|numeric', 'old_node' => 'required|numeric',

View File

@ -21,9 +21,6 @@ class Setting extends Model
*/ */
protected $fillable = ['key', 'value']; protected $fillable = ['key', 'value'];
/**
* @var array
*/
public static array $validationRules = [ public static array $validationRules = [
'key' => 'required|string|between:1,191', 'key' => 'required|string|between:1,191',
'value' => 'string', 'value' => 'string',

View File

@ -39,9 +39,6 @@ class Subuser extends Model
'permissions' => 'array', 'permissions' => 'array',
]; ];
/**
* @var array
*/
public static array $validationRules = [ public static array $validationRules = [
'user_id' => 'required|numeric|exists:users,id', 'user_id' => 'required|numeric|exists:users,id',
'server_id' => 'required|numeric|exists:servers,id', 'server_id' => 'required|numeric|exists:servers,id',

View File

@ -92,9 +92,6 @@ class Task extends Model
'continue_on_failure' => false, 'continue_on_failure' => false,
]; ];
/**
* @var array
*/
public static array $validationRules = [ public static array $validationRules = [
'schedule_id' => 'required|numeric|exists:schedules,id', 'schedule_id' => 'required|numeric|exists:schedules,id',
'sequence_id' => 'required|numeric|min:1', 'sequence_id' => 'required|numeric|min:1',

View File

@ -9,10 +9,10 @@ use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Pterodactyl\Models\Traits\HasAccessTokens; use Pterodactyl\Models\Traits\HasAccessTokens;
use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Auth\Passwords\CanResetPassword;
use Pterodactyl\Traits\Helpers\AvailableLanguages;
use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Foundation\Auth\Access\Authorizable; use Pterodactyl\Traits\Helpers\AvailableLanguages;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
@ -111,8 +111,6 @@ class User extends Model implements
/** /**
* Rules verifying that the data being stored matches the expectations of the database. * Rules verifying that the data being stored matches the expectations of the database.
*
* @var array
*/ */
public static array $validationRules = [ public static array $validationRules = [
'uuid' => 'required|string|size:36|unique:users,uuid', 'uuid' => 'required|string|size:36|unique:users,uuid',
@ -173,8 +171,6 @@ class User extends Model implements
/** /**
* Gets the avatar url for the user. * Gets the avatar url for the user.
*
* @return string
*/ */
public function avatarURL(): string public function avatarURL(): string
{ {
@ -183,10 +179,8 @@ class User extends Model implements
/** /**
* Gets the name of the role assigned to a user. * Gets the name of the role assigned to a user.
*
* @return string|null
*/ */
public function adminRoleName():? string public function adminRoleName(): ?string
{ {
$role = $this->adminRole; $role = $this->adminRole;
if (is_null($role)) { if (is_null($role)) {

View File

@ -20,7 +20,7 @@ class UserSSHKey extends Model
*/ */
public const RESOURCE_NAME = 'user_ssh_key'; public const RESOURCE_NAME = 'user_ssh_key';
const UPDATED_AT = null; public const UPDATED_AT = null;
protected $table = 'user_ssh_keys'; protected $table = 'user_ssh_keys';
protected bool $immutableDates = true; protected bool $immutableDates = true;

View File

@ -2,8 +2,8 @@
namespace Pterodactyl\Providers; namespace Pterodactyl\Providers;
use Pterodactyl\Models\User;
use Laravel\Sanctum\Sanctum; use Laravel\Sanctum\Sanctum;
use Pterodactyl\Models\User;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Pterodactyl\Models\Subuser; use Pterodactyl\Models\Subuser;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
@ -26,7 +26,7 @@ class AppServiceProvider extends ServiceProvider
Server::observe(ServerObserver::class); Server::observe(ServerObserver::class);
Subuser::observe(SubuserObserver::class); Subuser::observe(SubuserObserver::class);
/** /*
* @see https://laravel.com/docs/8.x/sanctum#overriding-default-models * @see https://laravel.com/docs/8.x/sanctum#overriding-default-models
*/ */
Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class); Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);
@ -41,7 +41,7 @@ class AppServiceProvider extends ServiceProvider
// Only load the settings service provider if the environment // Only load the settings service provider if the environment
// is configured to allow it. // is configured to allow it.
if (! config('pterodactyl.load_environment_only', false) && $this->app->environment() !== 'testing') { if (!config('pterodactyl.load_environment_only', false) && $this->app->environment() !== 'testing') {
$this->app->register(SettingsServiceProvider::class); $this->app->register(SettingsServiceProvider::class);
} }
} }

View File

@ -38,8 +38,6 @@ class BackupRepository extends EloquentRepository
/** /**
* Returns a query filtering only non-failed backups for a specific server. * Returns a query filtering only non-failed backups for a specific server.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/ */
public function getNonFailedBackups(Server $server): HasMany public function getNonFailedBackups(Server $server): HasMany
{ {

View File

@ -28,8 +28,6 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa
/** /**
* Return a nest or all nests with their associated eggs and variables. * Return a nest or all nests with their associated eggs and variables.
* *
* @param int|null $id
*
* @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Nest * @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Nest
* *
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException

View File

@ -55,11 +55,7 @@ class InitiateBackupService
/** /**
* InitiateBackupService constructor. * InitiateBackupService constructor.
* *
* @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository
* @param \Illuminate\Database\ConnectionInterface $connection
* @param \Pterodactyl\Repositories\Wings\DaemonBackupRepository $daemonBackupRepository
* @param \Pterodactyl\Services\Backups\DeleteBackupService $deleteBackupService * @param \Pterodactyl\Services\Backups\DeleteBackupService $deleteBackupService
* @param \Pterodactyl\Extensions\Backups\BackupManager $backupManager
*/ */
public function __construct( public function __construct(
BackupRepository $repository, BackupRepository $repository,

View File

@ -43,8 +43,6 @@ class SoftwareVersionService
/** /**
* Gets the current version of the panel that is being used. * Gets the current version of the panel that is being used.
*
* @return string
*/ */
public function getVersion(): string public function getVersion(): string
{ {
@ -53,8 +51,6 @@ class SoftwareVersionService
/** /**
* Get the latest version of the panel from the CDN servers. * Get the latest version of the panel from the CDN servers.
*
* @return string
*/ */
public function getLatestPanel(): string public function getLatestPanel(): string
{ {
@ -63,8 +59,6 @@ class SoftwareVersionService
/** /**
* Get the latest version of wings from the CDN servers. * Get the latest version of wings from the CDN servers.
*
* @return string
*/ */
public function getLatestWings(): string public function getLatestWings(): string
{ {
@ -89,8 +83,6 @@ class SoftwareVersionService
/** /**
* Determine if a passed wings version is the latest. * Determine if a passed wings version is the latest.
* *
* @param string $version
*
* @return bool * @return bool
*/ */
public function isLatestWings(string $version) public function isLatestWings(string $version)
@ -127,8 +119,6 @@ class SoftwareVersionService
/** /**
* Return version information for the footer. * Return version information for the footer.
*
* @return array
*/ */
protected function versionData(): array protected function versionData(): array
{ {
@ -159,8 +149,6 @@ class SoftwareVersionService
/** /**
* ? * ?
*
* @return array
*/ */
public function getVersionData(): array public function getVersionData(): array
{ {

View File

@ -35,8 +35,6 @@ class AllocationTransformer extends Transformer
/** /**
* Load the node relationship onto a given transformation. * Load the node relationship onto a given transformation.
* *
* @param \Pterodactyl\Models\Allocation $allocation
*
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
*/ */
public function includeNode(Allocation $allocation) public function includeNode(Allocation $allocation)
@ -51,8 +49,6 @@ class AllocationTransformer extends Transformer
/** /**
* Load the server relationship onto a given transformation. * Load the server relationship onto a given transformation.
* *
* @param \Pterodactyl\Models\Allocation $allocation
*
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
*/ */
public function includeServer(Allocation $allocation) public function includeServer(Allocation $allocation)

View File

@ -3,7 +3,6 @@
namespace Pterodactyl\Transformers\Api\Application; namespace Pterodactyl\Transformers\Api\Application;
use Pterodactyl\Models\Database; use Pterodactyl\Models\Database;
use Pterodactyl\Models\DatabaseHost;
use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Transformers\Api\Transformer; use Pterodactyl\Transformers\Api\Transformer;
use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Contracts\Encryption\Encrypter;

View File

@ -41,8 +41,6 @@ abstract class Transformer extends TransformerAbstract
/** /**
* Returns the authorized user for the request. * Returns the authorized user for the request.
*
* @return \Pterodactyl\Models\User
*/ */
protected function user(): User protected function user(): User
{ {
@ -62,10 +60,12 @@ abstract class Transformer extends TransformerAbstract
} }
/** /**
* @inheritDoc * {@inheritDoc}
*
* @param mixed $data * @param mixed $data
* @param callable|\League\Fractal\TransformerAbstract $transformer * @param callable|\League\Fractal\TransformerAbstract $transformer
* @param null $resourceKey * @param null $resourceKey
*
* @return \League\Fractal\Resource\Item * @return \League\Fractal\Resource\Item
*/ */
protected function item($data, $transformer, $resourceKey = null) protected function item($data, $transformer, $resourceKey = null)
@ -84,10 +84,12 @@ abstract class Transformer extends TransformerAbstract
} }
/** /**
* @inheritDoc * {@inheritDoc}
*
* @param mixed $data * @param mixed $data
* @param callable|\League\Fractal\TransformerAbstract $transformer * @param callable|\League\Fractal\TransformerAbstract $transformer
* @param null $resourceKey * @param null $resourceKey
*
* @return \League\Fractal\Resource\Collection * @return \League\Fractal\Resource\Collection
*/ */
protected function collection($data, $transformer, $resourceKey = null) protected function collection($data, $transformer, $resourceKey = null)
@ -138,7 +140,7 @@ abstract class Transformer extends TransformerAbstract
* *
* If no time is provided a null value is returned. * If no time is provided a null value is returned.
* *
* @param null|string|\DateTimeInterface $timestamp * @param string|\DateTimeInterface|null $timestamp
*/ */
protected static function formatTimestamp($timestamp, string $tz = null): ?string protected static function formatTimestamp($timestamp, string $tz = null): ?string
{ {

View File

@ -1,7 +1,6 @@
<?php <?php
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration | Cross-Origin Resource Sharing (CORS) Configuration

View File

@ -118,7 +118,7 @@ return [
'options' => [ 'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'), 'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
], ],
'default' => [ 'default' => [

View File

@ -1,7 +1,6 @@
<?php <?php
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Stateful Domains | Stateful Domains
@ -16,7 +15,7 @@ return [
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s', '%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1,pterodactyl.test', 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1,pterodactyl.test',
env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : '' env('APP_URL') ? ',' . parse_url(env('APP_URL'), PHP_URL_HOST) : ''
))), ))),
/* /*
@ -47,5 +46,4 @@ return [
'verify_csrf_token' => Pterodactyl\Http\Middleware\VerifyCsrfToken::class, 'verify_csrf_token' => Pterodactyl\Http\Middleware\VerifyCsrfToken::class,
'encrypt_cookies' => Pterodactyl\Http\Middleware\EncryptCookies::class, 'encrypt_cookies' => Pterodactyl\Http\Middleware\EncryptCookies::class,
], ],
]; ];

View File

@ -16,7 +16,7 @@ return [
'mailgun' => [ 'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'), 'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'), 'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT') 'endpoint' => env('MAILGUN_ENDPOINT'),
], ],
'mandrill' => [ 'mandrill' => [

View File

@ -1,7 +1,6 @@
<?php <?php
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| LaravelWebauthn Master Switch | LaravelWebauthn Master Switch
@ -208,7 +207,6 @@ return [
*/ */
'authenticator_selection_criteria' => [ 'authenticator_selection_criteria' => [
/* /*
| See https://www.w3.org/TR/webauthn/#attachment | See https://www.w3.org/TR/webauthn/#attachment
*/ */
@ -221,5 +219,4 @@ return [
*/ */
'user_verification' => \Webauthn\AuthenticatorSelectionCriteria::USER_VERIFICATION_REQUIREMENT_PREFERRED, 'user_verification' => \Webauthn\AuthenticatorSelectionCriteria::USER_VERIFICATION_REQUIREMENT_PREFERRED,
], ],
]; ];

View File

@ -1,8 +1,8 @@
<?php <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddWebauthn extends Migration class AddWebauthn extends Migration
{ {

View File

@ -1,8 +1,8 @@
<?php <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePersonalAccessTokensTable extends Migration class CreatePersonalAccessTokensTable extends Migration
{ {

View File

@ -1,8 +1,8 @@
<?php <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAdminRolesTable extends Migration class CreateAdminRolesTable extends Migration
{ {

View File

@ -1,8 +1,8 @@
<?php <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddIndexForServerAndAction extends Migration class AddIndexForServerAndAction extends Migration
{ {

View File

@ -1,8 +1,8 @@
<?php <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeSftpPortUnsignedInt extends Migration class MakeSftpPortUnsignedInt extends Migration
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ForceCronMonthFieldToHaveValueIfMissing extends Migration class ForceCronMonthFieldToHaveValueIfMissing extends Migration
{ {

View File

@ -1,8 +1,8 @@
<?php <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddContinueOnFailureOptionToTasks extends Migration class AddContinueOnFailureOptionToTasks extends Migration
{ {

View File

@ -1,8 +1,8 @@
<?php <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddOnlyRunWhenServerOnlineOptionToSchedules extends Migration class AddOnlyRunWhenServerOnlineOptionToSchedules extends Migration
{ {

View File

@ -1,8 +1,8 @@
<?php <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddSupportForLockingABackup extends Migration class AddSupportForLockingABackup extends Migration
{ {

View File

@ -7,6 +7,7 @@ class RemoveUserInteraction extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void * @return void
*/ */
public function up() public function up()

View File

@ -1,8 +1,8 @@
<?php <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserSshKeysTable extends Migration class CreateUserSshKeysTable extends Migration
{ {

View File

@ -1,8 +1,8 @@
<?php <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class YeetNamesFromUsersTable extends Migration class YeetNamesFromUsersTable extends Migration
{ {

View File

@ -132,7 +132,6 @@ Route::group(['prefix' => '/nodes'], function () {
}); });
}); });
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Role Controller Routes | Role Controller Routes
@ -152,7 +151,6 @@ Route::group(['prefix' => '/roles'], function () {
Route::delete('/{role}', 'Roles\RoleController@delete'); Route::delete('/{role}', 'Roles\RoleController@delete');
}); });
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Server Controller Routes | Server Controller Routes

View File

@ -41,9 +41,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
$this->createNewAccessToken(); $this->createNewAccessToken();
} }
/**
* @return \Pterodactyl\Models\User
*/
public function getApiUser(): User public function getApiUser(): User
{ {
return $this->user; return $this->user;

View File

@ -89,7 +89,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
} }
/** /**
* Test that backups can not be tasked when the backup limit is 0 * Test that backups can not be tasked when the backup limit is 0.
*/ */
public function testBackupsCanNotBeTaskedIfLimit0() public function testBackupsCanNotBeTaskedIfLimit0()
{ {

View File

@ -3,12 +3,11 @@
namespace Pterodactyl\Tests\Integration\Jobs\Schedule; namespace Pterodactyl\Tests\Integration\Jobs\Schedule;
use Mockery; use Mockery;
use Exception;
use Carbon\CarbonImmutable; use Carbon\CarbonImmutable;
use Pterodactyl\Models\Task;
use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Request;
use InvalidArgumentException; use Pterodactyl\Models\Task;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
use InvalidArgumentException;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Pterodactyl\Models\Schedule; use Pterodactyl\Models\Schedule;
use Illuminate\Support\Facades\Bus; use Illuminate\Support\Facades\Bus;

View File

@ -8,7 +8,6 @@ use GuzzleHttp\Psr7\Response;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Pterodactyl\Models\Allocation; use Pterodactyl\Models\Allocation;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\TransferException;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Tests\Integration\IntegrationTestCase; use Pterodactyl\Tests\Integration\IntegrationTestCase;
use Pterodactyl\Repositories\Wings\DaemonServerRepository; use Pterodactyl\Repositories\Wings\DaemonServerRepository;

View File

@ -6,8 +6,8 @@ use Mockery as m;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Models\WebauthnKey; use Pterodactyl\Models\WebauthnKey;
use Prologue\Alerts\AlertsMessageBag; use Prologue\Alerts\AlertsMessageBag;
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
use Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException; use Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException;
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
{ {
@ -23,7 +23,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->alerts = m::mock(AlertsMessageBag::class); $this->alerts = m::mock(AlertsMessageBag::class);
} }
public function testNoRequirement__userWithout_2fa() public function testNoRequirementUserWithout2fa()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_NONE); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_NONE);
@ -41,7 +41,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testNoRequirement__userWithTotp_2fa() public function testNoRequirementUserWithTotp2fa()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_NONE); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_NONE);
@ -59,7 +59,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testNoRequirement__userWithWebauthn_2fa() public function testNoRequirementUserWithWebauthn2fa()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_NONE); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_NONE);
@ -82,7 +82,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testNoRequirement__guestUser() public function testNoRequirementGuestUser()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_NONE); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_NONE);
@ -96,7 +96,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testAllRequirement__userWithout_2fa() public function testAllRequirementUserWithout2fa()
{ {
$this->expectException(TwoFactorAuthRequiredException::class); $this->expectException(TwoFactorAuthRequiredException::class);
@ -116,7 +116,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testAllRequirement__userWithTotp_2fa() public function testAllRequirementUserWithTotp2fa()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ALL); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ALL);
@ -134,7 +134,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testAllRequirement__ruserWithWebauthn_2fa() public function testAllRequirementRuserWithWebauthn2fa()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ALL); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ALL);
@ -157,7 +157,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testAllRequirement__guestUser() public function testAllRequirementGuestUser()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ALL); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ALL);
@ -171,7 +171,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testAdminRequirement__userWithout_2fa() public function testAdminRequirementUserWithout2fa()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN);
@ -190,7 +190,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testAdminRequirement__adminUserWithout_2fa() public function testAdminRequirementAdminUserWithout2fa()
{ {
$this->expectException(TwoFactorAuthRequiredException::class); $this->expectException(TwoFactorAuthRequiredException::class);
@ -211,7 +211,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testAdminRequirement__userWithTotp_2fa() public function testAdminRequirementUserWithTotp2fa()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN);
@ -230,7 +230,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testAdminRequirement__adminUserWithTotp_2fa() public function testAdminRequirementAdminUserWithTotp2fa()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN);
@ -249,7 +249,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testAdminRequirement__userWithWebauthn_2fa() public function testAdminRequirementUserWithWebauthn2fa()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN);
@ -271,7 +271,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testAdminRequirement__adminUserWithWebauthn_2fa() public function testAdminRequirementAdminUserWithWebauthn2fa()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN);
@ -295,7 +295,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
public function testAdminRequirement__guestUser() public function testAdminRequirementGuestUser()
{ {
// Disable the 2FA requirement // Disable the 2FA requirement
config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN); config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN);