api(application): v2 backport
This commit is contained in:
parent
4cd0bee231
commit
67bf3e342e
172 changed files with 2922 additions and 1579 deletions
|
@ -3,41 +3,20 @@
|
|||
namespace Pterodactyl\Http\Requests\Api\Application\Servers;
|
||||
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
||||
|
||||
class UpdateServerStartupRequest extends ApplicationApiRequest
|
||||
{
|
||||
protected ?string $resource = AdminAcl::RESOURCE_SERVERS;
|
||||
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
|
||||
/**
|
||||
* Validation rules to run the input against.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$data = Server::getRulesForUpdate($this->parameter('server', Server::class));
|
||||
$rules = Server::getRulesForUpdate($this->route()->parameter('server')->id);
|
||||
|
||||
return [
|
||||
'startup' => $data['startup'],
|
||||
'startup' => $rules['startup'],
|
||||
'environment' => 'present|array',
|
||||
'egg' => $data['egg_id'],
|
||||
'image' => $data['image'],
|
||||
'egg_id' => $rules['egg_id'],
|
||||
'image' => $rules['image'],
|
||||
'skip_scripts' => 'present|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the validated data in a format that is expected by the service.
|
||||
*/
|
||||
public function validated($key = null, $default = null): array
|
||||
{
|
||||
$data = parent::validated();
|
||||
|
||||
return collect($data)->only(['startup', 'environment', 'skip_scripts'])->merge([
|
||||
'egg_id' => array_get($data, 'egg'),
|
||||
'docker_image' => array_get($data, 'image'),
|
||||
])->toArray();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue