Merge branch 'develop' into dane/restore-backups

This commit is contained in:
Dane Everitt 2021-01-25 19:16:40 -08:00
commit 663143de0b
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
575 changed files with 6080 additions and 6864 deletions

View file

@ -31,11 +31,6 @@ class ServerDetailsController extends Controller
/**
* ServerConfigurationController constructor.
*
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
* @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService
* @param \Pterodactyl\Services\Eggs\EggConfigurationService $eggConfigurationService
* @param \Pterodactyl\Repositories\Eloquent\NodeRepository $nodeRepository
*/
public function __construct(
ServerRepository $repository,
@ -52,8 +47,8 @@ class ServerDetailsController extends Controller
* Returns details about the server that allows Wings to self-recover and ensure
* that the state of the server matches the Panel at all times.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
*
* @return \Illuminate\Http\JsonResponse
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -71,7 +66,6 @@ class ServerDetailsController extends Controller
/**
* Lists all servers with their configurations that are assigned to the requesting node.
*
* @param \Illuminate\Http\Request $request
* @return \Pterodactyl\Http\Resources\Wings\ServerConfigurationCollection
*/
public function list(Request $request)
@ -85,7 +79,7 @@ class ServerDetailsController extends Controller
->where('node_id', $node->id)
// If you don't cast this to a string you'll end up with a stringified per_page returned in
// the metadata, and then Wings will panic crash as a result.
->paginate((int)$request->input('per_page', 50));
->paginate((int) $request->input('per_page', 50));
return new ServerConfigurationCollection($servers);
}

View file

@ -19,8 +19,6 @@ class ServerInstallController extends Controller
/**
* ServerInstallController constructor.
*
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
*/
public function __construct(ServerRepository $repository)
{
@ -30,8 +28,6 @@ class ServerInstallController extends Controller
/**
* Returns installation information for a server.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\Http\JsonResponse
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -51,8 +47,6 @@ class ServerInstallController extends Controller
/**
* Updates the installation state of a server.
*
* @param \Pterodactyl\Http\Requests\Api\Remote\InstallationDataRequest $request
* @param string $uuid
* @return \Illuminate\Http\JsonResponse
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException

View file

@ -2,7 +2,7 @@
namespace Pterodactyl\Http\Controllers\Api\Remote\Servers;
use Cake\Chronos\Chronos;
use Carbon\CarbonImmutable;
use Illuminate\Support\Arr;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@ -53,13 +53,6 @@ class ServerTransferController extends Controller
/**
* ServerTransferController constructor.
*
* @param \Illuminate\Database\ConnectionInterface $connection
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
* @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository
* @param \Pterodactyl\Repositories\Wings\DaemonTransferRepository $daemonTransferRepository
* @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService
* @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService
*/
public function __construct(
ConnectionInterface $connection,
@ -80,8 +73,6 @@ class ServerTransferController extends Controller
/**
* The daemon notifies us about the archive status.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\Http\JsonResponse
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -92,7 +83,7 @@ class ServerTransferController extends Controller
$server = $this->repository->getByUuid($uuid);
// Unsuspend the server and don't continue the transfer.
if (! $request->input('successful')) {
if (!$request->input('successful')) {
return $this->processFailedTransfer($server->transfer);
}
@ -110,11 +101,11 @@ class ServerTransferController extends Controller
Arr::set($data, 'suspended', false);
$this->connection->transaction(function () use ($data, $server) {
// This token is used by the new node the server is being transfered to. It allows
// This token is used by the new node the server is being transferred to. It allows
// that node to communicate with the old node during the process to initiate the
// actual file transfer.
$token = $this->jwtService
->setExpiresAt(Chronos::now()->addMinutes(15))
->setExpiresAt(CarbonImmutable::now()->addMinutes(15))
->setSubject($server->uuid)
->handle($server->node, $server->uuid, 'sha256');
@ -128,7 +119,7 @@ class ServerTransferController extends Controller
$this->daemonTransferRepository
->setServer($server)
->setNode($server->transfer->newNode)
->notify($server, $data, $server->node, $token->__toString());
->notify($server, $data, $server->node, $token->toString());
});
return new JsonResponse([], Response::HTTP_NO_CONTENT);
@ -137,7 +128,6 @@ class ServerTransferController extends Controller
/**
* The daemon notifies us about a transfer failure.
*
* @param string $uuid
* @return \Illuminate\Http\JsonResponse
*
* @throws \Throwable
@ -152,7 +142,6 @@ class ServerTransferController extends Controller
/**
* The daemon notifies us about a transfer success.
*
* @param string $uuid
* @return \Illuminate\Http\JsonResponse
*
* @throws \Throwable
@ -165,7 +154,7 @@ class ServerTransferController extends Controller
/** @var \Pterodactyl\Models\Server $server */
$server = $this->connection->transaction(function () use ($server, $transfer) {
$allocations = [$transfer->old_allocation];
if (! empty($transfer->old_additional_allocations)) {
if (!empty($transfer->old_additional_allocations)) {
array_push($allocations, $transfer->old_additional_allocations);
}
@ -201,7 +190,6 @@ class ServerTransferController extends Controller
* Release all of the reserved allocations for this transfer and mark it as failed in
* the database.
*
* @param \Pterodactyl\Models\ServerTransfer $transfer
* @return \Illuminate\Http\JsonResponse
*
* @throws \Throwable
@ -212,7 +200,7 @@ class ServerTransferController extends Controller
$transfer->forceFill(['successful' => false])->saveOrFail();
$allocations = [$transfer->new_allocation];
if (! empty($transfer->new_additional_allocations)) {
if (!empty($transfer->new_additional_allocations)) {
array_push($allocations, $transfer->new_additional_allocations);
}