mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 23:03:45 +02:00
Reformat for csfixer
This commit is contained in:
@@ -17,7 +17,7 @@ class SeedCommand extends BaseSeedCommand
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (!$this->hasCompletedMigrations()) {
|
||||
if (! $this->hasCompletedMigrations()) {
|
||||
return $this->showMigrationWarning();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class UpCommand extends BaseUpCommand
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (!$this->hasCompletedMigrations()) {
|
||||
if (! $this->hasCompletedMigrations()) {
|
||||
return $this->showMigrationWarning();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Pterodactyl\Console\Commands\Schedule;
|
||||
|
||||
use Throwable;
|
||||
use Exception;
|
||||
use Throwable;
|
||||
use Illuminate\Console\Command;
|
||||
use Pterodactyl\Models\Schedule;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -99,9 +99,9 @@ class BulkPowerActionCommand extends Command
|
||||
|
||||
if (! empty($nodes) && ! empty($servers)) {
|
||||
$instance->whereIn('id', $servers)->orWhereIn('node_id', $nodes);
|
||||
} else if (empty($nodes) && ! empty($servers)) {
|
||||
} elseif (empty($nodes) && ! empty($servers)) {
|
||||
$instance->whereIn('id', $servers);
|
||||
} else if (! empty($nodes) && empty($servers)) {
|
||||
} elseif (! empty($nodes) && empty($servers)) {
|
||||
$instance->whereIn('node_id', $nodes);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,10 @@
|
||||
|
||||
namespace Pterodactyl\Console\Commands\User;
|
||||
|
||||
use Webmozart\Assert\Assert;
|
||||
use Pterodactyl\Models\User;
|
||||
use Webmozart\Assert\Assert;
|
||||
use Illuminate\Console\Command;
|
||||
use Pterodactyl\Services\Users\UserDeletionService;
|
||||
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
|
||||
|
||||
class DeleteUserCommand extends Command
|
||||
{
|
||||
@@ -42,7 +41,8 @@ class DeleteUserCommand extends Command
|
||||
*
|
||||
* @param \Pterodactyl\Services\Users\UserDeletionService $deletionService
|
||||
*/
|
||||
public function __construct(UserDeletionService $deletionService) {
|
||||
public function __construct(UserDeletionService $deletionService)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->deletionService = $deletionService;
|
||||
@@ -96,7 +96,5 @@ class DeleteUserCommand extends Command
|
||||
$this->deletionService->handle($deleteUser);
|
||||
$this->info(trans('command/messages.user.deleted'));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ trait RequiresDatabaseMigrations
|
||||
*/
|
||||
protected function showMigrationWarning(): int
|
||||
{
|
||||
$this->getOutput()->writeln("<options=bold>
|
||||
$this->getOutput()->writeln('<options=bold>
|
||||
| @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
||||
| |
|
||||
| Your database has not been properly migrated! |
|
||||
@@ -52,9 +52,9 @@ You must run the following command to finish migrating your database:
|
||||
|
||||
You will not be able to use Pterodactyl Panel as expected without fixing your
|
||||
database state by running the command above.
|
||||
");
|
||||
');
|
||||
|
||||
$this->getOutput()->error("You must correct the error above before continuing.");
|
||||
$this->getOutput()->error('You must correct the error above before continuing.');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace Pterodactyl\Contracts\Repository;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
interface AllocationRepositoryInterface extends RepositoryInterface
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -4,9 +4,6 @@ namespace Pterodactyl\Contracts\Repository;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\LazyCollection;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface;
|
||||
|
||||
interface NodeRepositoryInterface extends RepositoryInterface
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ class DaemonConnectionException extends DisplayException
|
||||
$body = $response->getBody();
|
||||
if (is_string($body) || (is_object($body) && method_exists($body, '__toString'))) {
|
||||
$body = json_decode(is_string($body) ? $body : $body->__toString(), true);
|
||||
$message = "[Wings Error]: " . Arr::get($body, 'error', $message);
|
||||
$message = '[Wings Error]: ' . Arr::get($body, 'error', $message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,6 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept
|
||||
*/
|
||||
public function __construct(Throwable $previous = null)
|
||||
{
|
||||
parent::__construct(Response::HTTP_BAD_REQUEST, "Two-factor authentication is required on this account in order to access this endpoint.", $previous);
|
||||
parent::__construct(Response::HTTP_BAD_REQUEST, 'Two-factor authentication is required on this account in order to access this endpoint.', $previous);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Webmozart\Assert\Assert;
|
||||
use InvalidArgumentException;
|
||||
use League\Flysystem\AdapterInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use League\Flysystem\AdapterInterface;
|
||||
use League\Flysystem\AwsS3v3\AwsS3Adapter;
|
||||
use League\Flysystem\Memory\MemoryAdapter;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
|
||||
@@ -3,17 +3,13 @@
|
||||
namespace Pterodactyl\Http\Controllers\Admin;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Models\Nest;
|
||||
use Pterodactyl\Models\Mount;
|
||||
use Pterodactyl\Models\Location;
|
||||
use Prologue\Alerts\AlertsMessageBag;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Pterodactyl\Services\Mounts\MountUpdateService;
|
||||
use Pterodactyl\Http\Requests\Admin\MountFormRequest;
|
||||
use Pterodactyl\Services\Mounts\MountCreationService;
|
||||
use Pterodactyl\Services\Mounts\MountDeletionService;
|
||||
use Pterodactyl\Repositories\Eloquent\MountRepository;
|
||||
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
|
||||
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
||||
|
||||
@@ -79,7 +79,7 @@ class EggController extends Controller
|
||||
public function store(EggFormRequest $request): RedirectResponse
|
||||
{
|
||||
$data = $request->normalize();
|
||||
if (!empty($data['docker_images']) && !is_array($data['docker_images'])) {
|
||||
if (! empty($data['docker_images']) && ! is_array($data['docker_images'])) {
|
||||
$data['docker_images'] = array_map(function ($value) {
|
||||
return trim($value);
|
||||
}, explode("\n", $data['docker_images']));
|
||||
@@ -116,7 +116,7 @@ class EggController extends Controller
|
||||
public function update(EggFormRequest $request, Egg $egg): RedirectResponse
|
||||
{
|
||||
$data = $request->normalize();
|
||||
if (!empty($data['docker_images']) && !is_array($data['docker_images'])) {
|
||||
if (! empty($data['docker_images']) && ! is_array($data['docker_images'])) {
|
||||
$data['docker_images'] = array_map(function ($value) {
|
||||
return trim($value);
|
||||
}, explode("\n", $data['docker_images']));
|
||||
|
||||
@@ -118,7 +118,7 @@ class CreateServerController extends Controller
|
||||
public function store(ServerFormRequest $request)
|
||||
{
|
||||
$data = $request->except(['_token']);
|
||||
if (!empty($data['custom_image'])) {
|
||||
if (! empty($data['custom_image'])) {
|
||||
$data['image'] = $data['custom_image'];
|
||||
unset($data['custom_image']);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,8 @@ class ServerTransferController extends Controller
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function transfer(Request $request, Server $server) {
|
||||
public function transfer(Request $request, Server $server)
|
||||
{
|
||||
$validatedData = $request->validate([
|
||||
'node_id' => 'required|exists:nodes,id',
|
||||
'allocation_id' => 'required|bail|unique:servers|exists:allocations,id',
|
||||
|
||||
@@ -9,14 +9,12 @@
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Models\Mount;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\MountServer;
|
||||
use Prologue\Alerts\AlertsMessageBag;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
@@ -37,7 +35,6 @@ use Illuminate\Contracts\Config\Repository as ConfigRepository;
|
||||
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
||||
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
|
||||
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
|
||||
use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
|
||||
use Pterodactyl\Services\Servers\ServerConfigurationStructureService;
|
||||
use Pterodactyl\Http\Requests\Admin\Servers\Databases\StoreServerDatabaseRequest;
|
||||
|
||||
@@ -338,7 +335,7 @@ class ServersController extends Controller
|
||||
public function saveStartup(Request $request, Server $server)
|
||||
{
|
||||
$data = $request->except('_token');
|
||||
if (!empty($data['custom_docker_image'])) {
|
||||
if (! empty($data['custom_docker_image'])) {
|
||||
$data['docker_image'] = $data['custom_docker_image'];
|
||||
unset($data['custom_docker_image']);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class ClientController extends ClientApiController
|
||||
? $builder
|
||||
: $builder->whereNotIn('servers.id', $user->accessibleServers()->pluck('id')->all());
|
||||
}
|
||||
} else if ($type === 'owner') {
|
||||
} elseif ($type === 'owner') {
|
||||
$builder = $builder->where('servers.owner_id', $user->id);
|
||||
} else {
|
||||
$builder = $builder->whereIn('servers.id', $user->accessibleServers()->pluck('id')->all());
|
||||
|
||||
@@ -61,6 +61,7 @@ class BackupController extends ClientApiController
|
||||
public function index(GetBackupsRequest $request, Server $server)
|
||||
{
|
||||
$limit = min($request->query('per_page') ?? 20, 50);
|
||||
|
||||
return $this->fractal->collection($server->backups()->paginate($limit))
|
||||
->transformWith($this->getTransformer(BackupTransformer::class))
|
||||
->toArray();
|
||||
|
||||
@@ -14,9 +14,9 @@ use Pterodactyl\Http\Controllers\Api\Client\ClientApiController;
|
||||
use Pterodactyl\Http\Requests\Api\Client\Servers\Files\CopyFileRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Client\Servers\Files\PullFileRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Client\Servers\Files\ListFilesRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Client\Servers\Files\ChmodFilesRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Client\Servers\Files\DeleteFileRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Client\Servers\Files\RenameFileRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Client\Servers\Files\ChmodFilesRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Client\Servers\Files\CreateFolderRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Client\Servers\Files\CompressFilesRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Client\Servers\Files\DecompressFilesRequest;
|
||||
|
||||
@@ -112,7 +112,7 @@ class NetworkAllocationController extends ClientApiController
|
||||
|
||||
/**
|
||||
* Set the notes for the allocation for a server.
|
||||
*s
|
||||
*s.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\NewAllocationRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
|
||||
@@ -10,7 +10,6 @@ use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\Schedule;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Pterodactyl\Helpers\Utilities;
|
||||
use Pterodactyl\Jobs\Schedule\RunTaskJob;
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Pterodactyl\Repositories\Eloquent\ScheduleRepository;
|
||||
use Pterodactyl\Services\Schedules\ProcessScheduleService;
|
||||
@@ -173,7 +172,7 @@ class ScheduleController extends ClientApiController
|
||||
*/
|
||||
public function execute(TriggerScheduleRequest $request, Server $server, Schedule $schedule)
|
||||
{
|
||||
if (!$schedule->is_active) {
|
||||
if (! $schedule->is_active) {
|
||||
throw new BadRequestHttpException(
|
||||
'Cannot trigger schedule exection for a schedule that is not currently active.'
|
||||
);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\Api\Client\Servers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -88,7 +87,7 @@ class SettingsController extends ClientApiController
|
||||
*/
|
||||
public function dockerImage(SetDockerImageRequest $request, Server $server)
|
||||
{
|
||||
if (!in_array($server->image, $server->egg->docker_images)) {
|
||||
if (! in_array($server->image, $server->egg->docker_images)) {
|
||||
throw new BadRequestHttpException(
|
||||
'This server\'s Docker image has been manually set by an administrator and cannot be updated.'
|
||||
);
|
||||
|
||||
@@ -86,11 +86,11 @@ class StartupController extends ClientApiController
|
||||
|
||||
if (is_null($variable) || ! $variable->user_viewable) {
|
||||
throw new BadRequestHttpException(
|
||||
"The environment variable you are trying to edit does not exist."
|
||||
'The environment variable you are trying to edit does not exist.'
|
||||
);
|
||||
} else if (! $variable->user_editable) {
|
||||
} elseif (! $variable->user_editable) {
|
||||
throw new BadRequestHttpException(
|
||||
"The environment variable you are trying to edit is read-only."
|
||||
'The environment variable you are trying to edit is read-only.'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ use Carbon\CarbonImmutable;
|
||||
use Pterodactyl\Models\Backup;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use League\Flysystem\AwsS3v3\AwsS3Adapter;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Pterodactyl\Extensions\Backups\BackupManager;
|
||||
use Pterodactyl\Repositories\Eloquent\BackupRepository;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
@@ -85,7 +85,7 @@ class ServerDetailsController extends Controller
|
||||
->where('node_id', $node->id)
|
||||
// If you don't cast this to a string you'll end up with a stringified per_page returned in
|
||||
// the metadata, and then Wings will panic crash as a result.
|
||||
->paginate((int)$request->input('per_page', 50));
|
||||
->paginate((int) $request->input('per_page', 50));
|
||||
|
||||
return new ServerConfigurationCollection($servers);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\Api\Remote\Servers;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
@@ -12,7 +12,6 @@ use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Pterodactyl\Http\Requests\Auth\LoginCheckpointRequest;
|
||||
use Illuminate\Contracts\Cache\Repository as CacheRepository;
|
||||
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
|
||||
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
|
||||
use Pterodactyl\Repositories\Eloquent\RecoveryTokenRepository;
|
||||
|
||||
class LoginCheckpointController extends AbstractLoginController
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\Auth;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Auth\AuthManager;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
@@ -8,8 +8,8 @@ use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Pterodactyl\Exceptions\Http\Server\ServerTransferringException;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
class AuthenticateServerAccess
|
||||
{
|
||||
|
||||
@@ -7,11 +7,11 @@ use Illuminate\Http\Request;
|
||||
use Pterodactyl\Models\Task;
|
||||
use Pterodactyl\Models\User;
|
||||
use InvalidArgumentException;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\Backup;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\Subuser;
|
||||
use Pterodactyl\Models\Schedule;
|
||||
use Pterodactyl\Models\Database;
|
||||
use Pterodactyl\Models\Schedule;
|
||||
use Pterodactyl\Models\Allocation;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
@@ -43,7 +43,7 @@ class SubstituteClientApiBindings extends ApiSubstituteBindings
|
||||
}
|
||||
});
|
||||
|
||||
$this->router->bind('database', function ($value) use ($request) {
|
||||
$this->router->bind('database', function ($value) {
|
||||
$id = Container::getInstance()->make(HashidsInterface::class)->decodeFirst($value);
|
||||
|
||||
return Database::query()->where('id', $id)->firstOrFail();
|
||||
|
||||
@@ -59,14 +59,14 @@ class RequireTwoFactorAuthentication
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
$level = (int)config('pterodactyl.auth.2fa_required');
|
||||
$level = (int) config('pterodactyl.auth.2fa_required');
|
||||
// If this setting is not configured, or the user is already using 2FA then we can just
|
||||
// send them right through, nothing else needs to be checked.
|
||||
//
|
||||
// If the level is set as admin and the user is not an admin, pass them through as well.
|
||||
if ($level === self::LEVEL_NONE || $user->use_totp) {
|
||||
return $next($request);
|
||||
} else if ($level === self::LEVEL_ADMIN && ! $user->root_admin) {
|
||||
} elseif ($level === self::LEVEL_ADMIN && ! $user->root_admin) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class EggFormRequest extends AdminFormRequest
|
||||
public function withValidator($validator)
|
||||
{
|
||||
$validator->sometimes('config_from', 'exists:eggs,id', function () {
|
||||
return (int)$this->input('config_from') !== 0;
|
||||
return (int) $this->input('config_from') !== 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class ServerConfigurationCollection extends ResourceCollection
|
||||
$egg = Container::getInstance()->make(EggConfigurationService::class);
|
||||
$configuration = Container::getInstance()->make(ServerConfigurationStructureService::class);
|
||||
|
||||
return $this->collection->map(function (Server $server) use ($configuration, $egg) {
|
||||
return $this->collection->map(function (Server $server) use ($configuration, $egg) {
|
||||
return [
|
||||
'uuid' => $server->uuid,
|
||||
'settings' => $configuration->handle($server),
|
||||
|
||||
@@ -8,7 +8,6 @@ use Carbon\CarbonImmutable;
|
||||
use Pterodactyl\Models\Task;
|
||||
use InvalidArgumentException;
|
||||
use Pterodactyl\Models\Schedule;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
@@ -42,12 +42,12 @@ class MultiFieldServerFilter implements Filter
|
||||
$parts = explode(':', $value);
|
||||
|
||||
$builder->when(
|
||||
!Str::startsWith($value, ':'),
|
||||
! Str::startsWith($value, ':'),
|
||||
// When the string does not start with a ":" it means we're looking for an IP or IP:Port
|
||||
// combo, so use a query to handle that.
|
||||
function (Builder $builder) use ($parts) {
|
||||
$builder->orWhere('allocations.ip', $parts[0]);
|
||||
if (!is_null($parts[1] ?? null)) {
|
||||
if (! is_null($parts[1] ?? null)) {
|
||||
$builder->where('allocations.port', 'LIKE', "{$parts[1]}%");
|
||||
}
|
||||
},
|
||||
|
||||
@@ -7,8 +7,8 @@ use Illuminate\Validation\Rule;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Contracts\Validation\Factory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model as IlluminateModel;
|
||||
use Pterodactyl\Exceptions\Model\DataValidationException;
|
||||
use Illuminate\Database\Eloquent\Model as IlluminateModel;
|
||||
|
||||
abstract class Model extends IlluminateModel
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@ class Mount extends Model
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Blacklisted source paths
|
||||
* Blacklisted source paths.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
@@ -98,7 +98,7 @@ class Mount extends Model
|
||||
];
|
||||
|
||||
/**
|
||||
* Blacklisted target paths
|
||||
* Blacklisted target paths.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
|
||||
@@ -202,7 +202,7 @@ class Node extends Model
|
||||
*/
|
||||
public function getDecryptedKey(): string
|
||||
{
|
||||
return (string)Container::getInstance()->make(Encrypter::class)->decrypt(
|
||||
return (string) Container::getInstance()->make(Encrypter::class)->decrypt(
|
||||
$this->daemon_token
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ use Illuminate\Foundation\Application;
|
||||
use Illuminate\Database\DatabaseManager;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
|
||||
use Pterodactyl\Exceptions\Repository\DuplicateDatabaseNameException;
|
||||
|
||||
class DatabaseRepository extends EloquentRepository implements DatabaseRepositoryInterface
|
||||
{
|
||||
|
||||
@@ -13,7 +13,6 @@ use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Pterodactyl\Contracts\Repository\RepositoryInterface;
|
||||
use Pterodactyl\Exceptions\Model\DataValidationException;
|
||||
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
|
||||
use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface;
|
||||
|
||||
abstract class EloquentRepository extends Repository implements RepositoryInterface
|
||||
{
|
||||
|
||||
@@ -4,8 +4,6 @@ namespace Pterodactyl\Repositories\Eloquent;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\LazyCollection;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
|
||||
|
||||
class NodeRepository extends EloquentRepository implements NodeRepositoryInterface
|
||||
|
||||
@@ -51,7 +51,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
|
||||
|
||||
if (! is_null($server) && is_null($node)) {
|
||||
$instance = $instance->where('id', '=', $server);
|
||||
} else if (is_null($server) && ! is_null($node)) {
|
||||
} elseif (is_null($server) && ! is_null($node)) {
|
||||
$instance = $instance->where('node_id', '=', $node);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
|
||||
|
||||
if (! is_null($server) && is_null($node)) {
|
||||
$instance = $instance->where('id', '=', $server);
|
||||
} else if (is_null($server) && ! is_null($node)) {
|
||||
} elseif (is_null($server) && ! is_null($node)) {
|
||||
$instance = $instance->where('node_id', '=', $node);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Pterodactyl\Repositories\Wings;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Webmozart\Assert\Assert;
|
||||
use Pterodactyl\Models\Backup;
|
||||
use Pterodactyl\Models\Server;
|
||||
|
||||
@@ -37,7 +37,7 @@ class DaemonFileRepository extends DaemonRepository
|
||||
throw new DaemonConnectionException($exception);
|
||||
}
|
||||
|
||||
$length = (int)$response->getHeader('Content-Length')[0] ?? 0;
|
||||
$length = (int) $response->getHeader('Content-Length')[0] ?? 0;
|
||||
|
||||
if ($notLargerThan && $length > $notLargerThan) {
|
||||
throw new FileSizeTooLargeException;
|
||||
|
||||
@@ -156,7 +156,7 @@ class DaemonServerRepository extends DaemonRepository
|
||||
{
|
||||
Assert::isInstanceOf($this->server, Server::class);
|
||||
|
||||
$this->revokeJTIs([ md5($id . $this->server->uuid) ]);
|
||||
$this->revokeJTIs([md5($id . $this->server->uuid)]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,6 @@ use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\Database;
|
||||
use Pterodactyl\Helpers\Utilities;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Symfony\Component\VarDumper\Cloner\Data;
|
||||
use Illuminate\Contracts\Encryption\Encrypter;
|
||||
use Pterodactyl\Extensions\DynamicDatabaseConnection;
|
||||
use Pterodactyl\Repositories\Eloquent\DatabaseRepository;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Pterodactyl\Services\Deployment;
|
||||
|
||||
use Webmozart\Assert\Assert;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Webmozart\Assert\Assert;
|
||||
use Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException;
|
||||
|
||||
class FindViableNodesService
|
||||
|
||||
@@ -108,7 +108,7 @@ class EggConfigurationService
|
||||
// Normalize the output of the configuration for the new Wings Daemon to more
|
||||
// easily ingest, as well as make things more flexible down the road.
|
||||
foreach ($configs as $file => $data) {
|
||||
$append = array_merge((array)$data, ['file' => $file, 'replace' => []]);
|
||||
$append = array_merge((array) $data, ['file' => $file, 'replace' => []]);
|
||||
|
||||
foreach ($this->iterate($data->find, $structure) as $find => $replace) {
|
||||
if (is_object($replace)) {
|
||||
|
||||
@@ -119,7 +119,7 @@ class EggImporterService
|
||||
], true, true);
|
||||
|
||||
collect($parsed->variables)->each(function ($variable) use ($egg) {
|
||||
$this->eggVariableRepository->create(array_merge((array)$variable, [
|
||||
$this->eggVariableRepository->create(array_merge((array) $variable, [
|
||||
'egg_id' => $egg->id,
|
||||
]));
|
||||
});
|
||||
|
||||
@@ -5,11 +5,9 @@ namespace Pterodactyl\Services\Nodes;
|
||||
use Illuminate\Support\Str;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use GuzzleHttp\Exception\ConnectException;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Illuminate\Contracts\Encryption\Encrypter;
|
||||
use Pterodactyl\Repositories\Eloquent\NodeRepository;
|
||||
use Pterodactyl\Repositories\Daemon\ConfigurationRepository;
|
||||
use Pterodactyl\Repositories\Wings\DaemonConfigurationRepository;
|
||||
use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
|
||||
use Pterodactyl\Exceptions\Service\Node\ConfigurationNotPersistedException;
|
||||
@@ -101,7 +99,7 @@ class NodeUpdateService
|
||||
// inject their own response pages, causing this logic to get fucked up.
|
||||
//
|
||||
// @see https://github.com/pterodactyl/panel/issues/2712
|
||||
return [ $updated, true ];
|
||||
return [$updated, true];
|
||||
}
|
||||
|
||||
return [$updated, false];
|
||||
|
||||
@@ -82,7 +82,7 @@ class BuildModificationService
|
||||
|
||||
$updateData = $this->structureService->handle($server);
|
||||
|
||||
if (!empty($updateData['build'])) {
|
||||
if (! empty($updateData['build'])) {
|
||||
$this->daemonServerRepository->setServer($server)->update([
|
||||
'build' => $updateData['build'],
|
||||
]);
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace Pterodactyl\Services\Servers;
|
||||
|
||||
use Pterodactyl\Models\Server;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Pterodactyl\Repositories\Eloquent\ServerRepository;
|
||||
use Pterodactyl\Repositories\Wings\DaemonServerRepository;
|
||||
|
||||
class ReinstallServerService
|
||||
|
||||
@@ -38,7 +38,7 @@ class ServerConfigurationStructureService
|
||||
$clone = $server;
|
||||
// If any overrides have been set on this call make sure to update them on the
|
||||
// cloned instance so that the configuration generated uses them.
|
||||
if (!empty($override)) {
|
||||
if (! empty($override)) {
|
||||
$clone = $server->fresh();
|
||||
foreach ($override as $key => $value) {
|
||||
$clone->setAttribute($key, $value);
|
||||
@@ -95,10 +95,10 @@ class ServerConfigurationStructureService
|
||||
'id' => $server->egg->uuid,
|
||||
'file_denylist' => [
|
||||
'config.yml',
|
||||
'**/*.json'
|
||||
]
|
||||
'**/*.json',
|
||||
],
|
||||
// 'file_denylist' => explode(PHP_EOL, $server->egg->inherit_file_denylist),
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -124,12 +124,12 @@ class ServerConfigurationStructureService
|
||||
})->toArray(),
|
||||
'env' => $this->environment->handle($server),
|
||||
'oom_disabled' => $server->oom_disabled,
|
||||
'memory' => (int)$server->memory,
|
||||
'swap' => (int)$server->swap,
|
||||
'io' => (int)$server->io,
|
||||
'cpu' => (int)$server->cpu,
|
||||
'memory' => (int) $server->memory,
|
||||
'swap' => (int) $server->swap,
|
||||
'io' => (int) $server->io,
|
||||
'cpu' => (int) $server->cpu,
|
||||
'threads' => $server->threads,
|
||||
'disk' => (int)$server->disk,
|
||||
'disk' => (int) $server->disk,
|
||||
'image' => $server->image,
|
||||
],
|
||||
'service' => [
|
||||
@@ -137,7 +137,7 @@ class ServerConfigurationStructureService
|
||||
'skip_scripts' => $server->skip_scripts,
|
||||
],
|
||||
'rebuild' => false,
|
||||
'suspended' => (int)$server->suspended,
|
||||
'suspended' => (int) $server->suspended,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class ServerDeletionService
|
||||
try {
|
||||
$this->databaseManagementService->delete($database);
|
||||
} catch (Exception $exception) {
|
||||
if (!$this->force) {
|
||||
if (! $this->force) {
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class StartupCommandService
|
||||
|
||||
foreach ($server->variables as $variable) {
|
||||
$find[] = '{{' . $variable->env_variable . '}}';
|
||||
$replace[] = ($variable->user_viewable && !$hideAllValues) ? ($variable->server_value ?? $variable->default_value) : '[hidden]';
|
||||
$replace[] = ($variable->user_viewable && ! $hideAllValues) ? ($variable->server_value ?? $variable->default_value) : '[hidden]';
|
||||
}
|
||||
|
||||
return str_replace($find, $replace, $server->startup);
|
||||
|
||||
@@ -91,7 +91,7 @@ class StartupModificationService
|
||||
{
|
||||
$eggId = Arr::get($data, 'egg_id');
|
||||
|
||||
if (is_digit($eggId) && $server->egg_id !== (int)$eggId) {
|
||||
if (is_digit($eggId) && $server->egg_id !== (int) $eggId) {
|
||||
/** @var \Pterodactyl\Models\Egg $egg */
|
||||
$egg = Egg::query()->findOrFail($data['egg_id']);
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ use Webmozart\Assert\Assert;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Pterodactyl\Repositories\Wings\DaemonServerRepository;
|
||||
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
|
||||
use Pterodactyl\Exceptions\Http\Server\ServerTransferringException;
|
||||
|
||||
class SuspensionService
|
||||
|
||||
@@ -68,7 +68,7 @@ class VariableValidatorService
|
||||
}
|
||||
|
||||
return Collection::make($variables)->map(function ($item) use ($fields) {
|
||||
return (object)[
|
||||
return (object) [
|
||||
'id' => $item->id,
|
||||
'key' => $item->env_variable,
|
||||
'value' => $fields[$item->env_variable] ?? null,
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Pterodactyl\Transformers\Api\Application;
|
||||
|
||||
use Pterodactyl\Models\Subuser;
|
||||
use Pterodactyl\Models\Permission;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
|
||||
class SubuserTransformer extends BaseTransformer
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Pterodactyl\Transformers\Api\Client;
|
||||
|
||||
use BadMethodCallException;
|
||||
use InvalidArgumentException;
|
||||
use Pterodactyl\Models\EggVariable;
|
||||
|
||||
class EggVariableTransformer extends BaseClientTransformer
|
||||
@@ -25,7 +24,7 @@ class EggVariableTransformer extends BaseClientTransformer
|
||||
// This guards against someone incorrectly retrieving variables (haha, me) and then passing
|
||||
// them into the transformer and along to the user. Just throw an exception and break the entire
|
||||
// pathway since you should never be exposing these types of variables to a client.
|
||||
if (!$variable->user_viewable) {
|
||||
if (! $variable->user_viewable) {
|
||||
throw new BadMethodCallException(
|
||||
'Cannot transform a hidden egg variable in a client transformer.'
|
||||
);
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
],
|
||||
"psr-4": {
|
||||
"Pterodactyl\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
"Database\\Factories\\": "database/Factories/",
|
||||
"Database\\Seeders\\": "database/Seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
|
||||
@@ -45,7 +45,7 @@ return [
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => env('DB_PREFIX', ''),
|
||||
'strict' => env('DB_STRICT_MODE', false),
|
||||
'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC')))
|
||||
'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))),
|
||||
],
|
||||
|
||||
/*
|
||||
@@ -68,7 +68,7 @@ return [
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'strict' => false,
|
||||
'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC')))
|
||||
'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))),
|
||||
],
|
||||
],
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ return [
|
||||
| setup on the panel. When set to true, configurations stored in the
|
||||
| database will not be applied.
|
||||
*/
|
||||
'load_environment_only' => (bool)env('APP_ENVIRONMENT_ONLY', false),
|
||||
'load_environment_only' => (bool) env('APP_ENVIRONMENT_ONLY', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@ class EggVariableFactory extends Factory
|
||||
return [
|
||||
'name' => $this->faker->firstName,
|
||||
'description' => $this->faker->sentence(),
|
||||
'env_variable' => Str::upper(Str::replaceArray(' ', [ '_' ], $this->faker->words(2, true))),
|
||||
'env_variable' => Str::upper(Str::replaceArray(' ', ['_'], $this->faker->words(2, true))),
|
||||
'default_value' => $this->faker->colorName,
|
||||
'user_viewable' => 0,
|
||||
'user_editable' => 0,
|
||||
@@ -24,7 +24,7 @@ class SubuserFactory extends Factory
|
||||
{
|
||||
return [
|
||||
'permissions' => [
|
||||
Permission::ACTION_WEBSOCKET_CONNECT
|
||||
Permission::ACTION_WEBSOCKET_CONNECT,
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -22,7 +22,7 @@ class MigrateToNewServiceSystem extends Migration
|
||||
}
|
||||
|
||||
$options = DB::table('service_options')->where('service_id', $service->id)->get();
|
||||
$options->each(function ($item) use ($options) {
|
||||
$options->each(function ($item) {
|
||||
if ($item->tag === 'srcds' && $item->name === 'Insurgency') {
|
||||
$item->tag = 'insurgency';
|
||||
} elseif ($item->tag === 'srcds' && $item->name === 'Team Fortress 2') {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Pterodactyl\Models\Permission;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Pterodactyl\Models\Permission as P;
|
||||
|
||||
@@ -20,13 +20,13 @@ class CreateBackupsTable extends Migration
|
||||
// to use. For now, just rename them to maintain the data.
|
||||
$results = DB::select('SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema = ? AND table_name LIKE ? AND table_name NOT LIKE \'%_plugin_bak\'', [
|
||||
config("database.connections.{$db}.database"),
|
||||
'backup%'
|
||||
'backup%',
|
||||
]);
|
||||
|
||||
// Take any of the results, most likely "backups" and "backup_logs" and rename them to have a
|
||||
// suffix so data isn't completely lost, but they're no longer in the way of this migration...
|
||||
foreach ($results as $result) {
|
||||
Schema::rename($result->TABLE_NAME, $result->TABLE_NAME. '_plugin_bak');
|
||||
Schema::rename($result->TABLE_NAME, $result->TABLE_NAME . '_plugin_bak');
|
||||
}
|
||||
|
||||
Schema::create('backups', function (Blueprint $table) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user