2018-01-30 20:36:59 -06:00
|
|
|
<?php
|
|
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2018-01-30 20:36:59 -06:00
|
|
|
namespace Pterodactyl\Http\Requests\Api\Application\Servers;
|
|
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|
|
|
|
use Pterodactyl\Http\Requests\Concerns\ParsesServerStartupData;
|
2018-01-30 20:36:59 -06:00
|
|
|
use Pterodactyl\Models\Server;
|
|
|
|
|
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
2026-10-05 18:10:18 -04:00
|
|
|
use Pterodactyl\Validation\ServerRules;
|
2018-01-30 20:36:59 -06:00
|
|
|
|
|
|
|
|
class UpdateServerStartupRequest extends ApplicationApiRequest
|
|
|
|
|
{
|
2026-10-05 18:10:18 -04:00
|
|
|
use ParsesServerStartupData;
|
|
|
|
|
|
2022-10-14 10:59:20 -06:00
|
|
|
protected ?string $resource = AdminAcl::RESOURCE_SERVERS;
|
2018-01-30 20:36:59 -06:00
|
|
|
|
2022-10-14 10:59:20 -06:00
|
|
|
protected int $permission = AdminAcl::WRITE;
|
2018-01-30 20:36:59 -06:00
|
|
|
|
|
|
|
|
/**
|
2018-05-13 10:50:56 -04:00
|
|
|
* Validation rules to run the input against.
|
2026-10-05 18:10:18 -04:00
|
|
|
*
|
|
|
|
|
* @return ValidationRules
|
2018-01-30 20:36:59 -06:00
|
|
|
*/
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
2026-10-05 18:10:18 -04:00
|
|
|
$data = ServerRules::rules($this->parameter('server', Server::class));
|
2018-01-30 20:36:59 -06:00
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
'startup' => $data['startup'],
|
2026-10-05 18:10:18 -04:00
|
|
|
'environment' => ['present', 'array'],
|
2018-01-30 20:36:59 -06:00
|
|
|
'egg' => $data['egg_id'],
|
|
|
|
|
'image' => $data['image'],
|
2026-10-05 18:10:18 -04:00
|
|
|
'skip_scripts' => ['present', 'boolean'],
|
2018-01-30 20:36:59 -06:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the validated data in a format that is expected by the service.
|
2026-10-05 18:10:18 -04:00
|
|
|
*
|
|
|
|
|
* @return ServerStartupModificationData
|
2018-01-30 20:36:59 -06:00
|
|
|
*/
|
2026-10-05 18:10:18 -04:00
|
|
|
public function payload(): array
|
2018-01-30 20:36:59 -06:00
|
|
|
{
|
2026-10-05 18:10:18 -04:00
|
|
|
return $this->serverStartupData('egg', 'image');
|
2018-01-30 20:36:59 -06:00
|
|
|
}
|
|
|
|
|
}
|