mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-25 18:42:31 +01:00
chore: update composer dependencies (#5198)
Signed-off-by: Matthew Penner <me@matthewp.io>
This commit is contained in:
parent
fbc24d27ee
commit
8ca098940a
8
.github/workflows/build.yaml
vendored
8
.github/workflows/build.yaml
vendored
@ -14,19 +14,21 @@ jobs:
|
|||||||
ui:
|
ui:
|
||||||
name: UI
|
name: UI
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16]
|
node-version: [16]
|
||||||
steps:
|
steps:
|
||||||
- name: Code Checkout
|
- name: Code Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: "yarn"
|
cache: yarn
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
|
16
.github/workflows/ci.yaml
vendored
16
.github/workflows/ci.yaml
vendored
@ -14,11 +14,18 @@ jobs:
|
|||||||
tests:
|
tests:
|
||||||
name: Tests
|
name: Tests
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php: [8.1, 8.2]
|
php: [8.2, 8.3]
|
||||||
database: ["mariadb:10.2", "mysql:8"]
|
database:
|
||||||
|
- mariadb:10.5
|
||||||
|
- mariadb:10.11
|
||||||
|
- mariadb:11.5
|
||||||
|
- mysql:8
|
||||||
|
- mysql:9
|
||||||
services:
|
services:
|
||||||
database:
|
database:
|
||||||
image: ${{ matrix.database }}
|
image: ${{ matrix.database }}
|
||||||
@ -27,10 +34,9 @@ jobs:
|
|||||||
MYSQL_DATABASE: testing
|
MYSQL_DATABASE: testing
|
||||||
ports:
|
ports:
|
||||||
- 3306
|
- 3306
|
||||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
||||||
steps:
|
steps:
|
||||||
- name: Code Checkout
|
- name: Code Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Get cache directory
|
- name: Get cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
@ -38,7 +44,7 @@ jobs:
|
|||||||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Cache
|
- name: Cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
|
||||||
|
15
.github/workflows/docker.yaml
vendored
15
.github/workflows/docker.yaml
vendored
@ -18,13 +18,16 @@ jobs:
|
|||||||
name: Push
|
name: Push
|
||||||
runs-on: ubuntu-20.04
|
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'))"
|
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:
|
steps:
|
||||||
- name: Code checkout
|
- name: Code checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Docker metadata
|
- name: Docker metadata
|
||||||
id: docker_meta
|
id: docker_meta
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ghcr.io/pterodactyl/panel
|
images: ghcr.io/pterodactyl/panel
|
||||||
flavor: |
|
flavor: |
|
||||||
@ -35,13 +38,13 @@ jobs:
|
|||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
|
|
||||||
- name: Setup QEMU
|
- name: Setup QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
- name: Setup Docker buildx
|
- name: Setup Docker buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v3
|
||||||
if: "github.event_name != 'pull_request'"
|
if: "github.event_name != 'pull_request'"
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
@ -56,7 +59,7 @@ jobs:
|
|||||||
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:1}',/" config/app.php
|
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:1}',/" config/app.php
|
||||||
|
|
||||||
- name: Build and Push
|
- name: Build and Push
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
|
6
.github/workflows/lint.yaml
vendored
6
.github/workflows/lint.yaml
vendored
@ -14,14 +14,16 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
name: Lint
|
name: Lint
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
- name: Code Checkout
|
- name: Code Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: "8.1"
|
php-version: "8.2"
|
||||||
extensions: bcmath, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
|
extensions: bcmath, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
|
||||||
tools: composer:v2
|
tools: composer:v2
|
||||||
coverage: none
|
coverage: none
|
||||||
|
10
.github/workflows/release.yaml
vendored
10
.github/workflows/release.yaml
vendored
@ -9,15 +9,17 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
permissions:
|
||||||
|
contents: write # write is required to create releases and push.
|
||||||
steps:
|
steps:
|
||||||
- name: Code checkout
|
- name: Code checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 16
|
||||||
cache: "yarn"
|
cache: yarn
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
@ -58,7 +60,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v2
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -21,7 +21,9 @@ public/assets/manifest.json
|
|||||||
# For local development with docker
|
# For local development with docker
|
||||||
# Remove if we ever put the Dockerfile in the repo
|
# Remove if we ever put the Dockerfile in the repo
|
||||||
.dockerignore
|
.dockerignore
|
||||||
docker-compose.yml
|
docker-compose.*
|
||||||
|
!docker-compose.example.yml
|
||||||
|
!docker-compose.example.yaml
|
||||||
|
|
||||||
# for image related files
|
# for image related files
|
||||||
misc
|
misc
|
||||||
@ -33,4 +35,3 @@ resources/lang/locales.js
|
|||||||
/public/build
|
/public/build
|
||||||
/public/hot
|
/public/hot
|
||||||
result
|
result
|
||||||
docker-compose.yaml
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use PhpCsFixer\Config;
|
use PhpCsFixer\Config;
|
||||||
use PhpCsFixer\Finder;
|
use PhpCsFixer\Finder;
|
||||||
|
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
|
||||||
|
|
||||||
$finder = (new Finder())
|
$finder = (new Finder())
|
||||||
->in(__DIR__)
|
->in(__DIR__)
|
||||||
@ -14,6 +15,7 @@ $finder = (new Finder())
|
|||||||
->notName(['_ide_helper*']);
|
->notName(['_ide_helper*']);
|
||||||
|
|
||||||
return (new Config())
|
return (new Config())
|
||||||
|
->setParallelConfig(ParallelConfigFactory::detect())
|
||||||
->setRiskyAllowed(true)
|
->setRiskyAllowed(true)
|
||||||
->setFinder($finder)
|
->setFinder($finder)
|
||||||
->setRules([
|
->setRules([
|
||||||
|
@ -10,7 +10,7 @@ RUN yarn install --frozen-lockfile \
|
|||||||
|
|
||||||
# Stage 1:
|
# Stage 1:
|
||||||
# Build the actual container with all of the needed PHP dependencies that will run the application.
|
# 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
|
WORKDIR /app
|
||||||
COPY . ./
|
COPY . ./
|
||||||
COPY --from=0 /app/public/assets ./public/assets
|
COPY --from=0 /app/public/assets ./public/assets
|
||||||
|
@ -20,7 +20,7 @@ class DeleteLocationCommand extends Command
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private LocationDeletionService $deletionService,
|
private LocationDeletionService $deletionService,
|
||||||
private LocationRepositoryInterface $repository
|
private LocationRepositoryInterface $repository,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class CleanServiceBackupFilesCommand extends Command
|
|||||||
|
|
||||||
collect($files)->each(function (\SplFileInfo $file) {
|
collect($files)->each(function (\SplFileInfo $file) {
|
||||||
$lastModified = Carbon::createFromTimestamp($this->disk->lastModified($file->getPath()));
|
$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->disk->delete($file->getPath());
|
||||||
$this->info(trans('command/messages.maintenance.deleting_service_backup', ['file' => $file->getFilename()]));
|
$this->info(trans('command/messages.maintenance.deleting_service_backup', ['file' => $file->getFilename()]));
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class NodeConfigurationCommand extends Command
|
|||||||
{
|
{
|
||||||
$column = ctype_digit((string) $this->argument('node')) ? 'id' : 'uuid';
|
$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 () {
|
$node = Node::query()->where($column, $this->argument('node'))->firstOr(function () {
|
||||||
$this->error('The selected node does not exist.');
|
$this->error('The selected node does not exist.');
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class BulkPowerActionCommand extends Command
|
|||||||
/**
|
/**
|
||||||
* Handle the bulk power request.
|
* Handle the bulk power request.
|
||||||
*
|
*
|
||||||
* @throws \Illuminate\Validation\ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
@ -133,7 +133,7 @@ class UpgradeCommand extends Command
|
|||||||
|
|
||||||
/** @var \Illuminate\Foundation\Application $app */
|
/** @var \Illuminate\Foundation\Application $app */
|
||||||
$app = require __DIR__ . '/../../../bootstrap/app.php';
|
$app = require __DIR__ . '/../../../bootstrap/app.php';
|
||||||
/** @var \Pterodactyl\Console\Kernel $kernel */
|
/** @var Kernel $kernel */
|
||||||
$kernel = $app->make(Kernel::class);
|
$kernel = $app->make(Kernel::class);
|
||||||
$kernel->bootstrap();
|
$kernel->bootstrap();
|
||||||
$this->setLaravel($app);
|
$this->setLaravel($app);
|
||||||
|
@ -11,5 +11,5 @@ interface HashidsInterface extends VendorHashidsInterface
|
|||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function decodeFirst(string $encoded, string $default = null): mixed;
|
public function decodeFirst(string $encoded, ?string $default = null): mixed;
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,14 @@ interface NestRepositoryInterface extends RepositoryInterface
|
|||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @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.
|
* Return a nest or all nests and the count of eggs and servers for that nest.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @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.
|
* Return a nest along with its associated eggs and the servers relation on those eggs.
|
||||||
|
@ -16,12 +16,12 @@ interface ServerRepositoryInterface extends RepositoryInterface
|
|||||||
/**
|
/**
|
||||||
* Return a collection of servers with their associated data for rebuild operations.
|
* 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.
|
* 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.
|
* Return a server model and all variables associated with the server.
|
||||||
|
@ -10,7 +10,7 @@ interface SettingsRepositoryInterface extends RepositoryInterface
|
|||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @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.
|
* Retrieve a persistent setting from the database.
|
||||||
|
@ -72,7 +72,7 @@ class DisplayException extends PterodactylException implements HttpExceptionInte
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$logger = Container::getInstance()->make(LoggerInterface::class);
|
$logger = Container::getInstance()->make(LoggerInterface::class);
|
||||||
} catch (Exception) {
|
} catch (\Exception) {
|
||||||
throw $this->getPrevious();
|
throw $this->getPrevious();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ class HttpForbiddenException extends HttpException
|
|||||||
/**
|
/**
|
||||||
* HttpForbiddenException constructor.
|
* 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);
|
parent::__construct(Response::HTTP_FORBIDDEN, $message, $previous);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ class ServerStateConflictException extends ConflictHttpException
|
|||||||
* Exception thrown when the server is in an unsupported state for API access or
|
* Exception thrown when the server is in an unsupported state for API access or
|
||||||
* certain operations within the codebase.
|
* 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.';
|
$message = 'This server is currently in an unsupported state, please try again later.';
|
||||||
if ($server->isSuspended()) {
|
if ($server->isSuspended()) {
|
||||||
|
@ -11,7 +11,7 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept
|
|||||||
/**
|
/**
|
||||||
* TwoFactorAuthRequiredException constructor.
|
* 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);
|
parent::__construct(Response::HTTP_BAD_REQUEST, 'Two-factor authentication is required on this account in order to access this endpoint.', $previous);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ class ServiceLimitExceededException extends DisplayException
|
|||||||
* Exception thrown when something goes over a defined limit, such as allocated
|
* Exception thrown when something goes over a defined limit, such as allocated
|
||||||
* ports, tasks, databases, etc.
|
* 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);
|
parent::__construct($message, $previous, self::LEVEL_WARNING);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class BackupManager
|
|||||||
/**
|
/**
|
||||||
* Returns a backup adapter instance.
|
* 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());
|
return $this->get($name ?: $this->getDefaultAdapter());
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ class DynamicDatabaseConnection
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
protected ConfigRepository $config,
|
protected ConfigRepository $config,
|
||||||
protected Encrypter $encrypter,
|
protected Encrypter $encrypter,
|
||||||
protected DatabaseHostRepositoryInterface $repository
|
protected DatabaseHostRepositoryInterface $repository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,10 +7,7 @@ use Pterodactyl\Contracts\Extensions\HashidsInterface;
|
|||||||
|
|
||||||
class Hashids extends VendorHashids implements HashidsInterface
|
class Hashids extends VendorHashids implements HashidsInterface
|
||||||
{
|
{
|
||||||
/**
|
public function decodeFirst(string $encoded, ?string $default = null): mixed
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function decodeFirst(string $encoded, string $default = null): mixed
|
|
||||||
{
|
{
|
||||||
$result = $this->decode($encoded);
|
$result = $this->decode($encoded);
|
||||||
if (!is_array($result)) {
|
if (!is_array($result)) {
|
||||||
|
@ -6,7 +6,7 @@ use Pterodactyl\Models\ApiKey;
|
|||||||
use Laravel\Sanctum\NewAccessToken as SanctumAccessToken;
|
use Laravel\Sanctum\NewAccessToken as SanctumAccessToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property \Pterodactyl\Models\ApiKey $accessToken
|
* @property ApiKey $accessToken
|
||||||
*/
|
*/
|
||||||
class NewAccessToken extends SanctumAccessToken
|
class NewAccessToken extends SanctumAccessToken
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ class DatabaseController extends Controller
|
|||||||
private HostDeletionService $deletionService,
|
private HostDeletionService $deletionService,
|
||||||
private HostUpdateService $updateService,
|
private HostUpdateService $updateService,
|
||||||
private LocationRepositoryInterface $locationRepository,
|
private LocationRepositoryInterface $locationRepository,
|
||||||
private ViewFactory $view
|
private ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class LocationController extends Controller
|
|||||||
protected LocationDeletionService $deletionService,
|
protected LocationDeletionService $deletionService,
|
||||||
protected LocationRepositoryInterface $repository,
|
protected LocationRepositoryInterface $repository,
|
||||||
protected LocationUpdateService $updateService,
|
protected LocationUpdateService $updateService,
|
||||||
protected ViewFactory $view
|
protected ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ class LocationController extends Controller
|
|||||||
* Delete a location from the system.
|
* Delete a location from the system.
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
*/
|
*/
|
||||||
public function delete(Location $location): RedirectResponse
|
public function delete(Location $location): RedirectResponse
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@ class MountController extends Controller
|
|||||||
protected NestRepositoryInterface $nestRepository,
|
protected NestRepositoryInterface $nestRepository,
|
||||||
protected LocationRepositoryInterface $locationRepository,
|
protected LocationRepositoryInterface $locationRepository,
|
||||||
protected MountRepository $repository,
|
protected MountRepository $repository,
|
||||||
protected ViewFactory $view
|
protected ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class EggController extends Controller
|
|||||||
protected EggRepositoryInterface $repository,
|
protected EggRepositoryInterface $repository,
|
||||||
protected EggUpdateService $updateService,
|
protected EggUpdateService $updateService,
|
||||||
protected NestRepositoryInterface $nestRepository,
|
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.
|
* 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 ?? ''));
|
$data = array_map(fn ($value) => trim($value), explode("\n", $input ?? ''));
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class EggScriptController extends Controller
|
|||||||
protected AlertsMessageBag $alert,
|
protected AlertsMessageBag $alert,
|
||||||
protected EggRepositoryInterface $repository,
|
protected EggRepositoryInterface $repository,
|
||||||
protected InstallScriptService $installScriptService,
|
protected InstallScriptService $installScriptService,
|
||||||
protected ViewFactory $view
|
protected ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class EggShareController extends Controller
|
|||||||
protected AlertsMessageBag $alert,
|
protected AlertsMessageBag $alert,
|
||||||
protected EggExporterService $exporterService,
|
protected EggExporterService $exporterService,
|
||||||
protected EggImporterService $importerService,
|
protected EggImporterService $importerService,
|
||||||
protected EggUpdateImporterService $updateImporterService
|
protected EggUpdateImporterService $updateImporterService,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class EggVariableController extends Controller
|
|||||||
protected VariableUpdateService $updateService,
|
protected VariableUpdateService $updateService,
|
||||||
protected EggRepositoryInterface $repository,
|
protected EggRepositoryInterface $repository,
|
||||||
protected EggVariableRepositoryInterface $variableRepository,
|
protected EggVariableRepositoryInterface $variableRepository,
|
||||||
protected ViewFactory $view
|
protected ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class NestController extends Controller
|
|||||||
protected NestDeletionService $nestDeletionService,
|
protected NestDeletionService $nestDeletionService,
|
||||||
protected NestRepositoryInterface $repository,
|
protected NestRepositoryInterface $repository,
|
||||||
protected NestUpdateService $nestUpdateService,
|
protected NestUpdateService $nestUpdateService,
|
||||||
protected ViewFactory $view
|
protected ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class NodeAutoDeployController extends Controller
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private ApiKeyRepository $repository,
|
private ApiKeyRepository $repository,
|
||||||
private Encrypter $encrypter,
|
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
|
public function __invoke(Request $request, Node $node): JsonResponse
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\ApiKey|null $key */
|
/** @var ApiKey|null $key */
|
||||||
$key = $this->repository->getApplicationKeys($request->user())
|
$key = $this->repository->getApplicationKeys($request->user())
|
||||||
->filter(function (ApiKey $key) {
|
->filter(function (ApiKey $key) {
|
||||||
foreach ($key->getAttributes() as $permission => $value) {
|
foreach ($key->getAttributes() as $permission => $value) {
|
||||||
|
@ -29,7 +29,7 @@ class NodeViewController extends Controller
|
|||||||
private NodeRepository $repository,
|
private NodeRepository $repository,
|
||||||
private ServerRepository $serverRepository,
|
private ServerRepository $serverRepository,
|
||||||
private SoftwareVersionService $versionService,
|
private SoftwareVersionService $versionService,
|
||||||
private ViewFactory $view
|
private ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class NodesController extends Controller
|
|||||||
protected ServerRepositoryInterface $serverRepository,
|
protected ServerRepositoryInterface $serverRepository,
|
||||||
protected NodeUpdateService $updateService,
|
protected NodeUpdateService $updateService,
|
||||||
protected SoftwareVersionService $versionService,
|
protected SoftwareVersionService $versionService,
|
||||||
protected ViewFactory $view
|
protected ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class CreateServerController extends Controller
|
|||||||
private NestRepository $nestRepository,
|
private NestRepository $nestRepository,
|
||||||
private NodeRepository $nodeRepository,
|
private NodeRepository $nodeRepository,
|
||||||
private ServerCreationService $creationService,
|
private ServerCreationService $creationService,
|
||||||
private ViewFactory $view
|
private ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class ServerTransferController extends Controller
|
|||||||
private ConnectionInterface $connection,
|
private ConnectionInterface $connection,
|
||||||
private DaemonTransferRepository $daemonTransferRepository,
|
private DaemonTransferRepository $daemonTransferRepository,
|
||||||
private NodeJWTService $nodeJWTService,
|
private NodeJWTService $nodeJWTService,
|
||||||
private NodeRepository $nodeRepository
|
private NodeRepository $nodeRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class ServerViewController extends Controller
|
|||||||
private NodeRepository $nodeRepository,
|
private NodeRepository $nodeRepository,
|
||||||
private ServerRepository $repository,
|
private ServerRepository $repository,
|
||||||
private EnvironmentService $environmentService,
|
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
|
* Returns the base server management page, or an exception if the server
|
||||||
* is in a state that cannot be recovered from.
|
* is in a state that cannot be recovered from.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
*/
|
*/
|
||||||
public function manage(Request $request, Server $server): View
|
public function manage(Request $request, Server $server): View
|
||||||
{
|
{
|
||||||
|
@ -57,14 +57,14 @@ class ServersController extends Controller
|
|||||||
protected NestRepositoryInterface $nestRepository,
|
protected NestRepositoryInterface $nestRepository,
|
||||||
protected ServerConfigurationStructureService $serverConfigurationStructureService,
|
protected ServerConfigurationStructureService $serverConfigurationStructureService,
|
||||||
protected StartupModificationService $startupModificationService,
|
protected StartupModificationService $startupModificationService,
|
||||||
protected SuspensionService $suspensionService
|
protected SuspensionService $suspensionService,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the details for a server.
|
* Update the details for a server.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
* @throws DataValidationException
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
*/
|
*/
|
||||||
public function setDetails(Request $request, Server $server): RedirectResponse
|
public function setDetails(Request $request, Server $server): RedirectResponse
|
||||||
@ -81,8 +81,8 @@ class ServersController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Toggles the installation status for a server.
|
* Toggles the installation status for a server.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
* @throws DataValidationException
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
*/
|
*/
|
||||||
public function toggleInstall(Server $server): RedirectResponse
|
public function toggleInstall(Server $server): RedirectResponse
|
||||||
@ -103,8 +103,8 @@ class ServersController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Reinstalls the server with the currently assigned service.
|
* Reinstalls the server with the currently assigned service.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
* @throws DataValidationException
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
*/
|
*/
|
||||||
public function reinstallServer(Server $server): RedirectResponse
|
public function reinstallServer(Server $server): RedirectResponse
|
||||||
@ -118,8 +118,8 @@ class ServersController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Manage the suspension status for a server.
|
* Manage the suspension status for a server.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
* @throws DataValidationException
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
*/
|
*/
|
||||||
public function manageSuspension(Request $request, Server $server): RedirectResponse
|
public function manageSuspension(Request $request, Server $server): RedirectResponse
|
||||||
@ -135,9 +135,9 @@ class ServersController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Update the build configuration for a server.
|
* Update the build configuration for a server.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
* @throws \Illuminate\Validation\ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
public function updateBuild(Request $request, Server $server): RedirectResponse
|
public function updateBuild(Request $request, Server $server): RedirectResponse
|
||||||
{
|
{
|
||||||
@ -159,7 +159,7 @@ class ServersController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Start the server deletion process.
|
* Start the server deletion process.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
* @throws \Throwable
|
* @throws \Throwable
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, Server $server): RedirectResponse
|
public function delete(Request $request, Server $server): RedirectResponse
|
||||||
@ -173,7 +173,7 @@ class ServersController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Update the startup command as well as variables.
|
* Update the startup command as well as variables.
|
||||||
*
|
*
|
||||||
* @throws \Illuminate\Validation\ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
public function saveStartup(Request $request, Server $server): RedirectResponse
|
public function saveStartup(Request $request, Server $server): RedirectResponse
|
||||||
{
|
{
|
||||||
@ -220,7 +220,7 @@ class ServersController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function resetDatabasePassword(Request $request, Server $server): Response
|
public function resetDatabasePassword(Request $request, Server $server): Response
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\Database $database */
|
/** @var Database $database */
|
||||||
$database = $server->databases()->findOrFail($request->input('database'));
|
$database = $server->databases()->findOrFail($request->input('database'));
|
||||||
|
|
||||||
$this->databasePasswordService->handle($database);
|
$this->databasePasswordService->handle($database);
|
||||||
|
@ -22,7 +22,7 @@ class AdvancedController extends Controller
|
|||||||
private ConfigRepository $config,
|
private ConfigRepository $config,
|
||||||
private Kernel $kernel,
|
private Kernel $kernel,
|
||||||
private SettingsRepositoryInterface $settings,
|
private SettingsRepositoryInterface $settings,
|
||||||
private ViewFactory $view
|
private ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class IndexController extends Controller
|
|||||||
private Kernel $kernel,
|
private Kernel $kernel,
|
||||||
private SettingsRepositoryInterface $settings,
|
private SettingsRepositoryInterface $settings,
|
||||||
private SoftwareVersionService $versionService,
|
private SoftwareVersionService $versionService,
|
||||||
private ViewFactory $view
|
private ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class MailController extends Controller
|
|||||||
private Encrypter $encrypter,
|
private Encrypter $encrypter,
|
||||||
private Kernel $kernel,
|
private Kernel $kernel,
|
||||||
private SettingsRepositoryInterface $settings,
|
private SettingsRepositoryInterface $settings,
|
||||||
private ViewFactory $view
|
private ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class UserController extends Controller
|
|||||||
protected Translator $translator,
|
protected Translator $translator,
|
||||||
protected UserUpdateService $updateService,
|
protected UserUpdateService $updateService,
|
||||||
protected UserRepositoryInterface $repository,
|
protected UserRepositoryInterface $repository,
|
||||||
protected ViewFactory $view
|
protected ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ class UserController extends Controller
|
|||||||
* Delete a user from the system.
|
* Delete a user from the system.
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, User $user): RedirectResponse
|
public function delete(Request $request, User $user): RedirectResponse
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ class LocationController extends ApplicationApiController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private LocationCreationService $creationService,
|
private LocationCreationService $creationService,
|
||||||
private LocationDeletionService $deletionService,
|
private LocationDeletionService $deletionService,
|
||||||
private LocationUpdateService $updateService
|
private LocationUpdateService $updateService,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ class AllocationController extends ApplicationApiController
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private AssignmentService $assignmentService,
|
private AssignmentService $assignmentService,
|
||||||
private AllocationDeletionService $deletionService
|
private AllocationDeletionService $deletionService,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class NodeController extends ApplicationApiController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private NodeCreationService $creationService,
|
private NodeCreationService $creationService,
|
||||||
private NodeDeletionService $deletionService,
|
private NodeDeletionService $deletionService,
|
||||||
private NodeUpdateService $updateService
|
private NodeUpdateService $updateService,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class DatabaseController extends ApplicationApiController
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private DatabaseManagementService $databaseManagementService,
|
private DatabaseManagementService $databaseManagementService,
|
||||||
private DatabasePasswordService $databasePasswordService
|
private DatabasePasswordService $databasePasswordService,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class ServerController extends ApplicationApiController
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private ServerCreationService $creationService,
|
private ServerCreationService $creationService,
|
||||||
private ServerDeletionService $deletionService
|
private ServerDeletionService $deletionService,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class ServerDetailsController extends ApplicationApiController
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private BuildModificationService $buildModificationService,
|
private BuildModificationService $buildModificationService,
|
||||||
private DetailsModificationService $detailsModificationService
|
private DetailsModificationService $detailsModificationService,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ class ServerManagementController extends ApplicationApiController
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private ReinstallServerService $reinstallServerService,
|
private ReinstallServerService $reinstallServerService,
|
||||||
private SuspensionService $suspensionService
|
private SuspensionService $suspensionService,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ class UserController extends ApplicationApiController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private UserCreationService $creationService,
|
private UserCreationService $creationService,
|
||||||
private UserDeletionService $deletionService,
|
private UserDeletionService $deletionService,
|
||||||
private UserUpdateService $updateService
|
private UserUpdateService $updateService,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class ApiKeyController extends ClientApiController
|
|||||||
/**
|
/**
|
||||||
* Store a new API key for a user's account.
|
* Store a new API key for a user's account.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
*/
|
*/
|
||||||
public function store(StoreApiKeyRequest $request): array
|
public function store(StoreApiKeyRequest $request): array
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ class ApiKeyController extends ClientApiController
|
|||||||
*/
|
*/
|
||||||
public function delete(ClientApiRequest $request, string $identifier): JsonResponse
|
public function delete(ClientApiRequest $request, string $identifier): JsonResponse
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\ApiKey $key */
|
/** @var ApiKey $key */
|
||||||
$key = $request->user()->apiKeys()
|
$key = $request->user()->apiKeys()
|
||||||
->where('key_type', ApiKey::TYPE_ACCOUNT)
|
->where('key_type', ApiKey::TYPE_ACCOUNT)
|
||||||
->where('identifier', $identifier)
|
->where('identifier', $identifier)
|
||||||
|
@ -30,7 +30,7 @@ class BackupController extends ClientApiController
|
|||||||
private DeleteBackupService $deleteBackupService,
|
private DeleteBackupService $deleteBackupService,
|
||||||
private InitiateBackupService $initiateBackupService,
|
private InitiateBackupService $initiateBackupService,
|
||||||
private DownloadLinkService $downloadLinkService,
|
private DownloadLinkService $downloadLinkService,
|
||||||
private BackupRepository $repository
|
private BackupRepository $repository,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ class BackupController extends ClientApiController
|
|||||||
* Returns all the backups for a given server instance in a paginated
|
* Returns all the backups for a given server instance in a paginated
|
||||||
* result set.
|
* result set.
|
||||||
*
|
*
|
||||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
* @throws AuthorizationException
|
||||||
*/
|
*/
|
||||||
public function index(Request $request, Server $server): array
|
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.
|
* Toggles the lock status of a given backup for a server.
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
* @throws \Throwable
|
||||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
* @throws AuthorizationException
|
||||||
*/
|
*/
|
||||||
public function toggleLock(Request $request, Server $server, Backup $backup): array
|
public function toggleLock(Request $request, Server $server, Backup $backup): array
|
||||||
{
|
{
|
||||||
@ -115,7 +115,7 @@ class BackupController extends ClientApiController
|
|||||||
/**
|
/**
|
||||||
* Returns information about a single backup.
|
* Returns information about a single backup.
|
||||||
*
|
*
|
||||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
* @throws AuthorizationException
|
||||||
*/
|
*/
|
||||||
public function view(Request $request, Server $server, Backup $backup): array
|
public function view(Request $request, Server $server, Backup $backup): array
|
||||||
{
|
{
|
||||||
@ -156,7 +156,7 @@ class BackupController extends ClientApiController
|
|||||||
* which the user is redirected to.
|
* which the user is redirected to.
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
* @throws \Throwable
|
||||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
* @throws AuthorizationException
|
||||||
*/
|
*/
|
||||||
public function download(Request $request, Server $server, Backup $backup): JsonResponse
|
public function download(Request $request, Server $server, Backup $backup): JsonResponse
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ class CommandController extends ClientApiController
|
|||||||
/**
|
/**
|
||||||
* Send a command to a running server.
|
* Send a command to a running server.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
* @throws DaemonConnectionException
|
||||||
*/
|
*/
|
||||||
public function index(SendCommandRequest $request, Server $server): Response
|
public function index(SendCommandRequest $request, Server $server): Response
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ class DatabaseController extends ClientApiController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private DeployServerDatabaseService $deployDatabaseService,
|
private DeployServerDatabaseService $deployDatabaseService,
|
||||||
private DatabaseManagementService $managementService,
|
private DatabaseManagementService $managementService,
|
||||||
private DatabasePasswordService $passwordService
|
private DatabasePasswordService $passwordService,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ class FileController extends ClientApiController
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private NodeJWTService $jwtService,
|
private NodeJWTService $jwtService,
|
||||||
private DaemonFileRepository $fileRepository
|
private DaemonFileRepository $fileRepository,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ class FileUploadController extends ClientApiController
|
|||||||
* FileUploadController constructor.
|
* FileUploadController constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private NodeJWTService $jwtService
|
private NodeJWTService $jwtService,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class NetworkAllocationController extends ClientApiController
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private FindAssignableAllocationService $assignableAllocationService,
|
private FindAssignableAllocationService $assignableAllocationService,
|
||||||
private ServerRepository $serverRepository
|
private ServerRepository $serverRepository,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ class NetworkAllocationController extends ClientApiController
|
|||||||
* Set the notes for the allocation for a server.
|
* Set the notes for the allocation for a server.
|
||||||
*s.
|
*s.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
*/
|
*/
|
||||||
public function store(NewAllocationRequest $request, Server $server): array
|
public function store(NewAllocationRequest $request, Server $server): array
|
||||||
{
|
{
|
||||||
@ -111,7 +111,7 @@ class NetworkAllocationController extends ClientApiController
|
|||||||
/**
|
/**
|
||||||
* Delete an allocation from a server.
|
* Delete an allocation from a server.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
*/
|
*/
|
||||||
public function delete(DeleteAllocationRequest $request, Server $server, Allocation $allocation): JsonResponse
|
public function delete(DeleteAllocationRequest $request, Server $server, Allocation $allocation): JsonResponse
|
||||||
{
|
{
|
||||||
|
@ -47,12 +47,12 @@ class ScheduleController extends ClientApiController
|
|||||||
/**
|
/**
|
||||||
* Store a new schedule for a server.
|
* Store a new schedule for a server.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||||
*/
|
*/
|
||||||
public function store(StoreScheduleRequest $request, Server $server): array
|
public function store(StoreScheduleRequest $request, Server $server): array
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\Schedule $model */
|
/** @var Schedule $model */
|
||||||
$model = $this->repository->create([
|
$model = $this->repository->create([
|
||||||
'server_id' => $server->id,
|
'server_id' => $server->id,
|
||||||
'name' => $request->input('name'),
|
'name' => $request->input('name'),
|
||||||
@ -95,7 +95,7 @@ class ScheduleController extends ClientApiController
|
|||||||
/**
|
/**
|
||||||
* Updates a given schedule with the new data provided.
|
* Updates a given schedule with the new data provided.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
*/
|
*/
|
||||||
@ -165,7 +165,7 @@ class ScheduleController extends ClientApiController
|
|||||||
/**
|
/**
|
||||||
* Get the next run timestamp based on the cron data provided.
|
* Get the next run timestamp based on the cron data provided.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
*/
|
*/
|
||||||
protected function getNextRunAt(Request $request): Carbon
|
protected function getNextRunAt(Request $request): Carbon
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ class ScheduleTaskController extends ClientApiController
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private ConnectionInterface $connection,
|
private ConnectionInterface $connection,
|
||||||
private TaskRepository $repository
|
private TaskRepository $repository,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ class ScheduleTaskController extends ClientApiController
|
|||||||
* Create a new task for a given schedule and store it in the database.
|
* Create a new task for a given schedule and store it in the database.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||||
* @throws \Pterodactyl\Exceptions\Service\ServiceLimitExceededException
|
* @throws ServiceLimitExceededException
|
||||||
*/
|
*/
|
||||||
public function store(StoreTaskRequest $request, Server $server, Schedule $schedule): array
|
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.");
|
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();
|
$lastTask = $schedule->tasks()->orderByDesc('sequence_id')->first();
|
||||||
|
|
||||||
/** @var \Pterodactyl\Models\Task $task */
|
/** @var Task $task */
|
||||||
$task = $this->connection->transaction(function () use ($request, $schedule, $lastTask) {
|
$task = $this->connection->transaction(function () use ($request, $schedule, $lastTask) {
|
||||||
$sequenceId = ($lastTask->sequence_id ?? 0) + 1;
|
$sequenceId = ($lastTask->sequence_id ?? 0) + 1;
|
||||||
$requestSequenceId = $request->integer('sequence_id', $sequenceId);
|
$requestSequenceId = $request->integer('sequence_id', $sequenceId);
|
||||||
|
@ -21,7 +21,7 @@ class SettingsController extends ClientApiController
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private ServerRepository $repository,
|
private ServerRepository $repository,
|
||||||
private ReinstallServerService $reinstallServerService
|
private ReinstallServerService $reinstallServerService,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ class StartupController extends ClientApiController
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private StartupCommandService $startupCommandService,
|
private StartupCommandService $startupCommandService,
|
||||||
private ServerVariableRepository $repository
|
private ServerVariableRepository $repository,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ class SubuserController extends ClientApiController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private SubuserRepository $repository,
|
private SubuserRepository $repository,
|
||||||
private SubuserCreationService $creationService,
|
private SubuserCreationService $creationService,
|
||||||
private DaemonServerRepository $serverRepository
|
private DaemonServerRepository $serverRepository,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ class WebsocketController extends ClientApiController
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private NodeJWTService $jwtService,
|
private NodeJWTService $jwtService,
|
||||||
private GetUserPermissionsService $permissionsService
|
private GetUserPermissionsService $permissionsService,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ class TwoFactorController extends ClientApiController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private ToggleTwoFactorService $toggleTwoFactorService,
|
private ToggleTwoFactorService $toggleTwoFactorService,
|
||||||
private TwoFactorSetupService $setupService,
|
private TwoFactorSetupService $setupService,
|
||||||
private ValidationFactory $validation
|
private ValidationFactory $validation,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ class ActivityProcessingController extends Controller
|
|||||||
|
|
||||||
$logs = [];
|
$logs = [];
|
||||||
foreach ($request->input('data') as $datum) {
|
foreach ($request->input('data') as $datum) {
|
||||||
/** @var \Pterodactyl\Models\Server|null $server */
|
/** @var Server|null $server */
|
||||||
$server = $servers->get($datum['server']);
|
$server = $servers->get($datum['server']);
|
||||||
if (is_null($server) || !Str::startsWith($datum['event'], 'server:')) {
|
if (is_null($server) || !Str::startsWith($datum['event'], 'server:')) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -42,7 +42,7 @@ class BackupRemoteUploadController extends Controller
|
|||||||
throw new BadRequestHttpException('A non-empty "size" query parameter must be provided.');
|
throw new BadRequestHttpException('A non-empty "size" query parameter must be provided.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var \Pterodactyl\Models\Backup $model */
|
/** @var Backup $model */
|
||||||
$model = Backup::query()
|
$model = Backup::query()
|
||||||
->where('uuid', $backup)
|
->where('uuid', $backup)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
@ -35,7 +35,7 @@ class BackupStatusController extends Controller
|
|||||||
/** @var \Pterodactyl\Models\Node $node */
|
/** @var \Pterodactyl\Models\Node $node */
|
||||||
$node = $request->attributes->get('node');
|
$node = $request->attributes->get('node');
|
||||||
|
|
||||||
/** @var \Pterodactyl\Models\Backup $model */
|
/** @var Backup $model */
|
||||||
$model = Backup::query()
|
$model = Backup::query()
|
||||||
->where('uuid', $backup)
|
->where('uuid', $backup)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
@ -92,7 +92,7 @@ class BackupStatusController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function restore(Request $request, string $backup): JsonResponse
|
public function restore(Request $request, string $backup): JsonResponse
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\Backup $model */
|
/** @var Backup $model */
|
||||||
$model = Backup::query()->where('uuid', $backup)->firstOrFail();
|
$model = Backup::query()->where('uuid', $backup)->firstOrFail();
|
||||||
|
|
||||||
$model->server->update(['status' => null]);
|
$model->server->update(['status' => null]);
|
||||||
@ -110,7 +110,7 @@ class BackupStatusController extends Controller
|
|||||||
* the given backup.
|
* the given backup.
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
*/
|
*/
|
||||||
protected function completeMultipartUpload(Backup $backup, S3Filesystem $adapter, bool $successful, ?array $parts): void
|
protected function completeMultipartUpload(Backup $backup, S3Filesystem $adapter, bool $successful, ?array $parts): void
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ class ServerDetailsController extends Controller
|
|||||||
protected ConnectionInterface $connection,
|
protected ConnectionInterface $connection,
|
||||||
private ServerRepository $repository,
|
private ServerRepository $repository,
|
||||||
private ServerConfigurationStructureService $configurationStructureService,
|
private ServerConfigurationStructureService $configurationStructureService,
|
||||||
private EggConfigurationService $eggConfigurationService
|
private EggConfigurationService $eggConfigurationService,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ class ServerDetailsController extends Controller
|
|||||||
->get();
|
->get();
|
||||||
|
|
||||||
$this->connection->transaction(function () use ($node, $servers) {
|
$this->connection->transaction(function () use ($node, $servers) {
|
||||||
/** @var \Pterodactyl\Models\Server $server */
|
/** @var Server $server */
|
||||||
foreach ($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
/** @var \Pterodactyl\Models\ActivityLog|null $activity */
|
/** @var \Pterodactyl\Models\ActivityLog|null $activity */
|
||||||
$activity = $server->activity->first();
|
$activity = $server->activity->first();
|
||||||
|
@ -22,7 +22,7 @@ class ServerTransferController extends Controller
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private ConnectionInterface $connection,
|
private ConnectionInterface $connection,
|
||||||
private ServerRepository $repository,
|
private ServerRepository $repository,
|
||||||
private DaemonServerRepository $daemonServerRepository
|
private DaemonServerRepository $daemonServerRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,9 +49,9 @@ abstract class AbstractLoginController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Get the failed login response instance.
|
* 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->incrementLoginAttempts($request);
|
||||||
$this->fireFailedLoginEvent($user, [
|
$this->fireFailedLoginEvent($user, [
|
||||||
@ -91,7 +91,7 @@ abstract class AbstractLoginController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Determine if the user is logging in using an email or username.
|
* 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';
|
return ($input && str_contains($input, '@')) ? 'email' : 'username';
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ abstract class AbstractLoginController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Fire a failed login event.
|
* 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));
|
Event::dispatch(new Failed('auth', $user, $credentials));
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class LoginCheckpointController extends AbstractLoginController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private Encrypter $encrypter,
|
private Encrypter $encrypter,
|
||||||
private Google2FA $google2FA,
|
private Google2FA $google2FA,
|
||||||
private ValidationFactory $validation
|
private ValidationFactory $validation,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ class LoginCheckpointController extends AbstractLoginController
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/** @var \Pterodactyl\Models\User $user */
|
/** @var User $user */
|
||||||
$user = User::query()->findOrFail($details['user_id']);
|
$user = User::query()->findOrFail($details['user_id']);
|
||||||
} catch (ModelNotFoundException) {
|
} catch (ModelNotFoundException) {
|
||||||
$this->sendFailedLoginResponse($request, null, self::TOKEN_EXPIRED_MESSAGE);
|
$this->sendFailedLoginResponse($request, null, self::TOKEN_EXPIRED_MESSAGE);
|
||||||
|
@ -48,7 +48,7 @@ class LoginController extends AbstractLoginController
|
|||||||
try {
|
try {
|
||||||
$username = $request->input('user');
|
$username = $request->input('user');
|
||||||
|
|
||||||
/** @var \Pterodactyl\Models\User $user */
|
/** @var User $user */
|
||||||
$user = User::query()->where($this->getField($username), $username)->firstOrFail();
|
$user = User::query()->where($this->getField($username), $username)->firstOrFail();
|
||||||
} catch (ModelNotFoundException) {
|
} catch (ModelNotFoundException) {
|
||||||
$this->sendFailedLoginResponse($request);
|
$this->sendFailedLoginResponse($request);
|
||||||
|
@ -31,14 +31,14 @@ class ResetPasswordController extends Controller
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private Dispatcher $dispatcher,
|
private Dispatcher $dispatcher,
|
||||||
private Hasher $hasher,
|
private Hasher $hasher,
|
||||||
private UserRepositoryInterface $userRepository
|
private UserRepositoryInterface $userRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the given user's password.
|
* Reset the given user's password.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws DisplayException
|
||||||
*/
|
*/
|
||||||
public function __invoke(ResetPasswordRequest $request): JsonResponse
|
public function __invoke(ResetPasswordRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@ class IndexController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected ServerRepositoryInterface $repository,
|
protected ServerRepositoryInterface $repository,
|
||||||
protected ViewFactory $view
|
protected ViewFactory $view,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class ServerInstalled
|
|||||||
*/
|
*/
|
||||||
public function handle(Request $request, \Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\Server|null $server */
|
/** @var Server|null $server */
|
||||||
$server = $request->route()->parameter('server');
|
$server = $request->route()->parameter('server');
|
||||||
|
|
||||||
if (!$server instanceof Server) {
|
if (!$server instanceof Server) {
|
||||||
|
@ -10,7 +10,7 @@ class AdminAuthenticate
|
|||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
* @throws AccessDeniedHttpException
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, \Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
|
@ -15,11 +15,11 @@ class AuthenticateIPAccess
|
|||||||
* Determine if a request IP has permission to access the API.
|
* Determine if a request IP has permission to access the API.
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
* @throws AccessDeniedHttpException
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, \Closure $next): mixed
|
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();
|
$token = $request->user()->currentAccessToken();
|
||||||
|
|
||||||
// If this is a stateful request just push the request through to the next
|
// If this is a stateful request just push the request through to the next
|
||||||
|
@ -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.');
|
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');
|
$server = $request->route()->parameter('server');
|
||||||
$exception = new NotFoundHttpException('The requested resource was not found for this server.');
|
$exception = new NotFoundHttpException('The requested resource was not found for this server.');
|
||||||
foreach ($params as $key => $model) {
|
foreach ($params as $key => $model) {
|
||||||
|
@ -29,7 +29,7 @@ class DaemonAuthenticate
|
|||||||
/**
|
/**
|
||||||
* Check if a request from the daemon can be properly attributed back to a single node instance.
|
* 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
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ class RedirectIfAuthenticated
|
|||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* 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()) {
|
if ($this->authManager->guard($guard)->check()) {
|
||||||
return redirect()->route('index');
|
return redirect()->route('index');
|
||||||
|
@ -31,7 +31,7 @@ class RequireTwoFactorAuthentication
|
|||||||
* order to perform actions. If so, we check the level at which it is required (all users
|
* 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.
|
* 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
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@ abstract class AdminFormRequest extends FormRequest
|
|||||||
* Return only the fields that we are interested in from the request.
|
* Return only the fields that we are interested in from the request.
|
||||||
* This will include empty fields as a null value.
|
* 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()));
|
return $this->only($only ?? array_keys($this->rules()));
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ class MailSettingsFormRequest extends AdminFormRequest
|
|||||||
* Override the default normalization function for this type of request
|
* Override the default normalization function for this type of request
|
||||||
* as we need to accept empty values on the keys.
|
* 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()));
|
$keys = array_flip(array_keys($this->rules()));
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ abstract class ApplicationApiRequest extends FormRequest
|
|||||||
* Determine if the current user is authorized to perform
|
* Determine if the current user is authorized to perform
|
||||||
* the requested action against the API.
|
* the requested action against the API.
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\PterodactylException
|
* @throws PterodactylException
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ class StoreNodeRequest extends ApplicationApiRequest
|
|||||||
/**
|
/**
|
||||||
* Validation rules to apply to this request.
|
* 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([
|
return collect($rules ?? Node::getRules())->only([
|
||||||
'public',
|
'public',
|
||||||
|
@ -10,7 +10,7 @@ class UpdateNodeRequest extends StoreNodeRequest
|
|||||||
* Apply validation rules to this request. Uses the parent class rules()
|
* Apply validation rules to this request. Uses the parent class rules()
|
||||||
* function but passes in the rules for updating rather than creating.
|
* 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;
|
$node = $this->route()->parameter('node')->id;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class StoreUserRequest extends ApplicationApiRequest
|
|||||||
/**
|
/**
|
||||||
* Return the validation rules for this request.
|
* 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();
|
$rules = $rules ?? User::getRules();
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class UpdateUserRequest extends StoreUserRequest
|
|||||||
/**
|
/**
|
||||||
* Return the validation rules for this request.
|
* 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;
|
$userId = $this->parameter('user', User::class)->id;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ use Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException;
|
|||||||
class UpdateEmailRequest extends ClientApiRequest
|
class UpdateEmailRequest extends ClientApiRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException
|
* @throws InvalidPasswordProvidedException
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ use Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException;
|
|||||||
class UpdatePasswordRequest extends ClientApiRequest
|
class UpdatePasswordRequest extends ClientApiRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException
|
* @throws InvalidPasswordProvidedException
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ class SetDockerImageRequest extends ClientApiRequest implements ClientPermission
|
|||||||
|
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\Server $server */
|
/** @var Server $server */
|
||||||
$server = $this->route()->parameter('server');
|
$server = $this->route()->parameter('server');
|
||||||
|
|
||||||
Assert::isInstanceOf($server, Server::class);
|
Assert::isInstanceOf($server, Server::class);
|
||||||
|
@ -63,8 +63,8 @@ abstract class SubuserRequest extends ClientApiRequest
|
|||||||
// Otherwise, get the current subuser's permission set, and ensure that the
|
// 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
|
// permissions they are trying to assign are not _more_ than the ones they
|
||||||
// already have.
|
// already have.
|
||||||
/** @var \Pterodactyl\Models\Subuser|null $subuser */
|
/** @var Subuser|null $subuser */
|
||||||
/** @var \Pterodactyl\Services\Servers\GetUserPermissionsService $service */
|
/** @var GetUserPermissionsService $service */
|
||||||
$service = $this->container->make(GetUserPermissionsService::class);
|
$service = $this->container->make(GetUserPermissionsService::class);
|
||||||
|
|
||||||
if (count(array_diff($permissions, $service->handle($server, $user))) > 0) {
|
if (count(array_diff($permissions, $service->handle($server, $user))) > 0) {
|
||||||
|
@ -37,7 +37,7 @@ class RunTaskJob extends Job implements ShouldQueue
|
|||||||
public function handle(
|
public function handle(
|
||||||
DaemonCommandRepository $commandRepository,
|
DaemonCommandRepository $commandRepository,
|
||||||
InitiateBackupService $backupService,
|
InitiateBackupService $backupService,
|
||||||
DaemonPowerRepository $powerRepository
|
DaemonPowerRepository $powerRepository,
|
||||||
) {
|
) {
|
||||||
// Do not process a task that is not set to active, unless it's been manually triggered.
|
// 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) {
|
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.
|
* 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->markTaskNotQueued();
|
||||||
$this->markScheduleComplete();
|
$this->markScheduleComplete();
|
||||||
@ -99,7 +99,7 @@ class RunTaskJob extends Job implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
private function queueNextTask()
|
private function queueNextTask()
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\Task|null $nextTask */
|
/** @var Task|null $nextTask */
|
||||||
$nextTask = Task::query()->where('schedule_id', $this->task->schedule_id)
|
$nextTask = Task::query()->where('schedule_id', $this->task->schedule_id)
|
||||||
->orderBy('sequence_id', 'asc')
|
->orderBy('sequence_id', 'asc')
|
||||||
->where('sequence_id', '>', $this->task->sequence_id)
|
->where('sequence_id', '>', $this->task->sequence_id)
|
||||||
|
@ -24,11 +24,11 @@ use Illuminate\Database\Eloquent\Model as IlluminateModel;
|
|||||||
* @property int|null $actor_id
|
* @property int|null $actor_id
|
||||||
* @property int|null $api_key_id
|
* @property int|null $api_key_id
|
||||||
* @property \Illuminate\Support\Collection|null $properties
|
* @property \Illuminate\Support\Collection|null $properties
|
||||||
* @property \Carbon\Carbon $timestamp
|
* @property Carbon $timestamp
|
||||||
* @property IlluminateModel|\Eloquent $actor
|
* @property IlluminateModel|\Eloquent $actor
|
||||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\ActivityLogSubject[] $subjects
|
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\ActivityLogSubject[] $subjects
|
||||||
* @property int|null $subjects_count
|
* @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 forActor(\Illuminate\Database\Eloquent\Model $actor)
|
||||||
* @method static Builder|ActivityLog forEvent(string $action)
|
* @method static Builder|ActivityLog forEvent(string $action)
|
||||||
|
@ -11,7 +11,7 @@ use Illuminate\Database\Eloquent\Relations\Pivot;
|
|||||||
* @property int $activity_log_id
|
* @property int $activity_log_id
|
||||||
* @property int $subject_id
|
* @property int $subject_id
|
||||||
* @property string $subject_type
|
* @property string $subject_type
|
||||||
* @property \Pterodactyl\Models\ActivityLog|null $activityLog
|
* @property ActivityLog|null $activityLog
|
||||||
* @property \Illuminate\Database\Eloquent\Model|\Eloquent $subject
|
* @property \Illuminate\Database\Eloquent\Model|\Eloquent $subject
|
||||||
*
|
*
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject newModelQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject newModelQuery()
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pterodactyl\Models\Allocation.
|
* Pterodactyl\Models\Allocation.
|
||||||
@ -18,8 +19,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
* @property \Carbon\Carbon|null $updated_at
|
* @property \Carbon\Carbon|null $updated_at
|
||||||
* @property string $alias
|
* @property string $alias
|
||||||
* @property bool $has_alias
|
* @property bool $has_alias
|
||||||
* @property \Pterodactyl\Models\Server|null $server
|
* @property Server|null $server
|
||||||
* @property \Pterodactyl\Models\Node $node
|
* @property Node $node
|
||||||
* @property string $hashid
|
* @property string $hashid
|
||||||
*
|
*
|
||||||
* @method static \Database\Factories\AllocationFactory factory(...$parameters)
|
* @method static \Database\Factories\AllocationFactory factory(...$parameters)
|
||||||
@ -40,6 +41,9 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
*/
|
*/
|
||||||
class Allocation extends Model
|
class Allocation extends Model
|
||||||
{
|
{
|
||||||
|
/** @use HasFactory<\Database\Factories\AllocationFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resource name for this model when it is transformed into an
|
* The resource name for this model when it is transformed into an
|
||||||
* API representation using fractal.
|
* API representation using fractal.
|
||||||
@ -74,9 +78,6 @@ class Allocation extends Model
|
|||||||
'notes' => 'nullable|string|max:256',
|
'notes' => 'nullable|string|max:256',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function getRouteKeyName(): string
|
public function getRouteKeyName(): string
|
||||||
{
|
{
|
||||||
return $this->getKeyName();
|
return $this->getKeyName();
|
||||||
|
@ -6,6 +6,7 @@ use Illuminate\Support\Str;
|
|||||||
use Webmozart\Assert\Assert;
|
use Webmozart\Assert\Assert;
|
||||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pterodactyl\Models\ApiKey.
|
* Pterodactyl\Models\ApiKey.
|
||||||
@ -30,8 +31,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
* @property int $r_eggs
|
* @property int $r_eggs
|
||||||
* @property int $r_database_hosts
|
* @property int $r_database_hosts
|
||||||
* @property int $r_server_databases
|
* @property int $r_server_databases
|
||||||
* @property \Pterodactyl\Models\User $tokenable
|
* @property User $tokenable
|
||||||
* @property \Pterodactyl\Models\User $user
|
* @property User $user
|
||||||
*
|
*
|
||||||
* @method static \Database\Factories\ApiKeyFactory factory(...$parameters)
|
* @method static \Database\Factories\ApiKeyFactory factory(...$parameters)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ApiKey newModelQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|ApiKey newModelQuery()
|
||||||
@ -61,6 +62,9 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
*/
|
*/
|
||||||
class ApiKey extends Model
|
class ApiKey extends Model
|
||||||
{
|
{
|
||||||
|
/** @use HasFactory<\Database\Factories\ApiKeyFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resource name for this model when it is transformed into an
|
* The resource name for this model when it is transformed into an
|
||||||
* API representation using fractal.
|
* API representation using fractal.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user