Merge branch 'release/v1.11.4' into release/v1.11.3

This commit is contained in:
Angelillo15 2023-10-14 21:02:03 +02:00
commit 40dd354b18
155 changed files with 2390 additions and 2080 deletions

View File

@ -68,8 +68,8 @@ body:
Run the following command to collect logs on your system. Run the following command to collect logs on your system.
Wings: `sudo wings diagnostics` Wings: `sudo wings diagnostics`
Panel: `tail -n 100 /var/www/pterodactyl/storage/logs/laravel-$(date +%F).log | nc bin.ptdl.co 99` Panel: `tail -n 150 /var/www/pterodactyl/storage/logs/laravel-$(date +%F).log | nc pteropaste.com 99`
placeholder: "https://bin.ptdl.co/a1h6z" placeholder: "https://pteropaste.com/a1h6z"
render: bash render: bash
validations: validations:
required: false required: false

View File

@ -3,7 +3,7 @@ cd /app
mkdir -p /var/log/panel/logs/ /var/log/supervisord/ /var/log/nginx/ /var/log/php7/ \ mkdir -p /var/log/panel/logs/ /var/log/supervisord/ /var/log/nginx/ /var/log/php7/ \
&& chmod 777 /var/log/panel/logs/ \ && chmod 777 /var/log/panel/logs/ \
&& ln -s /var/log/panel/logs/ /app/storage/logs/ && ln -s /app/storage/logs/ /var/log/panel/
## check for .env file and generate app keys if missing ## check for .env file and generate app keys if missing
if [ -f /app/var/.env ]; then if [ -f /app/var/.env ]; then

View File

@ -17,7 +17,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php: [8.0, 8.1] php: [8.1, 8.2]
database: ["mariadb:10.2", "mysql:8"] database: ["mariadb:10.2", "mysql:8"]
services: services:
database: database:

View File

@ -42,6 +42,7 @@ jobs:
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v2
if: "github.event_name != 'pull_request'"
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
@ -55,7 +56,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@v3 uses: docker/build-push-action@v4
with: with:
context: . context: .
file: ./Dockerfile file: ./Dockerfile

View File

@ -3,6 +3,24 @@ This file is a running track of new features and fixes to each version of the pa
This project follows [Semantic Versioning](http://semver.org) guidelines. This project follows [Semantic Versioning](http://semver.org) guidelines.
## v1.11.4
### Added
* Added support for the `server.queryport` option on the Rust egg.
* Added support for the Carbon modding framework to the Rust egg.
### Changed
* Upgraded to Laravel 10.
* Sensitive data is no longer shown in the CopyOnClick toast notification.
### Fixed
* Allow SVGs to be edited in the server's file manager.
* Properly validate the request body when creating a backup.
* Fixed issue with schedules running at the wrong time when the panel utilized a timezone with non-hour offsets (such as `Australia/Darwin`).
* Fixes the log directory when running the Panel in a container.
* Fixes the permission name used to check if a user has permission to read files/folders.
* Fixes the ability to unset a server's description through the client API.
* Fixed the MassActionBar on the server's file manager blocking elements below it, preventing them from being interacted with.
## v1.11.3 ## v1.11.3
### Changed ### Changed
* When updating a server's description through the client API, if no value is specified, the description will now remain unchanged. * When updating a server's description through the client API, if no value is specified, the description will now remain unchanged.

View File

@ -23,6 +23,7 @@ RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar un
&& chmod 777 -R bootstrap storage \ && chmod 777 -R bootstrap storage \
&& composer install --no-dev --optimize-autoloader \ && composer install --no-dev --optimize-autoloader \
&& rm -rf .env bootstrap/cache/*.php \ && rm -rf .env bootstrap/cache/*.php \
&& mkdir -p /app/storage/logs/ \
&& chown -R nginx:nginx . && chown -R nginx:nginx .
RUN rm /usr/local/etc/php-fpm.conf \ RUN rm /usr/local/etc/php-fpm.conf \

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Console\Commands\Environment; namespace Pterodactyl\Console\Commands\Environment;
use DateTimeZone;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Contracts\Console\Kernel; use Illuminate\Contracts\Console\Kernel;
use Pterodactyl\Traits\Commands\EnvironmentWriterTrait; use Pterodactyl\Traits\Commands\EnvironmentWriterTrait;
@ -89,7 +88,7 @@ class AppSettingsCommand extends Command
$this->output->comment('The timezone should match one of PHP\'s supported timezones. If you are unsure, please reference https://php.net/manual/en/timezones.php.'); $this->output->comment('The timezone should match one of PHP\'s supported timezones. If you are unsure, please reference https://php.net/manual/en/timezones.php.');
$this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate( $this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate(
'Application Timezone', 'Application Timezone',
DateTimeZone::listIdentifiers(), \DateTimeZone::listIdentifiers(),
config('app.timezone') config('app.timezone')
); );

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Console\Commands\Environment; namespace Pterodactyl\Console\Commands\Environment;
use PDOException;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Contracts\Console\Kernel; use Illuminate\Contracts\Console\Kernel;
use Illuminate\Database\DatabaseManager; use Illuminate\Database\DatabaseManager;
@ -72,7 +71,7 @@ class DatabaseSettingsCommand extends Command
try { try {
$this->testMySQLConnection(); $this->testMySQLConnection();
} catch (PDOException $exception) { } catch (\PDOException $exception) {
$this->output->error(sprintf('Unable to connect to the MySQL server using the provided credentials. The error returned was "%s".', $exception->getMessage())); $this->output->error(sprintf('Unable to connect to the MySQL server using the provided credentials. The error returned was "%s".', $exception->getMessage()));
$this->output->error('Your connection credentials have NOT been saved. You will need to provide valid connection information before proceeding.'); $this->output->error('Your connection credentials have NOT been saved. You will need to provide valid connection information before proceeding.');

View File

@ -44,7 +44,7 @@ class EmailSettingsCommand extends Command
trans('command/messages.environment.mail.ask_driver'), trans('command/messages.environment.mail.ask_driver'),
[ [
'smtp' => 'SMTP Server', 'smtp' => 'SMTP Server',
'mail' => 'PHP\'s Internal Mail Function', 'sendmail' => 'sendmail Binary',
'mailgun' => 'Mailgun Transactional Email', 'mailgun' => 'Mailgun Transactional Email',
'mandrill' => 'Mandrill Transactional Email', 'mandrill' => 'Mandrill Transactional Email',
'postmark' => 'Postmark Transactional Email', 'postmark' => 'Postmark Transactional Email',

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Console\Commands\Maintenance; namespace Pterodactyl\Console\Commands\Maintenance;
use SplFileInfo;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Contracts\Filesystem\Filesystem; use Illuminate\Contracts\Filesystem\Filesystem;
@ -35,7 +34,7 @@ class CleanServiceBackupFilesCommand extends Command
{ {
$files = $this->disk->files('services/.bak'); $files = $this->disk->files('services/.bak');
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 ($lastModified->diffInMinutes(Carbon::now()) > self::BACKUP_THRESHOLD_MINUTES) {
$this->disk->delete($file->getPath()); $this->disk->delete($file->getPath());

View File

@ -3,7 +3,6 @@
namespace Pterodactyl\Console\Commands\Maintenance; namespace Pterodactyl\Console\Commands\Maintenance;
use Carbon\CarbonImmutable; use Carbon\CarbonImmutable;
use InvalidArgumentException;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Pterodactyl\Repositories\Eloquent\BackupRepository; use Pterodactyl\Repositories\Eloquent\BackupRepository;
@ -11,7 +10,7 @@ class PruneOrphanedBackupsCommand extends Command
{ {
protected $signature = 'p:maintenance:prune-backups {--prune-age=}'; protected $signature = 'p:maintenance:prune-backups {--prune-age=}';
protected $description = 'Marks all backups that have not completed in the last "n" minutes as being failed.'; protected $description = 'Marks all backups older than "n" minutes that have not yet completed as being failed.';
/** /**
* PruneOrphanedBackupsCommand constructor. * PruneOrphanedBackupsCommand constructor.
@ -25,7 +24,7 @@ class PruneOrphanedBackupsCommand extends Command
{ {
$since = $this->option('prune-age') ?? config('backups.prune_age', 360); $since = $this->option('prune-age') ?? config('backups.prune_age', 360);
if (!$since || !is_digit($since)) { if (!$since || !is_digit($since)) {
throw new InvalidArgumentException('The "--prune-age" argument must be a value greater than 0.'); throw new \InvalidArgumentException('The "--prune-age" argument must be a value greater than 0.');
} }
$query = $this->backupRepository->getBuilder() $query = $this->backupRepository->getBuilder()
@ -39,7 +38,7 @@ class PruneOrphanedBackupsCommand extends Command
return; return;
} }
$this->warn("Marking $count backups that have not been marked as completed in the last $since minutes as failed."); $this->warn("Marking $count uncompleted backups that are older than $since minutes as failed.");
$query->update([ $query->update([
'is_successful' => false, 'is_successful' => false,

View File

@ -3,7 +3,6 @@
namespace Pterodactyl\Console\Commands\Schedule; namespace Pterodactyl\Console\Commands\Schedule;
use Exception; use Exception;
use Throwable;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Pterodactyl\Models\Schedule; use Pterodactyl\Models\Schedule;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@ -68,7 +67,7 @@ class ProcessRunnableCommand extends Command
'schedule' => $schedule->name, 'schedule' => $schedule->name,
'hash' => $schedule->hashid, 'hash' => $schedule->hashid,
])); ]));
} catch (Throwable|Exception $exception) { } catch (\Throwable|\Exception $exception) {
Log::error($exception, ['schedule_id' => $schedule->id]); Log::error($exception, ['schedule_id' => $schedule->id]);
$this->error("An error was encountered while processing Schedule #$schedule->id: " . $exception->getMessage()); $this->error("An error was encountered while processing Schedule #$schedule->id: " . $exception->getMessage());

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Console\Commands; namespace Pterodactyl\Console\Commands;
use Closure;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Pterodactyl\Console\Kernel; use Pterodactyl\Console\Kernel;
use Symfony\Component\Process\Process; use Symfony\Component\Process\Process;
@ -177,7 +176,7 @@ class UpgradeCommand extends Command
$this->info('Panel has been successfully upgraded. Please ensure you also update any Wings instances: https://pterodactyl.io/wings/1.0/upgrading.html'); $this->info('Panel has been successfully upgraded. Please ensure you also update any Wings instances: https://pterodactyl.io/wings/1.0/upgrading.html');
} }
protected function withProgress(ProgressBar $bar, Closure $callback) protected function withProgress(ProgressBar $bar, \Closure $callback)
{ {
$bar->clear(); $bar->clear();
$callback(); $callback();

View File

@ -18,7 +18,7 @@ class Kernel extends ConsoleKernel
/** /**
* Register the commands for the application. * Register the commands for the application.
*/ */
protected function commands() protected function commands(): void
{ {
$this->load(__DIR__ . '/Commands'); $this->load(__DIR__ . '/Commands');
} }
@ -26,8 +26,11 @@ class Kernel extends ConsoleKernel
/** /**
* Define the application's command schedule. * Define the application's command schedule.
*/ */
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule): void
{ {
// https://laravel.com/docs/10.x/upgrade#redis-cache-tags
$schedule->command('cache:prune-stale-tags')->hourly();
// Execute scheduled commands for servers every minute, as if there was a normal cron running. // Execute scheduled commands for servers every minute, as if there was a normal cron running.
$schedule->command(ProcessRunnableCommand::class)->everyMinute()->withoutOverlapping(); $schedule->command(ProcessRunnableCommand::class)->everyMinute()->withoutOverlapping();
$schedule->command(CleanServiceBackupFilesCommand::class)->daily(); $schedule->command(CleanServiceBackupFilesCommand::class)->daily();

View File

@ -2,8 +2,6 @@
namespace Pterodactyl\Exceptions; namespace Pterodactyl\Exceptions;
use Exception; class AccountNotFoundException extends \Exception
class AccountNotFoundException extends Exception
{ {
} }

View File

@ -2,8 +2,6 @@
namespace Pterodactyl\Exceptions; namespace Pterodactyl\Exceptions;
use Exception; class AutoDeploymentException extends \Exception
class AutoDeploymentException extends Exception
{ {
} }

View File

@ -3,7 +3,6 @@
namespace Pterodactyl\Exceptions; namespace Pterodactyl\Exceptions;
use Exception; use Exception;
use Throwable;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Illuminate\Http\Response; use Illuminate\Http\Response;
@ -23,7 +22,7 @@ class DisplayException extends PterodactylException implements HttpExceptionInte
/** /**
* DisplayException constructor. * DisplayException constructor.
*/ */
public function __construct(string $message, ?Throwable $previous = null, protected string $level = self::LEVEL_ERROR, int $code = 0) public function __construct(string $message, ?\Throwable $previous = null, protected string $level = self::LEVEL_ERROR, int $code = 0)
{ {
parent::__construct($message, $code, $previous); parent::__construct($message, $code, $previous);
} }
@ -67,7 +66,7 @@ class DisplayException extends PterodactylException implements HttpExceptionInte
*/ */
public function report() public function report()
{ {
if (!$this->getPrevious() instanceof Exception || !Handler::isReportable($this->getPrevious())) { if (!$this->getPrevious() instanceof \Exception || !Handler::isReportable($this->getPrevious())) {
return null; return null;
} }

View File

@ -3,8 +3,6 @@
namespace Pterodactyl\Exceptions; namespace Pterodactyl\Exceptions;
use Exception; use Exception;
use Throwable;
use PDOException;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
@ -75,13 +73,13 @@ class Handler extends ExceptionHandler
* *
* @noinspection PhpUnusedLocalVariableInspection * @noinspection PhpUnusedLocalVariableInspection
*/ */
public function register() public function register(): void
{ {
if (config('app.exceptions.report_all', false)) { if (config('app.exceptions.report_all', false)) {
$this->dontReport = []; $this->dontReport = [];
} }
$this->reportable(function (PDOException $ex) { $this->reportable(function (\PDOException $ex) {
$ex = $this->generateCleanedExceptionStack($ex); $ex = $this->generateCleanedExceptionStack($ex);
}); });
@ -90,7 +88,7 @@ class Handler extends ExceptionHandler
}); });
} }
private function generateCleanedExceptionStack(Throwable $exception): string private function generateCleanedExceptionStack(\Throwable $exception): string
{ {
$cleanedStack = ''; $cleanedStack = '';
foreach ($exception->getTrace() as $index => $item) { foreach ($exception->getTrace() as $index => $item) {
@ -123,7 +121,7 @@ class Handler extends ExceptionHandler
* *
* @throws \Throwable * @throws \Throwable
*/ */
public function render($request, Throwable $e): Response public function render($request, \Throwable $e): Response
{ {
$connections = $this->container->make(Connection::class); $connections = $this->container->make(Connection::class);
@ -189,7 +187,7 @@ class Handler extends ExceptionHandler
/** /**
* Return the exception as a JSONAPI representation for use on API requests. * Return the exception as a JSONAPI representation for use on API requests.
*/ */
protected function convertExceptionToArray(Throwable $e, array $override = []): array protected function convertExceptionToArray(\Throwable $e, array $override = []): array
{ {
$match = self::$exceptionResponseCodes[get_class($e)] ?? null; $match = self::$exceptionResponseCodes[get_class($e)] ?? null;
@ -235,7 +233,7 @@ class Handler extends ExceptionHandler
/** /**
* Return an array of exceptions that should not be reported. * Return an array of exceptions that should not be reported.
*/ */
public static function isReportable(Exception $exception): bool public static function isReportable(\Exception $exception): bool
{ {
return (new static(Container::getInstance()))->shouldReport($exception); return (new static(Container::getInstance()))->shouldReport($exception);
} }
@ -260,11 +258,11 @@ class Handler extends ExceptionHandler
* *
* @return \Throwable[] * @return \Throwable[]
*/ */
protected function extractPrevious(Throwable $e): array protected function extractPrevious(\Throwable $e): array
{ {
$previous = []; $previous = [];
while ($value = $e->getPrevious()) { while ($value = $e->getPrevious()) {
if (!$value instanceof Throwable) { if (!$value instanceof \Throwable) {
break; break;
} }
$previous[] = $value; $previous[] = $value;
@ -278,7 +276,7 @@ class Handler extends ExceptionHandler
* Helper method to allow reaching into the handler to convert an exception * Helper method to allow reaching into the handler to convert an exception
* into the expected array response type. * into the expected array response type.
*/ */
public static function toArray(Throwable $e): array public static function toArray(\Throwable $e): array
{ {
return (new self(app()))->convertExceptionToArray($e); return (new self(app()))->convertExceptionToArray($e);
} }

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Exceptions\Http\Server; namespace Pterodactyl\Exceptions\Http\Server;
use Throwable;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Symfony\Component\HttpKernel\Exception\ConflictHttpException; use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
@ -12,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()) {

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Exceptions\Http; namespace Pterodactyl\Exceptions\Http;
use Throwable;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
@ -12,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);
} }

View File

@ -2,11 +2,10 @@
namespace Pterodactyl\Exceptions; namespace Pterodactyl\Exceptions;
use Exception;
use Spatie\Ignition\Contracts\Solution; use Spatie\Ignition\Contracts\Solution;
use Spatie\Ignition\Contracts\ProvidesSolution; use Spatie\Ignition\Contracts\ProvidesSolution;
class ManifestDoesNotExistException extends Exception implements ProvidesSolution class ManifestDoesNotExistException extends \Exception implements ProvidesSolution
{ {
public function getSolution(): Solution public function getSolution(): Solution
{ {

View File

@ -2,8 +2,6 @@
namespace Pterodactyl\Exceptions; namespace Pterodactyl\Exceptions;
use Exception; class PterodactylException extends \Exception
class PterodactylException extends Exception
{ {
} }

View File

@ -2,8 +2,6 @@
namespace Pterodactyl\Exceptions\Service\Helper; namespace Pterodactyl\Exceptions\Service\Helper;
use Exception; class CdnVersionFetchingException extends \Exception
class CdnVersionFetchingException extends Exception
{ {
} }

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Exceptions\Service; namespace Pterodactyl\Exceptions\Service;
use Throwable;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
class ServiceLimitExceededException extends DisplayException class ServiceLimitExceededException extends DisplayException
@ -11,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);
} }

View File

@ -7,7 +7,6 @@ use Aws\S3\S3Client;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use InvalidArgumentException;
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
use League\Flysystem\FilesystemAdapter; use League\Flysystem\FilesystemAdapter;
use Pterodactyl\Extensions\Filesystem\S3Filesystem; use Pterodactyl\Extensions\Filesystem\S3Filesystem;
@ -70,7 +69,7 @@ class BackupManager
$config = $this->getConfig($name); $config = $this->getConfig($name);
if (empty($config['adapter'])) { if (empty($config['adapter'])) {
throw new InvalidArgumentException("Backup disk [$name] does not have a configured adapter."); throw new \InvalidArgumentException("Backup disk [$name] does not have a configured adapter.");
} }
$adapter = $config['adapter']; $adapter = $config['adapter'];
@ -88,7 +87,7 @@ class BackupManager
return $instance; return $instance;
} }
throw new InvalidArgumentException("Adapter [$adapter] is not supported."); throw new \InvalidArgumentException("Adapter [$adapter] is not supported.");
} }
/** /**
@ -164,7 +163,7 @@ class BackupManager
/** /**
* Register a custom adapter creator closure. * Register a custom adapter creator closure.
*/ */
public function extend(string $adapter, Closure $callback): self public function extend(string $adapter, \Closure $callback): self
{ {
$this->customCreators[$adapter] = $callback; $this->customCreators[$adapter] = $callback;

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Extensions\Lcobucci\JWT\Encoding; namespace Pterodactyl\Extensions\Lcobucci\JWT\Encoding;
use DateTimeImmutable;
use Lcobucci\JWT\ClaimsFormatter; use Lcobucci\JWT\ClaimsFormatter;
use Lcobucci\JWT\Token\RegisteredClaims; use Lcobucci\JWT\Token\RegisteredClaims;
@ -21,7 +20,7 @@ final class TimestampDates implements ClaimsFormatter
continue; continue;
} }
assert($claims[$claim] instanceof DateTimeImmutable); assert($claims[$claim] instanceof \DateTimeImmutable);
$claims[$claim] = $claims[$claim]->getTimestamp(); $claims[$claim] = $claims[$claim]->getTimestamp();
} }

View File

@ -15,8 +15,6 @@ final class Time
*/ */
public static function getMySQLTimezoneOffset(string $timezone): string public static function getMySQLTimezoneOffset(string $timezone): string
{ {
$offset = round(CarbonImmutable::now($timezone)->getTimezone()->getOffset(CarbonImmutable::now('UTC')) / 3600); return CarbonImmutable::now($timezone)->getTimezone()->toOffsetName();
return sprintf('%s%s:00', $offset > 0 ? '+' : '-', str_pad((string) abs($offset), 2, '0', STR_PAD_LEFT));
} }
} }

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Helpers; namespace Pterodactyl\Helpers;
use Exception;
use Carbon\Carbon; use Carbon\Carbon;
use Cron\CronExpression; use Cron\CronExpression;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@ -25,7 +24,7 @@ class Utilities
$string = substr_replace($string, $character, random_int(0, $length - 1), 1); $string = substr_replace($string, $character, random_int(0, $length - 1), 1);
} }
} catch (Exception $exception) { } catch (\Exception $exception) {
// Just log the error and hope for the best at this point. // Just log the error and hope for the best at this point.
Log::error($exception); Log::error($exception);
} }

View File

@ -3,7 +3,6 @@
namespace Pterodactyl\Http\Controllers\Admin; namespace Pterodactyl\Http\Controllers\Admin;
use Exception; use Exception;
use PDOException;
use Illuminate\View\View; use Illuminate\View\View;
use Pterodactyl\Models\DatabaseHost; use Pterodactyl\Models\DatabaseHost;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
@ -69,8 +68,8 @@ class DatabaseController extends Controller
{ {
try { try {
$host = $this->creationService->handle($request->normalize()); $host = $this->creationService->handle($request->normalize());
} catch (Exception $exception) { } catch (\Exception $exception) {
if ($exception instanceof PDOException || $exception->getPrevious() instanceof PDOException) { if ($exception instanceof \PDOException || $exception->getPrevious() instanceof \PDOException) {
$this->alert->danger( $this->alert->danger(
sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage()) sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage())
)->flash(); )->flash();
@ -98,10 +97,10 @@ class DatabaseController extends Controller
try { try {
$this->updateService->handle($host->id, $request->normalize()); $this->updateService->handle($host->id, $request->normalize());
$this->alert->success('Database host was updated successfully.')->flash(); $this->alert->success('Database host was updated successfully.')->flash();
} catch (Exception $exception) { } catch (\Exception $exception) {
// Catch any SQL related exceptions and display them back to the user, otherwise just // Catch any SQL related exceptions and display them back to the user, otherwise just
// throw the exception like normal and move on with it. // throw the exception like normal and move on with it.
if ($exception instanceof PDOException || $exception->getPrevious() instanceof PDOException) { if ($exception instanceof \PDOException || $exception->getPrevious() instanceof \PDOException) {
$this->alert->danger( $this->alert->danger(
sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage()) sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage())
)->flash(); )->flash();

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Controllers\Admin\Nests; namespace Pterodactyl\Http\Controllers\Admin\Nests;
use JavaScript;
use Illuminate\View\View; use Illuminate\View\View;
use Pterodactyl\Models\Egg; use Pterodactyl\Models\Egg;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
@ -40,7 +39,7 @@ class EggController extends Controller
public function create(): View public function create(): View
{ {
$nests = $this->nestRepository->getWithEggs(); $nests = $this->nestRepository->getWithEggs();
JavaScript::put(['nests' => $nests->keyBy('id')]); \JavaScript::put(['nests' => $nests->keyBy('id')]);
return $this->view->make('admin.eggs.new', ['nests' => $nests]); return $this->view->make('admin.eggs.new', ['nests' => $nests]);
} }

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Controllers\Admin\Servers; namespace Pterodactyl\Http\Controllers\Admin\Servers;
use JavaScript;
use Illuminate\View\View; use Illuminate\View\View;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use Pterodactyl\Models\Location; use Pterodactyl\Models\Location;
@ -45,7 +44,7 @@ class CreateServerController extends Controller
$nests = $this->nestRepository->getWithEggs(); $nests = $this->nestRepository->getWithEggs();
JavaScript::put([ \JavaScript::put([
'nodeData' => $this->nodeRepository->getNodesForServerCreation(), 'nodeData' => $this->nodeRepository->getNodesForServerCreation(),
'nests' => $nests->map(function ($item) { 'nests' => $nests->map(function ($item) {
return array_merge($item->toArray(), [ return array_merge($item->toArray(), [

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Controllers\Admin\Servers; namespace Pterodactyl\Http\Controllers\Admin\Servers;
use JavaScript;
use Illuminate\View\View; use Illuminate\View\View;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\Nest; use Pterodactyl\Models\Nest;
@ -134,7 +133,7 @@ class ServerViewController extends Controller
$canTransfer = true; $canTransfer = true;
} }
JavaScript::put([ \JavaScript::put([
'nodeData' => $this->nodeRepository->getNodesForServerCreation(), 'nodeData' => $this->nodeRepository->getNodesForServerCreation(),
]); ]);

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Controllers\Admin\Settings; namespace Pterodactyl\Http\Controllers\Admin\Settings;
use Exception;
use Illuminate\View\View; use Illuminate\View\View;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
@ -82,7 +81,7 @@ class MailController extends Controller
try { try {
Notification::route('mail', $request->user()->email) Notification::route('mail', $request->user()->email)
->notify(new MailTested($request->user())); ->notify(new MailTested($request->user()));
} catch (Exception $exception) { } catch (\Exception $exception) {
return response($exception->getMessage(), 500); return response($exception->getMessage(), 500);
} }

View File

@ -18,6 +18,7 @@ use Pterodactyl\Transformers\Api\Client\BackupTransformer;
use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Pterodactyl\Http\Requests\Api\Client\Servers\Backups\StoreBackupRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Backups\StoreBackupRequest;
use Pterodactyl\Http\Requests\Api\Client\Servers\Backups\RestoreBackupRequest;
class BackupController extends ClientApiController class BackupController extends ClientApiController
{ {
@ -188,12 +189,8 @@ class BackupController extends ClientApiController
* *
* @throws \Throwable * @throws \Throwable
*/ */
public function restore(Request $request, Server $server, Backup $backup): JsonResponse public function restore(RestoreBackupRequest $request, Server $server, Backup $backup): JsonResponse
{ {
if (!$request->user()->can(Permission::ACTION_BACKUP_RESTORE, $server)) {
throw new AuthorizationException();
}
// Cannot restore a backup unless a server is fully installed and not currently // Cannot restore a backup unless a server is fully installed and not currently
// processing a different backup restoration request. // processing a different backup restoration request.
if (!is_null($server->status)) { if (!is_null($server->status)) {

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Controllers\Api\Client\Servers; namespace Pterodactyl\Http\Controllers\Api\Client\Servers;
use Exception;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
@ -178,7 +177,7 @@ class ScheduleController extends ClientApiController
$request->input('month'), $request->input('month'),
$request->input('day_of_week') $request->input('day_of_week')
); );
} catch (Exception $exception) { } catch (\Exception $exception) {
throw new DisplayException('The cron data provided does not evaluate to a valid expression.'); throw new DisplayException('The cron data provided does not evaluate to a valid expression.');
} }
} }

View File

@ -35,7 +35,7 @@ class SettingsController extends ClientApiController
public function rename(RenameServerRequest $request, Server $server): JsonResponse public function rename(RenameServerRequest $request, Server $server): JsonResponse
{ {
$name = $request->input('name'); $name = $request->input('name');
$description = $request->input('description') ?? $server->description; $description = $request->has('description') ? (string) $request->input('description') : $server->description;
$this->repository->update($server->id, [ $this->repository->update($server->id, [
'name' => $name, 'name' => $name,
'description' => $description, 'description' => $description,

View File

@ -2,9 +2,7 @@
namespace Pterodactyl\Http\Controllers\Api\Remote; namespace Pterodactyl\Http\Controllers\Api\Remote;
use Exception;
use Carbon\Carbon; use Carbon\Carbon;
use DateTimeInterface;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
@ -37,11 +35,11 @@ class ActivityProcessingController extends Controller
try { try {
$when = Carbon::createFromFormat( $when = Carbon::createFromFormat(
DateTimeInterface::RFC3339, \DateTimeInterface::RFC3339,
preg_replace('/(\.\d+)Z$/', 'Z', $datum['timestamp']), preg_replace('/(\.\d+)Z$/', 'Z', $datum['timestamp']),
'UTC' 'UTC'
); );
} catch (Exception $exception) { } catch (\Exception $exception) {
Log::warning($exception, ['timestamp' => $datum['timestamp']]); Log::warning($exception, ['timestamp' => $datum['timestamp']]);
// If we cannot parse the value for some reason don't blow up this request, just go ahead // If we cannot parse the value for some reason don't blow up this request, just go ahead

View File

@ -86,7 +86,7 @@ class Kernel extends HttpKernel
/** /**
* The application's route middleware. * The application's route middleware.
*/ */
protected $routeMiddleware = [ protected $middlewareAliases = [
'auth' => Authenticate::class, 'auth' => Authenticate::class,
'auth.basic' => AuthenticateWithBasicAuth::class, 'auth.basic' => AuthenticateWithBasicAuth::class,
'auth.session' => AuthenticateSession::class, 'auth.session' => AuthenticateSession::class,

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware\Activity; namespace Pterodactyl\Http\Middleware\Activity;
use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Facades\LogTarget; use Pterodactyl\Facades\LogTarget;
@ -12,7 +11,7 @@ class AccountSubject
* Sets the actor and default subject for all requests passing through this * Sets the actor and default subject for all requests passing through this
* middleware to be the currently logged in user. * middleware to be the currently logged in user.
*/ */
public function handle(Request $request, Closure $next) public function handle(Request $request, \Closure $next)
{ {
LogTarget::setActor($request->user()); LogTarget::setActor($request->user());
LogTarget::setSubject($request->user()); LogTarget::setSubject($request->user());

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware\Activity; namespace Pterodactyl\Http\Middleware\Activity;
use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Pterodactyl\Facades\LogTarget; use Pterodactyl\Facades\LogTarget;
@ -17,7 +16,7 @@ class ServerSubject
* If no server is found this is a no-op as the activity log service can always * If no server is found this is a no-op as the activity log service can always
* set the user based on the authmanager response. * set the user based on the authmanager response.
*/ */
public function handle(Request $request, Closure $next) public function handle(Request $request, \Closure $next)
{ {
$server = $request->route()->parameter('server'); $server = $request->route()->parameter('server');
if ($server instanceof Server) { if ($server instanceof Server) {

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware\Activity; namespace Pterodactyl\Http\Middleware\Activity;
use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\ApiKey; use Pterodactyl\Models\ApiKey;
use Pterodactyl\Facades\LogTarget; use Pterodactyl\Facades\LogTarget;
@ -15,7 +14,7 @@ class TrackAPIKey
* request singleton so that all tracked activity log events are properly associated * request singleton so that all tracked activity log events are properly associated
* with the given API key. * with the given API key.
*/ */
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
if ($request->user()) { if ($request->user()) {
$token = $request->user()->currentAccessToken(); $token = $request->user()->currentAccessToken();

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware\Admin\Servers; namespace Pterodactyl\Http\Middleware\Admin\Servers;
use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
@ -14,7 +13,7 @@ class ServerInstalled
/** /**
* Checks that the server is installed before allowing access through the route. * Checks that the server is installed before allowing access through the route.
*/ */
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
/** @var \Pterodactyl\Models\Server|null $server */ /** @var \Pterodactyl\Models\Server|null $server */
$server = $request->route()->parameter('server'); $server = $request->route()->parameter('server');

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware; namespace Pterodactyl\Http\Middleware;
use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@ -13,7 +12,7 @@ class AdminAuthenticate
* *
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
*/ */
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
if (!$request->user() || !$request->user()->root_admin) { if (!$request->user() || !$request->user()->root_admin) {
throw new AccessDeniedHttpException(); throw new AccessDeniedHttpException();

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware\Api\Application; namespace Pterodactyl\Http\Middleware\Api\Application;
use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@ -12,7 +11,7 @@ class AuthenticateApplicationUser
* Authenticate that the currently authenticated user is an administrator * Authenticate that the currently authenticated user is an administrator
* and should be allowed to proceed through the application API. * and should be allowed to proceed through the application API.
*/ */
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
/** @var \Pterodactyl\Models\User|null $user */ /** @var \Pterodactyl\Models\User|null $user */
$user = $request->user(); $user = $request->user();

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware\Api; namespace Pterodactyl\Http\Middleware\Api;
use Closure;
use IPTools\IP; use IPTools\IP;
use IPTools\Range; use IPTools\Range;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -18,7 +17,7 @@ class AuthenticateIPAccess
* @throws \Exception * @throws \Exception
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException * @throws \Symfony\Component\HttpKernel\Exception\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 \Laravel\Sanctum\TransientToken|\Pterodactyl\Models\ApiKey $token */
$token = $request->user()->currentAccessToken(); $token = $request->user()->currentAccessToken();

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware\Api\Client\Server; namespace Pterodactyl\Http\Middleware\Api\Client\Server;
use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@ -27,7 +26,7 @@ class AuthenticateServerAccess
/** /**
* Authenticate that this server exists and is not suspended or marked as installing. * Authenticate that this server exists and is not suspended or marked as installing.
*/ */
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
/** @var \Pterodactyl\Models\User $user */ /** @var \Pterodactyl\Models\User $user */
$user = $request->user(); $user = $request->user();

View File

@ -2,11 +2,9 @@
namespace Pterodactyl\Http\Middleware\Api\Client\Server; namespace Pterodactyl\Http\Middleware\Api\Client\Server;
use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\Task; use Pterodactyl\Models\Task;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use InvalidArgumentException;
use Pterodactyl\Models\Backup; use Pterodactyl\Models\Backup;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Pterodactyl\Models\Subuser; use Pterodactyl\Models\Subuser;
@ -26,11 +24,11 @@ class ResourceBelongsToServer
* server that is expected, and that we're not accessing a resource completely * server that is expected, and that we're not accessing a resource completely
* unrelated to the server provided in the request. * unrelated to the server provided in the request.
*/ */
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
$params = $request->route()->parameters(); $params = $request->route()->parameters();
if (is_null($params) || !$params['server'] instanceof Server) { if (is_null($params) || !$params['server'] instanceof Server) {
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 \Pterodactyl\Models\Server $server */
@ -79,7 +77,7 @@ class ResourceBelongsToServer
default: default:
// Don't return a 404 here since we want to make sure no one relies // Don't return a 404 here since we want to make sure no one relies
// on this middleware in a context in which it will not work. Fail safe. // on this middleware in a context in which it will not work. Fail safe.
throw new InvalidArgumentException('There is no handler configured for a resource of this type: ' . get_class($model)); throw new \InvalidArgumentException('There is no handler configured for a resource of this type: ' . get_class($model));
} }
} }

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware\Api\Client; namespace Pterodactyl\Http\Middleware\Api\Client;
use Closure;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Routing\Middleware\SubstituteBindings; use Illuminate\Routing\Middleware\SubstituteBindings;
@ -11,7 +10,7 @@ class SubstituteClientBindings extends SubstituteBindings
/** /**
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
*/ */
public function handle($request, Closure $next): mixed public function handle($request, \Closure $next): mixed
{ {
// Override default behavior of the model binding to use a specific table // Override default behavior of the model binding to use a specific table
// column rather than the default 'id'. // column rather than the default 'id'.

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware\Api\Daemon; namespace Pterodactyl\Http\Middleware\Api\Daemon;
use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Contracts\Encryption\Encrypter;
use Pterodactyl\Repositories\Eloquent\NodeRepository; use Pterodactyl\Repositories\Eloquent\NodeRepository;
@ -32,7 +31,7 @@ class DaemonAuthenticate
* *
* @throws \Symfony\Component\HttpKernel\Exception\HttpException * @throws \Symfony\Component\HttpKernel\Exception\HttpException
*/ */
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
if (in_array($request->route()->getName(), $this->except)) { if (in_array($request->route()->getName(), $this->except)) {
return $next($request); return $next($request);

View File

@ -2,8 +2,6 @@
namespace Pterodactyl\Http\Middleware\Api; namespace Pterodactyl\Http\Middleware\Api;
use Closure;
use JsonException;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
@ -14,12 +12,12 @@ class IsValidJson
* parsing the data. This avoids confusing validation errors where every field is flagged and * parsing the data. This avoids confusing validation errors where every field is flagged and
* it is not immediately clear that there is an issue with the JSON being passed. * it is not immediately clear that there is an issue with the JSON being passed.
*/ */
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
if ($request->isJson() && !empty($request->getContent())) { if ($request->isJson() && !empty($request->getContent())) {
try { try {
json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR); json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $exception) { } catch (\JsonException $exception) {
throw new BadRequestHttpException('The JSON data passed in the request appears to be malformed: ' . $exception->getMessage()); throw new BadRequestHttpException('The JSON data passed in the request appears to be malformed: ' . $exception->getMessage());
} }
} }

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware; namespace Pterodactyl\Http\Middleware;
use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
@ -18,7 +17,7 @@ class LanguageMiddleware
/** /**
* Handle an incoming request and set the user's preferred language. * Handle an incoming request and set the user's preferred language.
*/ */
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
$this->app->setLocale($request->user()->language ?? config('app.locale', 'en')); $this->app->setLocale($request->user()->language ?? config('app.locale', 'en'));

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware; namespace Pterodactyl\Http\Middleware;
use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Contracts\Routing\ResponseFactory; use Illuminate\Contracts\Routing\ResponseFactory;
@ -18,7 +17,7 @@ class MaintenanceMiddleware
/** /**
* Handle an incoming request. * Handle an incoming request.
*/ */
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
/** @var \Pterodactyl\Models\Server $server */ /** @var \Pterodactyl\Models\Server $server */
$server = $request->attributes->get('server'); $server = $request->attributes->get('server');

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware; namespace Pterodactyl\Http\Middleware;
use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Auth\AuthManager; use Illuminate\Auth\AuthManager;
@ -18,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');

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Middleware; namespace Pterodactyl\Http\Middleware;
use Closure;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Prologue\Alerts\AlertsMessageBag; use Prologue\Alerts\AlertsMessageBag;
@ -34,7 +33,7 @@ class RequireTwoFactorAuthentication
* *
* @throws \Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException * @throws \Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException
*/ */
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
/** @var \Pterodactyl\Models\User $user */ /** @var \Pterodactyl\Models\User $user */
$user = $request->user(); $user = $request->user();

View File

@ -2,8 +2,6 @@
namespace Pterodactyl\Http\Middleware; namespace Pterodactyl\Http\Middleware;
use Closure;
use stdClass;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
@ -24,7 +22,7 @@ class VerifyReCaptcha
/** /**
* Handle an incoming request. * Handle an incoming request.
*/ */
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
if (!$this->config->get('recaptcha.enabled')) { if (!$this->config->get('recaptcha.enabled')) {
return $next($request); return $next($request);
@ -61,7 +59,7 @@ class VerifyReCaptcha
/** /**
* Determine if the response from the recaptcha servers was valid. * Determine if the response from the recaptcha servers was valid.
*/ */
private function isResponseVerified(stdClass $result, Request $request): bool private function isResponseVerified(\stdClass $result, Request $request): bool
{ {
if (!$this->config->get('recaptcha.verify_domain')) { if (!$this->config->get('recaptcha.verify_domain')) {
return false; return false;

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Requests\Api\Client\Account; namespace Pterodactyl\Http\Requests\Api\Client\Account;
use Exception;
use phpseclib3\Crypt\DSA; use phpseclib3\Crypt\DSA;
use phpseclib3\Crypt\RSA; use phpseclib3\Crypt\RSA;
use Pterodactyl\Models\UserSSHKey; use Pterodactyl\Models\UserSSHKey;
@ -71,7 +70,7 @@ class StoreSSHKeyRequest extends ClientApiRequest
public function getKeyFingerprint(): string public function getKeyFingerprint(): string
{ {
if (!$this->key) { if (!$this->key) {
throw new Exception('The public key was not properly loaded for this request.'); throw new \Exception('The public key was not properly loaded for this request.');
} }
return $this->key->getFingerprint('sha256'); return $this->key->getFingerprint('sha256');

View File

@ -0,0 +1,19 @@
<?php
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Backups;
use Pterodactyl\Models\Permission;
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
class RestoreBackupRequest extends ClientApiRequest
{
public function permission(): string
{
return Permission::ACTION_BACKUP_RESTORE;
}
public function rules(): array
{
return ['truncate' => 'required|boolean'];
}
}

View File

@ -6,7 +6,6 @@ use Exception;
use Pterodactyl\Jobs\Job; use Pterodactyl\Jobs\Job;
use Carbon\CarbonImmutable; use Carbon\CarbonImmutable;
use Pterodactyl\Models\Task; use Pterodactyl\Models\Task;
use InvalidArgumentException;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
@ -72,9 +71,9 @@ class RunTaskJob extends Job implements ShouldQueue
$backupService->setIgnoredFiles(explode(PHP_EOL, $this->task->payload))->handle($server, null, true); $backupService->setIgnoredFiles(explode(PHP_EOL, $this->task->payload))->handle($server, null, true);
break; break;
default: default:
throw new InvalidArgumentException('Invalid task action provided: ' . $this->task->action); throw new \InvalidArgumentException('Invalid task action provided: ' . $this->task->action);
} }
} catch (Exception $exception) { } catch (\Exception $exception) {
// If this isn't a DaemonConnectionException on a task that allows for failures // If this isn't a DaemonConnectionException on a task that allows for failures
// throw the exception back up the chain so that the task is stopped. // throw the exception back up the chain so that the task is stopped.
if (!($this->task->continue_on_failure && $exception instanceof DaemonConnectionException)) { if (!($this->task->continue_on_failure && $exception instanceof DaemonConnectionException)) {
@ -89,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();

View File

@ -3,7 +3,6 @@
namespace Pterodactyl\Models; namespace Pterodactyl\Models;
use Carbon\Carbon; use Carbon\Carbon;
use LogicException;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Pterodactyl\Events\ActivityLogged; use Pterodactyl\Events\ActivityLogged;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
@ -124,7 +123,7 @@ class ActivityLog extends Model
public function prunable() public function prunable()
{ {
if (is_null(config('activity.prune_days'))) { if (is_null(config('activity.prune_days'))) {
throw new LogicException('Cannot prune activity logs: no "prune_days" configuration value is set.'); throw new \LogicException('Cannot prune activity logs: no "prune_days" configuration value is set.');
} }
return static::where('timestamp', '<=', Carbon::now()->subDays(config('activity.prune_days'))); return static::where('timestamp', '<=', Carbon::now()->subDays(config('activity.prune_days')));

View File

@ -18,6 +18,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property array|null $allowed_ips * @property array|null $allowed_ips
* @property string|null $memo * @property string|null $memo
* @property \Illuminate\Support\Carbon|null $last_used_at * @property \Illuminate\Support\Carbon|null $last_used_at
* @property \Illuminate\Support\Carbon|null $expires_at
* @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at * @property \Illuminate\Support\Carbon|null $updated_at
* @property int $r_servers * @property int $r_servers
@ -97,6 +98,10 @@ class ApiKey extends Model
protected $casts = [ protected $casts = [
'allowed_ips' => 'array', 'allowed_ips' => 'array',
'user_id' => 'int', 'user_id' => 'int',
'last_used_at' => 'datetime',
'expires_at' => 'datetime',
self::CREATED_AT => 'datetime',
self::UPDATED_AT => 'datetime',
'r_' . AdminAcl::RESOURCE_USERS => 'int', 'r_' . AdminAcl::RESOURCE_USERS => 'int',
'r_' . AdminAcl::RESOURCE_ALLOCATIONS => 'int', 'r_' . AdminAcl::RESOURCE_ALLOCATIONS => 'int',
'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS => 'int', 'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS => 'int',
@ -117,6 +122,7 @@ class ApiKey extends Model
'allowed_ips', 'allowed_ips',
'memo', 'memo',
'last_used_at', 'last_used_at',
'expires_at',
]; ];
/** /**
@ -137,6 +143,7 @@ class ApiKey extends Model
'allowed_ips' => 'nullable|array', 'allowed_ips' => 'nullable|array',
'allowed_ips.*' => 'string', 'allowed_ips.*' => 'string',
'last_used_at' => 'nullable|date', 'last_used_at' => 'nullable|date',
'expires_at' => 'nullable|date',
'r_' . AdminAcl::RESOURCE_USERS => 'integer|min:0|max:3', 'r_' . AdminAcl::RESOURCE_USERS => 'integer|min:0|max:3',
'r_' . AdminAcl::RESOURCE_ALLOCATIONS => 'integer|min:0|max:3', 'r_' . AdminAcl::RESOURCE_ALLOCATIONS => 'integer|min:0|max:3',
'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS => 'integer|min:0|max:3', 'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS => 'integer|min:0|max:3',
@ -148,12 +155,6 @@ class ApiKey extends Model
'r_' . AdminAcl::RESOURCE_SERVERS => 'integer|min:0|max:3', 'r_' . AdminAcl::RESOURCE_SERVERS => 'integer|min:0|max:3',
]; ];
protected $dates = [
self::CREATED_AT,
self::UPDATED_AT,
'last_used_at',
];
/** /**
* Returns the user this token is assigned to. * Returns the user this token is assigned to.
*/ */

View File

@ -43,10 +43,7 @@ class Backup extends Model
'is_locked' => 'bool', 'is_locked' => 'bool',
'ignored_files' => 'array', 'ignored_files' => 'array',
'bytes' => 'int', 'bytes' => 'int',
]; 'completed_at' => 'datetime',
protected $dates = [
'completed_at',
]; ];
protected $attributes = [ protected $attributes = [

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Models\Filters; namespace Pterodactyl\Models\Filters;
use BadMethodCallException;
use Spatie\QueryBuilder\Filters\Filter; use Spatie\QueryBuilder\Filters\Filter;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
@ -17,7 +16,7 @@ class AdminServerFilter implements Filter
public function __invoke(Builder $query, $value, string $property) public function __invoke(Builder $query, $value, string $property)
{ {
if ($query->getQuery()->from !== 'servers') { if ($query->getQuery()->from !== 'servers') {
throw new BadMethodCallException('Cannot use the AdminServerFilter against a non-server model.'); throw new \BadMethodCallException('Cannot use the AdminServerFilter against a non-server model.');
} }
$query $query
->select('servers.*') ->select('servers.*')

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Models\Filters; namespace Pterodactyl\Models\Filters;
use BadMethodCallException;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Spatie\QueryBuilder\Filters\Filter; use Spatie\QueryBuilder\Filters\Filter;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
@ -25,7 +24,7 @@ class MultiFieldServerFilter implements Filter
public function __invoke(Builder $query, $value, string $property) public function __invoke(Builder $query, $value, string $property)
{ {
if ($query->getQuery()->from !== 'servers') { if ($query->getQuery()->from !== 'servers') {
throw new BadMethodCallException('Cannot use the MultiFieldServerFilter against a non-server model.'); throw new \BadMethodCallException('Cannot use the MultiFieldServerFilter against a non-server model.');
} }
if (preg_match(self::IPV4_REGEX, $value) || preg_match('/^:\d{1,5}$/', $value)) { if (preg_match(self::IPV4_REGEX, $value) || preg_match('/^:\d{1,5}$/', $value)) {

View File

@ -71,14 +71,8 @@ class Schedule extends Model
'is_active' => 'boolean', 'is_active' => 'boolean',
'is_processing' => 'boolean', 'is_processing' => 'boolean',
'only_when_online' => 'boolean', 'only_when_online' => 'boolean',
]; 'last_run_at' => 'datetime',
'next_run_at' => 'datetime',
/**
* Columns to mutate to a date.
*/
protected $dates = [
'last_run_at',
'next_run_at',
]; ];
protected $attributes = [ protected $attributes = [

View File

@ -139,11 +139,6 @@ class Server extends Model
*/ */
protected $with = ['allocation']; protected $with = ['allocation'];
/**
* The attributes that should be mutated to dates.
*/
protected $dates = [self::CREATED_AT, self::UPDATED_AT, 'deleted_at', 'installed_at'];
/** /**
* Fields that are not mass assignable. * Fields that are not mass assignable.
*/ */
@ -193,6 +188,10 @@ class Server extends Model
'database_limit' => 'integer', 'database_limit' => 'integer',
'allocation_limit' => 'integer', 'allocation_limit' => 'integer',
'backup_limit' => 'integer', 'backup_limit' => 'integer',
self::CREATED_AT => 'datetime',
self::UPDATED_AT => 'datetime',
'deleted_at' => 'datetime',
'installed_at' => 'datetime',
]; ];
/** /**

View File

@ -23,10 +23,8 @@ class TaskLog extends Model
'id' => 'integer', 'id' => 'integer',
'task_id' => 'integer', 'task_id' => 'integer',
'run_status' => 'integer', 'run_status' => 'integer',
'run_time' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
]; ];
/**
* The attributes that should be mutated to dates.
*/
protected $dates = ['run_time', 'created_at', 'updated_at'];
} }

View File

@ -134,10 +134,9 @@ class User extends Model implements
'root_admin' => 'boolean', 'root_admin' => 'boolean',
'use_totp' => 'boolean', 'use_totp' => 'boolean',
'gravatar' => 'boolean', 'gravatar' => 'boolean',
'totp_authenticated_at' => 'datetime',
]; ];
protected $dates = ['totp_authenticated_at'];
/** /**
* The attributes excluded from the model's JSON form. * The attributes excluded from the model's JSON form.
*/ */

View File

@ -18,7 +18,7 @@ class AppServiceProvider extends ServiceProvider
/** /**
* Bootstrap any application services. * Bootstrap any application services.
*/ */
public function boot() public function boot(): void
{ {
Schema::defaultStringLength(191); Schema::defaultStringLength(191);
@ -54,7 +54,7 @@ class AppServiceProvider extends ServiceProvider
/** /**
* Register application service providers. * Register application service providers.
*/ */
public function register() public function register(): void
{ {
// Only load the settings service provider if the environment // Only load the settings service provider if the environment
// is configured to allow it. // is configured to allow it.

View File

@ -17,14 +17,12 @@ class AuthServiceProvider extends ServiceProvider
Server::class => ServerPolicy::class, Server::class => ServerPolicy::class,
]; ];
public function boot() public function boot(): void
{ {
Sanctum::usePersonalAccessTokenModel(ApiKey::class); Sanctum::usePersonalAccessTokenModel(ApiKey::class);
$this->registerPolicies();
} }
public function register() public function register(): void
{ {
Sanctum::ignoreMigrations(); Sanctum::ignoreMigrations();
} }

View File

@ -11,7 +11,7 @@ class BackupsServiceProvider extends ServiceProvider implements DeferrableProvid
/** /**
* Register the S3 backup disk. * Register the S3 backup disk.
*/ */
public function register() public function register(): void
{ {
$this->app->singleton(BackupManager::class, function ($app) { $this->app->singleton(BackupManager::class, function ($app) {
return new BackupManager($app); return new BackupManager($app);

View File

@ -9,7 +9,7 @@ class BladeServiceProvider extends ServiceProvider
/** /**
* Perform post-registration booting of services. * Perform post-registration booting of services.
*/ */
public function boot() public function boot(): void
{ {
$this->app->make('blade.compiler') $this->app->make('blade.compiler')
->directive('datetimeHuman', function ($expression) { ->directive('datetimeHuman', function ($expression) {

View File

@ -10,7 +10,7 @@ class BroadcastServiceProvider extends ServiceProvider
/** /**
* Bootstrap any application services. * Bootstrap any application services.
*/ */
public function boot() public function boot(): void
{ {
Broadcast::routes(); Broadcast::routes();

View File

@ -11,7 +11,7 @@ class HashidsServiceProvider extends ServiceProvider
/** /**
* Register the ability to use Hashids. * Register the ability to use Hashids.
*/ */
public function register() public function register(): void
{ {
$this->app->singleton(HashidsInterface::class, function () { $this->app->singleton(HashidsInterface::class, function () {
/** @var \Illuminate\Contracts\Config\Repository $config */ /** @var \Illuminate\Contracts\Config\Repository $config */

View File

@ -41,9 +41,9 @@ use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
class RepositoryServiceProvider extends ServiceProvider class RepositoryServiceProvider extends ServiceProvider
{ {
/** /**
* Register all of the repository bindings. * Register all the repository bindings.
*/ */
public function register() public function register(): void
{ {
// Eloquent Repositories // Eloquent Repositories
$this->app->bind(AllocationRepositoryInterface::class, AllocationRepository::class); $this->app->bind(AllocationRepositoryInterface::class, AllocationRepository::class);

View File

@ -19,7 +19,7 @@ class RouteServiceProvider extends ServiceProvider
/** /**
* Define your route model bindings, pattern filters, etc. * Define your route model bindings, pattern filters, etc.
*/ */
public function boot() public function boot(): void
{ {
$this->configureRateLimiting(); $this->configureRateLimiting();
@ -68,7 +68,7 @@ class RouteServiceProvider extends ServiceProvider
/** /**
* Configure the rate limiters for the application. * Configure the rate limiters for the application.
*/ */
protected function configureRateLimiting() protected function configureRateLimiting(): void
{ {
// Authentication rate limiting. For login and checkpoint endpoints we'll apply // Authentication rate limiting. For login and checkpoint endpoints we'll apply
// a limit of 10 requests per minute, for the forgot password endpoint apply a // a limit of 10 requests per minute, for the forgot password endpoint apply a

View File

@ -57,7 +57,7 @@ class SettingsServiceProvider extends ServiceProvider
/** /**
* Boot the service provider. * Boot the service provider.
*/ */
public function boot(ConfigRepository $config, Encrypter $encrypter, Log $log, SettingsRepositoryInterface $settings) public function boot(ConfigRepository $config, Encrypter $encrypter, Log $log, SettingsRepositoryInterface $settings): void
{ {
// Only set the email driver settings from the database if we // Only set the email driver settings from the database if we
// are configured using SMTP as the driver. // are configured using SMTP as the driver.

View File

@ -10,7 +10,7 @@ class ViewComposerServiceProvider extends ServiceProvider
/** /**
* Register bindings in the container. * Register bindings in the container.
*/ */
public function boot() public function boot(): void
{ {
$this->app->make('view')->composer('*', AssetComposer::class); $this->app->make('view')->composer('*', AssetComposer::class);
} }

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Repositories\Eloquent; namespace Pterodactyl\Repositories\Eloquent;
use Exception;
use Pterodactyl\Contracts\Repository\PermissionRepositoryInterface; use Pterodactyl\Contracts\Repository\PermissionRepositoryInterface;
class PermissionRepository extends EloquentRepository implements PermissionRepositoryInterface class PermissionRepository extends EloquentRepository implements PermissionRepositoryInterface
@ -14,6 +13,6 @@ class PermissionRepository extends EloquentRepository implements PermissionRepos
*/ */
public function model(): string public function model(): string
{ {
throw new Exception('This functionality is not implemented.'); throw new \Exception('This functionality is not implemented.');
} }
} }

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Repositories; namespace Pterodactyl\Repositories;
use InvalidArgumentException;
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Pterodactyl\Contracts\Repository\RepositoryInterface; use Pterodactyl\Contracts\Repository\RepositoryInterface;
@ -97,7 +96,7 @@ abstract class Repository implements RepositoryInterface
case 2: case 2:
return $this->model = call_user_func([$this->app->make($model[0]), $model[1]]); return $this->model = call_user_func([$this->app->make($model[0]), $model[1]]);
default: default:
throw new InvalidArgumentException('Model must be a FQDN or an array with a count of two.'); throw new \InvalidArgumentException('Model must be a FQDN or an array with a count of two.');
} }
} }
} }

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Services\Acl\Api; namespace Pterodactyl\Services\Acl\Api;
use ReflectionClass;
use Pterodactyl\Models\ApiKey; use Pterodactyl\Models\ApiKey;
class AdminAcl class AdminAcl
@ -63,7 +62,7 @@ class AdminAcl
*/ */
public static function getResourceList(): array public static function getResourceList(): array
{ {
$reflect = new ReflectionClass(__CLASS__); $reflect = new \ReflectionClass(__CLASS__);
return collect($reflect->getConstants())->filter(function ($value, $key) { return collect($reflect->getConstants())->filter(function ($value, $key) {
return substr($key, 0, 9) === 'RESOURCE_'; return substr($key, 0, 9) === 'RESOURCE_';

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Services\Allocations; namespace Pterodactyl\Services\Allocations;
use Exception;
use IPTools\Network; use IPTools\Network;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;
@ -54,7 +53,7 @@ class AssignmentService
// IP to use, not multiple. // IP to use, not multiple.
$underlying = gethostbyname($data['allocation_ip']); $underlying = gethostbyname($data['allocation_ip']);
$parsed = Network::parse($underlying); $parsed = Network::parse($underlying);
} catch (Exception $exception) { } catch (\Exception $exception) {
/* @noinspection PhpUndefinedVariableInspection */ /* @noinspection PhpUndefinedVariableInspection */
throw new DisplayException("Could not parse provided allocation IP address ({$underlying}): {$exception->getMessage()}", $exception); throw new DisplayException("Could not parse provided allocation IP address ({$underlying}): {$exception->getMessage()}", $exception);
} }

View File

@ -3,7 +3,6 @@
namespace Pterodactyl\Services\Databases; namespace Pterodactyl\Services\Databases;
use Exception; use Exception;
use InvalidArgumentException;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Pterodactyl\Models\Database; use Pterodactyl\Models\Database;
use Pterodactyl\Helpers\Utilities; use Pterodactyl\Helpers\Utilities;
@ -86,7 +85,7 @@ class DatabaseManagementService
// Protect against developer mistakes... // Protect against developer mistakes...
if (empty($data['database']) || !preg_match(self::MATCH_NAME_REGEX, $data['database'])) { if (empty($data['database']) || !preg_match(self::MATCH_NAME_REGEX, $data['database'])) {
throw new InvalidArgumentException('The database name passed to DatabaseManagementService::handle MUST be prefixed with "s{server_id}_".'); throw new \InvalidArgumentException('The database name passed to DatabaseManagementService::handle MUST be prefixed with "s{server_id}_".');
} }
$data = array_merge($data, [ $data = array_merge($data, [
@ -117,14 +116,14 @@ class DatabaseManagementService
return $database; return $database;
}); });
} catch (Exception $exception) { } catch (\Exception $exception) {
try { try {
if ($database instanceof Database) { if ($database instanceof Database) {
$this->repository->dropDatabase($database->database); $this->repository->dropDatabase($database->database);
$this->repository->dropUser($database->username, $database->remote); $this->repository->dropUser($database->username, $database->remote);
$this->repository->flush(); $this->repository->flush();
} }
} catch (Exception $deletionException) { } catch (\Exception $deletionException) {
// Do nothing here. We've already encountered an issue before this point so no // Do nothing here. We've already encountered an issue before this point so no
// reason to prioritize this error over the initial one. // reason to prioritize this error over the initial one.
} }

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Services\Nodes; namespace Pterodactyl\Services\Nodes;
use DateTimeImmutable;
use Carbon\CarbonImmutable; use Carbon\CarbonImmutable;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
@ -19,7 +18,7 @@ class NodeJWTService
private ?User $user = null; private ?User $user = null;
private ?DateTimeImmutable $expiresAt; private ?\DateTimeImmutable $expiresAt;
private ?string $subject = null; private ?string $subject = null;
@ -44,7 +43,7 @@ class NodeJWTService
return $this; return $this;
} }
public function setExpiresAt(DateTimeImmutable $date): self public function setExpiresAt(\DateTimeImmutable $date): self
{ {
$this->expiresAt = $date; $this->expiresAt = $date;

View File

@ -56,7 +56,7 @@ class ProcessScheduleService
return; return;
} }
} catch (Exception $exception) { } catch (\Exception $exception) {
if (!$exception instanceof DaemonConnectionException) { if (!$exception instanceof DaemonConnectionException) {
// If we encountered some exception during this process that wasn't just an // If we encountered some exception during this process that wasn't just an
// issue connecting to Wings run the failed sequence for a job. Otherwise we // issue connecting to Wings run the failed sequence for a job. Otherwise we
@ -78,7 +78,7 @@ class ProcessScheduleService
// @see https://github.com/pterodactyl/panel/issues/2550 // @see https://github.com/pterodactyl/panel/issues/2550
try { try {
$this->dispatcher->dispatchNow($job); $this->dispatcher->dispatchNow($job);
} catch (Exception $exception) { } catch (\Exception $exception) {
$job->failed($exception); $job->failed($exception);
throw $exception; throw $exception;

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Services\Servers; namespace Pterodactyl\Services\Servers;
use Exception;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@ -61,7 +60,7 @@ class ServerDeletionService
foreach ($server->databases as $database) { foreach ($server->databases as $database) {
try { try {
$this->databaseManagementService->delete($database); $this->databaseManagementService->delete($database);
} catch (Exception $exception) { } catch (\Exception $exception) {
if (!$this->force) { if (!$this->force) {
throw $exception; throw $exception;
} }

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Services\Telemetry; namespace Pterodactyl\Services\Telemetry;
use PDO;
use Exception; use Exception;
use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Uuid;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
@ -123,7 +122,7 @@ class TelemetryCollectionService
'database' => [ 'database' => [
'type' => config('database.default'), 'type' => config('database.default'),
'version' => DB::getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION), 'version' => DB::getPdo()->getAttribute(\PDO::ATTR_SERVER_VERSION),
], ],
], ],
], ],

View File

@ -2,8 +2,6 @@
namespace Pterodactyl\Services\Users; namespace Pterodactyl\Services\Users;
use Exception;
use RuntimeException;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Contracts\Encryption\Encrypter;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface; use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
@ -38,8 +36,8 @@ class TwoFactorSetupService
for ($i = 0; $i < $this->config->get('pterodactyl.auth.2fa.bytes', 16); ++$i) { for ($i = 0; $i < $this->config->get('pterodactyl.auth.2fa.bytes', 16); ++$i) {
$secret .= substr(self::VALID_BASE32_CHARACTERS, random_int(0, 31), 1); $secret .= substr(self::VALID_BASE32_CHARACTERS, random_int(0, 31), 1);
} }
} catch (Exception $exception) { } catch (\Exception $exception) {
throw new RuntimeException($exception->getMessage(), 0, $exception); throw new \RuntimeException($exception->getMessage(), 0, $exception);
} }
$this->repository->withoutFreshModel()->update($user->id, [ $this->repository->withoutFreshModel()->update($user->id, [

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Traits\Controllers; namespace Pterodactyl\Traits\Controllers;
use JavaScript;
use Illuminate\Http\Request; use Illuminate\Http\Request;
trait JavascriptInjection trait JavascriptInjection
@ -24,6 +23,6 @@ trait JavascriptInjection
*/ */
public function plainInject(array $args = []): string public function plainInject(array $args = []): string
{ {
return JavaScript::put($args); return \JavaScript::put($args);
} }
} }

View File

@ -11,6 +11,6 @@ trait PlainJavascriptInjection
*/ */
public function injectJavascript($data) public function injectJavascript($data)
{ {
JavaScript::put($data); \JavaScript::put($data);
} }
} }

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Traits\Services; namespace Pterodactyl\Traits\Services;
use BadMethodCallException;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Illuminate\Contracts\Validation\Factory as ValidationFactory; use Illuminate\Contracts\Validation\Factory as ValidationFactory;
use Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException; use Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException;
@ -21,7 +20,7 @@ trait ValidatesValidationRules
{ {
try { try {
$this->getValidator()->make(['__TEST' => 'test'], ['__TEST' => $rules])->fails(); $this->getValidator()->make(['__TEST' => 'test'], ['__TEST' => $rules])->fails();
} catch (BadMethodCallException $exception) { } catch (\BadMethodCallException $exception) {
$matches = []; $matches = [];
if (preg_match('/Method \[(.+)\] does not exist\./', $exception->getMessage(), $matches)) { if (preg_match('/Method \[(.+)\] does not exist\./', $exception->getMessage(), $matches)) {
throw new BadValidationRuleException(trans('exceptions.nest.variables.bad_validation_rule', ['rule' => Str::snake(str_replace('validate', '', array_get($matches, 1, 'unknownRule')))]), $exception); throw new BadValidationRuleException(trans('exceptions.nest.variables.bad_validation_rule', ['rule' => Str::snake(str_replace('validate', '', array_get($matches, 1, 'unknownRule')))]), $exception);

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Transformers\Api\Client; namespace Pterodactyl\Transformers\Api\Client;
use BadMethodCallException;
use Pterodactyl\Models\EggVariable; use Pterodactyl\Models\EggVariable;
class EggVariableTransformer extends BaseClientTransformer class EggVariableTransformer extends BaseClientTransformer
@ -18,7 +17,7 @@ class EggVariableTransformer extends BaseClientTransformer
// them into the transformer and along to the user. Just throw an exception and break the entire // them into the transformer and along to the user. Just throw an exception and break the entire
// pathway since you should never be exposing these types of variables to a client. // pathway since you should never be exposing these types of variables to a client.
if (!$variable->user_viewable) { if (!$variable->user_viewable) {
throw new BadMethodCallException('Cannot transform a hidden egg variable in a client transformer.'); throw new \BadMethodCallException('Cannot transform a hidden egg variable in a client transformer.');
} }
return [ return [

View File

@ -17,53 +17,52 @@
} }
], ],
"require": { "require": {
"php": "^8.0.2 || ^8.1 || ^8.2", "php": "^8.1 || ^8.2",
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-pdo": "*", "ext-pdo": "*",
"ext-pdo_mysql": "*", "ext-pdo_mysql": "*",
"ext-posix": "*", "ext-posix": "*",
"ext-zip": "*", "ext-zip": "*",
"aws/aws-sdk-php": "~3.238.2", "aws/aws-sdk-php": "~3.260.1",
"doctrine/dbal": "~3.4.5", "doctrine/dbal": "~3.6.0",
"guzzlehttp/guzzle": "~7.5.0", "guzzlehttp/guzzle": "~7.5.0",
"hashids/hashids": "~4.1.0", "hashids/hashids": "~5.0.0",
"laracasts/utilities": "~3.2.1", "laracasts/utilities": "~3.2.2",
"laravel/framework": "^9.34.0", "laravel/framework": "~10.1.3",
"laravel/helpers": "~1.5.0", "laravel/helpers": "~1.6.0",
"laravel/sanctum": "~2.15.1", "laravel/sanctum": "~3.2.1",
"laravel/tinker": "~2.7.2", "laravel/tinker": "~2.8.1",
"laravel/ui": "~3.4.6", "laravel/ui": "~4.2.1",
"lcobucci/jwt": "~4.2.1", "lcobucci/jwt": "~4.3.0",
"league/flysystem-aws-s3-v3": "~3.5.0", "league/flysystem-aws-s3-v3": "~3.12.2",
"league/flysystem-memory": "~3.3.0", "league/flysystem-memory": "~3.10.3",
"matriphe/iso-639": "~1.2", "matriphe/iso-639": "~1.2",
"phpseclib/phpseclib": "~3.0", "phpseclib/phpseclib": "~3.0.18",
"pragmarx/google2fa": "~5.0.0", "pragmarx/google2fa": "~8.0.0",
"predis/predis": "~2.0.2", "predis/predis": "~2.1.1",
"prologue/alerts": "~1.0.0", "prologue/alerts": "~1.1.0",
"psr/cache": "~3.0.0", "psr/cache": "~3.0.0",
"s1lentium/iptools": "~1.1.1", "s1lentium/iptools": "~1.2.0",
"spatie/laravel-fractal": "~6.0.2", "spatie/laravel-fractal": "~6.0.3",
"spatie/laravel-query-builder": "~5.0.3", "spatie/laravel-query-builder": "~5.1.2",
"staudenmeir/belongs-to-through": "~2.12.1", "staudenmeir/belongs-to-through": "~2.13",
"symfony/http-client": "~6.0", "symfony/http-client": "~6.2.6",
"symfony/mailgun-mailer": "~6.0", "symfony/mailgun-mailer": "~6.2.5",
"symfony/postmark-mailer": "~6.0", "symfony/postmark-mailer": "~6.2.5",
"symfony/yaml": "~5.4", "symfony/yaml": "~6.2.5",
"webmozart/assert": "~1.11" "webmozart/assert": "~1.11.0"
}, },
"require-dev": { "require-dev": {
"barryvdh/laravel-ide-helper": "~2.12.3", "barryvdh/laravel-ide-helper": "~2.13.0",
"fakerphp/faker": "~1.20", "fakerphp/faker": "~1.21.0",
"friendsofphp/php-cs-fixer": "~3.11", "friendsofphp/php-cs-fixer": "~3.14.4",
"itsgoingd/clockwork": "~5.1", "itsgoingd/clockwork": "~5.1.12",
"laravel/sail": "~1.16", "laravel/sail": "~1.21.0",
"mockery/mockery": "~1.5", "mockery/mockery": "~1.5.1",
"nunomaduro/collision": "~6.3", "nunomaduro/collision": "~7.0.5",
"php-mock/php-mock-phpunit": "~2.6", "phpunit/phpunit": "~10.0.11",
"phpunit/phpunit": "~9.5", "spatie/laravel-ignition": "~2.0.0"
"spatie/laravel-ignition": "~1.5"
}, },
"autoload": { "autoload": {
"files": [ "files": [
@ -83,24 +82,25 @@
"scripts": { "scripts": {
"cs:fix": "php-cs-fixer fix", "cs:fix": "php-cs-fixer fix",
"cs:check": "php-cs-fixer fix --dry-run --diff --verbose", "cs:check": "php-cs-fixer fix --dry-run --diff --verbose",
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi || true"
],
"post-root-package-install": [ "post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
], ],
"post-create-project-cmd": [ "post-create-project-cmd": [
"@php artisan key:generate" "@php artisan key:generate --ansi"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover || true"
] ]
}, },
"prefer-stable": true,
"config": { "config": {
"optimize-autoloader": true, "optimize-autoloader": true,
"preferred-install": "dist", "preferred-install": "dist",
"sort-packages": true, "sort-packages": true,
"platform": { "platform": {
"php": "8.0.2" "php": "8.1.0"
} }
} },
"minimum-stability": "stable",
"prefer-stable": true
} }

3042
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ return [
| change this value if you are not maintaining your own internal versions. | change this value if you are not maintaining your own internal versions.
*/ */
'version' => '1.10.4', 'version' => '1.11.4',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -27,7 +27,7 @@ return [
| sending an e-mail. You will specify which one you are using for your | sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required. | mailers below. You are free to add additional mailers as required.
| |
| Supported: "smtp", "sendmail", "mailgun", "ses", | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "log", "array", "failover" | "postmark", "log", "array", "failover"
| |
*/ */

View File

@ -34,7 +34,7 @@ class EggVariableFactory extends Factory
/** /**
* Indicate that the egg variable is viewable. * Indicate that the egg variable is viewable.
*/ */
public function viewable(): Factory public function viewable(): static
{ {
return $this->state(function (array $attributes) { return $this->state(function (array $attributes) {
return [ return [
@ -46,7 +46,7 @@ class EggVariableFactory extends Factory
/** /**
* Indicate that the egg variable is editable. * Indicate that the egg variable is editable.
*/ */
public function editable(): Factory public function editable(): static
{ {
return $this->state(function (array $attributes) { return $this->state(function (array $attributes) {
return [ return [

View File

@ -43,7 +43,7 @@ class UserFactory extends Factory
/** /**
* Indicate that the user is an admin. * Indicate that the user is an admin.
*/ */
public function admin(): Factory public function admin(): static
{ {
return $this->state(['root_admin' => true]); return $this->state(['root_admin' => true]);
} }

View File

@ -1,21 +1,21 @@
{ {
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": { "meta": {
"version": "PTDL_v1", "version": "PTDL_v2",
"update_url": null "update_url": null
}, },
"exported_at": "2022-01-18T11:44:55-05:00", "exported_at": "2023-03-25T13:37:00+00:00",
"name": "Rust", "name": "Rust",
"author": "support@pterodactyl.io", "author": "support@pterodactyl.io",
"description": "The only aim in Rust is to survive. To do this you will need to overcome struggles such as hunger, thirst and cold. Build a fire. Build a shelter. Kill animals for meat. Protect yourself from other players, and kill them for meat. Create alliances with other players and form a town. Do whatever it takes to survive.", "description": "The only aim in Rust is to survive. To do this you will need to overcome struggles such as hunger, thirst and cold. Build a fire. Build a shelter. Kill animals for meat. Protect yourself from other players, and kill them for meat. Create alliances with other players and form a town. Do whatever it takes to survive.",
"features": [ "features": [
"steam_disk_space" "steam_disk_space"
], ],
"images": [ "docker_images": {
"quay.io\/pterodactyl\/core:rust" "quay.io\/pterodactyl\/core:rust": "quay.io\/pterodactyl\/core:rust"
], },
"file_denylist": [], "file_denylist": [],
"startup": ".\/RustDedicated -batchmode +server.port {{SERVER_PORT}} +server.identity \"rust\" +rcon.port {{RCON_PORT}} +rcon.web true +server.hostname \\\"{{HOSTNAME}}\\\" +server.level \\\"{{LEVEL}}\\\" +server.description \\\"{{DESCRIPTION}}\\\" +server.url \\\"{{SERVER_URL}}\\\" +server.headerimage \\\"{{SERVER_IMG}}\\\" +server.logoimage \\\"{{SERVER_LOGO}}\\\" +server.maxplayers {{MAX_PLAYERS}} +rcon.password \\\"{{RCON_PASS}}\\\" +server.saveinterval {{SAVEINTERVAL}} +app.port {{APP_PORT}} $( [ -z ${MAP_URL} ] && printf %s \"+server.worldsize \\\"{{WORLD_SIZE}}\\\" +server.seed \\\"{{WORLD_SEED}}\\\"\" || printf %s \"+server.levelurl {{MAP_URL}}\" ) {{ADDITIONAL_ARGS}}", "startup": ".\/RustDedicated -batchmode +server.port {{SERVER_PORT}} +server.queryport {{QUERY_PORT}} +server.identity \"rust\" +rcon.port {{RCON_PORT}} +rcon.web true +server.hostname \\\"{{HOSTNAME}}\\\" +server.level \\\"{{LEVEL}}\\\" +server.description \\\"{{DESCRIPTION}}\\\" +server.url \\\"{{SERVER_URL}}\\\" +server.headerimage \\\"{{SERVER_IMG}}\\\" +server.logoimage \\\"{{SERVER_LOGO}}\\\" +server.maxplayers {{MAX_PLAYERS}} +rcon.password \\\"{{RCON_PASS}}\\\" +server.saveinterval {{SAVEINTERVAL}} +app.port {{APP_PORT}} $( [ -z ${MAP_URL} ] && printf %s \"+server.worldsize \\\"{{WORLD_SIZE}}\\\" +server.seed \\\"{{WORLD_SEED}}\\\"\" || printf %s \"+server.levelurl {{MAP_URL}}\" ) {{ADDITIONAL_ARGS}}",
"config": { "config": {
"files": "{}", "files": "{}",
"startup": "{\r\n \"done\": \"Server startup complete\"\r\n}", "startup": "{\r\n \"done\": \"Server startup complete\"\r\n}",
@ -37,16 +37,18 @@
"default_value": "A Rust Server", "default_value": "A Rust Server",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "required|string|max:60" "rules": "required|string|max:60",
"field_type": "text"
}, },
{ {
"name": "OxideMod", "name": "Modding Framework",
"description": "Set whether you want the server to use and auto update OxideMod or not. Valid options are \"1\" for true and \"0\" for false.", "description": "The modding framework to be used: carbon, oxide, vanilla.\r\nDefaults to \"vanilla\" for a non-modded server installation.",
"env_variable": "OXIDE", "env_variable": "FRAMEWORK",
"default_value": "0", "default_value": "vanilla",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "required|boolean" "rules": "required|in:carbon,oxide,vanilla",
"field_type": "text"
}, },
{ {
"name": "Level", "name": "Level",
@ -55,7 +57,8 @@
"default_value": "Procedural Map", "default_value": "Procedural Map",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "required|string|max:20" "rules": "required|string|max:20",
"field_type": "text"
}, },
{ {
"name": "Description", "name": "Description",
@ -64,7 +67,8 @@
"default_value": "Powered by Pterodactyl", "default_value": "Powered by Pterodactyl",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "required|string" "rules": "required|string",
"field_type": "text"
}, },
{ {
"name": "URL", "name": "URL",
@ -73,7 +77,8 @@
"default_value": "http:\/\/pterodactyl.io", "default_value": "http:\/\/pterodactyl.io",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "nullable|url" "rules": "nullable|url",
"field_type": "text"
}, },
{ {
"name": "World Size", "name": "World Size",
@ -82,7 +87,8 @@
"default_value": "3000", "default_value": "3000",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "required|integer" "rules": "required|integer",
"field_type": "text"
}, },
{ {
"name": "World Seed", "name": "World Seed",
@ -91,7 +97,8 @@
"default_value": "", "default_value": "",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "nullable|string" "rules": "nullable|string",
"field_type": "text"
}, },
{ {
"name": "Max Players", "name": "Max Players",
@ -100,7 +107,8 @@
"default_value": "40", "default_value": "40",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "required|integer" "rules": "required|integer",
"field_type": "text"
}, },
{ {
"name": "Server Image", "name": "Server Image",
@ -109,7 +117,18 @@
"default_value": "", "default_value": "",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "nullable|url" "rules": "nullable|url",
"field_type": "text"
},
{
"name": "Query Port",
"description": "Server Query Port. Can't be the same as Game's primary port.",
"env_variable": "QUERY_PORT",
"default_value": "27017",
"user_viewable": true,
"user_editable": false,
"rules": "required|integer",
"field_type": "text"
}, },
{ {
"name": "RCON Port", "name": "RCON Port",
@ -118,16 +137,18 @@
"default_value": "28016", "default_value": "28016",
"user_viewable": true, "user_viewable": true,
"user_editable": false, "user_editable": false,
"rules": "required|integer" "rules": "required|integer",
"field_type": "text"
}, },
{ {
"name": "RCON Password", "name": "RCON Password",
"description": "RCON access password.", "description": "RCON access password.",
"env_variable": "RCON_PASS", "env_variable": "RCON_PASS",
"default_value": "CHANGEME", "default_value": "",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "required|regex:\/^[\\w.-]*$\/|max:64" "rules": "required|regex:\/^[\\w.-]*$\/|max:64",
"field_type": "text"
}, },
{ {
"name": "Save Interval", "name": "Save Interval",
@ -136,7 +157,8 @@
"default_value": "60", "default_value": "60",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "required|integer" "rules": "required|integer",
"field_type": "text"
}, },
{ {
"name": "Additional Arguments", "name": "Additional Arguments",
@ -145,7 +167,8 @@
"default_value": "", "default_value": "",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "nullable|string" "rules": "nullable|string",
"field_type": "text"
}, },
{ {
"name": "App Port", "name": "App Port",
@ -154,7 +177,8 @@
"default_value": "28082", "default_value": "28082",
"user_viewable": true, "user_viewable": true,
"user_editable": false, "user_editable": false,
"rules": "required|integer" "rules": "required|integer",
"field_type": "text"
}, },
{ {
"name": "Server Logo", "name": "Server Logo",
@ -163,7 +187,8 @@
"default_value": "", "default_value": "",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "nullable|url" "rules": "nullable|url",
"field_type": "text"
}, },
{ {
"name": "Custom Map URL", "name": "Custom Map URL",
@ -172,7 +197,8 @@
"default_value": "", "default_value": "",
"user_viewable": true, "user_viewable": true,
"user_editable": true, "user_editable": true,
"rules": "nullable|url" "rules": "nullable|url",
"field_type": "text"
} }
] ]
} }

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->timestamp('expires_at')->nullable()->after('last_used_at');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->dropColumn('expires_at');
});
}
};

View File

@ -1,12 +1,93 @@
{ {
"nodes": { "nodes": {
"flake-utils": { "devshell": {
"flake": false,
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1663445644,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=",
"owner": "numtide",
"repo": "devshell",
"rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"dream2nix": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"nix-unit": "nix-unit",
"nixpkgs": [
"nixpkgs"
],
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1695717405,
"narHash": "sha256-MvHrU3h0Bw57s2p+wCUnSZliR4wvvPi3xkW+MRWB5HU=",
"owner": "nix-community",
"repo": "dream2nix",
"rev": "6dbd59e4a47bd916a655c4425a3e730c6aeae033",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "dream2nix",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"dream2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1675933616,
"narHash": "sha256-/rczJkJHtx16IFxMmAWu5nNYcSXNg1YYXTHoGjLrLUA=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "47478a4a003e745402acf63be7f9a092d51b83d7",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -15,13 +96,105 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"mk-node-package": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
],
"npmlock2nix": "npmlock2nix",
"pnpm2nix": "pnpm2nix"
},
"locked": {
"lastModified": 1633790997,
"narHash": "sha256-1mk4EwNkWtTNpeRivZmJTzB+92g07maeFRVUMnnRh1U=",
"owner": "winston0410",
"repo": "mkNodePackage",
"rev": "a7eca5e027c8b260dca4ece7d8dd187f92420611",
"type": "github"
},
"original": {
"owner": "winston0410",
"repo": "mkNodePackage",
"type": "github"
}
},
"nix-github-actions": {
"inputs": {
"nixpkgs": [
"dream2nix",
"nix-unit",
"nixpkgs"
]
},
"locked": {
"lastModified": 1688870561,
"narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=",
"owner": "nix-community",
"repo": "nix-github-actions",
"rev": "165b1650b753316aa7f1787f3005a8d2da0f5301",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-github-actions",
"type": "github"
}
},
"nix-unit": {
"inputs": {
"flake-parts": [
"dream2nix",
"flake-parts"
],
"nix-github-actions": "nix-github-actions",
"nixpkgs": [
"dream2nix",
"nixpkgs"
],
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1690289081,
"narHash": "sha256-PCXQAQt8+i2pkUym9P1JY4JGoeZJLzzxWBhprHDdItM=",
"owner": "adisbladis",
"repo": "nix-unit",
"rev": "a9d6f33e50d4dcd9cfc0c92253340437bbae282b",
"type": "github"
},
"original": {
"owner": "adisbladis",
"repo": "nix-unit",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1666539104, "lastModified": 1695644571,
"narHash": "sha256-jeuC+d375wHHxMOFLgu7etseCQVJuPNKoEc9X9CsErg=", "narHash": "sha256-asS9dCCdlt1lPq0DLwkVBbVoEKuEuz+Zi3DG7pR/RxA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0e6df35f39651504249a05191f9a78d251707e22", "rev": "6500b4580c2a1f3d0f980d32d285739d8e156d92",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -31,11 +204,121 @@
"type": "github" "type": "github"
} }
}, },
"root": { "npmlock2nix": {
"flake": false,
"locked": {
"lastModified": 1633729941,
"narHash": "sha256-v2YPcEWI1Wz8ErivorubgLcDT06H6YzFT7uhp1ymqnE=",
"owner": "winston0410",
"repo": "npmlock2nix",
"rev": "6ade47a330b6919defb45c0eb984a64234aa8468",
"type": "github"
},
"original": {
"owner": "winston0410",
"ref": "issue113",
"repo": "npmlock2nix",
"type": "github"
}
},
"pnpm2nix": {
"flake": false,
"locked": {
"lastModified": 1594396611,
"narHash": "sha256-UXOUQ+2A89/zaxYhTHiRrRBU5exbUWrg+FoJYMcNwuI=",
"owner": "nix-community",
"repo": "pnpm2nix",
"rev": "f67be0925a91b92f54d99dbdead7a06920b979ac",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "pnpm2nix",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": [
"dream2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1646153636,
"narHash": "sha256-AlWHMzK+xJ1mG267FdT8dCq/HvLCA6jwmx2ZUy5O8tY=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "b6bc0b21e1617e2b07d8205e7fae7224036dfa4b",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"dream2nix": "dream2nix",
"flake-utils": "flake-utils_2",
"mk-node-package": "mk-node-package",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"dream2nix",
"nix-unit",
"nixpkgs"
]
},
"locked": {
"lastModified": 1689620039,
"narHash": "sha256-BtNwghr05z7k5YMdq+6nbue+nEalvDepuA7qdQMAKoQ=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "719c2977f958c41fa60a928e2fbc50af14844114",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

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