1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 00:52:43 +01:00

chore: update composer dependencies (#5198)

Signed-off-by: Matthew Penner <me@matthewp.io>
This commit is contained in:
Matthew Penner 2024-10-21 19:18:20 -06:00 committed by GitHub
parent fbc24d27ee
commit 8ca098940a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
455 changed files with 4749 additions and 4172 deletions

View File

@ -14,19 +14,21 @@ jobs:
ui:
name: UI
runs-on: ubuntu-20.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
node-version: [16]
steps:
- name: Code Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile

View File

@ -14,11 +14,18 @@ jobs:
tests:
name: Tests
runs-on: ubuntu-20.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
php: [8.1, 8.2]
database: ["mariadb:10.2", "mysql:8"]
php: [8.2, 8.3]
database:
- mariadb:10.5
- mariadb:10.11
- mariadb:11.5
- mysql:8
- mysql:9
services:
database:
image: ${{ matrix.database }}
@ -27,10 +34,9 @@ jobs:
MYSQL_DATABASE: testing
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Code Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Get cache directory
id: composer-cache
@ -38,7 +44,7 @@ jobs:
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}

View File

@ -18,13 +18,16 @@ jobs:
name: Push
runs-on: ubuntu-20.04
if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
permissions:
contents: read
packages: write
steps:
- name: Code checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Docker metadata
id: docker_meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ghcr.io/pterodactyl/panel
flavor: |
@ -35,13 +38,13 @@ jobs:
type=ref,event=branch
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
if: "github.event_name != 'pull_request'"
with:
registry: ghcr.io
@ -56,7 +59,7 @@ jobs:
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:1}',/" config/app.php
- name: Build and Push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile

View File

@ -14,14 +14,16 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-20.04
permissions:
contents: read
steps:
- name: Code Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
php-version: "8.2"
extensions: bcmath, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
tools: composer:v2
coverage: none

View File

@ -9,15 +9,17 @@ jobs:
release:
name: Release
runs-on: ubuntu-20.04
permissions:
contents: write # write is required to create releases and push.
steps:
- name: Code checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
cache: "yarn"
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
@ -41,7 +43,7 @@ jobs:
- name: Create release archive
run: |
rm -rf node_modules tests CODE_OF_CONDUCT.md CONTRIBUTING.md flake.lock flake.nix phpunit.xml shell.nix
rm -rf node_modules tests CODE_OF_CONDUCT.md CONTRIBUTING.md flake.lock flake.nix phpunit.xml shell.nix
tar -czf panel.tar.gz * .editorconfig .env.example .eslintignore .eslintrc.js .gitignore .prettierrc.json
- name: Extract changelog
@ -58,7 +60,7 @@ jobs:
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:

5
.gitignore vendored
View File

@ -21,7 +21,9 @@ public/assets/manifest.json
# For local development with docker
# Remove if we ever put the Dockerfile in the repo
.dockerignore
docker-compose.yml
docker-compose.*
!docker-compose.example.yml
!docker-compose.example.yaml
# for image related files
misc
@ -33,4 +35,3 @@ resources/lang/locales.js
/public/build
/public/hot
result
docker-compose.yaml

View File

@ -2,6 +2,7 @@
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
$finder = (new Finder())
->in(__DIR__)
@ -14,6 +15,7 @@ $finder = (new Finder())
->notName(['_ide_helper*']);
return (new Config())
->setParallelConfig(ParallelConfigFactory::detect())
->setRiskyAllowed(true)
->setFinder($finder)
->setRules([

View File

@ -10,7 +10,7 @@ RUN yarn install --frozen-lockfile \
# Stage 1:
# Build the actual container with all of the needed PHP dependencies that will run the application.
FROM --platform=$TARGETOS/$TARGETARCH php:8.1-fpm-alpine
FROM --platform=$TARGETOS/$TARGETARCH php:8.2-fpm-alpine
WORKDIR /app
COPY . ./
COPY --from=0 /app/public/assets ./public/assets

View File

@ -20,7 +20,7 @@ class DeleteLocationCommand extends Command
*/
public function __construct(
private LocationDeletionService $deletionService,
private LocationRepositoryInterface $repository
private LocationRepositoryInterface $repository,
) {
parent::__construct();
}

View File

@ -36,7 +36,7 @@ class CleanServiceBackupFilesCommand extends Command
collect($files)->each(function (\SplFileInfo $file) {
$lastModified = Carbon::createFromTimestamp($this->disk->lastModified($file->getPath()));
if ($lastModified->diffInMinutes(Carbon::now()) > self::BACKUP_THRESHOLD_MINUTES) {
if ((int) $lastModified->diffInMinutes(Carbon::now()) > self::BACKUP_THRESHOLD_MINUTES) {
$this->disk->delete($file->getPath());
$this->info(trans('command/messages.maintenance.deleting_service_backup', ['file' => $file->getFilename()]));
}

View File

@ -17,7 +17,7 @@ class NodeConfigurationCommand extends Command
{
$column = ctype_digit((string) $this->argument('node')) ? 'id' : 'uuid';
/** @var \Pterodactyl\Models\Node $node */
/** @var Node $node */
$node = Node::query()->where($column, $this->argument('node'))->firstOr(function () {
$this->error('The selected node does not exist.');

View File

@ -30,7 +30,7 @@ class BulkPowerActionCommand extends Command
/**
* Handle the bulk power request.
*
* @throws \Illuminate\Validation\ValidationException
* @throws ValidationException
*/
public function handle()
{

View File

@ -133,7 +133,7 @@ class UpgradeCommand extends Command
/** @var \Illuminate\Foundation\Application $app */
$app = require __DIR__ . '/../../../bootstrap/app.php';
/** @var \Pterodactyl\Console\Kernel $kernel */
/** @var Kernel $kernel */
$kernel = $app->make(Kernel::class);
$kernel->bootstrap();
$this->setLaravel($app);

View File

@ -11,5 +11,5 @@ interface HashidsInterface extends VendorHashidsInterface
*
* @throws \InvalidArgumentException
*/
public function decodeFirst(string $encoded, string $default = null): mixed;
public function decodeFirst(string $encoded, ?string $default = null): mixed;
}

View File

@ -12,14 +12,14 @@ interface NestRepositoryInterface extends RepositoryInterface
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithEggs(int $id = null): Collection|Nest;
public function getWithEggs(?int $id = null): Collection|Nest;
/**
* Return a nest or all nests and the count of eggs and servers for that nest.
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithCounts(int $id = null): Collection|Nest;
public function getWithCounts(?int $id = null): Collection|Nest;
/**
* Return a nest along with its associated eggs and the servers relation on those eggs.

View File

@ -16,12 +16,12 @@ interface ServerRepositoryInterface extends RepositoryInterface
/**
* Return a collection of servers with their associated data for rebuild operations.
*/
public function getDataForRebuild(int $server = null, int $node = null): Collection;
public function getDataForRebuild(?int $server = null, ?int $node = null): Collection;
/**
* Return a collection of servers with their associated data for reinstall operations.
*/
public function getDataForReinstall(int $server = null, int $node = null): Collection;
public function getDataForReinstall(?int $server = null, ?int $node = null): Collection;
/**
* Return a server model and all variables associated with the server.

View File

@ -10,7 +10,7 @@ interface SettingsRepositoryInterface extends RepositoryInterface
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function set(string $key, string $value = null);
public function set(string $key, ?string $value = null);
/**
* Retrieve a persistent setting from the database.

View File

@ -72,7 +72,7 @@ class DisplayException extends PterodactylException implements HttpExceptionInte
try {
$logger = Container::getInstance()->make(LoggerInterface::class);
} catch (Exception) {
} catch (\Exception) {
throw $this->getPrevious();
}

View File

@ -10,7 +10,7 @@ class HttpForbiddenException extends HttpException
/**
* HttpForbiddenException constructor.
*/
public function __construct(string $message = null, \Throwable $previous = null)
public function __construct(?string $message = null, ?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_FORBIDDEN, $message, $previous);
}

View File

@ -11,7 +11,7 @@ class ServerStateConflictException extends ConflictHttpException
* Exception thrown when the server is in an unsupported state for API access or
* certain operations within the codebase.
*/
public function __construct(Server $server, \Throwable $previous = null)
public function __construct(Server $server, ?\Throwable $previous = null)
{
$message = 'This server is currently in an unsupported state, please try again later.';
if ($server->isSuspended()) {

View File

@ -11,7 +11,7 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept
/**
* TwoFactorAuthRequiredException constructor.
*/
public function __construct(\Throwable $previous = null)
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);
}

View File

@ -10,7 +10,7 @@ class ServiceLimitExceededException extends DisplayException
* Exception thrown when something goes over a defined limit, such as allocated
* ports, tasks, databases, etc.
*/
public function __construct(string $message, \Throwable $previous = null)
public function __construct(string $message, ?\Throwable $previous = null)
{
parent::__construct($message, $previous, self::LEVEL_WARNING);
}

View File

@ -38,7 +38,7 @@ class BackupManager
/**
* Returns a backup adapter instance.
*/
public function adapter(string $name = null): FilesystemAdapter
public function adapter(?string $name = null): FilesystemAdapter
{
return $this->get($name ?: $this->getDefaultAdapter());
}

View File

@ -19,7 +19,7 @@ class DynamicDatabaseConnection
public function __construct(
protected ConfigRepository $config,
protected Encrypter $encrypter,
protected DatabaseHostRepositoryInterface $repository
protected DatabaseHostRepositoryInterface $repository,
) {
}

View File

@ -7,10 +7,7 @@ use Pterodactyl\Contracts\Extensions\HashidsInterface;
class Hashids extends VendorHashids implements HashidsInterface
{
/**
* {@inheritdoc}
*/
public function decodeFirst(string $encoded, string $default = null): mixed
public function decodeFirst(string $encoded, ?string $default = null): mixed
{
$result = $this->decode($encoded);
if (!is_array($result)) {

View File

@ -6,7 +6,7 @@ use Pterodactyl\Models\ApiKey;
use Laravel\Sanctum\NewAccessToken as SanctumAccessToken;
/**
* @property \Pterodactyl\Models\ApiKey $accessToken
* @property ApiKey $accessToken
*/
class NewAccessToken extends SanctumAccessToken
{

View File

@ -30,7 +30,7 @@ class DatabaseController extends Controller
private HostDeletionService $deletionService,
private HostUpdateService $updateService,
private LocationRepositoryInterface $locationRepository,
private ViewFactory $view
private ViewFactory $view,
) {
}

View File

@ -26,7 +26,7 @@ class LocationController extends Controller
protected LocationDeletionService $deletionService,
protected LocationRepositoryInterface $repository,
protected LocationUpdateService $updateService,
protected ViewFactory $view
protected ViewFactory $view,
) {
}
@ -86,7 +86,7 @@ class LocationController extends Controller
* Delete a location from the system.
*
* @throws \Exception
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
*/
public function delete(Location $location): RedirectResponse
{

View File

@ -28,7 +28,7 @@ class MountController extends Controller
protected NestRepositoryInterface $nestRepository,
protected LocationRepositoryInterface $locationRepository,
protected MountRepository $repository,
protected ViewFactory $view
protected ViewFactory $view,
) {
}

View File

@ -27,7 +27,7 @@ class EggController extends Controller
protected EggRepositoryInterface $repository,
protected EggUpdateService $updateService,
protected NestRepositoryInterface $nestRepository,
protected ViewFactory $view
protected ViewFactory $view,
) {
}
@ -111,7 +111,7 @@ class EggController extends Controller
/**
* Normalizes a string of docker image data into the expected egg format.
*/
protected function normalizeDockerImages(string $input = null): array
protected function normalizeDockerImages(?string $input = null): array
{
$data = array_map(fn ($value) => trim($value), explode("\n", $input ?? ''));

View File

@ -21,7 +21,7 @@ class EggScriptController extends Controller
protected AlertsMessageBag $alert,
protected EggRepositoryInterface $repository,
protected InstallScriptService $installScriptService,
protected ViewFactory $view
protected ViewFactory $view,
) {
}

View File

@ -21,7 +21,7 @@ class EggShareController extends Controller
protected AlertsMessageBag $alert,
protected EggExporterService $exporterService,
protected EggImporterService $importerService,
protected EggUpdateImporterService $updateImporterService
protected EggUpdateImporterService $updateImporterService,
) {
}

View File

@ -26,7 +26,7 @@ class EggVariableController extends Controller
protected VariableUpdateService $updateService,
protected EggRepositoryInterface $repository,
protected EggVariableRepositoryInterface $variableRepository,
protected ViewFactory $view
protected ViewFactory $view,
) {
}

View File

@ -24,7 +24,7 @@ class NestController extends Controller
protected NestDeletionService $nestDeletionService,
protected NestRepositoryInterface $repository,
protected NestUpdateService $nestUpdateService,
protected ViewFactory $view
protected ViewFactory $view,
) {
}

View File

@ -19,7 +19,7 @@ class NodeAutoDeployController extends Controller
public function __construct(
private ApiKeyRepository $repository,
private Encrypter $encrypter,
private KeyCreationService $keyCreationService
private KeyCreationService $keyCreationService,
) {
}
@ -31,7 +31,7 @@ class NodeAutoDeployController extends Controller
*/
public function __invoke(Request $request, Node $node): JsonResponse
{
/** @var \Pterodactyl\Models\ApiKey|null $key */
/** @var ApiKey|null $key */
$key = $this->repository->getApplicationKeys($request->user())
->filter(function (ApiKey $key) {
foreach ($key->getAttributes() as $permission => $value) {

View File

@ -29,7 +29,7 @@ class NodeViewController extends Controller
private NodeRepository $repository,
private ServerRepository $serverRepository,
private SoftwareVersionService $versionService,
private ViewFactory $view
private ViewFactory $view,
) {
}

View File

@ -44,7 +44,7 @@ class NodesController extends Controller
protected ServerRepositoryInterface $serverRepository,
protected NodeUpdateService $updateService,
protected SoftwareVersionService $versionService,
protected ViewFactory $view
protected ViewFactory $view,
) {
}

View File

@ -24,7 +24,7 @@ class CreateServerController extends Controller
private NestRepository $nestRepository,
private NodeRepository $nodeRepository,
private ServerCreationService $creationService,
private ViewFactory $view
private ViewFactory $view,
) {
}

View File

@ -26,7 +26,7 @@ class ServerTransferController extends Controller
private ConnectionInterface $connection,
private DaemonTransferRepository $daemonTransferRepository,
private NodeJWTService $nodeJWTService,
private NodeRepository $nodeRepository
private NodeRepository $nodeRepository,
) {
}

View File

@ -33,7 +33,7 @@ class ServerViewController extends Controller
private NodeRepository $nodeRepository,
private ServerRepository $repository,
private EnvironmentService $environmentService,
private ViewFactory $view
private ViewFactory $view,
) {
}
@ -118,7 +118,7 @@ class ServerViewController extends Controller
* Returns the base server management page, or an exception if the server
* is in a state that cannot be recovered from.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
*/
public function manage(Request $request, Server $server): View
{

View File

@ -57,14 +57,14 @@ class ServersController extends Controller
protected NestRepositoryInterface $nestRepository,
protected ServerConfigurationStructureService $serverConfigurationStructureService,
protected StartupModificationService $startupModificationService,
protected SuspensionService $suspensionService
protected SuspensionService $suspensionService,
) {
}
/**
* Update the details for a server.
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function setDetails(Request $request, Server $server): RedirectResponse
@ -81,8 +81,8 @@ class ServersController extends Controller
/**
* Toggles the installation status for a server.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws DisplayException
* @throws DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function toggleInstall(Server $server): RedirectResponse
@ -103,8 +103,8 @@ class ServersController extends Controller
/**
* Reinstalls the server with the currently assigned service.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws DisplayException
* @throws DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function reinstallServer(Server $server): RedirectResponse
@ -118,8 +118,8 @@ class ServersController extends Controller
/**
* Manage the suspension status for a server.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws DisplayException
* @throws DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function manageSuspension(Request $request, Server $server): RedirectResponse
@ -135,9 +135,9 @@ class ServersController extends Controller
/**
* Update the build configuration for a server.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
* @throws \Illuminate\Validation\ValidationException
* @throws ValidationException
*/
public function updateBuild(Request $request, Server $server): RedirectResponse
{
@ -159,7 +159,7 @@ class ServersController extends Controller
/**
* Start the server deletion process.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
* @throws \Throwable
*/
public function delete(Request $request, Server $server): RedirectResponse
@ -173,7 +173,7 @@ class ServersController extends Controller
/**
* Update the startup command as well as variables.
*
* @throws \Illuminate\Validation\ValidationException
* @throws ValidationException
*/
public function saveStartup(Request $request, Server $server): RedirectResponse
{
@ -220,7 +220,7 @@ class ServersController extends Controller
*/
public function resetDatabasePassword(Request $request, Server $server): Response
{
/** @var \Pterodactyl\Models\Database $database */
/** @var Database $database */
$database = $server->databases()->findOrFail($request->input('database'));
$this->databasePasswordService->handle($database);

View File

@ -22,7 +22,7 @@ class AdvancedController extends Controller
private ConfigRepository $config,
private Kernel $kernel,
private SettingsRepositoryInterface $settings,
private ViewFactory $view
private ViewFactory $view,
) {
}

View File

@ -25,7 +25,7 @@ class IndexController extends Controller
private Kernel $kernel,
private SettingsRepositoryInterface $settings,
private SoftwareVersionService $versionService,
private ViewFactory $view
private ViewFactory $view,
) {
}

View File

@ -27,7 +27,7 @@ class MailController extends Controller
private Encrypter $encrypter,
private Kernel $kernel,
private SettingsRepositoryInterface $settings,
private ViewFactory $view
private ViewFactory $view,
) {
}

View File

@ -36,7 +36,7 @@ class UserController extends Controller
protected Translator $translator,
protected UserUpdateService $updateService,
protected UserRepositoryInterface $repository,
protected ViewFactory $view
protected ViewFactory $view,
) {
}
@ -85,7 +85,7 @@ class UserController extends Controller
* Delete a user from the system.
*
* @throws \Exception
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
*/
public function delete(Request $request, User $user): RedirectResponse
{

View File

@ -25,7 +25,7 @@ class LocationController extends ApplicationApiController
public function __construct(
private LocationCreationService $creationService,
private LocationDeletionService $deletionService,
private LocationUpdateService $updateService
private LocationUpdateService $updateService,
) {
parent::__construct();
}

View File

@ -23,7 +23,7 @@ class AllocationController extends ApplicationApiController
*/
public function __construct(
private AssignmentService $assignmentService,
private AllocationDeletionService $deletionService
private AllocationDeletionService $deletionService,
) {
parent::__construct();
}

View File

@ -24,7 +24,7 @@ class NodeController extends ApplicationApiController
public function __construct(
private NodeCreationService $creationService,
private NodeDeletionService $deletionService,
private NodeUpdateService $updateService
private NodeUpdateService $updateService,
) {
parent::__construct();
}

View File

@ -22,7 +22,7 @@ class DatabaseController extends ApplicationApiController
*/
public function __construct(
private DatabaseManagementService $databaseManagementService,
private DatabasePasswordService $databasePasswordService
private DatabasePasswordService $databasePasswordService,
) {
parent::__construct();
}

View File

@ -22,7 +22,7 @@ class ServerController extends ApplicationApiController
*/
public function __construct(
private ServerCreationService $creationService,
private ServerDeletionService $deletionService
private ServerDeletionService $deletionService,
) {
parent::__construct();
}

View File

@ -17,7 +17,7 @@ class ServerDetailsController extends ApplicationApiController
*/
public function __construct(
private BuildModificationService $buildModificationService,
private DetailsModificationService $detailsModificationService
private DetailsModificationService $detailsModificationService,
) {
parent::__construct();
}

View File

@ -16,7 +16,7 @@ class ServerManagementController extends ApplicationApiController
*/
public function __construct(
private ReinstallServerService $reinstallServerService,
private SuspensionService $suspensionService
private SuspensionService $suspensionService,
) {
parent::__construct();
}

View File

@ -23,7 +23,7 @@ class UserController extends ApplicationApiController
public function __construct(
private UserCreationService $creationService,
private UserDeletionService $deletionService,
private UserUpdateService $updateService
private UserUpdateService $updateService,
) {
parent::__construct();
}

View File

@ -25,7 +25,7 @@ class ApiKeyController extends ClientApiController
/**
* Store a new API key for a user's account.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
*/
public function store(StoreApiKeyRequest $request): array
{
@ -54,7 +54,7 @@ class ApiKeyController extends ClientApiController
*/
public function delete(ClientApiRequest $request, string $identifier): JsonResponse
{
/** @var \Pterodactyl\Models\ApiKey $key */
/** @var ApiKey $key */
$key = $request->user()->apiKeys()
->where('key_type', ApiKey::TYPE_ACCOUNT)
->where('identifier', $identifier)

View File

@ -30,7 +30,7 @@ class BackupController extends ClientApiController
private DeleteBackupService $deleteBackupService,
private InitiateBackupService $initiateBackupService,
private DownloadLinkService $downloadLinkService,
private BackupRepository $repository
private BackupRepository $repository,
) {
parent::__construct();
}
@ -39,7 +39,7 @@ class BackupController extends ClientApiController
* Returns all the backups for a given server instance in a paginated
* result set.
*
* @throws \Illuminate\Auth\Access\AuthorizationException
* @throws AuthorizationException
*/
public function index(Request $request, Server $server): array
{
@ -93,7 +93,7 @@ class BackupController extends ClientApiController
* Toggles the lock status of a given backup for a server.
*
* @throws \Throwable
* @throws \Illuminate\Auth\Access\AuthorizationException
* @throws AuthorizationException
*/
public function toggleLock(Request $request, Server $server, Backup $backup): array
{
@ -115,7 +115,7 @@ class BackupController extends ClientApiController
/**
* Returns information about a single backup.
*
* @throws \Illuminate\Auth\Access\AuthorizationException
* @throws AuthorizationException
*/
public function view(Request $request, Server $server, Backup $backup): array
{
@ -156,7 +156,7 @@ class BackupController extends ClientApiController
* which the user is redirected to.
*
* @throws \Throwable
* @throws \Illuminate\Auth\Access\AuthorizationException
* @throws AuthorizationException
*/
public function download(Request $request, Server $server, Backup $backup): JsonResponse
{

View File

@ -26,7 +26,7 @@ class CommandController extends ClientApiController
/**
* Send a command to a running server.
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
* @throws DaemonConnectionException
*/
public function index(SendCommandRequest $request, Server $server): Response
{

View File

@ -24,7 +24,7 @@ class DatabaseController extends ClientApiController
public function __construct(
private DeployServerDatabaseService $deployDatabaseService,
private DatabaseManagementService $managementService,
private DatabasePasswordService $passwordService
private DatabasePasswordService $passwordService,
) {
parent::__construct();
}

View File

@ -30,7 +30,7 @@ class FileController extends ClientApiController
*/
public function __construct(
private NodeJWTService $jwtService,
private DaemonFileRepository $fileRepository
private DaemonFileRepository $fileRepository,
) {
parent::__construct();
}

View File

@ -16,7 +16,7 @@ class FileUploadController extends ClientApiController
* FileUploadController constructor.
*/
public function __construct(
private NodeJWTService $jwtService
private NodeJWTService $jwtService,
) {
parent::__construct();
}

View File

@ -24,7 +24,7 @@ class NetworkAllocationController extends ClientApiController
*/
public function __construct(
private FindAssignableAllocationService $assignableAllocationService,
private ServerRepository $serverRepository
private ServerRepository $serverRepository,
) {
parent::__construct();
}
@ -88,7 +88,7 @@ class NetworkAllocationController extends ClientApiController
* Set the notes for the allocation for a server.
*s.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
*/
public function store(NewAllocationRequest $request, Server $server): array
{
@ -111,7 +111,7 @@ class NetworkAllocationController extends ClientApiController
/**
* Delete an allocation from a server.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
*/
public function delete(DeleteAllocationRequest $request, Server $server, Allocation $allocation): JsonResponse
{

View File

@ -47,12 +47,12 @@ class ScheduleController extends ClientApiController
/**
* Store a new schedule for a server.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function store(StoreScheduleRequest $request, Server $server): array
{
/** @var \Pterodactyl\Models\Schedule $model */
/** @var Schedule $model */
$model = $this->repository->create([
'server_id' => $server->id,
'name' => $request->input('name'),
@ -95,7 +95,7 @@ class ScheduleController extends ClientApiController
/**
* Updates a given schedule with the new data provided.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
@ -165,7 +165,7 @@ class ScheduleController extends ClientApiController
/**
* Get the next run timestamp based on the cron data provided.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
*/
protected function getNextRunAt(Request $request): Carbon
{

View File

@ -26,7 +26,7 @@ class ScheduleTaskController extends ClientApiController
*/
public function __construct(
private ConnectionInterface $connection,
private TaskRepository $repository
private TaskRepository $repository,
) {
parent::__construct();
}
@ -35,7 +35,7 @@ class ScheduleTaskController extends ClientApiController
* Create a new task for a given schedule and store it in the database.
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Service\ServiceLimitExceededException
* @throws ServiceLimitExceededException
*/
public function store(StoreTaskRequest $request, Server $server, Schedule $schedule): array
{
@ -48,10 +48,10 @@ class ScheduleTaskController extends ClientApiController
throw new HttpForbiddenException("A backup task cannot be created when the server's backup limit is set to 0.");
}
/** @var \Pterodactyl\Models\Task|null $lastTask */
/** @var Task|null $lastTask */
$lastTask = $schedule->tasks()->orderByDesc('sequence_id')->first();
/** @var \Pterodactyl\Models\Task $task */
/** @var Task $task */
$task = $this->connection->transaction(function () use ($request, $schedule, $lastTask) {
$sequenceId = ($lastTask->sequence_id ?? 0) + 1;
$requestSequenceId = $request->integer('sequence_id', $sequenceId);

View File

@ -21,7 +21,7 @@ class SettingsController extends ClientApiController
*/
public function __construct(
private ServerRepository $repository,
private ReinstallServerService $reinstallServerService
private ReinstallServerService $reinstallServerService,
) {
parent::__construct();
}

View File

@ -19,7 +19,7 @@ class StartupController extends ClientApiController
*/
public function __construct(
private StartupCommandService $startupCommandService,
private ServerVariableRepository $repository
private ServerVariableRepository $repository,
) {
parent::__construct();
}

View File

@ -27,7 +27,7 @@ class SubuserController extends ClientApiController
public function __construct(
private SubuserRepository $repository,
private SubuserCreationService $creationService,
private DaemonServerRepository $serverRepository
private DaemonServerRepository $serverRepository,
) {
parent::__construct();
}

View File

@ -19,7 +19,7 @@ class WebsocketController extends ClientApiController
*/
public function __construct(
private NodeJWTService $jwtService,
private GetUserPermissionsService $permissionsService
private GetUserPermissionsService $permissionsService,
) {
parent::__construct();
}

View File

@ -20,7 +20,7 @@ class TwoFactorController extends ClientApiController
public function __construct(
private ToggleTwoFactorService $toggleTwoFactorService,
private TwoFactorSetupService $setupService,
private ValidationFactory $validation
private ValidationFactory $validation,
) {
parent::__construct();
}

View File

@ -27,7 +27,7 @@ class ActivityProcessingController extends Controller
$logs = [];
foreach ($request->input('data') as $datum) {
/** @var \Pterodactyl\Models\Server|null $server */
/** @var Server|null $server */
$server = $servers->get($datum['server']);
if (is_null($server) || !Str::startsWith($datum['event'], 'server:')) {
continue;

View File

@ -42,7 +42,7 @@ class BackupRemoteUploadController extends Controller
throw new BadRequestHttpException('A non-empty "size" query parameter must be provided.');
}
/** @var \Pterodactyl\Models\Backup $model */
/** @var Backup $model */
$model = Backup::query()
->where('uuid', $backup)
->firstOrFail();

View File

@ -35,7 +35,7 @@ class BackupStatusController extends Controller
/** @var \Pterodactyl\Models\Node $node */
$node = $request->attributes->get('node');
/** @var \Pterodactyl\Models\Backup $model */
/** @var Backup $model */
$model = Backup::query()
->where('uuid', $backup)
->firstOrFail();
@ -92,7 +92,7 @@ class BackupStatusController extends Controller
*/
public function restore(Request $request, string $backup): JsonResponse
{
/** @var \Pterodactyl\Models\Backup $model */
/** @var Backup $model */
$model = Backup::query()->where('uuid', $backup)->firstOrFail();
$model->server->update(['status' => null]);
@ -110,7 +110,7 @@ class BackupStatusController extends Controller
* the given backup.
*
* @throws \Exception
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
*/
protected function completeMultipartUpload(Backup $backup, S3Filesystem $adapter, bool $successful, ?array $parts): void
{

View File

@ -22,7 +22,7 @@ class ServerDetailsController extends Controller
protected ConnectionInterface $connection,
private ServerRepository $repository,
private ServerConfigurationStructureService $configurationStructureService,
private EggConfigurationService $eggConfigurationService
private EggConfigurationService $eggConfigurationService,
) {
}
@ -90,7 +90,7 @@ class ServerDetailsController extends Controller
->get();
$this->connection->transaction(function () use ($node, $servers) {
/** @var \Pterodactyl\Models\Server $server */
/** @var Server $server */
foreach ($servers as $server) {
/** @var \Pterodactyl\Models\ActivityLog|null $activity */
$activity = $server->activity->first();

View File

@ -22,7 +22,7 @@ class ServerTransferController extends Controller
public function __construct(
private ConnectionInterface $connection,
private ServerRepository $repository,
private DaemonServerRepository $daemonServerRepository
private DaemonServerRepository $daemonServerRepository,
) {
}

View File

@ -49,9 +49,9 @@ abstract class AbstractLoginController extends Controller
/**
* Get the failed login response instance.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
*/
protected function sendFailedLoginResponse(Request $request, Authenticatable $user = null, string $message = null)
protected function sendFailedLoginResponse(Request $request, ?Authenticatable $user = null, ?string $message = null)
{
$this->incrementLoginAttempts($request);
$this->fireFailedLoginEvent($user, [
@ -91,7 +91,7 @@ abstract class AbstractLoginController extends Controller
/**
* Determine if the user is logging in using an email or username.
*/
protected function getField(string $input = null): string
protected function getField(?string $input = null): string
{
return ($input && str_contains($input, '@')) ? 'email' : 'username';
}
@ -99,7 +99,7 @@ abstract class AbstractLoginController extends Controller
/**
* Fire a failed login event.
*/
protected function fireFailedLoginEvent(Authenticatable $user = null, array $credentials = [])
protected function fireFailedLoginEvent(?Authenticatable $user = null, array $credentials = [])
{
Event::dispatch(new Failed('auth', $user, $credentials));
}

View File

@ -24,7 +24,7 @@ class LoginCheckpointController extends AbstractLoginController
public function __construct(
private Encrypter $encrypter,
private Google2FA $google2FA,
private ValidationFactory $validation
private ValidationFactory $validation,
) {
parent::__construct();
}
@ -56,7 +56,7 @@ class LoginCheckpointController extends AbstractLoginController
}
try {
/** @var \Pterodactyl\Models\User $user */
/** @var User $user */
$user = User::query()->findOrFail($details['user_id']);
} catch (ModelNotFoundException) {
$this->sendFailedLoginResponse($request, null, self::TOKEN_EXPIRED_MESSAGE);

View File

@ -48,7 +48,7 @@ class LoginController extends AbstractLoginController
try {
$username = $request->input('user');
/** @var \Pterodactyl\Models\User $user */
/** @var User $user */
$user = User::query()->where($this->getField($username), $username)->firstOrFail();
} catch (ModelNotFoundException) {
$this->sendFailedLoginResponse($request);

View File

@ -31,14 +31,14 @@ class ResetPasswordController extends Controller
public function __construct(
private Dispatcher $dispatcher,
private Hasher $hasher,
private UserRepositoryInterface $userRepository
private UserRepositoryInterface $userRepository,
) {
}
/**
* Reset the given user's password.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayException
*/
public function __invoke(ResetPasswordRequest $request): JsonResponse
{

View File

@ -14,7 +14,7 @@ class IndexController extends Controller
*/
public function __construct(
protected ServerRepositoryInterface $repository,
protected ViewFactory $view
protected ViewFactory $view,
) {
}

View File

@ -15,7 +15,7 @@ class ServerInstalled
*/
public function handle(Request $request, \Closure $next): mixed
{
/** @var \Pterodactyl\Models\Server|null $server */
/** @var Server|null $server */
$server = $request->route()->parameter('server');
if (!$server instanceof Server) {

View File

@ -10,7 +10,7 @@ class AdminAuthenticate
/**
* Handle an incoming request.
*
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
* @throws AccessDeniedHttpException
*/
public function handle(Request $request, \Closure $next): mixed
{

View File

@ -15,11 +15,11 @@ class AuthenticateIPAccess
* Determine if a request IP has permission to access the API.
*
* @throws \Exception
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
* @throws AccessDeniedHttpException
*/
public function handle(Request $request, \Closure $next): mixed
{
/** @var \Laravel\Sanctum\TransientToken|\Pterodactyl\Models\ApiKey $token */
/** @var TransientToken|\Pterodactyl\Models\ApiKey $token */
$token = $request->user()->currentAccessToken();
// If this is a stateful request just push the request through to the next

View File

@ -31,7 +31,7 @@ class ResourceBelongsToServer
throw new \InvalidArgumentException('This middleware cannot be used in a context that is missing a server in the parameters.');
}
/** @var \Pterodactyl\Models\Server $server */
/** @var Server $server */
$server = $request->route()->parameter('server');
$exception = new NotFoundHttpException('The requested resource was not found for this server.');
foreach ($params as $key => $model) {

View File

@ -29,7 +29,7 @@ class DaemonAuthenticate
/**
* Check if a request from the daemon can be properly attributed back to a single node instance.
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
* @throws HttpException
*/
public function handle(Request $request, \Closure $next): mixed
{

View File

@ -17,7 +17,7 @@ class RedirectIfAuthenticated
/**
* Handle an incoming request.
*/
public function handle(Request $request, \Closure $next, string $guard = null): mixed
public function handle(Request $request, \Closure $next, ?string $guard = null): mixed
{
if ($this->authManager->guard($guard)->check()) {
return redirect()->route('index');

View File

@ -31,7 +31,7 @@ class RequireTwoFactorAuthentication
* order to perform actions. If so, we check the level at which it is required (all users
* or just admins) and then check if the user has enabled it for their account.
*
* @throws \Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException
* @throws TwoFactorAuthRequiredException
*/
public function handle(Request $request, \Closure $next): mixed
{

View File

@ -28,7 +28,7 @@ abstract class AdminFormRequest extends FormRequest
* Return only the fields that we are interested in from the request.
* This will include empty fields as a null value.
*/
public function normalize(array $only = null): array
public function normalize(?array $only = null): array
{
return $this->only($only ?? array_keys($this->rules()));
}

View File

@ -27,7 +27,7 @@ class MailSettingsFormRequest extends AdminFormRequest
* Override the default normalization function for this type of request
* as we need to accept empty values on the keys.
*/
public function normalize(array $only = null): array
public function normalize(?array $only = null): array
{
$keys = array_flip(array_keys($this->rules()));

View File

@ -29,7 +29,7 @@ abstract class ApplicationApiRequest extends FormRequest
* Determine if the current user is authorized to perform
* the requested action against the API.
*
* @throws \Pterodactyl\Exceptions\PterodactylException
* @throws PterodactylException
*/
public function authorize(): bool
{

View File

@ -15,7 +15,7 @@ class StoreNodeRequest extends ApplicationApiRequest
/**
* Validation rules to apply to this request.
*/
public function rules(array $rules = null): array
public function rules(?array $rules = null): array
{
return collect($rules ?? Node::getRules())->only([
'public',

View File

@ -10,7 +10,7 @@ class UpdateNodeRequest extends StoreNodeRequest
* Apply validation rules to this request. Uses the parent class rules()
* function but passes in the rules for updating rather than creating.
*/
public function rules(array $rules = null): array
public function rules(?array $rules = null): array
{
$node = $this->route()->parameter('node')->id;

View File

@ -15,7 +15,7 @@ class StoreUserRequest extends ApplicationApiRequest
/**
* Return the validation rules for this request.
*/
public function rules(array $rules = null): array
public function rules(?array $rules = null): array
{
$rules = $rules ?? User::getRules();

View File

@ -9,7 +9,7 @@ class UpdateUserRequest extends StoreUserRequest
/**
* Return the validation rules for this request.
*/
public function rules(array $rules = null): array
public function rules(?array $rules = null): array
{
$userId = $this->parameter('user', User::class)->id;

View File

@ -11,7 +11,7 @@ use Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException;
class UpdateEmailRequest extends ClientApiRequest
{
/**
* @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException
* @throws InvalidPasswordProvidedException
*/
public function authorize(): bool
{

View File

@ -10,7 +10,7 @@ use Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException;
class UpdatePasswordRequest extends ClientApiRequest
{
/**
* @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException
* @throws InvalidPasswordProvidedException
*/
public function authorize(): bool
{

View File

@ -18,7 +18,7 @@ class SetDockerImageRequest extends ClientApiRequest implements ClientPermission
public function rules(): array
{
/** @var \Pterodactyl\Models\Server $server */
/** @var Server $server */
$server = $this->route()->parameter('server');
Assert::isInstanceOf($server, Server::class);

View File

@ -63,8 +63,8 @@ abstract class SubuserRequest extends ClientApiRequest
// Otherwise, get the current subuser's permission set, and ensure that the
// permissions they are trying to assign are not _more_ than the ones they
// already have.
/** @var \Pterodactyl\Models\Subuser|null $subuser */
/** @var \Pterodactyl\Services\Servers\GetUserPermissionsService $service */
/** @var Subuser|null $subuser */
/** @var GetUserPermissionsService $service */
$service = $this->container->make(GetUserPermissionsService::class);
if (count(array_diff($permissions, $service->handle($server, $user))) > 0) {

View File

@ -37,7 +37,7 @@ class RunTaskJob extends Job implements ShouldQueue
public function handle(
DaemonCommandRepository $commandRepository,
InitiateBackupService $backupService,
DaemonPowerRepository $powerRepository
DaemonPowerRepository $powerRepository,
) {
// Do not process a task that is not set to active, unless it's been manually triggered.
if (!$this->task->schedule->is_active && !$this->manualRun) {
@ -88,7 +88,7 @@ class RunTaskJob extends Job implements ShouldQueue
/**
* Handle a failure while sending the action to the daemon or otherwise processing the job.
*/
public function failed(\Exception $exception = null)
public function failed(?\Exception $exception = null)
{
$this->markTaskNotQueued();
$this->markScheduleComplete();
@ -99,7 +99,7 @@ class RunTaskJob extends Job implements ShouldQueue
*/
private function queueNextTask()
{
/** @var \Pterodactyl\Models\Task|null $nextTask */
/** @var Task|null $nextTask */
$nextTask = Task::query()->where('schedule_id', $this->task->schedule_id)
->orderBy('sequence_id', 'asc')
->where('sequence_id', '>', $this->task->sequence_id)

View File

@ -24,11 +24,11 @@ use Illuminate\Database\Eloquent\Model as IlluminateModel;
* @property int|null $actor_id
* @property int|null $api_key_id
* @property \Illuminate\Support\Collection|null $properties
* @property \Carbon\Carbon $timestamp
* @property Carbon $timestamp
* @property IlluminateModel|\Eloquent $actor
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\ActivityLogSubject[] $subjects
* @property int|null $subjects_count
* @property \Pterodactyl\Models\ApiKey|null $apiKey
* @property ApiKey|null $apiKey
*
* @method static Builder|ActivityLog forActor(\Illuminate\Database\Eloquent\Model $actor)
* @method static Builder|ActivityLog forEvent(string $action)

View File

@ -11,7 +11,7 @@ use Illuminate\Database\Eloquent\Relations\Pivot;
* @property int $activity_log_id
* @property int $subject_id
* @property string $subject_type
* @property \Pterodactyl\Models\ActivityLog|null $activityLog
* @property ActivityLog|null $activityLog
* @property \Illuminate\Database\Eloquent\Model|\Eloquent $subject
*
* @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject newModelQuery()

View File

@ -3,6 +3,7 @@
namespace Pterodactyl\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Factories\HasFactory;
/**
* Pterodactyl\Models\Allocation.
@ -18,8 +19,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property \Carbon\Carbon|null $updated_at
* @property string $alias
* @property bool $has_alias
* @property \Pterodactyl\Models\Server|null $server
* @property \Pterodactyl\Models\Node $node
* @property Server|null $server
* @property Node $node
* @property string $hashid
*
* @method static \Database\Factories\AllocationFactory factory(...$parameters)
@ -40,6 +41,9 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
*/
class Allocation extends Model
{
/** @use HasFactory<\Database\Factories\AllocationFactory> */
use HasFactory;
/**
* The resource name for this model when it is transformed into an
* API representation using fractal.
@ -74,9 +78,6 @@ class Allocation extends Model
'notes' => 'nullable|string|max:256',
];
/**
* {@inheritDoc}
*/
public function getRouteKeyName(): string
{
return $this->getKeyName();

View File

@ -6,6 +6,7 @@ use Illuminate\Support\Str;
use Webmozart\Assert\Assert;
use Pterodactyl\Services\Acl\Api\AdminAcl;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Factories\HasFactory;
/**
* Pterodactyl\Models\ApiKey.
@ -30,8 +31,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property int $r_eggs
* @property int $r_database_hosts
* @property int $r_server_databases
* @property \Pterodactyl\Models\User $tokenable
* @property \Pterodactyl\Models\User $user
* @property User $tokenable
* @property User $user
*
* @method static \Database\Factories\ApiKeyFactory factory(...$parameters)
* @method static \Illuminate\Database\Eloquent\Builder|ApiKey newModelQuery()
@ -61,6 +62,9 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
*/
class ApiKey extends Model
{
/** @use HasFactory<\Database\Factories\ApiKeyFactory> */
use HasFactory;
/**
* The resource name for this model when it is transformed into an
* API representation using fractal.

Some files were not shown because too many files have changed in this diff Show More