Use more standardized phpcs
This commit is contained in:
parent
a043071e3c
commit
c449ca5155
493 changed files with 1116 additions and 3903 deletions
|
@ -33,10 +33,6 @@ class ApiController extends Controller
|
|||
|
||||
/**
|
||||
* ApplicationApiController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository
|
||||
* @param \Pterodactyl\Services\Api\KeyCreationService $keyCreationService
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -50,9 +46,6 @@ class ApiController extends Controller
|
|||
|
||||
/**
|
||||
* Render view showing all of a user's application API keys.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request): View
|
||||
{
|
||||
|
@ -64,7 +57,6 @@ class ApiController extends Controller
|
|||
/**
|
||||
* Render view allowing an admin to create a new application API key.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function create(): View
|
||||
|
@ -85,9 +77,6 @@ class ApiController extends Controller
|
|||
/**
|
||||
* Store the new key and redirect the user back to the application key listing.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Api\StoreApplicationApiKeyRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
*/
|
||||
public function store(StoreApplicationApiKeyRequest $request): RedirectResponse
|
||||
|
@ -104,10 +93,6 @@ class ApiController extends Controller
|
|||
|
||||
/**
|
||||
* Delete an application API key from the database.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $identifier
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function delete(Request $request, string $identifier): Response
|
||||
{
|
||||
|
|
|
@ -15,8 +15,6 @@ class BaseController extends Controller
|
|||
|
||||
/**
|
||||
* BaseController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Helpers\SoftwareVersionService $version
|
||||
*/
|
||||
public function __construct(SoftwareVersionService $version)
|
||||
{
|
||||
|
@ -25,8 +23,6 @@ class BaseController extends Controller
|
|||
|
||||
/**
|
||||
* Return the admin index view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
|
|
|
@ -56,14 +56,6 @@ class DatabaseController extends Controller
|
|||
|
||||
/**
|
||||
* DatabaseController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository
|
||||
* @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $databaseRepository
|
||||
* @param \Pterodactyl\Services\Databases\Hosts\HostCreationService $creationService
|
||||
* @param \Pterodactyl\Services\Databases\Hosts\HostDeletionService $deletionService
|
||||
* @param \Pterodactyl\Services\Databases\Hosts\HostUpdateService $updateService
|
||||
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $locationRepository
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -85,8 +77,6 @@ class DatabaseController extends Controller
|
|||
|
||||
/**
|
||||
* Display database host index.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
|
@ -99,9 +89,6 @@ class DatabaseController extends Controller
|
|||
/**
|
||||
* Display database host to user.
|
||||
*
|
||||
* @param int $host
|
||||
* @return \Illuminate\View\View
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function view(int $host): View
|
||||
|
@ -116,9 +103,6 @@ class DatabaseController extends Controller
|
|||
/**
|
||||
* Handle request to create a new database host.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function create(DatabaseHostFormRequest $request): RedirectResponse
|
||||
|
@ -145,10 +129,6 @@ class DatabaseController extends Controller
|
|||
/**
|
||||
* Handle updating database host.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest $request
|
||||
* @param \Pterodactyl\Models\DatabaseHost $host
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function update(DatabaseHostFormRequest $request, DatabaseHost $host): RedirectResponse
|
||||
|
@ -178,9 +158,6 @@ class DatabaseController extends Controller
|
|||
/**
|
||||
* Handle request to delete a database host.
|
||||
*
|
||||
* @param int $host
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
|
||||
*/
|
||||
public function delete(int $host): RedirectResponse
|
||||
|
|
|
@ -48,12 +48,6 @@ class LocationController extends Controller
|
|||
|
||||
/**
|
||||
* LocationController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Services\Locations\LocationCreationService $creationService
|
||||
* @param \Pterodactyl\Services\Locations\LocationDeletionService $deletionService
|
||||
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository
|
||||
* @param \Pterodactyl\Services\Locations\LocationUpdateService $updateService
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -85,6 +79,7 @@ class LocationController extends Controller
|
|||
* Return the location view page.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
|
@ -99,7 +94,6 @@ class LocationController extends Controller
|
|||
/**
|
||||
* Handle request to create new location.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\LocationFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
@ -115,8 +109,6 @@ class LocationController extends Controller
|
|||
/**
|
||||
* Handle request to update or delete location.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\LocationFormRequest $request
|
||||
* @param \Pterodactyl\Models\Location $location
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
@ -136,7 +128,6 @@ class LocationController extends Controller
|
|||
/**
|
||||
* Delete a location from the system.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Location $location
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
|
|
|
@ -38,11 +38,6 @@ class MountController extends Controller
|
|||
|
||||
/**
|
||||
* MountController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $nestRepository
|
||||
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $locationRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\MountRepository $repository
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -72,6 +67,7 @@ class MountController extends Controller
|
|||
* Return the mount view page.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
|
@ -91,7 +87,6 @@ class MountController extends Controller
|
|||
/**
|
||||
* Handle request to create new mount.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\MountFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
@ -112,8 +107,6 @@ class MountController extends Controller
|
|||
/**
|
||||
* Handle request to update or delete location.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\MountFormRequest $request
|
||||
* @param \Pterodactyl\Models\Mount $mount
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
@ -134,7 +127,6 @@ class MountController extends Controller
|
|||
/**
|
||||
* Delete a location from the system.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Mount $mount
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
|
@ -149,8 +141,6 @@ class MountController extends Controller
|
|||
/**
|
||||
* Adds eggs to the mount's many to many relation.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Mount $mount
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function addEggs(Request $request, Mount $mount)
|
||||
|
@ -172,8 +162,6 @@ class MountController extends Controller
|
|||
/**
|
||||
* Adds nodes to the mount's many to many relation.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Mount $mount
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function addNodes(Request $request, Mount $mount)
|
||||
|
@ -193,8 +181,6 @@ class MountController extends Controller
|
|||
/**
|
||||
* Deletes an egg from the mount's many to many relation.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Mount $mount
|
||||
* @param int $egg_id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function deleteEgg(Mount $mount, int $egg_id)
|
||||
|
@ -207,8 +193,6 @@ class MountController extends Controller
|
|||
/**
|
||||
* Deletes an node from the mount's many to many relation.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Mount $mount
|
||||
* @param int $node_id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function deleteNode(Mount $mount, int $node_id)
|
||||
|
|
|
@ -55,8 +55,6 @@ class EggController extends Controller
|
|||
/**
|
||||
* Handle a request to display the Egg creation page.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function create(): View
|
||||
|
@ -70,16 +68,13 @@ class EggController extends Controller
|
|||
/**
|
||||
* Handle request to store a new Egg.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException
|
||||
*/
|
||||
public function store(EggFormRequest $request): RedirectResponse
|
||||
{
|
||||
$data = $request->normalize();
|
||||
if (! empty($data['docker_images']) && ! is_array($data['docker_images'])) {
|
||||
if (!empty($data['docker_images']) && !is_array($data['docker_images'])) {
|
||||
$data['docker_images'] = array_map(function ($value) {
|
||||
return trim($value);
|
||||
}, explode("\n", $data['docker_images']));
|
||||
|
@ -93,9 +88,6 @@ class EggController extends Controller
|
|||
|
||||
/**
|
||||
* Handle request to view a single Egg.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function view(Egg $egg): View
|
||||
{
|
||||
|
@ -105,10 +97,6 @@ class EggController extends Controller
|
|||
/**
|
||||
* Handle request to update an Egg.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggFormRequest $request
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException
|
||||
|
@ -116,7 +104,7 @@ class EggController extends Controller
|
|||
public function update(EggFormRequest $request, Egg $egg): RedirectResponse
|
||||
{
|
||||
$data = $request->normalize();
|
||||
if (! empty($data['docker_images']) && ! is_array($data['docker_images'])) {
|
||||
if (!empty($data['docker_images']) && !is_array($data['docker_images'])) {
|
||||
$data['docker_images'] = array_map(function ($value) {
|
||||
return trim($value);
|
||||
}, explode("\n", $data['docker_images']));
|
||||
|
@ -131,9 +119,6 @@ class EggController extends Controller
|
|||
/**
|
||||
* Handle request to destroy an egg.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\Egg\HasChildrenException
|
||||
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
|
||||
*/
|
||||
|
|
|
@ -30,10 +30,6 @@ class EggScriptController extends Controller
|
|||
|
||||
/**
|
||||
* EggScriptController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
|
||||
* @param \Pterodactyl\Services\Eggs\Scripts\InstallScriptService $installScriptService
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -47,9 +43,6 @@ class EggScriptController extends Controller
|
|||
|
||||
/**
|
||||
* Handle requests to render installation script for an Egg.
|
||||
*
|
||||
* @param int $egg
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(int $egg): View
|
||||
{
|
||||
|
@ -74,10 +67,6 @@ class EggScriptController extends Controller
|
|||
/**
|
||||
* Handle a request to update the installation script for an Egg.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggScriptFormRequest $request
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Egg\InvalidCopyFromException
|
||||
|
|
|
@ -43,11 +43,6 @@ class EggShareController extends Controller
|
|||
|
||||
/**
|
||||
* OptionShareController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Services\Eggs\Sharing\EggExporterService $exporterService
|
||||
* @param \Pterodactyl\Services\Eggs\Sharing\EggImporterService $importerService
|
||||
* @param \Pterodactyl\Services\Eggs\Sharing\EggUpdateImporterService $updateImporterService
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -62,9 +57,6 @@ class EggShareController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function export(Egg $egg): Response
|
||||
|
@ -82,9 +74,6 @@ class EggShareController extends Controller
|
|||
/**
|
||||
* Import a new service option using an XML file.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggImportFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Egg\BadJsonFormatException
|
||||
|
@ -101,10 +90,6 @@ class EggShareController extends Controller
|
|||
/**
|
||||
* Update an existing Egg using a new imported file.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggImportFormRequest $request
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Egg\BadJsonFormatException
|
||||
|
|
|
@ -50,12 +50,6 @@ class EggVariableController extends Controller
|
|||
|
||||
/**
|
||||
* EggVariableController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Services\Eggs\Variables\VariableCreationService $creationService
|
||||
* @param \Pterodactyl\Services\Eggs\Variables\VariableUpdateService $updateService
|
||||
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
|
||||
* @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $variableRepository
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -74,9 +68,6 @@ class EggVariableController extends Controller
|
|||
/**
|
||||
* Handle request to view the variables attached to an Egg.
|
||||
*
|
||||
* @param int $egg
|
||||
* @return \Illuminate\View\View
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function view(int $egg): View
|
||||
|
@ -89,10 +80,6 @@ class EggVariableController extends Controller
|
|||
/**
|
||||
* Handle a request to create a new Egg variable.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggVariableFormRequest $request
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException
|
||||
|
@ -108,11 +95,6 @@ class EggVariableController extends Controller
|
|||
/**
|
||||
* Handle a request to update an existing Egg variable.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggVariableFormRequest $request
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
* @param \Pterodactyl\Models\EggVariable $variable
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
|
@ -130,10 +112,6 @@ class EggVariableController extends Controller
|
|||
|
||||
/**
|
||||
* Handle a request to delete an existing Egg variable from the Panel.
|
||||
*
|
||||
* @param int $egg
|
||||
* @param \Pterodactyl\Models\EggVariable $variable
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(int $egg, EggVariable $variable): RedirectResponse
|
||||
{
|
||||
|
|
|
@ -48,12 +48,6 @@ class NestController extends Controller
|
|||
|
||||
/**
|
||||
* NestController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Services\Nests\NestCreationService $nestCreationService
|
||||
* @param \Pterodactyl\Services\Nests\NestDeletionService $nestDeletionService
|
||||
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository
|
||||
* @param \Pterodactyl\Services\Nests\NestUpdateService $nestUpdateService
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -72,8 +66,6 @@ class NestController extends Controller
|
|||
/**
|
||||
* Render nest listing page.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function index(): View
|
||||
|
@ -85,8 +77,6 @@ class NestController extends Controller
|
|||
|
||||
/**
|
||||
* Render nest creation page.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function create(): View
|
||||
{
|
||||
|
@ -96,9 +86,6 @@ class NestController extends Controller
|
|||
/**
|
||||
* Handle the storage of a new nest.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Nest\StoreNestFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
*/
|
||||
public function store(StoreNestFormRequest $request): RedirectResponse
|
||||
|
@ -112,9 +99,6 @@ class NestController extends Controller
|
|||
/**
|
||||
* Return details about a nest including all of the eggs and servers per egg.
|
||||
*
|
||||
* @param int $nest
|
||||
* @return \Illuminate\View\View
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function view(int $nest): View
|
||||
|
@ -127,10 +111,6 @@ class NestController extends Controller
|
|||
/**
|
||||
* Handle request to update a nest.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Nest\StoreNestFormRequest $request
|
||||
* @param int $nest
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
@ -145,9 +125,6 @@ class NestController extends Controller
|
|||
/**
|
||||
* Handle request to delete a nest.
|
||||
*
|
||||
* @param int $nest
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
|
||||
*/
|
||||
public function destroy(int $nest): RedirectResponse
|
||||
|
|
|
@ -30,10 +30,6 @@ class NodeAutoDeployController extends Controller
|
|||
|
||||
/**
|
||||
* NodeAutoDeployController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ApiKeyRepository $repository
|
||||
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
|
||||
* @param \Pterodactyl\Services\Api\KeyCreationService $keyCreationService
|
||||
*/
|
||||
public function __construct(
|
||||
ApiKeyRepository $repository,
|
||||
|
@ -49,8 +45,6 @@ class NodeAutoDeployController extends Controller
|
|||
* Generates a new API key for the logged in user with only permission to read
|
||||
* nodes, and returns that as the deployment key for a node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -72,7 +66,7 @@ class NodeAutoDeployController extends Controller
|
|||
|
||||
// We couldn't find a key that exists for this user with only permission for
|
||||
// reading nodes. Go ahead and create it now.
|
||||
if (! $key) {
|
||||
if (!$key) {
|
||||
$key = $this->keyCreationService->setKeyType(ApiKey::TYPE_APPLICATION)->handle([
|
||||
'user_id' => $request->user()->id,
|
||||
'memo' => 'Automatically generated node deployment key.',
|
||||
|
|
|
@ -23,9 +23,6 @@ class NodeController extends Controller
|
|||
|
||||
/**
|
||||
* NodeController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\NodeRepository $repository
|
||||
* @param \Illuminate\Contracts\View\Factory $view
|
||||
*/
|
||||
public function __construct(NodeRepository $repository, Factory $view)
|
||||
{
|
||||
|
@ -36,7 +33,6 @@ class NodeController extends Controller
|
|||
/**
|
||||
* Returns a listing of nodes on the system.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
|
|
@ -51,13 +51,6 @@ class NodeViewController extends Controller
|
|||
|
||||
/**
|
||||
* NodeViewController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\AllocationRepository $allocationRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\LocationRepository $locationRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\NodeRepository $repository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $serverRepository
|
||||
* @param \Pterodactyl\Services\Helpers\SoftwareVersionService $versionService
|
||||
* @param \Illuminate\Contracts\View\Factory $view
|
||||
*/
|
||||
public function __construct(
|
||||
AllocationRepository $allocationRepository,
|
||||
|
@ -78,8 +71,6 @@ class NodeViewController extends Controller
|
|||
/**
|
||||
* Returns index view for a specific node on the system.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request, Node $node)
|
||||
|
@ -96,8 +87,6 @@ class NodeViewController extends Controller
|
|||
/**
|
||||
* Returns the settings page for a specific node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function settings(Request $request, Node $node)
|
||||
|
@ -111,8 +100,6 @@ class NodeViewController extends Controller
|
|||
/**
|
||||
* Return the node configuration page for a specific node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function configuration(Request $request, Node $node)
|
||||
|
@ -123,8 +110,6 @@ class NodeViewController extends Controller
|
|||
/**
|
||||
* Return the node allocation management page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function allocations(Request $request, Node $node)
|
||||
|
@ -145,8 +130,6 @@ class NodeViewController extends Controller
|
|||
/**
|
||||
* Return a listing of servers that exist for this specific node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function servers(Request $request, Node $node)
|
||||
|
|
|
@ -18,8 +18,6 @@ class SystemInformationController extends Controller
|
|||
|
||||
/**
|
||||
* SystemInformationController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository $repository
|
||||
*/
|
||||
public function __construct(DaemonConfigurationRepository $repository)
|
||||
{
|
||||
|
@ -29,8 +27,6 @@ class SystemInformationController extends Controller
|
|||
/**
|
||||
* Returns system information from the Daemon.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
|
|
|
@ -94,19 +94,6 @@ class NodesController extends Controller
|
|||
|
||||
/**
|
||||
* NodesController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Services\Allocations\AllocationDeletionService $allocationDeletionService
|
||||
* @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $allocationRepository
|
||||
* @param \Pterodactyl\Services\Allocations\AssignmentService $assignmentService
|
||||
* @param \Illuminate\Cache\Repository $cache
|
||||
* @param \Pterodactyl\Services\Nodes\NodeCreationService $creationService
|
||||
* @param \Pterodactyl\Services\Nodes\NodeDeletionService $deletionService
|
||||
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $locationRepository
|
||||
* @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $repository
|
||||
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository
|
||||
* @param \Pterodactyl\Services\Nodes\NodeUpdateService $updateService
|
||||
* @param \Pterodactyl\Services\Helpers\SoftwareVersionService $versionService
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -156,7 +143,6 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Post controller to create a new node on the system.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Node\NodeFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -172,8 +158,6 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Updates settings for a node.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Node\NodeFormRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -191,10 +175,6 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Removes a single allocation from a node.
|
||||
*
|
||||
* @param int $node
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException
|
||||
*/
|
||||
public function allocationRemoveSingle(int $node, Allocation $allocation): Response
|
||||
|
@ -207,10 +187,6 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Removes multiple individual allocations from a node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException
|
||||
*/
|
||||
public function allocationRemoveMultiple(Request $request, int $node): Response
|
||||
|
@ -228,8 +204,8 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Remove all allocations for a specific IP at once on a node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $node
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function allocationRemoveBlock(Request $request, $node)
|
||||
|
@ -249,7 +225,6 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Sets an alias for a specific allocation on a node.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Node\AllocationAliasFormRequest $request
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -267,8 +242,8 @@ class NodesController extends Controller
|
|||
/**
|
||||
* Creates new allocations on a node.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Node\AllocationFormRequest $request
|
||||
* @param int|\Pterodactyl\Models\Node $node
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException
|
||||
|
@ -288,6 +263,7 @@ class NodesController extends Controller
|
|||
* Deletes a node from the system.
|
||||
*
|
||||
* @param $node
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
|
|
@ -47,13 +47,6 @@ class CreateServerController extends Controller
|
|||
|
||||
/**
|
||||
* CreateServerController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Repositories\Eloquent\NestRepository $nestRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\LocationRepository $locationRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\NodeRepository $nodeRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
|
||||
* @param \Pterodactyl\Services\Servers\ServerCreationService $creationService
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -75,6 +68,7 @@ class CreateServerController extends Controller
|
|||
* Displays the create server page.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function index()
|
||||
|
@ -106,7 +100,6 @@ class CreateServerController extends Controller
|
|||
/**
|
||||
* Create a new server on the remote system.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\ServerFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
|
@ -118,7 +111,7 @@ class CreateServerController extends Controller
|
|||
public function store(ServerFormRequest $request)
|
||||
{
|
||||
$data = $request->except(['_token']);
|
||||
if (! empty($data['custom_image'])) {
|
||||
if (!empty($data['custom_image'])) {
|
||||
$data['image'] = $data['custom_image'];
|
||||
unset($data['custom_image']);
|
||||
}
|
||||
|
|
|
@ -25,9 +25,6 @@ class ServerController extends Controller
|
|||
|
||||
/**
|
||||
* ServerController constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\Factory $view
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
|
||||
*/
|
||||
public function __construct(
|
||||
Factory $view,
|
||||
|
@ -41,7 +38,6 @@ class ServerController extends Controller
|
|||
* Returns all of the servers that exist on the system using a paginated result set. If
|
||||
* a query is passed along in the request it is also passed to the repository function.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
@ -49,7 +45,7 @@ class ServerController extends Controller
|
|||
$servers = QueryBuilder::for(Server::query()->with('node', 'user', 'allocation'))
|
||||
->allowedFilters([
|
||||
AllowedFilter::exact('owner_id'),
|
||||
AllowedFilter::custom('*', new AdminServerFilter),
|
||||
AllowedFilter::custom('*', new AdminServerFilter()),
|
||||
])
|
||||
->paginate(config()->get('pterodactyl.paginate.admin.servers'));
|
||||
|
||||
|
|
|
@ -53,14 +53,6 @@ class ServerTransferController extends Controller
|
|||
|
||||
/**
|
||||
* ServerTransferController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $allocationRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\LocationRepository $locationRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\NodeRepository $nodeRepository
|
||||
* @param \Pterodactyl\Services\Servers\TransferService $transferService
|
||||
* @param \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository $daemonConfigurationRepository
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -83,8 +75,6 @@ class ServerTransferController extends Controller
|
|||
/**
|
||||
* Starts a transfer of a server to a new node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
@ -108,7 +98,7 @@ class ServerTransferController extends Controller
|
|||
$this->daemonConfigurationRepository->setNode($node)->getSystemInformation();
|
||||
|
||||
// Create a new ServerTransfer entry.
|
||||
$transfer = new ServerTransfer;
|
||||
$transfer = new ServerTransfer();
|
||||
|
||||
$transfer->server_id = $server->id;
|
||||
$transfer->old_node = $server->node_id;
|
||||
|
@ -136,11 +126,6 @@ class ServerTransferController extends Controller
|
|||
|
||||
/**
|
||||
* Assigns the specified allocations to the specified server.
|
||||
*
|
||||
* @param Server $server
|
||||
* @param int $node_id
|
||||
* @param int $allocation_id
|
||||
* @param array $additional_allocations
|
||||
*/
|
||||
private function assignAllocationsToServer(Server $server, int $node_id, int $allocation_id, array $additional_allocations)
|
||||
{
|
||||
|
@ -151,14 +136,14 @@ class ServerTransferController extends Controller
|
|||
|
||||
$updateIds = [];
|
||||
foreach ($allocations as $allocation) {
|
||||
if (! in_array($allocation, $unassigned)) {
|
||||
if (!in_array($allocation, $unassigned)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$updateIds[] = $allocation;
|
||||
}
|
||||
|
||||
if (! empty($updateIds)) {
|
||||
if (!empty($updateIds)) {
|
||||
$this->allocationRepository->updateWhereIn('id', $updateIds, ['server_id' => $server->id]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,15 +64,6 @@ class ServerViewController extends Controller
|
|||
|
||||
/**
|
||||
* ServerViewController constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\Factory $view
|
||||
* @param \Pterodactyl\Repositories\Eloquent\DatabaseHostRepository $databaseHostRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\LocationRepository $locationRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\MountRepository $mountRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\NestRepository $nestRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\NodeRepository $nodeRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
|
||||
* @param \Pterodactyl\Services\Servers\EnvironmentService $environmentService
|
||||
*/
|
||||
public function __construct(
|
||||
Factory $view,
|
||||
|
@ -97,8 +88,6 @@ class ServerViewController extends Controller
|
|||
/**
|
||||
* Returns the index view for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request, Server $server)
|
||||
|
@ -109,8 +98,6 @@ class ServerViewController extends Controller
|
|||
/**
|
||||
* Returns the server details page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function details(Request $request, Server $server)
|
||||
|
@ -121,8 +108,6 @@ class ServerViewController extends Controller
|
|||
/**
|
||||
* Returns a view of server build settings.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function build(Request $request, Server $server)
|
||||
|
@ -139,8 +124,6 @@ class ServerViewController extends Controller
|
|||
/**
|
||||
* Returns the server startup management page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
|
@ -166,8 +149,6 @@ class ServerViewController extends Controller
|
|||
/**
|
||||
* Returns all of the databases that exist for the server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function database(Request $request, Server $server)
|
||||
|
@ -181,8 +162,6 @@ class ServerViewController extends Controller
|
|||
/**
|
||||
* Returns all of the mounts that exist for the server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function mounts(Request $request, Server $server)
|
||||
|
@ -199,8 +178,6 @@ class ServerViewController extends Controller
|
|||
* Returns the base server management page, or an exception if the server
|
||||
* is in a state that cannot be recovered from.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -208,9 +185,7 @@ class ServerViewController extends Controller
|
|||
public function manage(Request $request, Server $server)
|
||||
{
|
||||
if ($server->installed > 1) {
|
||||
throw new DisplayException(
|
||||
'This server is in a failed install state and cannot be recovered. Please delete and re-create the server.'
|
||||
);
|
||||
throw new DisplayException('This server is in a failed install state and cannot be recovered. Please delete and re-create the server.');
|
||||
}
|
||||
|
||||
// Check if the panel doesn't have at least 2 nodes configured.
|
||||
|
@ -234,8 +209,6 @@ class ServerViewController extends Controller
|
|||
/**
|
||||
* Returns the server deletion page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function delete(Request $request, Server $server)
|
||||
|
|
|
@ -132,25 +132,6 @@ class ServersController extends Controller
|
|||
|
||||
/**
|
||||
* ServersController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $allocationRepository
|
||||
* @param \Pterodactyl\Services\Servers\BuildModificationService $buildModificationService
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
* @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository
|
||||
* @param \Pterodactyl\Services\Databases\DatabaseManagementService $databaseManagementService
|
||||
* @param \Pterodactyl\Services\Databases\DatabasePasswordService $databasePasswordService
|
||||
* @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $databaseRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\DatabaseHostRepository $databaseHostRepository
|
||||
* @param \Pterodactyl\Services\Servers\ServerDeletionService $deletionService
|
||||
* @param \Pterodactyl\Services\Servers\DetailsModificationService $detailsModificationService
|
||||
* @param \Pterodactyl\Services\Servers\ReinstallServerService $reinstallService
|
||||
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\MountRepository $mountRepository
|
||||
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $nestRepository
|
||||
* @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $serverConfigurationStructureService
|
||||
* @param \Pterodactyl\Services\Servers\StartupModificationService $startupModificationService
|
||||
* @param \Pterodactyl\Services\Servers\SuspensionService $suspensionService
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -195,8 +176,6 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Update the details for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -216,7 +195,6 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Toggles the install status for a server.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -230,7 +208,7 @@ class ServersController extends Controller
|
|||
}
|
||||
|
||||
$this->repository->update($server->id, [
|
||||
'installed' => ! $server->installed,
|
||||
'installed' => !$server->installed,
|
||||
], true, true);
|
||||
|
||||
$this->alert->success(trans('admin/server.alerts.install_toggled'))->flash();
|
||||
|
@ -241,7 +219,6 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Reinstalls the server with the currently assigned service.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -259,8 +236,6 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Manage the suspension status for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -280,8 +255,6 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Update the build configuration for a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -308,8 +281,6 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Start the server deletion process.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -326,8 +297,6 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Update the startup command as well as variables.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
|
@ -335,7 +304,7 @@ class ServersController extends Controller
|
|||
public function saveStartup(Request $request, Server $server)
|
||||
{
|
||||
$data = $request->except('_token');
|
||||
if (! empty($data['custom_docker_image'])) {
|
||||
if (!empty($data['custom_docker_image'])) {
|
||||
$data['docker_image'] = $data['custom_docker_image'];
|
||||
unset($data['custom_docker_image']);
|
||||
}
|
||||
|
@ -356,8 +325,6 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Creates a new database assigned to a specific server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Servers\Databases\StoreServerDatabaseRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
@ -377,8 +344,8 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Resets the database password for a specific database on this server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $server
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
@ -400,6 +367,7 @@ class ServersController extends Controller
|
|||
*
|
||||
* @param int $server
|
||||
* @param int $database
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
|
@ -420,15 +388,13 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Add a mount to a server.
|
||||
*
|
||||
* @param Server $server
|
||||
* @param \Pterodactyl\Models\Mount $mount
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function addMount(Server $server, Mount $mount)
|
||||
{
|
||||
$mountServer = (new MountServer)->forceFill([
|
||||
$mountServer = (new MountServer())->forceFill([
|
||||
'mount_id' => $mount->id,
|
||||
'server_id' => $server->id,
|
||||
]);
|
||||
|
@ -443,8 +409,6 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Remove a mount from a server.
|
||||
*
|
||||
* @param Server $server
|
||||
* @param \Pterodactyl\Models\Mount $mount
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function deleteMount(Server $server, Mount $mount)
|
||||
|
|
|
@ -35,11 +35,6 @@ class AdvancedController extends Controller
|
|||
|
||||
/**
|
||||
* AdvancedController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
* @param \Illuminate\Contracts\Console\Kernel $kernel
|
||||
* @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -55,8 +50,6 @@ class AdvancedController extends Controller
|
|||
|
||||
/**
|
||||
* Render advanced Panel settings UI.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
|
@ -74,8 +67,6 @@ class AdvancedController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Settings\AdvancedSettingsFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
|
|
@ -38,17 +38,13 @@ class IndexController extends Controller
|
|||
|
||||
/**
|
||||
* IndexController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Illuminate\Contracts\Console\Kernel $kernel
|
||||
* @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings
|
||||
* @param \Pterodactyl\Services\Helpers\SoftwareVersionService $versionService
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
Kernel $kernel,
|
||||
SettingsRepositoryInterface $settings,
|
||||
SoftwareVersionService $versionService)
|
||||
SoftwareVersionService $versionService
|
||||
)
|
||||
{
|
||||
$this->alert = $alert;
|
||||
$this->kernel = $kernel;
|
||||
|
@ -58,8 +54,6 @@ class IndexController extends Controller
|
|||
|
||||
/**
|
||||
* Render the UI for basic Panel settings.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
|
@ -72,8 +66,6 @@ class IndexController extends Controller
|
|||
/**
|
||||
* Handle settings update.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Settings\BaseSettingsFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
|
|
@ -47,12 +47,6 @@ class MailController extends Controller
|
|||
|
||||
/**
|
||||
* MailController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
|
||||
* @param \Illuminate\Contracts\Console\Kernel $kernel
|
||||
* @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -71,8 +65,6 @@ class MailController extends Controller
|
|||
/**
|
||||
* Render UI for editing mail settings. This UI should only display if
|
||||
* the server is configured to send mail using SMTP.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
|
@ -84,9 +76,6 @@ class MailController extends Controller
|
|||
/**
|
||||
* Handle request to update SMTP mail settings.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Settings\MailSettingsFormRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
|
@ -103,7 +92,7 @@ class MailController extends Controller
|
|||
}
|
||||
|
||||
foreach ($values as $key => $value) {
|
||||
if (in_array($key, SettingsServiceProvider::getEncryptedKeys()) && ! empty($value)) {
|
||||
if (in_array($key, SettingsServiceProvider::getEncryptedKeys()) && !empty($value)) {
|
||||
$value = $this->encrypter->encrypt($value);
|
||||
}
|
||||
|
||||
|
@ -117,9 +106,6 @@ class MailController extends Controller
|
|||
|
||||
/**
|
||||
* Submit a request to send a test mail message.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function test(Request $request): Response
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ class StatisticsController extends Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
$servers = $this->serverRepository->all();
|
||||
$nodes = $this->nodeRepository->all();
|
||||
$usersCount = $this->userRepository->count();
|
||||
|
|
|
@ -52,13 +52,6 @@ class UserController extends Controller
|
|||
|
||||
/**
|
||||
* UserController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Services\Users\UserCreationService $creationService
|
||||
* @param \Pterodactyl\Services\Users\UserDeletionService $deletionService
|
||||
* @param \Illuminate\Contracts\Translation\Translator $translator
|
||||
* @param \Pterodactyl\Services\Users\UserUpdateService $updateService
|
||||
* @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(
|
||||
AlertsMessageBag $alert,
|
||||
|
@ -79,7 +72,6 @@ class UserController extends Controller
|
|||
/**
|
||||
* Display user index page.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
@ -114,7 +106,6 @@ class UserController extends Controller
|
|||
/**
|
||||
* Display user view page.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function view(User $user)
|
||||
|
@ -128,8 +119,6 @@ class UserController extends Controller
|
|||
/**
|
||||
* Delete a user from the system.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
|
@ -149,7 +138,6 @@ class UserController extends Controller
|
|||
/**
|
||||
* Create a user.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\UserFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
|
@ -166,8 +154,6 @@ class UserController extends Controller
|
|||
/**
|
||||
* Update a user on the system.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\UserFormRequest $request
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -187,7 +173,6 @@ class UserController extends Controller
|
|||
/**
|
||||
* Get a JSON response of users on the system.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Support\Collection|\Pterodactyl\Models\Model
|
||||
*/
|
||||
public function json(Request $request)
|
||||
|
|
|
@ -45,9 +45,6 @@ abstract class ApplicationApiController extends Controller
|
|||
/**
|
||||
* Perform dependency injection of certain classes needed for core functionality
|
||||
* without littering the constructors of classes that extend this abstract.
|
||||
*
|
||||
* @param \Pterodactyl\Extensions\Spatie\Fractalistic\Fractal $fractal
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*/
|
||||
public function loadDependencies(Fractal $fractal, Request $request)
|
||||
{
|
||||
|
@ -58,7 +55,6 @@ abstract class ApplicationApiController extends Controller
|
|||
/**
|
||||
* Return an instance of an application transformer.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @return \Pterodactyl\Transformers\Api\Application\BaseTransformer
|
||||
*/
|
||||
public function getTransformer(string $abstract)
|
||||
|
@ -74,8 +70,6 @@ abstract class ApplicationApiController extends Controller
|
|||
|
||||
/**
|
||||
* Return a HTTP/204 response for the API.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
protected function returnNoContent(): Response
|
||||
{
|
||||
|
|
|
@ -42,11 +42,6 @@ class LocationController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* LocationController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Locations\LocationCreationService $creationService
|
||||
* @param \Pterodactyl\Services\Locations\LocationDeletionService $deletionService
|
||||
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository
|
||||
* @param \Pterodactyl\Services\Locations\LocationUpdateService $updateService
|
||||
*/
|
||||
public function __construct(
|
||||
LocationCreationService $creationService,
|
||||
|
@ -64,9 +59,6 @@ class LocationController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* Return all of the locations currently registered on the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationsRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetLocationsRequest $request): array
|
||||
{
|
||||
|
@ -82,9 +74,6 @@ class LocationController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* Return a single location.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function view(GetLocationRequest $request): array
|
||||
{
|
||||
|
@ -97,9 +86,6 @@ class LocationController extends ApplicationApiController
|
|||
* Store a new location on the Panel and return a HTTP/201 response code with the
|
||||
* new location attached.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\StoreLocationRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
*/
|
||||
public function store(StoreLocationRequest $request): JsonResponse
|
||||
|
@ -119,9 +105,6 @@ class LocationController extends ApplicationApiController
|
|||
/**
|
||||
* Update a location on the Panel and return the updated record to the user.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\UpdateLocationRequest $request
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
@ -137,9 +120,6 @@ class LocationController extends ApplicationApiController
|
|||
/**
|
||||
* Delete a location from the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\DeleteLocationRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\Location\HasActiveNodesException
|
||||
*/
|
||||
public function delete(DeleteLocationRequest $request): Response
|
||||
|
|
|
@ -19,8 +19,6 @@ class EggController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* EggController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(EggRepositoryInterface $repository)
|
||||
{
|
||||
|
@ -31,9 +29,6 @@ class EggController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* Return all eggs that exist for a given nest.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nests\Eggs\GetEggsRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetEggsRequest $request): array
|
||||
{
|
||||
|
@ -48,9 +43,6 @@ class EggController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* Return a single egg that exists on the specified nest.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nests\Eggs\GetEggRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function view(GetEggRequest $request): array
|
||||
{
|
||||
|
|
|
@ -17,8 +17,6 @@ class NestController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* NestController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(NestRepositoryInterface $repository)
|
||||
{
|
||||
|
@ -29,9 +27,6 @@ class NestController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* Return all Nests that exist on the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nests\GetNestsRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetNestsRequest $request): array
|
||||
{
|
||||
|
@ -44,9 +39,6 @@ class NestController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* Return information about a single Nest model.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nests\GetNestsRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function view(GetNestsRequest $request): array
|
||||
{
|
||||
|
|
|
@ -27,9 +27,6 @@ class AllocationController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* AllocationController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Allocations\AssignmentService $assignmentService
|
||||
* @param \Pterodactyl\Services\Allocations\AllocationDeletionService $deletionService
|
||||
*/
|
||||
public function __construct(
|
||||
AssignmentService $assignmentService,
|
||||
|
@ -43,10 +40,6 @@ class AllocationController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* Return all of the allocations that exist for a given node.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Allocations\GetAllocationsRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetAllocationsRequest $request, Node $node): array
|
||||
{
|
||||
|
@ -60,10 +53,6 @@ class AllocationController extends ApplicationApiController
|
|||
/**
|
||||
* Store new allocations for a given node.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Allocations\StoreAllocationRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Allocation\InvalidPortMappingException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Allocation\PortOutOfRangeException
|
||||
|
@ -79,11 +68,6 @@ class AllocationController extends ApplicationApiController
|
|||
/**
|
||||
* Delete a specific allocation from the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Allocations\DeleteAllocationRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException
|
||||
*/
|
||||
public function delete(DeleteAllocationRequest $request, Node $node, Allocation $allocation): JsonResponse
|
||||
|
|
|
@ -14,8 +14,6 @@ class NodeConfigurationController extends ApplicationApiController
|
|||
* to remote machines so long as an API key is provided to the machine to make the request
|
||||
* with, and the node is known.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function __invoke(GetNodeRequest $request, Node $node)
|
||||
|
|
|
@ -41,11 +41,6 @@ class NodeController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* NodeController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Nodes\NodeCreationService $creationService
|
||||
* @param \Pterodactyl\Services\Nodes\NodeDeletionService $deletionService
|
||||
* @param \Pterodactyl\Services\Nodes\NodeUpdateService $updateService
|
||||
* @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(
|
||||
NodeCreationService $creationService,
|
||||
|
@ -63,9 +58,6 @@ class NodeController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* Return all of the nodes currently available on the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodesRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetNodesRequest $request): array
|
||||
{
|
||||
|
@ -81,10 +73,6 @@ class NodeController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* Return data for a single instance of a node.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return array
|
||||
*/
|
||||
public function view(GetNodeRequest $request, Node $node): array
|
||||
{
|
||||
|
@ -97,9 +85,6 @@ class NodeController extends ApplicationApiController
|
|||
* Create a new node on the Panel. Returns the created node and a HTTP/201
|
||||
* status response on success.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nodes\StoreNodeRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
*/
|
||||
public function store(StoreNodeRequest $request): JsonResponse
|
||||
|
@ -119,16 +104,14 @@ class NodeController extends ApplicationApiController
|
|||
/**
|
||||
* Update an existing node on the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nodes\UpdateNodeRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return array
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function update(UpdateNodeRequest $request, Node $node): array
|
||||
{
|
||||
$node = $this->updateService->handle(
|
||||
$node, $request->validated(), $request->input('reset_secret') === true
|
||||
$node,
|
||||
$request->validated(),
|
||||
$request->input('reset_secret') === true
|
||||
);
|
||||
|
||||
return $this->fractal->item($node)
|
||||
|
@ -140,10 +123,6 @@ class NodeController extends ApplicationApiController
|
|||
* Deletes a given node from the Panel as long as there are no servers
|
||||
* currently attached to it.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nodes\DeleteNodeRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
|
||||
*/
|
||||
public function delete(DeleteNodeRequest $request, Node $node): JsonResponse
|
||||
|
|
|
@ -16,8 +16,6 @@ class NodeDeploymentController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* NodeDeploymentController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Deployment\FindViableNodesService $viableNodesService
|
||||
*/
|
||||
public function __construct(FindViableNodesService $viableNodesService)
|
||||
{
|
||||
|
@ -31,9 +29,6 @@ class NodeDeploymentController extends ApplicationApiController
|
|||
* similarly to the server creation process, but allows you to pass the deployment object
|
||||
* to this endpoint and get back a list of all Nodes satisfying the requirements.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetDeployableNodesRequest $request
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException
|
||||
*/
|
||||
public function __invoke(GetDeployableNodesRequest $request): array
|
||||
|
|
|
@ -35,10 +35,6 @@ class DatabaseController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* DatabaseController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Databases\DatabaseManagementService $databaseManagementService
|
||||
* @param \Pterodactyl\Services\Databases\DatabasePasswordService $databasePasswordService
|
||||
* @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(
|
||||
DatabaseManagementService $databaseManagementService,
|
||||
|
@ -55,10 +51,6 @@ class DatabaseController extends ApplicationApiController
|
|||
/**
|
||||
* Return a listing of all databases currently available to a single
|
||||
* server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\GetServerDatabasesRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetServerDatabasesRequest $request, Server $server): array
|
||||
{
|
||||
|
@ -69,11 +61,6 @@ class DatabaseController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* Return a single server database.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\GetServerDatabaseRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Database $database
|
||||
* @return array
|
||||
*/
|
||||
public function view(GetServerDatabaseRequest $request, Server $server, Database $database): array
|
||||
{
|
||||
|
@ -85,11 +72,6 @@ class DatabaseController extends ApplicationApiController
|
|||
/**
|
||||
* Reset the password for a specific server database.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\ServerDatabaseWriteRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Database $database
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function resetPassword(ServerDatabaseWriteRequest $request, Server $server, Database $database): JsonResponse
|
||||
|
@ -102,10 +84,6 @@ class DatabaseController extends ApplicationApiController
|
|||
/**
|
||||
* Create a new database on the Panel for a given server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\StoreServerDatabaseRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function store(StoreServerDatabaseRequest $request, Server $server): JsonResponse
|
||||
|
@ -128,9 +106,6 @@ class DatabaseController extends ApplicationApiController
|
|||
/**
|
||||
* Handle a request to delete a specific server database from the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\ServerDatabaseWriteRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function delete(ServerDatabaseWriteRequest $request): Response
|
||||
|
|
|
@ -10,9 +10,6 @@ class ExternalServerController extends ApplicationApiController
|
|||
{
|
||||
/**
|
||||
* Retrieve a specific server from the database using its external ID.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\GetExternalServerRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetExternalServerRequest $request): array
|
||||
{
|
||||
|
|
|
@ -35,10 +35,6 @@ class ServerController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* ServerController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Servers\ServerCreationService $creationService
|
||||
* @param \Pterodactyl\Services\Servers\ServerDeletionService $deletionService
|
||||
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(
|
||||
ServerCreationService $creationService,
|
||||
|
@ -54,9 +50,6 @@ class ServerController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* Return all of the servers that currently exist on the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\GetServersRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetServersRequest $request): array
|
||||
{
|
||||
|
@ -73,9 +66,6 @@ class ServerController extends ApplicationApiController
|
|||
/**
|
||||
* Create a new server on the system.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\StoreServerRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -95,9 +85,6 @@ class ServerController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* Show a single server transformed for the application API.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\GetServerRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function view(GetServerRequest $request): array
|
||||
{
|
||||
|
@ -107,11 +94,6 @@ class ServerController extends ApplicationApiController
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param string $force
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function delete(ServerWriteRequest $request, Server $server, string $force = ''): Response
|
||||
|
|
|
@ -24,9 +24,6 @@ class ServerDetailsController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* ServerDetailsController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Servers\BuildModificationService $buildModificationService
|
||||
* @param \Pterodactyl\Services\Servers\DetailsModificationService $detailsModificationService
|
||||
*/
|
||||
public function __construct(
|
||||
BuildModificationService $buildModificationService,
|
||||
|
@ -41,9 +38,6 @@ class ServerDetailsController extends ApplicationApiController
|
|||
/**
|
||||
* Update the details for a specific server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\UpdateServerDetailsRequest $request
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
|
@ -51,7 +45,8 @@ class ServerDetailsController extends ApplicationApiController
|
|||
public function details(UpdateServerDetailsRequest $request): array
|
||||
{
|
||||
$server = $this->detailsModificationService->returnUpdatedModel()->handle(
|
||||
$request->getModel(Server::class), $request->validated()
|
||||
$request->getModel(Server::class),
|
||||
$request->validated()
|
||||
);
|
||||
|
||||
return $this->fractal->item($server)
|
||||
|
@ -62,10 +57,6 @@ class ServerDetailsController extends ApplicationApiController
|
|||
/**
|
||||
* Update the build details for a specific server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\UpdateServerBuildConfigurationRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
|
|
|
@ -23,9 +23,6 @@ class ServerManagementController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* SuspensionController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Servers\ReinstallServerService $reinstallServerService
|
||||
* @param \Pterodactyl\Services\Servers\SuspensionService $suspensionService
|
||||
*/
|
||||
public function __construct(
|
||||
ReinstallServerService $reinstallServerService,
|
||||
|
@ -40,10 +37,6 @@ class ServerManagementController extends ApplicationApiController
|
|||
/**
|
||||
* Suspend a server on the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function suspend(ServerWriteRequest $request, Server $server): Response
|
||||
|
@ -56,10 +49,6 @@ class ServerManagementController extends ApplicationApiController
|
|||
/**
|
||||
* Unsuspend a server on the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function unsuspend(ServerWriteRequest $request, Server $server): Response
|
||||
|
@ -72,10 +61,6 @@ class ServerManagementController extends ApplicationApiController
|
|||
/**
|
||||
* Mark a server as needing to be reinstalled.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
|
|
|
@ -18,8 +18,6 @@ class StartupController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* StartupController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Servers\StartupModificationService $modificationService
|
||||
*/
|
||||
public function __construct(StartupModificationService $modificationService)
|
||||
{
|
||||
|
@ -31,9 +29,6 @@ class StartupController extends ApplicationApiController
|
|||
/**
|
||||
* Update the startup and environment settings for a specific server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\UpdateServerStartupRequest $request
|
||||
* @return array
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
|
|
@ -10,9 +10,6 @@ class ExternalUserController extends ApplicationApiController
|
|||
{
|
||||
/**
|
||||
* Retrieve a specific user from the database using their external ID.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Users\GetExternalUserRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetExternalUserRequest $request): array
|
||||
{
|
||||
|
|
|
@ -41,11 +41,6 @@ class UserController extends ApplicationApiController
|
|||
|
||||
/**
|
||||
* UserController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository
|
||||
* @param \Pterodactyl\Services\Users\UserCreationService $creationService
|
||||
* @param \Pterodactyl\Services\Users\UserDeletionService $deletionService
|
||||
* @param \Pterodactyl\Services\Users\UserUpdateService $updateService
|
||||
*/
|
||||
public function __construct(
|
||||
UserRepositoryInterface $repository,
|
||||
|
@ -65,9 +60,6 @@ class UserController extends ApplicationApiController
|
|||
* Handle request to list all users on the panel. Returns a JSON-API representation
|
||||
* of a collection of users including any defined relations passed in
|
||||
* the request.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Users\GetUsersRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetUsersRequest $request): array
|
||||
{
|
||||
|
@ -84,10 +76,6 @@ class UserController extends ApplicationApiController
|
|||
/**
|
||||
* Handle a request to view a single user. Includes any relations that
|
||||
* were defined in the request.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Users\GetUsersRequest $request
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return array
|
||||
*/
|
||||
public function view(GetUsersRequest $request, User $user): array
|
||||
{
|
||||
|
@ -104,10 +92,6 @@ class UserController extends ApplicationApiController
|
|||
* Revocation errors are returned under the 'revocation_errors' key in the response
|
||||
* meta. If there are no errors this is an empty array.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Users\UpdateUserRequest $request
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
@ -126,9 +110,6 @@ class UserController extends ApplicationApiController
|
|||
* Store a new user on the system. Returns the created user and a HTTP/201
|
||||
* header on successful creation.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Users\StoreUserRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
*/
|
||||
|
@ -150,10 +131,6 @@ class UserController extends ApplicationApiController
|
|||
* Handle a request to delete a user from the Panel. Returns a HTTP/204 response
|
||||
* on successful deletion.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Users\DeleteUserRequest $request
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function delete(DeleteUserRequest $request, User $user): JsonResponse
|
||||
|
|
|
@ -25,9 +25,6 @@ class AccountController extends ClientApiController
|
|||
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @param \Illuminate\Auth\AuthManager $sessionGuard
|
||||
* @param \Pterodactyl\Services\Users\UserUpdateService $updateService
|
||||
*/
|
||||
public function __construct(AuthManager $sessionGuard, UserUpdateService $updateService)
|
||||
{
|
||||
|
@ -37,10 +34,6 @@ class AccountController extends ClientApiController
|
|||
$this->sessionGuard = $sessionGuard;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(Request $request): array
|
||||
{
|
||||
return $this->fractal->item($request->user())
|
||||
|
@ -51,9 +44,6 @@ class AccountController extends ClientApiController
|
|||
/**
|
||||
* Update the authenticated user's email address.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Account\UpdateEmailRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
@ -68,9 +58,6 @@ class AccountController extends ClientApiController
|
|||
* Update the authenticated user's password. All existing sessions will be logged
|
||||
* out immediately.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Account\UpdatePasswordRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
|
|
@ -32,10 +32,6 @@ class ApiKeyController extends ClientApiController
|
|||
|
||||
/**
|
||||
* ApiKeyController constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
|
||||
* @param \Pterodactyl\Services\Api\KeyCreationService $keyCreationService
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ApiKeyRepository $repository
|
||||
*/
|
||||
public function __construct(
|
||||
Encrypter $encrypter,
|
||||
|
@ -52,7 +48,6 @@ class ApiKeyController extends ClientApiController
|
|||
/**
|
||||
* Returns all of the API keys that exist for the given client.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(ClientApiRequest $request)
|
||||
|
@ -65,7 +60,6 @@ class ApiKeyController extends ClientApiController
|
|||
/**
|
||||
* Store a new API key for a user's account.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Account\StoreApiKeyRequest $request
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -74,9 +68,7 @@ class ApiKeyController extends ClientApiController
|
|||
public function store(StoreApiKeyRequest $request)
|
||||
{
|
||||
if ($request->user()->apiKeys->count() >= 5) {
|
||||
throw new DisplayException(
|
||||
'You have reached the account limit for number of API keys.'
|
||||
);
|
||||
throw new DisplayException('You have reached the account limit for number of API keys.');
|
||||
}
|
||||
|
||||
$key = $this->keyCreationService->setKeyType(ApiKey::TYPE_ACCOUNT)->handle([
|
||||
|
@ -96,8 +88,6 @@ class ApiKeyController extends ClientApiController
|
|||
/**
|
||||
* Deletes a given API key.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request
|
||||
* @param string $identifier
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function delete(ClientApiRequest $request, string $identifier)
|
||||
|
@ -108,8 +98,8 @@ class ApiKeyController extends ClientApiController
|
|||
'identifier' => $identifier,
|
||||
]);
|
||||
|
||||
if (! $response) {
|
||||
throw new NotFoundHttpException;
|
||||
if (!$response) {
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
return JsonResponse::create([], JsonResponse::HTTP_NO_CONTENT);
|
||||
|
|
|
@ -13,8 +13,6 @@ abstract class ClientApiController extends ApplicationApiController
|
|||
/**
|
||||
* Returns only the includes which are valid for the given transformer.
|
||||
*
|
||||
* @param \Pterodactyl\Transformers\Api\Client\BaseClientTransformer $transformer
|
||||
* @param array $merge
|
||||
* @return string[]
|
||||
*/
|
||||
protected function getIncludesForTransformer(BaseClientTransformer $transformer, array $merge = [])
|
||||
|
@ -35,7 +33,7 @@ abstract class ClientApiController extends ApplicationApiController
|
|||
{
|
||||
$includes = $this->request->query('include') ?? [];
|
||||
|
||||
if (! is_string($includes)) {
|
||||
if (!is_string($includes)) {
|
||||
return $includes;
|
||||
}
|
||||
|
||||
|
@ -47,7 +45,6 @@ abstract class ClientApiController extends ApplicationApiController
|
|||
/**
|
||||
* Return an instance of an application transformer.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @return \Pterodactyl\Transformers\Api\Client\BaseClientTransformer
|
||||
*/
|
||||
public function getTransformer(string $abstract)
|
||||
|
|
|
@ -20,8 +20,6 @@ class ClientController extends ClientApiController
|
|||
|
||||
/**
|
||||
* ClientController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
|
||||
*/
|
||||
public function __construct(ServerRepository $repository)
|
||||
{
|
||||
|
@ -33,9 +31,6 @@ class ClientController extends ClientApiController
|
|||
/**
|
||||
* Return all of the servers available to the client making the API
|
||||
* request, including servers the user has access to as a subuser.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\GetServersRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetServersRequest $request): array
|
||||
{
|
||||
|
@ -49,7 +44,7 @@ class ClientController extends ClientApiController
|
|||
'uuid',
|
||||
'name',
|
||||
'external_id',
|
||||
AllowedFilter::custom('*', new MultiFieldServerFilter),
|
||||
AllowedFilter::custom('*', new MultiFieldServerFilter()),
|
||||
]);
|
||||
|
||||
$type = $request->input('type');
|
||||
|
@ -60,7 +55,7 @@ class ClientController extends ClientApiController
|
|||
if (in_array($type, ['admin', 'admin-all'])) {
|
||||
// If they aren't an admin but want all the admin servers don't fail the request, just
|
||||
// make it a query that will never return any results back.
|
||||
if (! $user->root_admin) {
|
||||
if (!$user->root_admin) {
|
||||
$builder->whereRaw('1 = 2');
|
||||
} else {
|
||||
$builder = $type === 'admin-all'
|
||||
|
|
|
@ -33,10 +33,6 @@ class BackupController extends ClientApiController
|
|||
|
||||
/**
|
||||
* BackupController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository
|
||||
* @param \Pterodactyl\Services\Backups\DeleteBackupService $deleteBackupService
|
||||
* @param \Pterodactyl\Services\Backups\InitiateBackupService $initiateBackupService
|
||||
*/
|
||||
public function __construct(
|
||||
BackupRepository $repository,
|
||||
|
@ -54,8 +50,6 @@ class BackupController extends ClientApiController
|
|||
* Returns all of the backups for a given server instance in a paginated
|
||||
* result set.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Backups\GetBackupsRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetBackupsRequest $request, Server $server)
|
||||
|
@ -70,8 +64,6 @@ class BackupController extends ClientApiController
|
|||
/**
|
||||
* Starts the backup process for a server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Backups\StoreBackupRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*
|
||||
* @throws \Exception|\Throwable
|
||||
|
@ -92,9 +84,6 @@ class BackupController extends ClientApiController
|
|||
/**
|
||||
* Returns information about a single backup.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Backups\GetBackupsRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Backup $backup
|
||||
* @return array
|
||||
*/
|
||||
public function view(GetBackupsRequest $request, Server $server, Backup $backup)
|
||||
|
@ -108,9 +97,6 @@ class BackupController extends ClientApiController
|
|||
* Deletes a backup from the panel as well as the remote source where it is currently
|
||||
* being stored.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Backups\DeleteBackupRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Backup $backup
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
|
|
@ -21,8 +21,6 @@ class CommandController extends ClientApiController
|
|||
|
||||
/**
|
||||
* CommandController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Wings\DaemonCommandRepository $repository
|
||||
*/
|
||||
public function __construct(DaemonCommandRepository $repository)
|
||||
{
|
||||
|
@ -34,10 +32,6 @@ class CommandController extends ClientApiController
|
|||
/**
|
||||
* Send a command to a running server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\SendCommandRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function index(SendCommandRequest $request, Server $server): Response
|
||||
|
@ -52,9 +46,7 @@ class CommandController extends ClientApiController
|
|||
$previous->getResponse() instanceof ResponseInterface
|
||||
&& $previous->getResponse()->getStatusCode() === Response::HTTP_BAD_GATEWAY
|
||||
) {
|
||||
throw new HttpException(
|
||||
Response::HTTP_BAD_GATEWAY, 'Server must be online in order to send commands.', $exception
|
||||
);
|
||||
throw new HttpException(Response::HTTP_BAD_GATEWAY, 'Server must be online in order to send commands.', $exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,11 +40,6 @@ class DatabaseController extends ClientApiController
|
|||
|
||||
/**
|
||||
* DatabaseController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Databases\DatabaseManagementService $managementService
|
||||
* @param \Pterodactyl\Services\Databases\DatabasePasswordService $passwordService
|
||||
* @param \Pterodactyl\Repositories\Eloquent\DatabaseRepository $repository
|
||||
* @param \Pterodactyl\Services\Databases\DeployServerDatabaseService $deployDatabaseService
|
||||
*/
|
||||
public function __construct(
|
||||
DatabaseManagementService $managementService,
|
||||
|
@ -62,10 +57,6 @@ class DatabaseController extends ClientApiController
|
|||
|
||||
/**
|
||||
* Return all of the databases that belong to the given server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Databases\GetDatabasesRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetDatabasesRequest $request, Server $server): array
|
||||
{
|
||||
|
@ -77,10 +68,6 @@ class DatabaseController extends ClientApiController
|
|||
/**
|
||||
* Create a new database for the given server and return it.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Databases\StoreDatabaseRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*
|
||||
* @throws \Throwable
|
||||
* @throws \Pterodactyl\Exceptions\Service\Database\TooManyDatabasesException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException
|
||||
|
@ -99,9 +86,6 @@ class DatabaseController extends ClientApiController
|
|||
* Rotates the password for the given server model and returns a fresh instance to
|
||||
* the caller.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Databases\RotatePasswordRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Database $database
|
||||
* @return array
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
@ -120,11 +104,6 @@ class DatabaseController extends ClientApiController
|
|||
/**
|
||||
* Removes a database from the server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Databases\DeleteDatabaseRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Database $database
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function delete(DeleteDatabaseRequest $request, Server $server, Database $database): Response
|
||||
|
|
|
@ -39,11 +39,6 @@ class DownloadBackupController extends ClientApiController
|
|||
|
||||
/**
|
||||
* DownloadBackupController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Wings\DaemonBackupRepository $daemonBackupRepository
|
||||
* @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService
|
||||
* @param \Pterodactyl\Extensions\Backups\BackupManager $backupManager
|
||||
* @param \Illuminate\Contracts\Routing\ResponseFactory $responseFactory
|
||||
*/
|
||||
public function __construct(
|
||||
DaemonBackupRepository $daemonBackupRepository,
|
||||
|
@ -64,9 +59,6 @@ class DownloadBackupController extends ClientApiController
|
|||
* will be streamed back through the Panel. For AWS S3 files, a signed URL will be generated
|
||||
* which the user is redirected to.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Backups\DownloadBackupRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Backup $backup
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function __invoke(DownloadBackupRequest $request, Server $server, Backup $backup)
|
||||
|
@ -79,7 +71,7 @@ class DownloadBackupController extends ClientApiController
|
|||
$url = $this->getS3BackupUrl($backup, $server);
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestHttpException;
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
return new JsonResponse([
|
||||
|
@ -94,8 +86,6 @@ class DownloadBackupController extends ClientApiController
|
|||
* Returns a signed URL that allows us to download a file directly out of a non-public
|
||||
* S3 bucket by using a signed URL.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Backup $backup
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return string
|
||||
*/
|
||||
protected function getS3BackupUrl(Backup $backup, Server $server)
|
||||
|
@ -120,9 +110,6 @@ class DownloadBackupController extends ClientApiController
|
|||
/**
|
||||
* Returns a download link a backup stored on a wings instance.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Backup $backup
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return string
|
||||
*/
|
||||
protected function getLocalBackupUrl(Backup $backup, Server $server, User $user)
|
||||
|
|
|
@ -42,10 +42,6 @@ class FileController extends ClientApiController
|
|||
|
||||
/**
|
||||
* FileController constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Routing\ResponseFactory $responseFactory
|
||||
* @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService
|
||||
* @param \Pterodactyl\Repositories\Wings\DaemonFileRepository $fileRepository
|
||||
*/
|
||||
public function __construct(
|
||||
ResponseFactory $responseFactory,
|
||||
|
@ -62,10 +58,6 @@ class FileController extends ClientApiController
|
|||
/**
|
||||
* Returns a listing of files in a given directory.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\ListFilesRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function directory(ListFilesRequest $request, Server $server): array
|
||||
|
@ -82,10 +74,6 @@ class FileController extends ClientApiController
|
|||
/**
|
||||
* Return the contents of a specified file for the user.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\GetFileContentsRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Server\FileSizeTooLargeException
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
|
@ -93,7 +81,8 @@ class FileController extends ClientApiController
|
|||
{
|
||||
return new Response(
|
||||
$this->fileRepository->setServer($server)->getContent(
|
||||
$request->get('file'), config('pterodactyl.files.max_edit_size')
|
||||
$request->get('file'),
|
||||
config('pterodactyl.files.max_edit_size')
|
||||
),
|
||||
Response::HTTP_OK,
|
||||
['Content-Type' => 'text/plain']
|
||||
|
@ -104,8 +93,6 @@ class FileController extends ClientApiController
|
|||
* Generates a one-time token with a link that the user can use to
|
||||
* download a given file.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\GetFileContentsRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*
|
||||
* @throws \Exception
|
||||
|
@ -135,10 +122,6 @@ class FileController extends ClientApiController
|
|||
/**
|
||||
* Writes the contents of the specified file to the server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\WriteFileContentRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function write(WriteFileContentRequest $request, Server $server): JsonResponse
|
||||
|
@ -151,10 +134,6 @@ class FileController extends ClientApiController
|
|||
/**
|
||||
* Creates a new folder on the server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\CreateFolderRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function create(CreateFolderRequest $request, Server $server): JsonResponse
|
||||
|
@ -169,10 +148,6 @@ class FileController extends ClientApiController
|
|||
/**
|
||||
* Renames a file on the remote machine.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\RenameFileRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function rename(RenameFileRequest $request, Server $server): JsonResponse
|
||||
|
@ -187,10 +162,6 @@ class FileController extends ClientApiController
|
|||
/**
|
||||
* Copies a file on the server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\CopyFileRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function copy(CopyFileRequest $request, Server $server): JsonResponse
|
||||
|
@ -203,10 +174,6 @@ class FileController extends ClientApiController
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\CompressFilesRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function compress(CompressFilesRequest $request, Server $server): array
|
||||
|
@ -216,7 +183,8 @@ class FileController extends ClientApiController
|
|||
|
||||
$file = $this->fileRepository->setServer($server)
|
||||
->compressFiles(
|
||||
$request->input('root'), $request->input('files')
|
||||
$request->input('root'),
|
||||
$request->input('files')
|
||||
);
|
||||
|
||||
return $this->fractal->item($file)
|
||||
|
@ -225,10 +193,6 @@ class FileController extends ClientApiController
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\DecompressFilesRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function decompress(DecompressFilesRequest $request, Server $server): JsonResponse
|
||||
|
@ -245,17 +209,14 @@ class FileController extends ClientApiController
|
|||
/**
|
||||
* Deletes files or folders for the server in the given root directory.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\DeleteFileRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function delete(DeleteFileRequest $request, Server $server): JsonResponse
|
||||
{
|
||||
$this->fileRepository->setServer($server)
|
||||
->deleteFiles(
|
||||
$request->input('root'), $request->input('files')
|
||||
$request->input('root'),
|
||||
$request->input('files')
|
||||
);
|
||||
|
||||
return new JsonResponse([], Response::HTTP_NO_CONTENT);
|
||||
|
@ -264,17 +225,14 @@ class FileController extends ClientApiController
|
|||
/**
|
||||
* Updates file permissions for file(s) in the given root directory.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\ChmodFilesRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function chmod(ChmodFilesRequest $request, Server $server): JsonResponse
|
||||
{
|
||||
$this->fileRepository->setServer($server)
|
||||
->chmodFiles(
|
||||
$request->input('root'), $request->input('files')
|
||||
$request->input('root'),
|
||||
$request->input('files')
|
||||
);
|
||||
|
||||
return new JsonResponse([], Response::HTTP_NO_CONTENT);
|
||||
|
@ -284,8 +242,6 @@ class FileController extends ClientApiController
|
|||
* Requests that a file be downloaded from a remote location by Wings.
|
||||
*
|
||||
* @param $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
|
|
|
@ -19,8 +19,6 @@ class FileUploadController extends ClientApiController
|
|||
|
||||
/**
|
||||
* FileUploadController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService
|
||||
*/
|
||||
public function __construct(
|
||||
NodeJWTService $jwtService
|
||||
|
@ -33,9 +31,6 @@ class FileUploadController extends ClientApiController
|
|||
/**
|
||||
* Returns a url where files can be uploaded to.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\UploadFileRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function __invoke(UploadFileRequest $request, Server $server)
|
||||
|
@ -51,8 +46,6 @@ class FileUploadController extends ClientApiController
|
|||
/**
|
||||
* Returns a url where files can be uploaded to.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return string
|
||||
*/
|
||||
protected function getUploadUrl(Server $server, User $user)
|
||||
|
|
|
@ -36,10 +36,6 @@ class NetworkAllocationController extends ClientApiController
|
|||
|
||||
/**
|
||||
* NetworkController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\AllocationRepository $repository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $serverRepository
|
||||
* @param \Pterodactyl\Services\Allocations\FindAssignableAllocationService $assignableAllocationService
|
||||
*/
|
||||
public function __construct(
|
||||
AllocationRepository $repository,
|
||||
|
@ -56,10 +52,6 @@ class NetworkAllocationController extends ClientApiController
|
|||
/**
|
||||
* Lists all of the allocations available to a server and wether or
|
||||
* not they are currently assigned as the primary for this server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\GetNetworkRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetNetworkRequest $request, Server $server): array
|
||||
{
|
||||
|
@ -71,11 +63,6 @@ class NetworkAllocationController extends ClientApiController
|
|||
/**
|
||||
* Set the primary allocation for a server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\UpdateAllocationRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
@ -93,11 +80,6 @@ class NetworkAllocationController extends ClientApiController
|
|||
/**
|
||||
* Set the primary allocation for a server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\SetPrimaryAllocationRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
@ -114,18 +96,12 @@ class NetworkAllocationController extends ClientApiController
|
|||
* Set the notes for the allocation for a server.
|
||||
*s.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\NewAllocationRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function store(NewAllocationRequest $request, Server $server): array
|
||||
{
|
||||
if ($server->allocations()->count() >= $server->allocation_limit) {
|
||||
throw new DisplayException(
|
||||
'Cannot assign additional allocations to this server: limit has been reached.'
|
||||
);
|
||||
throw new DisplayException('Cannot assign additional allocations to this server: limit has been reached.');
|
||||
}
|
||||
|
||||
$allocation = $this->assignableAllocationService->handle($server);
|
||||
|
@ -138,9 +114,6 @@ class NetworkAllocationController extends ClientApiController
|
|||
/**
|
||||
* Delete an allocation from a server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\DeleteAllocationRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -148,9 +121,7 @@ class NetworkAllocationController extends ClientApiController
|
|||
public function delete(DeleteAllocationRequest $request, Server $server, Allocation $allocation)
|
||||
{
|
||||
if ($allocation->id === $server->allocation_id) {
|
||||
throw new DisplayException(
|
||||
'You cannot delete the primary allocation for this server.'
|
||||
);
|
||||
throw new DisplayException('You cannot delete the primary allocation for this server.');
|
||||
}
|
||||
|
||||
Allocation::query()->where('id', $allocation->id)->update([
|
||||
|
|
|
@ -17,8 +17,6 @@ class PowerController extends ClientApiController
|
|||
|
||||
/**
|
||||
* PowerController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Wings\DaemonPowerRepository $repository
|
||||
*/
|
||||
public function __construct(DaemonPowerRepository $repository)
|
||||
{
|
||||
|
@ -30,10 +28,6 @@ class PowerController extends ClientApiController
|
|||
/**
|
||||
* Send a power action to a server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\SendPowerRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function index(SendPowerRequest $request, Server $server): Response
|
||||
|
|
|
@ -17,8 +17,6 @@ class ResourceUtilizationController extends ClientApiController
|
|||
|
||||
/**
|
||||
* ResourceUtilizationController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $repository
|
||||
*/
|
||||
public function __construct(DaemonServerRepository $repository)
|
||||
{
|
||||
|
@ -30,10 +28,6 @@ class ResourceUtilizationController extends ClientApiController
|
|||
/**
|
||||
* Return the current resource utilization for a server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\GetServerRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function __invoke(GetServerRequest $request, Server $server): array
|
||||
|
|
|
@ -37,9 +37,6 @@ class ScheduleController extends ClientApiController
|
|||
|
||||
/**
|
||||
* ScheduleController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ScheduleRepository $repository
|
||||
* @param \Pterodactyl\Services\Schedules\ProcessScheduleService $service
|
||||
*/
|
||||
public function __construct(ScheduleRepository $repository, ProcessScheduleService $service)
|
||||
{
|
||||
|
@ -52,8 +49,6 @@ class ScheduleController extends ClientApiController
|
|||
/**
|
||||
* Returns all of the schedules belonging to a given server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\ViewScheduleRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*/
|
||||
public function index(ViewScheduleRequest $request, Server $server)
|
||||
|
@ -69,8 +64,6 @@ class ScheduleController extends ClientApiController
|
|||
/**
|
||||
* Store a new schedule for a server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreScheduleRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -99,15 +92,12 @@ class ScheduleController extends ClientApiController
|
|||
/**
|
||||
* Returns a specific schedule for the server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\ViewScheduleRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Schedule $schedule
|
||||
* @return array
|
||||
*/
|
||||
public function view(ViewScheduleRequest $request, Server $server, Schedule $schedule)
|
||||
{
|
||||
if ($schedule->server_id !== $server->id) {
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
$schedule->loadMissing('tasks');
|
||||
|
@ -120,9 +110,6 @@ class ScheduleController extends ClientApiController
|
|||
/**
|
||||
* Updates a given schedule with the new data provided.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\UpdateScheduleRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Schedule $schedule
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -163,19 +150,14 @@ class ScheduleController extends ClientApiController
|
|||
* Executes a given schedule immediately rather than waiting on it's normally scheduled time
|
||||
* to pass. This does not care about the schedule state.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\TriggerScheduleRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Schedule $schedule
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function execute(TriggerScheduleRequest $request, Server $server, Schedule $schedule)
|
||||
{
|
||||
if (! $schedule->is_active) {
|
||||
throw new BadRequestHttpException(
|
||||
'Cannot trigger schedule exection for a schedule that is not currently active.'
|
||||
);
|
||||
if (!$schedule->is_active) {
|
||||
throw new BadRequestHttpException('Cannot trigger schedule exection for a schedule that is not currently active.');
|
||||
}
|
||||
|
||||
$this->service->handle($schedule, true);
|
||||
|
@ -186,9 +168,6 @@ class ScheduleController extends ClientApiController
|
|||
/**
|
||||
* Deletes a schedule and it's associated tasks.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\DeleteScheduleRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Schedule $schedule
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function delete(DeleteScheduleRequest $request, Server $server, Schedule $schedule)
|
||||
|
@ -201,8 +180,6 @@ class ScheduleController extends ClientApiController
|
|||
/**
|
||||
* Get the next run timestamp based on the cron data provided.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Carbon\Carbon
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
protected function getNextRunAt(Request $request): Carbon
|
||||
|
@ -216,9 +193,7 @@ class ScheduleController extends ClientApiController
|
|||
$request->input('day_of_week')
|
||||
);
|
||||
} 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.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@ class ScheduleTaskController extends ClientApiController
|
|||
|
||||
/**
|
||||
* ScheduleTaskController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\TaskRepository $repository
|
||||
*/
|
||||
public function __construct(TaskRepository $repository)
|
||||
{
|
||||
|
@ -39,9 +37,6 @@ class ScheduleTaskController extends ClientApiController
|
|||
/**
|
||||
* Create a new task for a given schedule and store it in the database.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreTaskRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Schedule $schedule
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -51,9 +46,7 @@ class ScheduleTaskController extends ClientApiController
|
|||
{
|
||||
$limit = config('pterodactyl.client_features.schedules.per_schedule_task_limit', 10);
|
||||
if ($schedule->tasks()->count() >= $limit) {
|
||||
throw new ServiceLimitExceededException(
|
||||
"Schedules may not have more than {$limit} tasks associated with them. Creating this task would put this schedule over the limit."
|
||||
);
|
||||
throw new ServiceLimitExceededException("Schedules may not have more than {$limit} tasks associated with them. Creating this task would put this schedule over the limit.");
|
||||
}
|
||||
|
||||
/** @var \Pterodactyl\Models\Task|null $lastTask */
|
||||
|
@ -76,10 +69,6 @@ class ScheduleTaskController extends ClientApiController
|
|||
/**
|
||||
* Updates a given task for a server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreTaskRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Schedule $schedule
|
||||
* @param \Pterodactyl\Models\Task $task
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -88,7 +77,7 @@ class ScheduleTaskController extends ClientApiController
|
|||
public function update(StoreTaskRequest $request, Server $server, Schedule $schedule, Task $task)
|
||||
{
|
||||
if ($schedule->id !== $task->schedule_id || $server->id !== $schedule->server_id) {
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
$this->repository->update($task->id, [
|
||||
|
@ -106,10 +95,6 @@ class ScheduleTaskController extends ClientApiController
|
|||
* Delete a given task for a schedule. If there are subsequent tasks stored in the database
|
||||
* for this schedule their sequence IDs are decremented properly.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @param \Pterodactyl\Models\Schedule $schedule
|
||||
* @param \Pterodactyl\Models\Task $task
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
|
@ -117,10 +102,10 @@ class ScheduleTaskController extends ClientApiController
|
|||
public function delete(ClientApiRequest $request, Server $server, Schedule $schedule, Task $task)
|
||||
{
|
||||
if ($task->schedule_id !== $schedule->id || $schedule->server_id !== $server->id) {
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
if (! $request->user()->can(Permission::ACTION_SCHEDULE_UPDATE, $server)) {
|
||||
if (!$request->user()->can(Permission::ACTION_SCHEDULE_UPDATE, $server)) {
|
||||
throw new HttpForbiddenException('You do not have permission to perform this action.');
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,6 @@ class ServerController extends ClientApiController
|
|||
|
||||
/**
|
||||
* ServerController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Servers\GetUserPermissionsService $permissionsService
|
||||
* @param \Pterodactyl\Repositories\Eloquent\SubuserRepository $repository
|
||||
*/
|
||||
public function __construct(GetUserPermissionsService $permissionsService, SubuserRepository $repository)
|
||||
{
|
||||
|
@ -38,10 +35,6 @@ class ServerController extends ClientApiController
|
|||
/**
|
||||
* Transform an individual server into a response that can be consumed by a
|
||||
* client using the API.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\GetServerRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetServerRequest $request, Server $server): array
|
||||
{
|
||||
|
|
|
@ -27,9 +27,6 @@ class SettingsController extends ClientApiController
|
|||
|
||||
/**
|
||||
* SettingsController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
|
||||
* @param \Pterodactyl\Services\Servers\ReinstallServerService $reinstallServerService
|
||||
*/
|
||||
public function __construct(
|
||||
ServerRepository $repository,
|
||||
|
@ -44,8 +41,6 @@ class SettingsController extends ClientApiController
|
|||
/**
|
||||
* Renames a server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Settings\RenameServerRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -63,8 +58,6 @@ class SettingsController extends ClientApiController
|
|||
/**
|
||||
* Reinstalls the server on the daemon.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Settings\ReinstallServerRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
@ -79,18 +72,14 @@ class SettingsController extends ClientApiController
|
|||
/**
|
||||
* Changes the Docker image in use by the server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Settings\SetDockerImageRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function dockerImage(SetDockerImageRequest $request, Server $server)
|
||||
{
|
||||
if (! in_array($server->image, $server->egg->docker_images)) {
|
||||
throw new BadRequestHttpException(
|
||||
'This server\'s Docker image has been manually set by an administrator and cannot be updated.'
|
||||
);
|
||||
if (!in_array($server->image, $server->egg->docker_images)) {
|
||||
throw new BadRequestHttpException('This server\'s Docker image has been manually set by an administrator and cannot be updated.');
|
||||
}
|
||||
|
||||
$server->forceFill(['image' => $request->input('docker_image')])->saveOrFail();
|
||||
|
|
|
@ -31,10 +31,6 @@ class StartupController extends ClientApiController
|
|||
|
||||
/**
|
||||
* StartupController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Servers\VariableValidatorService $service
|
||||
* @param \Pterodactyl\Services\Servers\StartupCommandService $startupCommandService
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ServerVariableRepository $repository
|
||||
*/
|
||||
public function __construct(VariableValidatorService $service, StartupCommandService $startupCommandService, ServerVariableRepository $repository)
|
||||
{
|
||||
|
@ -48,8 +44,6 @@ class StartupController extends ClientApiController
|
|||
/**
|
||||
* Returns the startup information for the server including all of the variables.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Startup\GetStartupRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetStartupRequest $request, Server $server)
|
||||
|
@ -71,8 +65,6 @@ class StartupController extends ClientApiController
|
|||
/**
|
||||
* Updates a single variable for a server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Startup\UpdateStartupVariableRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
|
@ -84,14 +76,10 @@ class StartupController extends ClientApiController
|
|||
/** @var \Pterodactyl\Models\EggVariable $variable */
|
||||
$variable = $server->variables()->where('env_variable', $request->input('key'))->first();
|
||||
|
||||
if (is_null($variable) || ! $variable->user_viewable) {
|
||||
throw new BadRequestHttpException(
|
||||
'The environment variable you are trying to edit does not exist.'
|
||||
);
|
||||
} elseif (! $variable->user_editable) {
|
||||
throw new BadRequestHttpException(
|
||||
'The environment variable you are trying to edit is read-only.'
|
||||
);
|
||||
if (is_null($variable) || !$variable->user_viewable) {
|
||||
throw new BadRequestHttpException('The environment variable you are trying to edit does not exist.');
|
||||
} elseif (!$variable->user_editable) {
|
||||
throw new BadRequestHttpException('The environment variable you are trying to edit is read-only.');
|
||||
}
|
||||
|
||||
// Revalidate the variable value using the egg variable specific validation rules for it.
|
||||
|
|
|
@ -37,10 +37,6 @@ class SubuserController extends ClientApiController
|
|||
|
||||
/**
|
||||
* SubuserController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\SubuserRepository $repository
|
||||
* @param \Pterodactyl\Services\Subusers\SubuserCreationService $creationService
|
||||
* @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $serverRepository
|
||||
*/
|
||||
public function __construct(
|
||||
SubuserRepository $repository,
|
||||
|
@ -57,8 +53,6 @@ class SubuserController extends ClientApiController
|
|||
/**
|
||||
* Return the users associated with this server instance.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\GetSubuserRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetSubuserRequest $request, Server $server)
|
||||
|
@ -71,7 +65,6 @@ class SubuserController extends ClientApiController
|
|||
/**
|
||||
* Returns a single subuser associated with this server instance.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\GetSubuserRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function view(GetSubuserRequest $request)
|
||||
|
@ -86,8 +79,6 @@ class SubuserController extends ClientApiController
|
|||
/**
|
||||
* Create a new subuser for the given server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\StoreSubuserRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -98,7 +89,9 @@ class SubuserController extends ClientApiController
|
|||
public function store(StoreSubuserRequest $request, Server $server)
|
||||
{
|
||||
$response = $this->creationService->handle(
|
||||
$server, $request->input('email'), $this->getDefaultPermissions($request)
|
||||
$server,
|
||||
$request->input('email'),
|
||||
$this->getDefaultPermissions($request)
|
||||
);
|
||||
|
||||
return $this->fractal->item($response)
|
||||
|
@ -109,10 +102,6 @@ class SubuserController extends ClientApiController
|
|||
/**
|
||||
* Update a given subuser in the system for the server.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\UpdateSubuserRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
@ -151,8 +140,6 @@ class SubuserController extends ClientApiController
|
|||
/**
|
||||
* Removes a subusers from a server's assignment.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\DeleteSubuserRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function delete(DeleteSubuserRequest $request, Server $server)
|
||||
|
@ -174,9 +161,6 @@ class SubuserController extends ClientApiController
|
|||
|
||||
/**
|
||||
* Returns the default permissions for all subusers to ensure none are ever removed wrongly.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
protected function getDefaultPermissions(Request $request): array
|
||||
{
|
||||
|
|
|
@ -26,9 +26,6 @@ class WebsocketController extends ClientApiController
|
|||
|
||||
/**
|
||||
* WebsocketController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService
|
||||
* @param \Pterodactyl\Services\Servers\GetUserPermissionsService $permissionsService
|
||||
*/
|
||||
public function __construct(
|
||||
NodeJWTService $jwtService,
|
||||
|
@ -46,8 +43,6 @@ class WebsocketController extends ClientApiController
|
|||
* allows us to continually renew this token and avoid users mainitaining sessions wrongly,
|
||||
* as well as ensure that user's only perform actions they're allowed to.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function __invoke(ClientApiRequest $request, Server $server)
|
||||
|
@ -60,9 +55,9 @@ class WebsocketController extends ClientApiController
|
|||
$permissions = $this->permissionsService->handle($server, $user);
|
||||
|
||||
$node = $server->node;
|
||||
if (! is_null($server->transfer)) {
|
||||
if (!is_null($server->transfer)) {
|
||||
// Check if the user has permissions to receive transfer logs.
|
||||
if (! in_array('admin.websocket.transfer', $permissions)) {
|
||||
if (!in_array('admin.websocket.transfer', $permissions)) {
|
||||
throw new HttpForbiddenException('You do not have permission to view server transfer logs.');
|
||||
}
|
||||
|
||||
|
|
|
@ -31,10 +31,6 @@ class TwoFactorController extends ClientApiController
|
|||
|
||||
/**
|
||||
* TwoFactorController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Users\ToggleTwoFactorService $toggleTwoFactorService
|
||||
* @param \Pterodactyl\Services\Users\TwoFactorSetupService $setupService
|
||||
* @param \Illuminate\Contracts\Validation\Factory $validation
|
||||
*/
|
||||
public function __construct(
|
||||
ToggleTwoFactorService $toggleTwoFactorService,
|
||||
|
@ -53,7 +49,6 @@ class TwoFactorController extends ClientApiController
|
|||
* it on their account. If two-factor is already enabled this endpoint
|
||||
* will return a 400 error.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -75,7 +70,6 @@ class TwoFactorController extends ClientApiController
|
|||
/**
|
||||
* Updates a user's account to have two-factor enabled.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
|
@ -110,15 +104,12 @@ class TwoFactorController extends ClientApiController
|
|||
* Disables two-factor authentication on an account if the password provided
|
||||
* is valid.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function delete(Request $request)
|
||||
{
|
||||
if (! password_verify($request->input('password') ?? '', $request->user()->password)) {
|
||||
throw new BadRequestHttpException(
|
||||
'The password provided was not valid.'
|
||||
);
|
||||
if (!password_verify($request->input('password') ?? '', $request->user()->password)) {
|
||||
throw new BadRequestHttpException('The password provided was not valid.');
|
||||
}
|
||||
|
||||
/** @var \Pterodactyl\Models\User $user */
|
||||
|
|
|
@ -15,7 +15,7 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
|||
|
||||
class BackupRemoteUploadController extends Controller
|
||||
{
|
||||
const PART_SIZE = 5 * 1024 * 1024 * 1024;
|
||||
public const PART_SIZE = 5 * 1024 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Repositories\Eloquent\BackupRepository
|
||||
|
@ -29,9 +29,6 @@ class BackupRemoteUploadController extends Controller
|
|||
|
||||
/**
|
||||
* BackupRemoteUploadController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository
|
||||
* @param \Pterodactyl\Extensions\Backups\BackupManager $backupManager
|
||||
*/
|
||||
public function __construct(BackupRepository $repository, BackupManager $backupManager)
|
||||
{
|
||||
|
@ -42,9 +39,6 @@ class BackupRemoteUploadController extends Controller
|
|||
/**
|
||||
* Returns the required presigned urls to upload a backup to S3 cloud storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $backup
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
|
@ -64,13 +58,13 @@ class BackupRemoteUploadController extends Controller
|
|||
|
||||
// Prevent backups that have already been completed from trying to
|
||||
// be uploaded again.
|
||||
if (! is_null($backup->completed_at)) {
|
||||
if (!is_null($backup->completed_at)) {
|
||||
throw new ConflictHttpException('This backup is already in a completed state.');
|
||||
}
|
||||
|
||||
// Ensure we are using the S3 adapter.
|
||||
$adapter = $this->backupManager->adapter();
|
||||
if (! $adapter instanceof AwsS3Adapter) {
|
||||
if (!$adapter instanceof AwsS3Adapter) {
|
||||
throw new BadRequestHttpException('The configured backup adapter is not an S3 compatible adapter.');
|
||||
}
|
||||
|
||||
|
@ -97,9 +91,10 @@ class BackupRemoteUploadController extends Controller
|
|||
|
||||
// Create as many UploadPart presigned urls as needed
|
||||
$parts = [];
|
||||
for ($i = 0; $i < ($size / self::PART_SIZE); $i++) {
|
||||
for ($i = 0; $i < ($size / self::PART_SIZE); ++$i) {
|
||||
$parts[] = $client->createPresignedRequest(
|
||||
$client->getCommand('UploadPart', array_merge($params, ['PartNumber' => $i + 1])), $expires
|
||||
$client->getCommand('UploadPart', array_merge($params, ['PartNumber' => $i + 1])),
|
||||
$expires
|
||||
)->getUri()->__toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,6 @@ class BackupStatusController extends Controller
|
|||
|
||||
/**
|
||||
* BackupStatusController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository
|
||||
* @param \Pterodactyl\Extensions\Backups\BackupManager $backupManager
|
||||
*/
|
||||
public function __construct(BackupRepository $repository, BackupManager $backupManager)
|
||||
{
|
||||
|
@ -40,8 +37,6 @@ class BackupStatusController extends Controller
|
|||
/**
|
||||
* Handles updating the state of a backup.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Remote\ReportBackupCompleteRequest $request
|
||||
* @param string $backup
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
|
@ -51,10 +46,8 @@ class BackupStatusController extends Controller
|
|||
/** @var \Pterodactyl\Models\Backup $model */
|
||||
$model = Backup::query()->where('uuid', $backup)->firstOrFail();
|
||||
|
||||
if (! is_null($model->completed_at)) {
|
||||
throw new BadRequestHttpException(
|
||||
'Cannot update the status of a backup that is already marked as completed.'
|
||||
);
|
||||
if (!is_null($model->completed_at)) {
|
||||
throw new BadRequestHttpException('Cannot update the status of a backup that is already marked as completed.');
|
||||
}
|
||||
|
||||
$successful = $request->input('successful') ? true : false;
|
||||
|
@ -80,10 +73,6 @@ class BackupStatusController extends Controller
|
|||
* Marks a multipart upload in a given S3-compatiable instance as failed or successful for
|
||||
* the given backup.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Backup $backup
|
||||
* @param \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter
|
||||
* @param bool $successful
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
|
@ -95,7 +84,7 @@ class BackupStatusController extends Controller
|
|||
// A failed backup doesn't need to error here, this can happen if the backup encouters
|
||||
// an error before we even start the upload. AWS gives you tooling to clear these failed
|
||||
// multipart uploads as needed too.
|
||||
if (! $successful) {
|
||||
if (!$successful) {
|
||||
return;
|
||||
}
|
||||
throw new DisplayException('Cannot complete backup request: no upload_id present on model.');
|
||||
|
@ -108,7 +97,7 @@ class BackupStatusController extends Controller
|
|||
];
|
||||
|
||||
$client = $adapter->getClient();
|
||||
if (! $successful) {
|
||||
if (!$successful) {
|
||||
$client->execute($client->getCommand('AbortMultipartUpload', $params));
|
||||
|
||||
return;
|
||||
|
|
|
@ -22,9 +22,6 @@ class EggInstallController extends Controller
|
|||
|
||||
/**
|
||||
* EggInstallController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Servers\EnvironmentService $environment
|
||||
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(EnvironmentService $environment, ServerRepositoryInterface $repository)
|
||||
{
|
||||
|
@ -36,10 +33,6 @@ class EggInstallController extends Controller
|
|||
* Handle request to get script and installation information for a server
|
||||
* that is being created on the node.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $uuid
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function index(Request $request, string $uuid): JsonResponse
|
||||
|
@ -57,7 +50,7 @@ class EggInstallController extends Controller
|
|||
|
||||
return response()->json([
|
||||
'scripts' => [
|
||||
'install' => ! $egg->copy_script_install ? null : str_replace(["\r\n", "\n", "\r"], "\n", $egg->copy_script_install),
|
||||
'install' => !$egg->copy_script_install ? null : str_replace(["\r\n", "\n", "\r"], "\n", $egg->copy_script_install),
|
||||
'privileged' => $egg->script_is_privileged,
|
||||
],
|
||||
'config' => [
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -18,8 +18,6 @@ class ServerInstallController extends Controller
|
|||
|
||||
/**
|
||||
* ServerInstallController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
|
||||
*/
|
||||
public function __construct(ServerRepository $repository)
|
||||
{
|
||||
|
@ -29,8 +27,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
|
||||
|
@ -50,8 +46,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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,10 +38,6 @@ class SftpAuthenticationController extends Controller
|
|||
|
||||
/**
|
||||
* SftpController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Servers\GetUserPermissionsService $permissionsService
|
||||
* @param \Pterodactyl\Repositories\Eloquent\UserRepository $userRepository
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $serverRepository
|
||||
*/
|
||||
public function __construct(
|
||||
GetUserPermissionsService $permissionsService,
|
||||
|
@ -57,9 +53,6 @@ class SftpAuthenticationController extends Controller
|
|||
* Authenticate a set of credentials and return the associated server details
|
||||
* for a SFTP connection on the daemon.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Remote\SftpAuthenticationFormRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function __invoke(SftpAuthenticationFormRequest $request): JsonResponse
|
||||
|
@ -76,15 +69,13 @@ class SftpAuthenticationController extends Controller
|
|||
if ($this->hasTooManyLoginAttempts($request)) {
|
||||
$seconds = $this->limiter()->availableIn($this->throttleKey($request));
|
||||
|
||||
throw new TooManyRequestsHttpException(
|
||||
$seconds, "Too many login attempts for this account, please try again in {$seconds} seconds."
|
||||
);
|
||||
throw new TooManyRequestsHttpException($seconds, "Too many login attempts for this account, please try again in {$seconds} seconds.");
|
||||
}
|
||||
|
||||
/** @var \Pterodactyl\Models\Node $node */
|
||||
$node = $request->attributes->get('node');
|
||||
if (empty($connection['server'])) {
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
/** @var \Pterodactyl\Models\User $user */
|
||||
|
@ -93,35 +84,29 @@ class SftpAuthenticationController extends Controller
|
|||
]);
|
||||
|
||||
$server = $this->serverRepository->getByUuid($connection['server'] ?? '');
|
||||
if (! password_verify($request->input('password'), $user->password) || $server->node_id !== $node->id) {
|
||||
if (!password_verify($request->input('password'), $user->password) || $server->node_id !== $node->id) {
|
||||
$this->incrementLoginAttempts($request);
|
||||
|
||||
throw new HttpForbiddenException(
|
||||
'Authorization credentials were not correct, please try again.'
|
||||
);
|
||||
throw new HttpForbiddenException('Authorization credentials were not correct, please try again.');
|
||||
}
|
||||
|
||||
if (! $user->root_admin && $server->owner_id !== $user->id) {
|
||||
if (!$user->root_admin && $server->owner_id !== $user->id) {
|
||||
$permissions = $this->permissionsService->handle($server, $user);
|
||||
|
||||
if (! in_array(Permission::ACTION_FILE_SFTP, $permissions)) {
|
||||
throw new HttpForbiddenException(
|
||||
'You do not have permission to access SFTP for this server.'
|
||||
);
|
||||
if (!in_array(Permission::ACTION_FILE_SFTP, $permissions)) {
|
||||
throw new HttpForbiddenException('You do not have permission to access SFTP for this server.');
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent SFTP access to servers that are being transferred.
|
||||
if (! is_null($server->transfer)) {
|
||||
throw new ServerTransferringException;
|
||||
if (!is_null($server->transfer)) {
|
||||
throw new ServerTransferringException();
|
||||
}
|
||||
|
||||
// Remember, for security purposes, only reveal the existence of the server to people that
|
||||
// have provided valid credentials, and have permissions to know about it.
|
||||
if ($server->installed !== 1 || $server->suspended) {
|
||||
throw new BadRequestHttpException(
|
||||
'Server is not installed or is currently suspended.'
|
||||
);
|
||||
throw new BadRequestHttpException('Server is not installed or is currently suspended.');
|
||||
}
|
||||
|
||||
return new JsonResponse([
|
||||
|
@ -134,9 +119,6 @@ class SftpAuthenticationController extends Controller
|
|||
|
||||
/**
|
||||
* Get the throttle key for the given request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string
|
||||
*/
|
||||
protected function throttleKey(Request $request): string
|
||||
{
|
||||
|
|
|
@ -50,9 +50,6 @@ abstract class AbstractLoginController extends Controller
|
|||
|
||||
/**
|
||||
* LoginController constructor.
|
||||
*
|
||||
* @param \Illuminate\Auth\AuthManager $auth
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
*/
|
||||
public function __construct(AuthManager $auth, Repository $config)
|
||||
{
|
||||
|
@ -66,10 +63,6 @@ abstract class AbstractLoginController extends Controller
|
|||
/**
|
||||
* Get the failed login response instance.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable|null $user
|
||||
* @param string|null $message
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
protected function sendFailedLoginResponse(Request $request, Authenticatable $user = null, string $message = null)
|
||||
|
@ -80,9 +73,7 @@ abstract class AbstractLoginController extends Controller
|
|||
]);
|
||||
|
||||
if ($request->route()->named('auth.login-checkpoint')) {
|
||||
throw new DisplayException(
|
||||
$message ?? trans('auth.two_factor.checkpoint_failed')
|
||||
);
|
||||
throw new DisplayException($message ?? trans('auth.two_factor.checkpoint_failed'));
|
||||
}
|
||||
|
||||
throw new DisplayException(trans('auth.failed'));
|
||||
|
@ -90,10 +81,6 @@ abstract class AbstractLoginController extends Controller
|
|||
|
||||
/**
|
||||
* Send the response after the user was authenticated.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function sendLoginResponse(User $user, Request $request): JsonResponse
|
||||
{
|
||||
|
@ -115,7 +102,6 @@ abstract class AbstractLoginController extends Controller
|
|||
* Determine if the user is logging in using an email or username,.
|
||||
*
|
||||
* @param string $input
|
||||
* @return string
|
||||
*/
|
||||
protected function getField(string $input = null): string
|
||||
{
|
||||
|
@ -124,9 +110,6 @@ abstract class AbstractLoginController extends Controller
|
|||
|
||||
/**
|
||||
* Fire a failed login event.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable|null $user
|
||||
* @param array $credentials
|
||||
*/
|
||||
protected function fireFailedLoginEvent(Authenticatable $user = null, array $credentials = [])
|
||||
{
|
||||
|
|
|
@ -18,7 +18,6 @@ class ForgotPasswordController extends Controller
|
|||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @param string $response
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function sendResetLinkFailedResponse(Request $request, $response): JsonResponse
|
||||
{
|
||||
|
@ -33,9 +32,7 @@ class ForgotPasswordController extends Controller
|
|||
/**
|
||||
* Get the response for a successful password reset link.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $response
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function sendResetLinkResponse(Request $request, $response): JsonResponse
|
||||
{
|
||||
|
|
|
@ -43,14 +43,6 @@ class LoginCheckpointController extends AbstractLoginController
|
|||
|
||||
/**
|
||||
* LoginCheckpointController constructor.
|
||||
*
|
||||
* @param \Illuminate\Auth\AuthManager $auth
|
||||
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
|
||||
* @param \PragmaRX\Google2FA\Google2FA $google2FA
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
* @param \Illuminate\Contracts\Cache\Repository $cache
|
||||
* @param \Pterodactyl\Repositories\Eloquent\RecoveryTokenRepository $recoveryTokenRepository
|
||||
* @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(
|
||||
AuthManager $auth,
|
||||
|
@ -75,7 +67,6 @@ class LoginCheckpointController extends AbstractLoginController
|
|||
* token. Once a user has reached this stage it is assumed that they have already
|
||||
* provided a valid username and password.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Auth\LoginCheckpointRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse|void
|
||||
*
|
||||
* @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException
|
||||
|
@ -98,12 +89,14 @@ class LoginCheckpointController extends AbstractLoginController
|
|||
$this->incrementLoginAttempts($request);
|
||||
|
||||
return $this->sendFailedLoginResponse(
|
||||
$request, null, 'The authentication token provided has expired, please refresh the page and try again.'
|
||||
$request,
|
||||
null,
|
||||
'The authentication token provided has expired, please refresh the page and try again.'
|
||||
);
|
||||
}
|
||||
|
||||
// Recovery tokens go through a slightly different pathway for usage.
|
||||
if (! is_null($recoveryToken = $request->input('recovery_token'))) {
|
||||
if (!is_null($recoveryToken = $request->input('recovery_token'))) {
|
||||
if ($this->isValidRecoveryToken($user, $recoveryToken)) {
|
||||
return $this->sendLoginResponse($user, $request);
|
||||
}
|
||||
|
@ -119,15 +112,13 @@ class LoginCheckpointController extends AbstractLoginController
|
|||
|
||||
$this->incrementLoginAttempts($request);
|
||||
|
||||
return $this->sendFailedLoginResponse($request, $user, ! empty($recoveryToken) ? 'The recovery token provided is not valid.' : null);
|
||||
return $this->sendFailedLoginResponse($request, $user, !empty($recoveryToken) ? 'The recovery token provided is not valid.' : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a given recovery token is valid for the user account. If we find a matching token
|
||||
* it will be deleted from the database.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Exception
|
||||
|
|
|
@ -33,12 +33,6 @@ class LoginController extends AbstractLoginController
|
|||
|
||||
/**
|
||||
* LoginController constructor.
|
||||
*
|
||||
* @param \Illuminate\Auth\AuthManager $auth
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
* @param \Illuminate\Contracts\Cache\Repository $cache
|
||||
* @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository
|
||||
* @param \Illuminate\Contracts\View\Factory $view
|
||||
*/
|
||||
public function __construct(
|
||||
AuthManager $auth,
|
||||
|
@ -58,8 +52,6 @@ class LoginController extends AbstractLoginController
|
|||
* Handle all incoming requests for the authentication routes and render the
|
||||
* base authentication view component. Vuejs will take over at this point and
|
||||
* turn the login area into a SPA.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
|
@ -69,7 +61,6 @@ class LoginController extends AbstractLoginController
|
|||
/**
|
||||
* Handle a login request to the application.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse|void
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -95,7 +86,7 @@ class LoginController extends AbstractLoginController
|
|||
// continue. Previously this was handled in the 2FA checkpoint, however that has
|
||||
// a flaw in which you can discover if an account exists simply by seeing if you
|
||||
// can proceede to the next step in the login process.
|
||||
if (! password_verify($request->input('password'), $user->password)) {
|
||||
if (!password_verify($request->input('password'), $user->password)) {
|
||||
return $this->sendFailedLoginResponse($request, $user);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,10 +47,6 @@ class ResetPasswordController extends Controller
|
|||
|
||||
/**
|
||||
* ResetPasswordController constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher $dispatcher
|
||||
* @param \Illuminate\Contracts\Hashing\Hasher $hasher
|
||||
* @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $userRepository
|
||||
*/
|
||||
public function __construct(Dispatcher $dispatcher, Hasher $hasher, UserRepositoryInterface $userRepository)
|
||||
{
|
||||
|
@ -62,9 +58,6 @@ class ResetPasswordController extends Controller
|
|||
/**
|
||||
* Reset the given user's password.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Auth\ResetPasswordRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function __invoke(ResetPasswordRequest $request): JsonResponse
|
||||
|
@ -73,7 +66,8 @@ class ResetPasswordController extends Controller
|
|||
// will update the password on an actual user model and persist it to the
|
||||
// database. Otherwise we will parse the error and return the response.
|
||||
$response = $this->broker()->reset(
|
||||
$this->credentials($request), function ($user, $password) {
|
||||
$this->credentials($request),
|
||||
function ($user, $password) {
|
||||
$this->resetPassword($user, $password);
|
||||
}
|
||||
);
|
||||
|
@ -94,7 +88,7 @@ class ResetPasswordController extends Controller
|
|||
* form with a note telling them their password was changed and to log back in.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\CanResetPassword|\Pterodactyl\Models\User $user
|
||||
* @param string $password
|
||||
* @param string $password
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
|
@ -110,7 +104,7 @@ class ResetPasswordController extends Controller
|
|||
|
||||
// If the user is not using 2FA log them in, otherwise skip this step and force a
|
||||
// fresh login where they'll be prompted to enter a token.
|
||||
if (! $user->use_totp) {
|
||||
if (!$user->use_totp) {
|
||||
$this->guard()->login($user);
|
||||
}
|
||||
|
||||
|
@ -119,8 +113,6 @@ class ResetPasswordController extends Controller
|
|||
|
||||
/**
|
||||
* Send a successful password reset response back to the callee.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function sendResetResponse(): JsonResponse
|
||||
{
|
||||
|
|
|
@ -14,8 +14,6 @@ class IndexController extends Controller
|
|||
|
||||
/**
|
||||
* IndexController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(ServerRepositoryInterface $repository)
|
||||
{
|
||||
|
|
|
@ -16,8 +16,6 @@ class LocaleController extends Controller
|
|||
|
||||
/**
|
||||
* LocaleController constructor.
|
||||
*
|
||||
* @param \Illuminate\Translation\Translator $translator
|
||||
*/
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
|
@ -27,9 +25,6 @@ class LocaleController extends Controller
|
|||
/**
|
||||
* Returns translation data given a specific locale and namespace.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $locale
|
||||
* @param string $namespace
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function __invoke(Request $request, string $locale, string $namespace)
|
||||
|
|
|
@ -9,5 +9,7 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|||
|
||||
abstract class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
use AuthorizesRequests;
|
||||
use DispatchesJobs;
|
||||
use ValidatesRequests;
|
||||
}
|
||||
|
|
|
@ -14,8 +14,6 @@ class ServerInstalled
|
|||
/**
|
||||
* Checks that the server is installed before allowing access through the route.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
|
@ -23,16 +21,12 @@ class ServerInstalled
|
|||
/** @var \Pterodactyl\Models\Server|null $server */
|
||||
$server = $request->route()->parameter('server');
|
||||
|
||||
if (! $server instanceof Server) {
|
||||
throw new NotFoundHttpException(
|
||||
'No server resource was located in the request parameters.'
|
||||
);
|
||||
if (!$server instanceof Server) {
|
||||
throw new NotFoundHttpException('No server resource was located in the request parameters.');
|
||||
}
|
||||
|
||||
if ($server->installed !== 1) {
|
||||
throw new HttpException(
|
||||
Response::HTTP_FORBIDDEN, 'Access to this resource is not allowed due to the current installation state.'
|
||||
);
|
||||
throw new HttpException(Response::HTTP_FORBIDDEN, 'Access to this resource is not allowed due to the current installation state.');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
|
|
@ -18,16 +18,14 @@ class AdminAuthenticate
|
|||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if (! $request->user() || ! $request->user()->root_admin) {
|
||||
throw new AccessDeniedHttpException;
|
||||
if (!$request->user() || !$request->user()->root_admin) {
|
||||
throw new AccessDeniedHttpException();
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
|
|
@ -42,7 +42,7 @@ class ApiSubstituteBindings extends SubstituteBindings
|
|||
* a 404 error if a model is not found.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
|
@ -50,7 +50,7 @@ class ApiSubstituteBindings extends SubstituteBindings
|
|||
$route = $request->route();
|
||||
|
||||
foreach (self::$mappings as $key => $model) {
|
||||
if (! is_null($this->router->getBindingCallback($key))) {
|
||||
if (!is_null($this->router->getBindingCallback($key))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,13 +12,11 @@ class AuthenticateApplicationUser
|
|||
* Authenticate that the currently authenticated user is an administrator
|
||||
* and should be allowed to proceed through the application API.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if (is_null($request->user()) || ! $request->user()->root_admin) {
|
||||
if (is_null($request->user()) || !$request->user()->root_admin) {
|
||||
throw new AccessDeniedHttpException('This account does not have permission to access the API.');
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@ class AuthenticateIPAccess
|
|||
/**
|
||||
* Determine if a request IP has permission to access the API.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Exception
|
||||
|
|
|
@ -33,10 +33,6 @@ class AuthenticateKey
|
|||
|
||||
/**
|
||||
* AuthenticateKey constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository
|
||||
* @param \Illuminate\Auth\AuthManager $auth
|
||||
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
|
||||
*/
|
||||
public function __construct(ApiKeyRepositoryInterface $repository, AuthManager $auth, Encrypter $encrypter)
|
||||
{
|
||||
|
@ -49,9 +45,6 @@ class AuthenticateKey
|
|||
* Handle an API request by verifying that the provided API key
|
||||
* is in a valid format and exists in the database.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param int $keyType
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -85,10 +78,6 @@ class AuthenticateKey
|
|||
/**
|
||||
* Authenticate an API key.
|
||||
*
|
||||
* @param string $key
|
||||
* @param int $keyType
|
||||
* @return \Pterodactyl\Models\ApiKey
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
@ -103,11 +92,11 @@ class AuthenticateKey
|
|||
['key_type', '=', $keyType],
|
||||
]);
|
||||
} catch (RecordNotFoundException $exception) {
|
||||
throw new AccessDeniedHttpException;
|
||||
throw new AccessDeniedHttpException();
|
||||
}
|
||||
|
||||
if (! hash_equals($this->encrypter->decrypt($model->token), $token)) {
|
||||
throw new AccessDeniedHttpException;
|
||||
if (!hash_equals($this->encrypter->decrypt($model->token), $token)) {
|
||||
throw new AccessDeniedHttpException();
|
||||
}
|
||||
|
||||
$this->repository->withoutFreshModel()->update($model->id, ['last_used_at' => CarbonImmutable::now()]);
|
||||
|
|
|
@ -29,8 +29,6 @@ class AuthenticateServerAccess
|
|||
|
||||
/**
|
||||
* AuthenticateServerAccess constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(ServerRepositoryInterface $repository)
|
||||
{
|
||||
|
@ -40,8 +38,6 @@ class AuthenticateServerAccess
|
|||
/**
|
||||
* Authenticate that this server exists and is not suspended or marked as installing.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
|
@ -50,39 +46,37 @@ class AuthenticateServerAccess
|
|||
$user = $request->user();
|
||||
$server = $request->route()->parameter('server');
|
||||
|
||||
if (! $server instanceof Server) {
|
||||
if (!$server instanceof Server) {
|
||||
throw new NotFoundHttpException(trans('exceptions.api.resource_not_found'));
|
||||
}
|
||||
|
||||
// At the very least, ensure that the user trying to make this request is the
|
||||
// server owner, a subuser, or a root admin. We'll leave it up to the controllers
|
||||
// to authenticate more detailed permissions if needed.
|
||||
if ($user->id !== $server->owner_id && ! $user->root_admin) {
|
||||
if ($user->id !== $server->owner_id && !$user->root_admin) {
|
||||
// Check for subuser status.
|
||||
if (! $server->subusers->contains('user_id', $user->id)) {
|
||||
if (!$server->subusers->contains('user_id', $user->id)) {
|
||||
throw new NotFoundHttpException(trans('exceptions.api.resource_not_found'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($server->suspended && ! $request->routeIs('api:client:server.resources')) {
|
||||
throw new BadRequestHttpException(
|
||||
'This server is currently suspended and the functionality requested is unavailable.'
|
||||
);
|
||||
if ($server->suspended && !$request->routeIs('api:client:server.resources')) {
|
||||
throw new BadRequestHttpException('This server is currently suspended and the functionality requested is unavailable.');
|
||||
}
|
||||
|
||||
// Still allow users to get information about their server if it is installing or being transferred.
|
||||
if (! $request->routeIs('api:client:server.view')) {
|
||||
if (! $server->isInstalled()) {
|
||||
if (!$request->routeIs('api:client:server.view')) {
|
||||
if (!$server->isInstalled()) {
|
||||
// Throw an exception for all server routes; however if the user is an admin and requesting the
|
||||
// server details, don't throw the exception for them.
|
||||
if (! $user->root_admin || ($user->root_admin && ! $request->routeIs($this->except))) {
|
||||
if (!$user->root_admin || ($user->root_admin && !$request->routeIs($this->except))) {
|
||||
throw new ConflictHttpException('Server has not completed the installation process.');
|
||||
}
|
||||
}
|
||||
|
||||
if (! is_null($server->transfer)) {
|
||||
if (! $user->root_admin || ($user->root_admin && ! $request->routeIs($this->except))) {
|
||||
throw new ServerTransferringException;
|
||||
if (!is_null($server->transfer)) {
|
||||
if (!$user->root_admin || ($user->root_admin && !$request->routeIs($this->except))) {
|
||||
throw new ServerTransferringException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,14 +26,12 @@ class ResourceBelongsToServer
|
|||
* server that is expected, and that we're not accessing a resource completely
|
||||
* unrelated to the server provided in the request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$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.');
|
||||
}
|
||||
|
||||
|
@ -45,7 +43,7 @@ class ResourceBelongsToServer
|
|||
// other resources are assigned to this server. Also skip anything that
|
||||
// is not currently a Model instance since those will just end up being
|
||||
// a 404 down the road.
|
||||
if ($key === 'server' || ! $model instanceof Model) {
|
||||
if ($key === 'server' || !$model instanceof Model) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class SubstituteClientApiBindings extends ApiSubstituteBindings
|
|||
* a 404 error if a model is not found.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
|
|
|
@ -34,9 +34,6 @@ class DaemonAuthenticate
|
|||
|
||||
/**
|
||||
* DaemonAuthenticate constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
|
||||
* @param \Pterodactyl\Repositories\Eloquent\NodeRepository $repository
|
||||
*/
|
||||
public function __construct(Encrypter $encrypter, NodeRepository $repository)
|
||||
{
|
||||
|
@ -47,8 +44,6 @@ class DaemonAuthenticate
|
|||
/**
|
||||
* Check if a request from the daemon can be properly attributed back to a single node instance.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
|
@ -60,17 +55,13 @@ class DaemonAuthenticate
|
|||
}
|
||||
|
||||
if (is_null($bearer = $request->bearerToken())) {
|
||||
throw new HttpException(
|
||||
401, 'Access this this endpoint must include an Authorization header.', null, ['WWW-Authenticate' => 'Bearer']
|
||||
);
|
||||
throw new HttpException(401, 'Access this this endpoint must include an Authorization header.', null, ['WWW-Authenticate' => 'Bearer']);
|
||||
}
|
||||
|
||||
$parts = explode('.', $bearer);
|
||||
// Ensure that all of the correct parts are provided in the header.
|
||||
if (count($parts) !== 2 || empty($parts[0]) || empty($parts[1])) {
|
||||
throw new BadRequestHttpException(
|
||||
'The Authorization header provided was not in a valid format.'
|
||||
);
|
||||
throw new BadRequestHttpException('The Authorization header provided was not in a valid format.');
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -88,8 +79,6 @@ class DaemonAuthenticate
|
|||
// Do nothing, we don't want to expose a node not existing at all.
|
||||
}
|
||||
|
||||
throw new AccessDeniedHttpException(
|
||||
'You are not authorized to access this resource.'
|
||||
);
|
||||
throw new AccessDeniedHttpException('You are not authorized to access this resource.');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,23 +13,15 @@ class IsValidJson
|
|||
* 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.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if ($request->isJson() && ! empty($request->getContent())) {
|
||||
if ($request->isJson() && !empty($request->getContent())) {
|
||||
json_decode($request->getContent(), true);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
throw new BadRequestHttpException(
|
||||
sprintf(
|
||||
'The JSON data passed in the request appears to be malformed. err_code: %d err_message: "%s"',
|
||||
json_last_error(),
|
||||
json_last_error_msg()
|
||||
)
|
||||
);
|
||||
throw new BadRequestHttpException(sprintf('The JSON data passed in the request appears to be malformed. err_code: %d err_message: "%s"', json_last_error(), json_last_error_msg()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@ class SetSessionDriver
|
|||
|
||||
/**
|
||||
* SetSessionDriver constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
*/
|
||||
public function __construct(ConfigRepository $config)
|
||||
{
|
||||
|
@ -26,8 +24,6 @@ class SetSessionDriver
|
|||
/**
|
||||
* Set the session for API calls to only last for the one request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
|
|
|
@ -11,16 +11,14 @@ class Authenticate
|
|||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Illuminate\Auth\AuthenticationException
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if (! $request->user()) {
|
||||
throw new AuthenticationException;
|
||||
if (!$request->user()) {
|
||||
throw new AuthenticationException();
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
|
|
@ -15,8 +15,6 @@ class LanguageMiddleware
|
|||
|
||||
/**
|
||||
* LanguageMiddleware constructor.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Application $app
|
||||
*/
|
||||
public function __construct(Application $app)
|
||||
{
|
||||
|
@ -26,8 +24,6 @@ class LanguageMiddleware
|
|||
/**
|
||||
* Handle an incoming request and set the user's preferred language.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
|
|
|
@ -14,8 +14,6 @@ class MaintenanceMiddleware
|
|||
|
||||
/**
|
||||
* MaintenanceMiddleware constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Routing\ResponseFactory $response
|
||||
*/
|
||||
public function __construct(ResponseFactory $response)
|
||||
{
|
||||
|
@ -26,7 +24,7 @@ class MaintenanceMiddleware
|
|||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
|
|
|
@ -15,8 +15,6 @@ class RedirectIfAuthenticated
|
|||
|
||||
/**
|
||||
* RedirectIfAuthenticated constructor.
|
||||
*
|
||||
* @param \Illuminate\Auth\AuthManager $authManager
|
||||
*/
|
||||
public function __construct(AuthManager $authManager)
|
||||
{
|
||||
|
@ -26,9 +24,6 @@ class RedirectIfAuthenticated
|
|||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, string $guard = null)
|
||||
|
|
|
@ -10,9 +10,9 @@ use Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException;
|
|||
|
||||
class RequireTwoFactorAuthentication
|
||||
{
|
||||
const LEVEL_NONE = 0;
|
||||
const LEVEL_ADMIN = 1;
|
||||
const LEVEL_ALL = 2;
|
||||
public const LEVEL_NONE = 0;
|
||||
public const LEVEL_ADMIN = 1;
|
||||
public const LEVEL_ALL = 2;
|
||||
|
||||
/**
|
||||
* @var \Prologue\Alerts\AlertsMessageBag
|
||||
|
@ -28,8 +28,6 @@ class RequireTwoFactorAuthentication
|
|||
|
||||
/**
|
||||
* RequireTwoFactorAuthentication constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
*/
|
||||
public function __construct(AlertsMessageBag $alert)
|
||||
{
|
||||
|
@ -42,8 +40,6 @@ class RequireTwoFactorAuthentication
|
|||
* order to perform actions. If so, we check the level at which it is required (all users
|
||||
* or just admins) and then check if the user has enabled it for their account.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException
|
||||
|
@ -55,7 +51,7 @@ class RequireTwoFactorAuthentication
|
|||
$uri = rtrim($request->getRequestUri(), '/') . '/';
|
||||
$current = $request->route()->getName();
|
||||
|
||||
if (! $user || Str::startsWith($uri, ['/auth/']) || Str::startsWith($current, ['auth.', 'account.'])) {
|
||||
if (!$user || Str::startsWith($uri, ['/auth/']) || Str::startsWith($current, ['auth.', 'account.'])) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
@ -66,13 +62,13 @@ class RequireTwoFactorAuthentication
|
|||
// If the level is set as admin and the user is not an admin, pass them through as well.
|
||||
if ($level === self::LEVEL_NONE || $user->use_totp) {
|
||||
return $next($request);
|
||||
} elseif ($level === self::LEVEL_ADMIN && ! $user->root_admin) {
|
||||
} elseif ($level === self::LEVEL_ADMIN && !$user->root_admin) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
// For API calls return an exception which gets rendered nicely in the API response.
|
||||
if ($request->isJson() || Str::startsWith($uri, '/api/')) {
|
||||
throw new TwoFactorAuthRequiredException;
|
||||
throw new TwoFactorAuthRequiredException();
|
||||
}
|
||||
|
||||
$this->alert->danger(trans('auth.2fa_must_be_enabled'))->flash();
|
||||
|
|
|
@ -31,10 +31,6 @@ class AccessingValidServer
|
|||
|
||||
/**
|
||||
* AccessingValidServer constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
* @param \Illuminate\Contracts\Routing\ResponseFactory $response
|
||||
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(
|
||||
ConfigRepository $config,
|
||||
|
@ -49,8 +45,6 @@ class AccessingValidServer
|
|||
/**
|
||||
* Determine if a given user has permission to access a server.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return \Illuminate\Http\Response|mixed
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
|
@ -81,9 +75,9 @@ class AccessingValidServer
|
|||
return $this->response->view('errors.installing', [], 409);
|
||||
}
|
||||
|
||||
if (! is_null($server->transfer)) {
|
||||
if (!is_null($server->transfer)) {
|
||||
if ($isApiRequest) {
|
||||
throw new ServerTransferringException;
|
||||
throw new ServerTransferringException();
|
||||
}
|
||||
|
||||
return $this->response->view('errors.transferring', [], 409);
|
||||
|
|
|
@ -26,9 +26,6 @@ class VerifyReCaptcha
|
|||
|
||||
/**
|
||||
* VerifyReCaptcha constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher $dispatcher
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
*/
|
||||
public function __construct(Dispatcher $dispatcher, Repository $config)
|
||||
{
|
||||
|
@ -40,12 +37,12 @@ class VerifyReCaptcha
|
|||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (! $this->config->get('recaptcha.enabled')) {
|
||||
if (!$this->config->get('recaptcha.enabled')) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
@ -61,7 +58,7 @@ class VerifyReCaptcha
|
|||
if ($res->getStatusCode() === 200) {
|
||||
$result = json_decode($res->getBody());
|
||||
|
||||
if ($result->success && (! $this->config->get('recaptcha.verify_domain') || $this->isResponseVerified($result, $request))) {
|
||||
if ($result->success && (!$this->config->get('recaptcha.verify_domain') || $this->isResponseVerified($result, $request))) {
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
@ -69,25 +66,20 @@ class VerifyReCaptcha
|
|||
|
||||
$this->dispatcher->dispatch(
|
||||
new FailedCaptcha(
|
||||
$request->ip(), ! empty($result) ? ($result->hostname ?? null) : null
|
||||
$request->ip(),
|
||||
!empty($result) ? ($result->hostname ?? null) : null
|
||||
)
|
||||
);
|
||||
|
||||
throw new HttpException(
|
||||
Response::HTTP_BAD_REQUEST, 'Failed to validate reCAPTCHA data.'
|
||||
);
|
||||
throw new HttpException(Response::HTTP_BAD_REQUEST, 'Failed to validate reCAPTCHA data.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the response from the recaptcha servers was valid.
|
||||
*
|
||||
* @param stdClass $result
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ abstract class AdminFormRequest extends FormRequest
|
|||
* Return only the fields that we are interested in from the request.
|
||||
* This will include empty fields as a null value.
|
||||
*
|
||||
* @param array|null $only
|
||||
* @return array
|
||||
*/
|
||||
public function normalize(array $only = null)
|
||||
|
|
|
@ -10,6 +10,7 @@ class StoreApplicationApiKeyRequest extends AdminFormRequest
|
|||
{
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,7 @@ class DatabaseHostFormRequest extends AdminFormRequest
|
|||
*/
|
||||
protected function getValidatorInstance()
|
||||
{
|
||||
if (! $this->filled('node_id')) {
|
||||
if (!$this->filled('node_id')) {
|
||||
$this->merge(['node_id' => null]);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class NodeFormRequest extends AdminFormRequest
|
|||
{
|
||||
$validator->after(function ($validator) {
|
||||
// Check that the FQDN is a valid IP address.
|
||||
if (! filter_var(gethostbyname($this->input('fqdn')), FILTER_VALIDATE_IP)) {
|
||||
if (!filter_var(gethostbyname($this->input('fqdn')), FILTER_VALIDATE_IP)) {
|
||||
$validator->errors()->add('fqdn', trans('admin/node.validation.fqdn_not_resolvable'));
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue