api(application): v2 backport
This commit is contained in:
parent
4cd0bee231
commit
67bf3e342e
172 changed files with 2922 additions and 1579 deletions
16
app/Http/Requests/Api/Application/Eggs/DeleteEggRequest.php
Normal file
16
app/Http/Requests/Api/Application/Eggs/DeleteEggRequest.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Eggs;
|
||||
|
||||
use Pterodactyl\Models\Egg;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
||||
|
||||
class DeleteEggRequest extends ApplicationApiRequest
|
||||
{
|
||||
public function resourceExists(): bool
|
||||
{
|
||||
$egg = $this->route()->parameter('egg');
|
||||
|
||||
return $egg instanceof Egg && $egg->exists;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Eggs;
|
||||
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
||||
|
||||
class ExportEggRequest extends ApplicationApiRequest
|
||||
{
|
||||
}
|
7
app/Http/Requests/Api/Application/Eggs/GetEggRequest.php
Normal file
7
app/Http/Requests/Api/Application/Eggs/GetEggRequest.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Eggs;
|
||||
|
||||
class GetEggRequest extends GetEggsRequest
|
||||
{
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Eggs;
|
||||
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
||||
|
||||
class GetEggsRequest extends ApplicationApiRequest
|
||||
{
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Eggs;
|
||||
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
||||
|
||||
class ImportEggRequest extends ApplicationApiRequest
|
||||
{
|
||||
}
|
30
app/Http/Requests/Api/Application/Eggs/StoreEggRequest.php
Normal file
30
app/Http/Requests/Api/Application/Eggs/StoreEggRequest.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Eggs;
|
||||
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
||||
|
||||
class StoreEggRequest extends ApplicationApiRequest
|
||||
{
|
||||
public function rules(array $rules = null): array
|
||||
{
|
||||
return [
|
||||
'nest_id' => 'required|bail|numeric|exists:nests,id',
|
||||
'name' => 'required|string|max:191',
|
||||
'description' => 'sometimes|string|nullable',
|
||||
'features' => 'sometimes|array',
|
||||
'docker_images' => 'required|array|min:1',
|
||||
'docker_images.*' => 'required|string',
|
||||
'file_denylist' => 'sometimes|array|nullable',
|
||||
'file_denylist.*' => 'sometimes|string',
|
||||
'config_files' => 'required|nullable|json',
|
||||
'config_startup' => 'required|nullable|json',
|
||||
'config_stop' => 'required|nullable|string|max:191',
|
||||
// 'config_from' => 'sometimes|nullable|numeric|exists:eggs,id',
|
||||
'startup' => 'required|string',
|
||||
'script_container' => 'sometimes|string',
|
||||
'script_entry' => 'sometimes|string',
|
||||
'script_install' => 'sometimes|string',
|
||||
];
|
||||
}
|
||||
}
|
28
app/Http/Requests/Api/Application/Eggs/UpdateEggRequest.php
Normal file
28
app/Http/Requests/Api/Application/Eggs/UpdateEggRequest.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Eggs;
|
||||
|
||||
class UpdateEggRequest extends StoreEggRequest
|
||||
{
|
||||
public function rules(array $rules = null): array
|
||||
{
|
||||
return [
|
||||
'nest_id' => 'sometimes|numeric|exists:nests,id',
|
||||
'name' => 'sometimes|string|max:191',
|
||||
'description' => 'sometimes|string|nullable',
|
||||
'features' => 'sometimes|array',
|
||||
'docker_images' => 'sometimes|array|min:1',
|
||||
'docker_images.*' => 'sometimes|string',
|
||||
'file_denylist' => 'sometimes|array|nullable',
|
||||
'file_denylist.*' => 'sometimes|string',
|
||||
'config_files' => 'sometimes|nullable|json',
|
||||
'config_startup' => 'sometimes|nullable|json',
|
||||
'config_stop' => 'sometimes|nullable|string|max:191',
|
||||
// 'config_from' => 'sometimes|nullable|numeric|exists:eggs,id',
|
||||
'startup' => 'sometimes|string',
|
||||
'script_container' => 'sometimes|string',
|
||||
'script_entry' => 'sometimes|string',
|
||||
'script_install' => 'sometimes|string',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Eggs\Variables;
|
||||
|
||||
use Pterodactyl\Models\EggVariable;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
||||
|
||||
class StoreEggVariableRequest extends ApplicationApiRequest
|
||||
{
|
||||
public function rules(array $rules = null): array
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string|min:1|max:191',
|
||||
'description' => 'sometimes|string|nullable',
|
||||
'env_variable' => 'required|regex:/^[\w]{1,191}$/|notIn:' . EggVariable::RESERVED_ENV_NAMES,
|
||||
'default_value' => 'present',
|
||||
'user_viewable' => 'required|boolean',
|
||||
'user_editable' => 'required|boolean',
|
||||
'rules' => 'bail|required|string',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Eggs\Variables;
|
||||
|
||||
use Pterodactyl\Models\EggVariable;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
||||
|
||||
class UpdateEggVariablesRequest extends ApplicationApiRequest
|
||||
{
|
||||
public function rules(array $rules = null): array
|
||||
{
|
||||
return [
|
||||
'*' => 'array',
|
||||
'*.id' => 'required|integer',
|
||||
'*.name' => 'sometimes|string|min:1|max:191',
|
||||
'*.description' => 'sometimes|string|nullable',
|
||||
'*.env_variable' => 'sometimes|regex:/^[\w]{1,191}$/|notIn:' . EggVariable::RESERVED_ENV_NAMES,
|
||||
'*.default_value' => 'sometimes|present',
|
||||
'*.user_viewable' => 'sometimes|boolean',
|
||||
'*.user_editable' => 'sometimes|boolean',
|
||||
'*.rules' => 'sometimes|string',
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue