Skip to content

Commit

Permalink
Merge branch '1.0-develop' of https://ghgo.xyz/https://github.com/pte…
Browse files Browse the repository at this point in the history
…rodactyl/panel into 1.0-develop
  • Loading branch information
vlssu committed Dec 29, 2024
2 parents 4b7af39 + 90ae588 commit 8bc7f54
Show file tree
Hide file tree
Showing 459 changed files with 6,325 additions and 4,843 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ jobs:
ui:
name: UI
runs-on: ubuntu-20.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
node-version: [16]
steps:
- name: Code Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ jobs:
tests:
name: Tests
runs-on: ubuntu-20.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
php: [8.1, 8.2]
database: ["mariadb:10.2", "mysql:8"]
php: [8.2, 8.3]
database:
- mariadb:10.5
- mariadb:10.11
- mariadb:11.5
- mysql:8
- mysql:9
services:
database:
image: ${{ matrix.database }}
Expand All @@ -27,18 +34,17 @@ jobs:
MYSQL_DATABASE: testing
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Code Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
name: Push
runs-on: ubuntu-20.04
if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
permissions:
contents: read
packages: write
steps:
- name: Code checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -46,7 +49,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Update version
if: "github.event_name == 'release' && github.event.action == 'published'"
Expand All @@ -56,7 +59,7 @@ jobs:
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:1}',/" config/app.php
- name: Build and Push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-20.04
permissions:
contents: read
steps:
- name: Code Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
php-version: "8.2"
extensions: bcmath, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
tools: composer:v2
coverage: none
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ jobs:
release:
name: Release
runs-on: ubuntu-20.04
permissions:
contents: write # write is required to create releases and push.
steps:
- name: Code checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
cache: "yarn"
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile
Expand All @@ -41,7 +43,7 @@ jobs:
- name: Create release archive
run: |
rm -rf node_modules tests CODE_OF_CONDUCT.md CONTRIBUTING.md flake.lock flake.nix phpunit.xml shell.nix
rm -rf node_modules tests CODE_OF_CONDUCT.md CONTRIBUTING.md flake.lock flake.nix phpunit.xml shell.nix
tar -czf panel.tar.gz * .editorconfig .env.example .eslintignore .eslintrc.js .gitignore .prettierrc.json
- name: Extract changelog
Expand All @@ -58,7 +60,7 @@ jobs:
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ public/assets/manifest.json
# For local development with docker
# Remove if we ever put the Dockerfile in the repo
.dockerignore
docker-compose.yml
docker-compose.*
!docker-compose.example.yml
!docker-compose.example.yaml

# for image related files
misc
Expand All @@ -33,4 +35,3 @@ resources/lang/locales.js
/public/build
/public/hot
result
docker-compose.yaml
2 changes: 2 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

$finder = (new Finder())
->in(__DIR__)
Expand All @@ -14,6 +15,7 @@
->notName(['_ide_helper*']);

return (new Config())
->setParallelConfig(ParallelConfigFactory::detect())
->setRiskyAllowed(true)
->setFinder($finder)
->setRules([
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@ 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.

## v1.11.10

### BREAKING

* Minimum PHP verion is now 8.2 due to Laravel upgrade!

### Fixed

* Update Laravel to address [CVE-2024-52301](https://github.com/advisories/GHSA-gv7v-rgg6-548h)

## v1.11.9

### Fixed

* Fixed issue with CI not pushing Docker image

## v1.11.8

### Fixed

* Fixed an issue where a `DELETE` request was used instead of a `POST`, potentially logging user passwords in plain text if they disable 2FA.

## v1.11.7

### Added
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN yarn install --frozen-lockfile --network-timeout 200000 \

# Stage 1:
# Build the actual container with all of the needed PHP dependencies that will run the application.
FROM --platform=$TARGETOS/$TARGETARCH php:8.1-fpm-alpine
FROM --platform=$TARGETOS/$TARGETARCH php:8.2-fpm-alpine
WORKDIR /app
COPY . ./
COPY --from=0 /app/public/assets ./public/assets
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Location/DeleteLocationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DeleteLocationCommand extends Command
*/
public function __construct(
private LocationDeletionService $deletionService,
private LocationRepositoryInterface $repository
private LocationRepositoryInterface $repository,
) {
parent::__construct();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function handle()

collect($files)->each(function (\SplFileInfo $file) {
$lastModified = Carbon::createFromTimestamp($this->disk->lastModified($file->getPath()));
if ($lastModified->diffInMinutes(Carbon::now()) > self::BACKUP_THRESHOLD_MINUTES) {
if ((int) $lastModified->diffInMinutes(Carbon::now()) > self::BACKUP_THRESHOLD_MINUTES) {
$this->disk->delete($file->getPath());
$this->info(trans('command/messages.maintenance.deleting_service_backup', ['file' => $file->getFilename()]));
}
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Node/NodeConfigurationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function handle(): int
{
$column = ctype_digit((string) $this->argument('node')) ? 'id' : 'uuid';

/** @var \Pterodactyl\Models\Node $node */
/** @var Node $node */
$node = Node::query()->where($column, $this->argument('node'))->firstOr(function () {
$this->error('The selected node does not exist.');

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Server/BulkPowerActionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(private DaemonPowerRepository $powerRepository, priv
/**
* Handle the bulk power request.
*
* @throws \Illuminate\Validation\ValidationException
* @throws ValidationException
*/
public function handle()
{
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/UpgradeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function handle()

/** @var \Illuminate\Foundation\Application $app */
$app = require __DIR__ . '/../../../bootstrap/app.php';
/** @var \Pterodactyl\Console\Kernel $kernel */
/** @var Kernel $kernel */
$kernel = $app->make(Kernel::class);
$kernel->bootstrap();
$this->setLaravel($app);
Expand Down
2 changes: 1 addition & 1 deletion app/Contracts/Extensions/HashidsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ interface HashidsInterface extends VendorHashidsInterface
*
* @throws \InvalidArgumentException
*/
public function decodeFirst(string $encoded, string $default = null): mixed;
public function decodeFirst(string $encoded, ?string $default = null): mixed;
}
4 changes: 2 additions & 2 deletions app/Contracts/Repository/NestRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ interface NestRepositoryInterface extends RepositoryInterface
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithEggs(int $id = null): Collection|Nest;
public function getWithEggs(?int $id = null): Collection|Nest;

/**
* Return a nest or all nests and the count of eggs and servers for that nest.
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithCounts(int $id = null): Collection|Nest;
public function getWithCounts(?int $id = null): Collection|Nest;

/**
* Return a nest along with its associated eggs and the servers relation on those eggs.
Expand Down
4 changes: 2 additions & 2 deletions app/Contracts/Repository/ServerRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public function loadEggRelations(Server $server, bool $refresh = false): Server;
/**
* Return a collection of servers with their associated data for rebuild operations.
*/
public function getDataForRebuild(int $server = null, int $node = null): Collection;
public function getDataForRebuild(?int $server = null, ?int $node = null): Collection;

/**
* Return a collection of servers with their associated data for reinstall operations.
*/
public function getDataForReinstall(int $server = null, int $node = null): Collection;
public function getDataForReinstall(?int $server = null, ?int $node = null): Collection;

/**
* Return a server model and all variables associated with the server.
Expand Down
2 changes: 1 addition & 1 deletion app/Contracts/Repository/SettingsRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface SettingsRepositoryInterface extends RepositoryInterface
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function set(string $key, string $value = null);
public function set(string $key, ?string $value = null);

/**
* Retrieve a persistent setting from the database.
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/DisplayException.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function report()

try {
$logger = Container::getInstance()->make(LoggerInterface::class);
} catch (Exception) {
} catch (\Exception) {
throw $this->getPrevious();
}

Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Http/HttpForbiddenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class HttpForbiddenException extends HttpException
/**
* HttpForbiddenException constructor.
*/
public function __construct(string $message = null, \Throwable $previous = null)
public function __construct(?string $message = null, ?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_FORBIDDEN, $message, $previous);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ServerStateConflictException extends ConflictHttpException
* Exception thrown when the server is in an unsupported state for API access or
* certain operations within the codebase.
*/
public function __construct(Server $server, \Throwable $previous = null)
public function __construct(Server $server, ?\Throwable $previous = null)
{
$message = '此服务器目前处于不受支持的状态,请稍后再试。';
if ($server->isSuspended()) {
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Http/TwoFactorAuthRequiredException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept
/**
* TwoFactorAuthRequiredException constructor.
*/
public function __construct(\Throwable $previous = null)
public function __construct(?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_BAD_REQUEST, '此帐户需要动态口令认证才能访问此端点。', $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Service/ServiceLimitExceededException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ServiceLimitExceededException extends DisplayException
* Exception thrown when something goes over a defined limit, such as allocated
* ports, tasks, databases, etc.
*/
public function __construct(string $message, \Throwable $previous = null)
public function __construct(string $message, ?\Throwable $previous = null)
{
parent::__construct($message, $previous, self::LEVEL_WARNING);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Extensions/Backups/BackupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(protected Application $app)
/**
* Returns a backup adapter instance.
*/
public function adapter(string $name = null): FilesystemAdapter
public function adapter(?string $name = null): FilesystemAdapter
{
return $this->get($name ?: $this->getDefaultAdapter());
}
Expand Down
2 changes: 1 addition & 1 deletion app/Extensions/DynamicDatabaseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DynamicDatabaseConnection
public function __construct(
protected ConfigRepository $config,
protected Encrypter $encrypter,
protected DatabaseHostRepositoryInterface $repository
protected DatabaseHostRepositoryInterface $repository,
) {
}

Expand Down
5 changes: 1 addition & 4 deletions app/Extensions/Hashids.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

class Hashids extends VendorHashids implements HashidsInterface
{
/**
* {@inheritdoc}
*/
public function decodeFirst(string $encoded, string $default = null): mixed
public function decodeFirst(string $encoded, ?string $default = null): mixed
{
$result = $this->decode($encoded);
if (!is_array($result)) {
Expand Down
2 changes: 1 addition & 1 deletion app/Extensions/Laravel/Sanctum/NewAccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Laravel\Sanctum\NewAccessToken as SanctumAccessToken;

/**
* @property \Pterodactyl\Models\ApiKey $accessToken
* @property ApiKey $accessToken
*/
class NewAccessToken extends SanctumAccessToken
{
Expand Down
Loading

0 comments on commit 8bc7f54

Please sign in to comment.