Merge branch 'develop' into dane/restore-backups
This commit is contained in:
commit
be26921fcc
41 changed files with 440 additions and 362 deletions
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -34,7 +34,7 @@ jobs:
|
||||||
- name: Create release archive
|
- name: Create release archive
|
||||||
run: |
|
run: |
|
||||||
rm -rf node_modules/ test/ codecov.yml CODE_OF_CONDUCT.md CONTRIBUTING.md phpunit.dusk.xml phpunit.xml Vagrantfile
|
rm -rf node_modules/ test/ codecov.yml CODE_OF_CONDUCT.md CONTRIBUTING.md phpunit.dusk.xml phpunit.xml Vagrantfile
|
||||||
tar -czf panel.tar.gz * .env.example
|
tar -czf panel.tar.gz * .env.example .babel-plugin-macrosrc.js
|
||||||
|
|
||||||
- name: Extract changelog
|
- name: Extract changelog
|
||||||
id: extract_changelog
|
id: extract_changelog
|
||||||
|
|
11
.php_cs.dist
11
.php_cs.dist
|
@ -23,6 +23,17 @@ return (new Config())
|
||||||
'ordered_imports' => [
|
'ordered_imports' => [
|
||||||
'sortAlgorithm' => 'length',
|
'sortAlgorithm' => 'length',
|
||||||
],
|
],
|
||||||
|
'phpdoc_align' => [
|
||||||
|
'align' => 'left',
|
||||||
|
'tags' => [
|
||||||
|
'param',
|
||||||
|
'property',
|
||||||
|
'return',
|
||||||
|
'throws',
|
||||||
|
'type',
|
||||||
|
'var',
|
||||||
|
],
|
||||||
|
],
|
||||||
'random_api_migration' => true,
|
'random_api_migration' => true,
|
||||||
'ternary_to_null_coalescing' => true,
|
'ternary_to_null_coalescing' => true,
|
||||||
'yoda_style' => [
|
'yoda_style' => [
|
||||||
|
|
|
@ -17,7 +17,7 @@ interface HashidsInterface extends VendorHashidsInterface
|
||||||
* Decode an encoded hashid and return the first result.
|
* Decode an encoded hashid and return the first result.
|
||||||
*
|
*
|
||||||
* @param string $encoded
|
* @param string $encoded
|
||||||
* @param null $default
|
* @param null $default
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*
|
*
|
||||||
|
|
|
@ -26,7 +26,7 @@ class DisplayException extends PterodactylException
|
||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param string $level
|
* @param string $level
|
||||||
* @param int $code
|
* @param int $code
|
||||||
*/
|
*/
|
||||||
public function __construct($message, Throwable $previous = null, $level = self::LEVEL_ERROR, $code = 0)
|
public function __construct($message, Throwable $previous = null, $level = self::LEVEL_ERROR, $code = 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,9 +51,9 @@ class DynamicDatabaseConnection
|
||||||
/**
|
/**
|
||||||
* Adds a dynamic database connection entry to the runtime config.
|
* Adds a dynamic database connection entry to the runtime config.
|
||||||
*
|
*
|
||||||
* @param string $connection
|
* @param string $connection
|
||||||
* @param \Pterodactyl\Models\DatabaseHost|int $host
|
* @param \Pterodactyl\Models\DatabaseHost|int $host
|
||||||
* @param string $database
|
* @param string $database
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -88,7 +88,7 @@ class ResetPasswordController extends Controller
|
||||||
* form with a note telling them their password was changed and to log back in.
|
* 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 \Illuminate\Contracts\Auth\CanResetPassword|\Pterodactyl\Models\User $user
|
||||||
* @param string $password
|
* @param string $password
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
|
|
|
@ -22,7 +22,7 @@ class EggFormRequest extends AdminFormRequest
|
||||||
'name' => 'required|string|max:191',
|
'name' => 'required|string|max:191',
|
||||||
'description' => 'nullable|string',
|
'description' => 'nullable|string',
|
||||||
'docker_images' => 'required|string',
|
'docker_images' => 'required|string',
|
||||||
'file_denylist' => 'string',
|
'file_denylist' => 'array',
|
||||||
'startup' => 'required|string',
|
'startup' => 'required|string',
|
||||||
'config_from' => 'sometimes|bail|nullable|numeric',
|
'config_from' => 'sometimes|bail|nullable|numeric',
|
||||||
'config_stop' => 'required_without:config_from|nullable|string|max:191',
|
'config_stop' => 'required_without:config_from|nullable|string|max:191',
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $node_id
|
* @property int $node_id
|
||||||
* @property string $ip
|
* @property string $ip
|
||||||
* @property string|null $ip_alias
|
* @property string|null $ip_alias
|
||||||
* @property int $port
|
* @property int $port
|
||||||
* @property int|null $server_id
|
* @property int|null $server_id
|
||||||
* @property string|null $notes
|
* @property string|null $notes
|
||||||
* @property \Carbon\Carbon|null $created_at
|
* @property \Carbon\Carbon|null $created_at
|
||||||
* @property \Carbon\Carbon|null $updated_at
|
* @property \Carbon\Carbon|null $updated_at
|
||||||
* @property string $alias
|
* @property string $alias
|
||||||
* @property bool $has_alias
|
* @property bool $has_alias
|
||||||
* @property \Pterodactyl\Models\Server|null $server
|
* @property \Pterodactyl\Models\Server|null $server
|
||||||
* @property \Pterodactyl\Models\Node $node
|
* @property \Pterodactyl\Models\Node $node
|
||||||
*/
|
*/
|
||||||
class Allocation extends Model
|
class Allocation extends Model
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,16 +5,16 @@ namespace Pterodactyl\Models;
|
||||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property int $key_type
|
* @property int $key_type
|
||||||
* @property string $identifier
|
* @property string $identifier
|
||||||
* @property string $token
|
* @property string $token
|
||||||
* @property array $allowed_ips
|
* @property array $allowed_ips
|
||||||
* @property string $memo
|
* @property string $memo
|
||||||
* @property \Carbon\Carbon|null $last_used_at
|
* @property \Carbon\Carbon|null $last_used_at
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
*/
|
*/
|
||||||
class ApiKey extends Model
|
class ApiKey extends Model
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,21 +5,21 @@ namespace Pterodactyl\Models;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $server_id
|
* @property int $server_id
|
||||||
* @property string $uuid
|
* @property string $uuid
|
||||||
* @property bool $is_successful
|
* @property bool $is_successful
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string[] $ignored_files
|
* @property string[] $ignored_files
|
||||||
* @property string $disk
|
* @property string $disk
|
||||||
* @property string|null $checksum
|
* @property string|null $checksum
|
||||||
* @property int $bytes
|
* @property int $bytes
|
||||||
* @property string|null $upload_id
|
* @property string|null $upload_id
|
||||||
* @property \Carbon\CarbonImmutable|null $completed_at
|
* @property \Carbon\CarbonImmutable|null $completed_at
|
||||||
* @property \Carbon\CarbonImmutable $created_at
|
* @property \Carbon\CarbonImmutable $created_at
|
||||||
* @property \Carbon\CarbonImmutable $updated_at
|
* @property \Carbon\CarbonImmutable $updated_at
|
||||||
* @property \Carbon\CarbonImmutable|null $deleted_at
|
* @property \Carbon\CarbonImmutable|null $deleted_at
|
||||||
* @property \Pterodactyl\Models\Server $server
|
* @property \Pterodactyl\Models\Server $server
|
||||||
*/
|
*/
|
||||||
class Backup extends Model
|
class Backup extends Model
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,17 +3,17 @@
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $server_id
|
* @property int $server_id
|
||||||
* @property int $database_host_id
|
* @property int $database_host_id
|
||||||
* @property string $database
|
* @property string $database
|
||||||
* @property string $username
|
* @property string $username
|
||||||
* @property string $remote
|
* @property string $remote
|
||||||
* @property string $password
|
* @property string $password
|
||||||
* @property int $max_connections
|
* @property int $max_connections
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property \Pterodactyl\Models\Server $server
|
* @property \Pterodactyl\Models\Server $server
|
||||||
* @property \Pterodactyl\Models\DatabaseHost $host
|
* @property \Pterodactyl\Models\DatabaseHost $host
|
||||||
*/
|
*/
|
||||||
class Database extends Model
|
class Database extends Model
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $host
|
* @property string $host
|
||||||
* @property int $port
|
* @property int $port
|
||||||
* @property string $username
|
* @property string $username
|
||||||
* @property string $password
|
* @property string $password
|
||||||
* @property int|null $max_databases
|
* @property int|null $max_databases
|
||||||
* @property int|null $node_id
|
* @property int|null $node_id
|
||||||
* @property \Carbon\CarbonImmutable $created_at
|
* @property \Carbon\CarbonImmutable $created_at
|
||||||
* @property \Carbon\CarbonImmutable $updated_at
|
* @property \Carbon\CarbonImmutable $updated_at
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,44 +3,44 @@
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $uuid
|
* @property string $uuid
|
||||||
* @property int $nest_id
|
* @property int $nest_id
|
||||||
* @property string $author
|
* @property string $author
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string|null $description
|
* @property string|null $description
|
||||||
* @property array|null $features
|
* @property array|null $features
|
||||||
* @property string $docker_image -- deprecated, use $docker_images
|
* @property string $docker_image -- deprecated, use $docker_images
|
||||||
* @property string $update_url
|
* @property string $update_url
|
||||||
* @property array $docker_images
|
* @property array $docker_images
|
||||||
* @property string $file_denylist
|
* @property array|null $file_denylist
|
||||||
* @property string|null $config_files
|
* @property string|null $config_files
|
||||||
* @property string|null $config_startup
|
* @property string|null $config_startup
|
||||||
* @property string|null $config_logs
|
* @property string|null $config_logs
|
||||||
* @property string|null $config_stop
|
* @property string|null $config_stop
|
||||||
* @property int|null $config_from
|
* @property int|null $config_from
|
||||||
* @property string|null $startup
|
* @property string|null $startup
|
||||||
* @property bool $script_is_privileged
|
* @property bool $script_is_privileged
|
||||||
* @property string|null $script_install
|
* @property string|null $script_install
|
||||||
* @property string $script_entry
|
* @property string $script_entry
|
||||||
* @property string $script_container
|
* @property string $script_container
|
||||||
* @property int|null $copy_script_from
|
* @property int|null $copy_script_from
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string|null $copy_script_install
|
* @property string|null $copy_script_install
|
||||||
* @property string $copy_script_entry
|
* @property string $copy_script_entry
|
||||||
* @property string $copy_script_container
|
* @property string $copy_script_container
|
||||||
* @property string|null $inherit_config_files
|
* @property string|null $inherit_config_files
|
||||||
* @property string|null $inherit_config_startup
|
* @property string|null $inherit_config_startup
|
||||||
* @property string|null $inherit_config_logs
|
* @property string|null $inherit_config_logs
|
||||||
* @property string|null $inherit_config_stop
|
* @property string|null $inherit_config_stop
|
||||||
* @property string $inherit_file_denylist
|
* @property string $inherit_file_denylist
|
||||||
* @property array|null $inherit_features
|
* @property array|null $inherit_features
|
||||||
* @property \Pterodactyl\Models\Nest $nest
|
* @property \Pterodactyl\Models\Nest $nest
|
||||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers
|
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers
|
||||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\EggVariable[] $variables
|
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\EggVariable[] $variables
|
||||||
* @property \Pterodactyl\Models\Egg|null $scriptFrom
|
* @property \Pterodactyl\Models\Egg|null $scriptFrom
|
||||||
* @property \Pterodactyl\Models\Egg|null $configFrom
|
* @property \Pterodactyl\Models\Egg|null $configFrom
|
||||||
*/
|
*/
|
||||||
class Egg extends Model
|
class Egg extends Model
|
||||||
{
|
{
|
||||||
|
@ -105,6 +105,7 @@ class Egg extends Model
|
||||||
'copy_script_from' => 'integer',
|
'copy_script_from' => 'integer',
|
||||||
'features' => 'array',
|
'features' => 'array',
|
||||||
'docker_images' => 'array',
|
'docker_images' => 'array',
|
||||||
|
'file_denylist' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,6 +118,8 @@ class Egg extends Model
|
||||||
'description' => 'string|nullable',
|
'description' => 'string|nullable',
|
||||||
'features' => 'array|nullable',
|
'features' => 'array|nullable',
|
||||||
'author' => 'required|string|email',
|
'author' => 'required|string|email',
|
||||||
|
'file_denylist' => 'array|nullable',
|
||||||
|
'file_denylist.*' => 'string',
|
||||||
'docker_images' => 'required|array|min:1',
|
'docker_images' => 'required|array|min:1',
|
||||||
'docker_images.*' => 'required|string',
|
'docker_images.*' => 'required|string',
|
||||||
'startup' => 'required|nullable|string',
|
'startup' => 'required|nullable|string',
|
||||||
|
@ -133,6 +136,7 @@ class Egg extends Model
|
||||||
*/
|
*/
|
||||||
protected $attributes = [
|
protected $attributes = [
|
||||||
'features' => null,
|
'features' => null,
|
||||||
|
'file_denylist' => null,
|
||||||
'config_stop' => null,
|
'config_stop' => null,
|
||||||
'config_startup' => null,
|
'config_startup' => null,
|
||||||
'config_logs' => null,
|
'config_logs' => null,
|
||||||
|
@ -260,7 +264,7 @@ class Egg extends Model
|
||||||
* Returns the features available to this egg from the parent configuration if there are
|
* Returns the features available to this egg from the parent configuration if there are
|
||||||
* no features defined for this egg specifically and there is a parent egg configured.
|
* no features defined for this egg specifically and there is a parent egg configured.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string[]|null
|
||||||
*/
|
*/
|
||||||
public function getInheritFileDenylistAttribute()
|
public function getInheritFileDenylistAttribute()
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $egg_id
|
* @property int $egg_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $description
|
* @property string $description
|
||||||
* @property string $env_variable
|
* @property string $env_variable
|
||||||
* @property string $default_value
|
* @property string $default_value
|
||||||
* @property bool $user_viewable
|
* @property bool $user_viewable
|
||||||
* @property bool $user_editable
|
* @property bool $user_editable
|
||||||
* @property string $rules
|
* @property string $rules
|
||||||
* @property \Carbon\CarbonImmutable $created_at
|
* @property \Carbon\CarbonImmutable $created_at
|
||||||
* @property \Carbon\CarbonImmutable $updated_at
|
* @property \Carbon\CarbonImmutable $updated_at
|
||||||
* @property bool $required
|
* @property bool $required
|
||||||
* @property \Pterodactyl\Models\Egg $egg
|
* @property \Pterodactyl\Models\Egg $egg
|
||||||
* @property \Pterodactyl\Models\ServerVariable $serverVariable
|
* @property \Pterodactyl\Models\ServerVariable $serverVariable
|
||||||
*
|
*
|
||||||
* The "server_value" variable is only present on the object if you've loaded this model
|
* The "server_value" variable is only present on the object if you've loaded this model
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $short
|
* @property string $short
|
||||||
* @property string $long
|
* @property string $long
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property \Pterodactyl\Models\Node[] $nodes
|
* @property \Pterodactyl\Models\Node[] $nodes
|
||||||
* @property \Pterodactyl\Models\Server[] $servers
|
* @property \Pterodactyl\Models\Server[] $servers
|
||||||
*/
|
*/
|
||||||
class Location extends Model
|
class Location extends Model
|
||||||
|
|
|
@ -5,16 +5,16 @@ namespace Pterodactyl\Models;
|
||||||
use Illuminate\Validation\Rules\NotIn;
|
use Illuminate\Validation\Rules\NotIn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $uuid
|
* @property string $uuid
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $description
|
* @property string $description
|
||||||
* @property string $source
|
* @property string $source
|
||||||
* @property string $target
|
* @property string $target
|
||||||
* @property bool $read_only
|
* @property bool $read_only
|
||||||
* @property bool $user_mountable
|
* @property bool $user_mountable
|
||||||
* @property \Pterodactyl\Models\Egg[]|\Illuminate\Database\Eloquent\Collection $eggs
|
* @property \Pterodactyl\Models\Egg[]|\Illuminate\Database\Eloquent\Collection $eggs
|
||||||
* @property \Pterodactyl\Models\Node[]|\Illuminate\Database\Eloquent\Collection $nodes
|
* @property \Pterodactyl\Models\Node[]|\Illuminate\Database\Eloquent\Collection $nodes
|
||||||
* @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers
|
* @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers
|
||||||
*/
|
*/
|
||||||
class Mount extends Model
|
class Mount extends Model
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $uuid
|
* @property string $uuid
|
||||||
* @property string $author
|
* @property string $author
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string|null $description
|
* @property string|null $description
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers
|
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers
|
||||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Egg[] $eggs
|
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Egg[] $eggs
|
||||||
*/
|
*/
|
||||||
class Nest extends Model
|
class Nest extends Model
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,31 +8,31 @@ use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Contracts\Encryption\Encrypter;
|
use Illuminate\Contracts\Encryption\Encrypter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $uuid
|
* @property string $uuid
|
||||||
* @property bool $public
|
* @property bool $public
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string|null $description
|
* @property string|null $description
|
||||||
* @property int $location_id
|
* @property int $location_id
|
||||||
* @property string $fqdn
|
* @property string $fqdn
|
||||||
* @property string $scheme
|
* @property string $scheme
|
||||||
* @property bool $behind_proxy
|
* @property bool $behind_proxy
|
||||||
* @property bool $maintenance_mode
|
* @property bool $maintenance_mode
|
||||||
* @property int $memory
|
* @property int $memory
|
||||||
* @property int $memory_overallocate
|
* @property int $memory_overallocate
|
||||||
* @property int $disk
|
* @property int $disk
|
||||||
* @property int $disk_overallocate
|
* @property int $disk_overallocate
|
||||||
* @property int $upload_size
|
* @property int $upload_size
|
||||||
* @property string $daemon_token_id
|
* @property string $daemon_token_id
|
||||||
* @property string $daemon_token
|
* @property string $daemon_token
|
||||||
* @property int $daemonListen
|
* @property int $daemonListen
|
||||||
* @property int $daemonSFTP
|
* @property int $daemonSFTP
|
||||||
* @property string $daemonBase
|
* @property string $daemonBase
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property \Pterodactyl\Models\Location $location
|
* @property \Pterodactyl\Models\Location $location
|
||||||
* @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts
|
* @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts
|
||||||
* @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers
|
* @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers
|
||||||
* @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations
|
* @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations
|
||||||
*/
|
*/
|
||||||
class Node extends Model
|
class Node extends Model
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property string $token
|
* @property string $token
|
||||||
* @property \Carbon\CarbonImmutable $created_at
|
* @property \Carbon\CarbonImmutable $created_at
|
||||||
* @property \Pterodactyl\Models\User $user
|
* @property \Pterodactyl\Models\User $user
|
||||||
*/
|
*/
|
||||||
class RecoveryToken extends Model
|
class RecoveryToken extends Model
|
||||||
|
|
|
@ -8,22 +8,22 @@ use Illuminate\Container\Container;
|
||||||
use Pterodactyl\Contracts\Extensions\HashidsInterface;
|
use Pterodactyl\Contracts\Extensions\HashidsInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $server_id
|
* @property int $server_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $cron_day_of_week
|
* @property string $cron_day_of_week
|
||||||
* @property string $cron_month
|
* @property string $cron_month
|
||||||
* @property string $cron_day_of_month
|
* @property string $cron_day_of_month
|
||||||
* @property string $cron_hour
|
* @property string $cron_hour
|
||||||
* @property string $cron_minute
|
* @property string $cron_minute
|
||||||
* @property bool $is_active
|
* @property bool $is_active
|
||||||
* @property bool $is_processing
|
* @property bool $is_processing
|
||||||
* @property \Carbon\Carbon|null $last_run_at
|
* @property \Carbon\Carbon|null $last_run_at
|
||||||
* @property \Carbon\Carbon|null $next_run_at
|
* @property \Carbon\Carbon|null $next_run_at
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string $hashid
|
* @property string $hashid
|
||||||
* @property \Pterodactyl\Models\Server $server
|
* @property \Pterodactyl\Models\Server $server
|
||||||
* @property \Pterodactyl\Models\Task[]|\Illuminate\Support\Collection $tasks
|
* @property \Pterodactyl\Models\Task[]|\Illuminate\Support\Collection $tasks
|
||||||
*/
|
*/
|
||||||
class Schedule extends Model
|
class Schedule extends Model
|
||||||
|
|
|
@ -8,48 +8,48 @@ use Illuminate\Database\Query\JoinClause;
|
||||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string|null $external_id
|
* @property string|null $external_id
|
||||||
* @property string $uuid
|
* @property string $uuid
|
||||||
* @property string $uuidShort
|
* @property string $uuidShort
|
||||||
* @property int $node_id
|
* @property int $node_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $description
|
* @property string $description
|
||||||
* @property string|null $status
|
* @property string|null $status
|
||||||
* @property bool $skip_scripts
|
* @property bool $skip_scripts
|
||||||
* @property int $owner_id
|
* @property int $owner_id
|
||||||
* @property int $memory
|
* @property int $memory
|
||||||
* @property int $swap
|
* @property int $swap
|
||||||
* @property int $disk
|
* @property int $disk
|
||||||
* @property int $io
|
* @property int $io
|
||||||
* @property int $cpu
|
* @property int $cpu
|
||||||
* @property string $threads
|
* @property string $threads
|
||||||
* @property bool $oom_disabled
|
* @property bool $oom_disabled
|
||||||
* @property int $allocation_id
|
* @property int $allocation_id
|
||||||
* @property int $nest_id
|
* @property int $nest_id
|
||||||
* @property int $egg_id
|
* @property int $egg_id
|
||||||
* @property string $startup
|
* @property string $startup
|
||||||
* @property string $image
|
* @property string $image
|
||||||
* @property int $allocation_limit
|
* @property int $allocation_limit
|
||||||
* @property int $database_limit
|
* @property int $database_limit
|
||||||
* @property int $backup_limit
|
* @property int $backup_limit
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property \Pterodactyl\Models\User $user
|
* @property \Pterodactyl\Models\User $user
|
||||||
* @property \Pterodactyl\Models\Subuser[]|\Illuminate\Database\Eloquent\Collection $subusers
|
* @property \Pterodactyl\Models\Subuser[]|\Illuminate\Database\Eloquent\Collection $subusers
|
||||||
* @property \Pterodactyl\Models\Allocation $allocation
|
* @property \Pterodactyl\Models\Allocation $allocation
|
||||||
* @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations
|
* @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations
|
||||||
* @property \Pterodactyl\Models\Node $node
|
* @property \Pterodactyl\Models\Node $node
|
||||||
* @property \Pterodactyl\Models\Nest $nest
|
* @property \Pterodactyl\Models\Nest $nest
|
||||||
* @property \Pterodactyl\Models\Egg $egg
|
* @property \Pterodactyl\Models\Egg $egg
|
||||||
* @property \Pterodactyl\Models\EggVariable[]|\Illuminate\Database\Eloquent\Collection $variables
|
* @property \Pterodactyl\Models\EggVariable[]|\Illuminate\Database\Eloquent\Collection $variables
|
||||||
* @property \Pterodactyl\Models\Schedule[]|\Illuminate\Database\Eloquent\Collection $schedule
|
* @property \Pterodactyl\Models\Schedule[]|\Illuminate\Database\Eloquent\Collection $schedule
|
||||||
* @property \Pterodactyl\Models\Database[]|\Illuminate\Database\Eloquent\Collection $databases
|
* @property \Pterodactyl\Models\Database[]|\Illuminate\Database\Eloquent\Collection $databases
|
||||||
* @property \Pterodactyl\Models\Location $location
|
* @property \Pterodactyl\Models\Location $location
|
||||||
* @property \Pterodactyl\Models\ServerTransfer $transfer
|
* @property \Pterodactyl\Models\ServerTransfer $transfer
|
||||||
* @property \Pterodactyl\Models\Backup[]|\Illuminate\Database\Eloquent\Collection $backups
|
* @property \Pterodactyl\Models\Backup[]|\Illuminate\Database\Eloquent\Collection $backups
|
||||||
* @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts
|
* @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts
|
||||||
* @property \Pterodactyl\Models\AuditLog[] $audits
|
* @property \Pterodactyl\Models\AuditLog[] $audits
|
||||||
*/
|
*/
|
||||||
class Server extends Model
|
class Server extends Model
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,21 +3,21 @@
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $server_id
|
* @property int $server_id
|
||||||
* @property int $old_node
|
* @property int $old_node
|
||||||
* @property int $new_node
|
* @property int $new_node
|
||||||
* @property int $old_allocation
|
* @property int $old_allocation
|
||||||
* @property int $new_allocation
|
* @property int $new_allocation
|
||||||
* @property array|null $old_additional_allocations
|
* @property array|null $old_additional_allocations
|
||||||
* @property array|null $new_additional_allocations
|
* @property array|null $new_additional_allocations
|
||||||
* @property bool|null $successful
|
* @property bool|null $successful
|
||||||
* @property bool $archived
|
* @property bool $archived
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property \Pterodactyl\Models\Server $server
|
* @property \Pterodactyl\Models\Server $server
|
||||||
* @property \Pterodactyl\Models\Node $oldNode
|
* @property \Pterodactyl\Models\Node $oldNode
|
||||||
* @property \Pterodactyl\Models\Node $newNode
|
* @property \Pterodactyl\Models\Node $newNode
|
||||||
*/
|
*/
|
||||||
class ServerTransfer extends Model
|
class ServerTransfer extends Model
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,8 +2,16 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
/**
|
||||||
|
* @property int $id
|
||||||
|
* @property int $server_id
|
||||||
|
* @property int $variable_id
|
||||||
|
* @property string $variable_value
|
||||||
|
* @property \Carbon\CarbonImmutable|null $created_at
|
||||||
|
* @property \Carbon\CarbonImmutable|null $updated_at
|
||||||
|
* @property \Pterodactyl\Models\EggVariable $variable
|
||||||
|
* @property \Pterodactyl\Models\Server $server
|
||||||
|
*/
|
||||||
class ServerVariable extends Model
|
class ServerVariable extends Model
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -12,58 +20,36 @@ class ServerVariable extends Model
|
||||||
*/
|
*/
|
||||||
public const RESOURCE_NAME = 'server_variable';
|
public const RESOURCE_NAME = 'server_variable';
|
||||||
|
|
||||||
/**
|
/** @var bool */
|
||||||
* The table associated with the model.
|
protected $immutableDates = true;
|
||||||
*
|
|
||||||
* @var string
|
/** @var string */
|
||||||
*/
|
|
||||||
protected $table = 'server_variables';
|
protected $table = 'server_variables';
|
||||||
|
|
||||||
/**
|
/** @var string[] */
|
||||||
* Fields that are not mass assignable.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
/** @var string[] */
|
||||||
* Cast values to correct type.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'server_id' => 'integer',
|
'server_id' => 'integer',
|
||||||
'variable_id' => 'integer',
|
'variable_id' => 'integer',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/** @var string[] */
|
||||||
* Determine if variable is viewable by users.
|
public static $validationRules = [
|
||||||
*
|
'server_id' => 'required|int',
|
||||||
* @return bool
|
'variable_id' => 'required|int',
|
||||||
*/
|
'variable_value' => 'string',
|
||||||
public function getUserCanViewAttribute()
|
];
|
||||||
{
|
|
||||||
return (bool) $this->variable->user_viewable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if variable is editable by users.
|
* Returns the server this variable is associated with.
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
*/
|
*/
|
||||||
public function getUserCanEditAttribute()
|
public function server()
|
||||||
{
|
{
|
||||||
return (bool) $this->variable->user_editable;
|
return $this->belongsTo(Server::class);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if variable is required.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function getRequiredAttribute()
|
|
||||||
{
|
|
||||||
return $this->variable->required;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,13 +5,13 @@ namespace Pterodactyl\Models;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property int $server_id
|
* @property int $server_id
|
||||||
* @property array $permissions
|
* @property array $permissions
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property \Pterodactyl\Models\User $user
|
* @property \Pterodactyl\Models\User $user
|
||||||
* @property \Pterodactyl\Models\Server $server
|
* @property \Pterodactyl\Models\Server $server
|
||||||
*/
|
*/
|
||||||
class Subuser extends Model
|
class Subuser extends Model
|
||||||
|
|
|
@ -7,18 +7,18 @@ use Znck\Eloquent\Traits\BelongsToThrough;
|
||||||
use Pterodactyl\Contracts\Extensions\HashidsInterface;
|
use Pterodactyl\Contracts\Extensions\HashidsInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $schedule_id
|
* @property int $schedule_id
|
||||||
* @property int $sequence_id
|
* @property int $sequence_id
|
||||||
* @property string $action
|
* @property string $action
|
||||||
* @property string $payload
|
* @property string $payload
|
||||||
* @property int $time_offset
|
* @property int $time_offset
|
||||||
* @property bool $is_queued
|
* @property bool $is_queued
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string $hashid
|
* @property string $hashid
|
||||||
* @property \Pterodactyl\Models\Schedule $schedule
|
* @property \Pterodactyl\Models\Schedule $schedule
|
||||||
* @property \Pterodactyl\Models\Server $server
|
* @property \Pterodactyl\Models\Server $server
|
||||||
*/
|
*/
|
||||||
class Task extends Model
|
class Task extends Model
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,26 +17,26 @@ use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
|
||||||
use Pterodactyl\Notifications\SendPasswordReset as ResetPasswordNotification;
|
use Pterodactyl\Notifications\SendPasswordReset as ResetPasswordNotification;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string|null $external_id
|
* @property string|null $external_id
|
||||||
* @property string $uuid
|
* @property string $uuid
|
||||||
* @property string $username
|
* @property string $username
|
||||||
* @property string $email
|
* @property string $email
|
||||||
* @property string|null $name_first
|
* @property string|null $name_first
|
||||||
* @property string|null $name_last
|
* @property string|null $name_last
|
||||||
* @property string $password
|
* @property string $password
|
||||||
* @property string|null $remeber_token
|
* @property string|null $remeber_token
|
||||||
* @property string $language
|
* @property string $language
|
||||||
* @property bool $root_admin
|
* @property bool $root_admin
|
||||||
* @property bool $use_totp
|
* @property bool $use_totp
|
||||||
* @property string|null $totp_secret
|
* @property string|null $totp_secret
|
||||||
* @property \Carbon\Carbon|null $totp_authenticated_at
|
* @property \Carbon\Carbon|null $totp_authenticated_at
|
||||||
* @property bool $gravatar
|
* @property bool $gravatar
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property \Pterodactyl\Models\ApiKey[]|\Illuminate\Database\Eloquent\Collection $apiKeys
|
* @property \Pterodactyl\Models\ApiKey[]|\Illuminate\Database\Eloquent\Collection $apiKeys
|
||||||
* @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers
|
* @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers
|
||||||
* @property \Pterodactyl\Models\RecoveryToken[]|\Illuminate\Database\Eloquent\Collection $recoveryTokens
|
* @property \Pterodactyl\Models\RecoveryToken[]|\Illuminate\Database\Eloquent\Collection $recoveryTokens
|
||||||
*/
|
*/
|
||||||
class User extends Model implements
|
class User extends Model implements
|
||||||
|
|
|
@ -65,7 +65,7 @@ class ServerPolicy
|
||||||
* policy permission.
|
* policy permission.
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param mixed $arguments
|
* @param mixed $arguments
|
||||||
*/
|
*/
|
||||||
public function __call($name, $arguments)
|
public function __call($name, $arguments)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Username implements Rule
|
||||||
* Allowed characters: a-z0-9_-.
|
* Allowed characters: a-z0-9_-.
|
||||||
*
|
*
|
||||||
* @param string $attribute
|
* @param string $attribute
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*/
|
*/
|
||||||
public function passes($attribute, $value): bool
|
public function passes($attribute, $value): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
namespace Pterodactyl\Services\Eggs\Sharing;
|
namespace Pterodactyl\Services\Eggs\Sharing;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Pterodactyl\Models\EggVariable;
|
||||||
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
|
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
|
||||||
|
|
||||||
class EggExporterService
|
class EggExporterService
|
||||||
|
@ -41,7 +43,9 @@ class EggExporterService
|
||||||
'description' => $egg->description,
|
'description' => $egg->description,
|
||||||
'features' => $egg->features,
|
'features' => $egg->features,
|
||||||
'images' => $egg->docker_images,
|
'images' => $egg->docker_images,
|
||||||
'file_denylist' => $egg->inherit_file_denylist,
|
'file_denylist' => Collection::make($egg->inherit_file_denylist)->filter(function ($value) {
|
||||||
|
return !empty($value);
|
||||||
|
}),
|
||||||
'startup' => $egg->startup,
|
'startup' => $egg->startup,
|
||||||
'config' => [
|
'config' => [
|
||||||
'files' => $egg->inherit_config_files,
|
'files' => $egg->inherit_config_files,
|
||||||
|
@ -56,10 +60,10 @@ class EggExporterService
|
||||||
'entrypoint' => $egg->copy_script_entry,
|
'entrypoint' => $egg->copy_script_entry,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'variables' => $egg->variables->transform(function ($item) {
|
'variables' => $egg->variables->transform(function (EggVariable $item) {
|
||||||
return collect($item->toArray())->except([
|
return Collection::make($item->toArray())
|
||||||
'id', 'egg_id', 'created_at', 'updated_at',
|
->except(['id', 'egg_id', 'created_at', 'updated_at'])
|
||||||
])->toArray();
|
->toArray();
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
namespace Pterodactyl\Services\Eggs\Sharing;
|
namespace Pterodactyl\Services\Eggs\Sharing;
|
||||||
|
|
||||||
use Ramsey\Uuid\Uuid;
|
use Ramsey\Uuid\Uuid;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
use Pterodactyl\Models\Egg;
|
use Pterodactyl\Models\Egg;
|
||||||
use Illuminate\Http\UploadedFile;
|
use Illuminate\Http\UploadedFile;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Database\ConnectionInterface;
|
use Illuminate\Database\ConnectionInterface;
|
||||||
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
|
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
|
||||||
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
|
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
|
||||||
|
@ -63,43 +65,47 @@ class EggImporterService
|
||||||
throw new InvalidFileUploadException(sprintf('The selected file ["%s"] was not in a valid format to import. (is_file: %s is_valid: %s err_code: %s err: %s)', $file->getFilename(), $file->isFile() ? 'true' : 'false', $file->isValid() ? 'true' : 'false', $file->getError(), $file->getErrorMessage()));
|
throw new InvalidFileUploadException(sprintf('The selected file ["%s"] was not in a valid format to import. (is_file: %s is_valid: %s err_code: %s err: %s)', $file->getFilename(), $file->isFile() ? 'true' : 'false', $file->isValid() ? 'true' : 'false', $file->getError(), $file->getErrorMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$parsed = json_decode($file->openFile()->fread($file->getSize()));
|
/** @var array $parsed */
|
||||||
|
$parsed = json_decode($file->openFile()->fread($file->getSize()), true);
|
||||||
if (json_last_error() !== 0) {
|
if (json_last_error() !== 0) {
|
||||||
throw new BadJsonFormatException(trans('exceptions.nest.importer.json_error', ['error' => json_last_error_msg()]));
|
throw new BadJsonFormatException(trans('exceptions.nest.importer.json_error', ['error' => json_last_error_msg()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object_get($parsed, 'meta.version') !== 'PTDL_v1') {
|
if (Arr::get($parsed, 'meta.version') !== 'PTDL_v1') {
|
||||||
throw new InvalidFileUploadException(trans('exceptions.nest.importer.invalid_json_provided'));
|
throw new InvalidFileUploadException(trans('exceptions.nest.importer.invalid_json_provided'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$nest = $this->nestRepository->getWithEggs($nest);
|
$nest = $this->nestRepository->getWithEggs($nest);
|
||||||
$this->connection->beginTransaction();
|
$this->connection->beginTransaction();
|
||||||
|
|
||||||
|
/** @var \Pterodactyl\Models\Egg $egg */
|
||||||
$egg = $this->repository->create([
|
$egg = $this->repository->create([
|
||||||
'uuid' => Uuid::uuid4()->toString(),
|
'uuid' => Uuid::uuid4()->toString(),
|
||||||
'nest_id' => $nest->id,
|
'nest_id' => $nest->id,
|
||||||
'author' => object_get($parsed, 'author'),
|
'author' => Arr::get($parsed, 'author'),
|
||||||
'name' => object_get($parsed, 'name'),
|
'name' => Arr::get($parsed, 'name'),
|
||||||
'description' => object_get($parsed, 'description'),
|
'description' => Arr::get($parsed, 'description'),
|
||||||
'features' => object_get($parsed, 'features'),
|
'features' => Arr::get($parsed, 'features'),
|
||||||
// Maintain backwards compatability for eggs that are still using the old single image
|
// Maintain backwards compatability for eggs that are still using the old single image
|
||||||
// string format. New eggs can provide an array of Docker images that can be used.
|
// string format. New eggs can provide an array of Docker images that can be used.
|
||||||
'docker_images' => object_get($parsed, 'images') ?? [object_get($parsed, 'image')],
|
'docker_images' => Arr::get($parsed, 'images') ?? [Arr::get($parsed, 'image')],
|
||||||
'file_denylist' => implode(PHP_EOL, object_get($parsed, 'file_denylist') ?? []),
|
'file_denylist' => Collection::make(Arr::get($parsed, 'file_denylist'))->filter(function ($value) {
|
||||||
'update_url' => object_get($parsed, 'meta.update_url'),
|
return !empty($value);
|
||||||
'config_files' => object_get($parsed, 'config.files'),
|
}),
|
||||||
'config_startup' => object_get($parsed, 'config.startup'),
|
'update_url' => Arr::get($parsed, 'meta.update_url'),
|
||||||
'config_logs' => object_get($parsed, 'config.logs'),
|
'config_files' => Arr::get($parsed, 'config.files'),
|
||||||
'config_stop' => object_get($parsed, 'config.stop'),
|
'config_startup' => Arr::get($parsed, 'config.startup'),
|
||||||
'startup' => object_get($parsed, 'startup'),
|
'config_logs' => Arr::get($parsed, 'config.logs'),
|
||||||
'script_install' => object_get($parsed, 'scripts.installation.script'),
|
'config_stop' => Arr::get($parsed, 'config.stop'),
|
||||||
'script_entry' => object_get($parsed, 'scripts.installation.entrypoint'),
|
'startup' => Arr::get($parsed, 'startup'),
|
||||||
'script_container' => object_get($parsed, 'scripts.installation.container'),
|
'script_install' => Arr::get($parsed, 'scripts.installation.script'),
|
||||||
|
'script_entry' => Arr::get($parsed, 'scripts.installation.entrypoint'),
|
||||||
|
'script_container' => Arr::get($parsed, 'scripts.installation.container'),
|
||||||
'copy_script_from' => null,
|
'copy_script_from' => null,
|
||||||
], true, true);
|
], true, true);
|
||||||
|
|
||||||
collect($parsed->variables)->each(function ($variable) use ($egg) {
|
Collection::make($parsed['variables'] ?? [])->each(function (array $variable) use ($egg) {
|
||||||
$this->eggVariableRepository->create(array_merge((array) $variable, [
|
$this->eggVariableRepository->create(array_merge($variable, [
|
||||||
'egg_id' => $egg->id,
|
'egg_id' => $egg->id,
|
||||||
]));
|
]));
|
||||||
});
|
});
|
||||||
|
|
|
@ -80,7 +80,7 @@ class ServerConfigurationStructureService
|
||||||
}),
|
}),
|
||||||
'egg' => [
|
'egg' => [
|
||||||
'id' => $server->egg->uuid,
|
'id' => $server->egg->uuid,
|
||||||
'file_denylist' => explode(PHP_EOL, $server->egg->inherit_file_denylist),
|
'file_denylist' => $server->egg->inherit_file_denylist,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,8 +76,8 @@ class ServerCreationService
|
||||||
* CreationService constructor.
|
* CreationService constructor.
|
||||||
*
|
*
|
||||||
* @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService
|
* @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService
|
||||||
* @param \Pterodactyl\Services\Servers\ServerDeletionService $serverDeletionService
|
* @param \Pterodactyl\Services\Servers\ServerDeletionService $serverDeletionService
|
||||||
* @param \Pterodactyl\Services\Servers\VariableValidatorService $validatorService
|
* @param \Pterodactyl\Services\Servers\VariableValidatorService $validatorService
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AllocationSelectionService $allocationSelectionService,
|
AllocationSelectionService $allocationSelectionService,
|
||||||
|
@ -258,7 +258,7 @@ class ServerCreationService
|
||||||
return [
|
return [
|
||||||
'server_id' => $server->id,
|
'server_id' => $server->id,
|
||||||
'variable_id' => $result->id,
|
'variable_id' => $result->id,
|
||||||
'variable_value' => $result->value,
|
'variable_value' => $result->value ?? '',
|
||||||
];
|
];
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,11 @@ class EggTransformer extends BaseTransformer
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'nest', 'servers', 'config', 'script', 'variables',
|
'nest',
|
||||||
|
'servers',
|
||||||
|
'config',
|
||||||
|
'script',
|
||||||
|
'variables',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,7 +56,7 @@ class EggTransformer extends BaseTransformer
|
||||||
'startup' => json_decode($model->config_startup, true),
|
'startup' => json_decode($model->config_startup, true),
|
||||||
'stop' => $model->config_stop,
|
'stop' => $model->config_stop,
|
||||||
'logs' => json_decode($model->config_logs, true),
|
'logs' => json_decode($model->config_logs, true),
|
||||||
'file_denylist' => explode(PHP_EOL, $model->file_denylist),
|
'file_denylist' => $model->file_denylist,
|
||||||
'extends' => $model->config_from,
|
'extends' => $model->config_from,
|
||||||
],
|
],
|
||||||
'startup' => $model->startup,
|
'startup' => $model->startup,
|
||||||
|
|
|
@ -22,7 +22,7 @@ if (!function_exists('object_get_strict')) {
|
||||||
*
|
*
|
||||||
* @param object $object
|
* @param object $object
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param null $default
|
* @param null $default
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"php-cs-fixer": "php-cs-fixer fix --diff --diff-format=udiff --config=./.php_cs.dist --rules=psr_autoloading",
|
"php-cs-fixer": "php-cs-fixer fix --diff --diff-format=udiff --config=./.php_cs.dist",
|
||||||
"post-root-package-install": [
|
"post-root-package-install": [
|
||||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||||
],
|
],
|
||||||
|
|
|
@ -3,12 +3,13 @@
|
||||||
"meta": {
|
"meta": {
|
||||||
"version": "PTDL_v1"
|
"version": "PTDL_v1"
|
||||||
},
|
},
|
||||||
"exported_at": "2020-10-20T00:03:09+00:00",
|
"exported_at": "2021-01-25T07:42:35+02:00",
|
||||||
"name": "Rust",
|
"name": "Rust",
|
||||||
"author": "support@pterodactyl.io",
|
"author": "support@pterodactyl.io",
|
||||||
"description": "The only aim in Rust is to survive. To do this you will need to overcome struggles such as hunger, thirst and cold. Build a fire. Build a shelter. Kill animals for meat. Protect yourself from other players, and kill them for meat. Create alliances with other players and form a town. Do whatever it takes to survive.",
|
"description": "The only aim in Rust is to survive. To do this you will need to overcome struggles such as hunger, thirst and cold. Build a fire. Build a shelter. Kill animals for meat. Protect yourself from other players, and kill them for meat. Create alliances with other players and form a town. Do whatever it takes to survive.",
|
||||||
|
"features": null,
|
||||||
"image": "quay.io\/pterodactyl\/core:rust",
|
"image": "quay.io\/pterodactyl\/core:rust",
|
||||||
"startup": ".\/RustDedicated -batchmode +server.port {{SERVER_PORT}} +server.identity \"rust\" +rcon.port {{RCON_PORT}} +rcon.web true +server.hostname \\\"{{HOSTNAME}}\\\" +server.level \\\"{{LEVEL}}\\\" +server.description \\\"{{DESCRIPTION}}\\\" +server.url \\\"{{SERVER_URL}}\\\" +server.headerimage \\\"{{SERVER_IMG}}\\\" +server.worldsize \\\"{{WORLD_SIZE}}\\\" +server.seed \\\"{{WORLD_SEED}}\\\" +server.maxplayers {{MAX_PLAYERS}} +rcon.password \\\"{{RCON_PASS}}\\\" +server.saveinterval {{SAVEINTERVAL}} {{ADDITIONAL_ARGS}}",
|
"startup": ".\/RustDedicated -batchmode +server.port {{SERVER_PORT}} +server.identity \"rust\" +rcon.port {{RCON_PORT}} +rcon.web true +server.hostname \\\"{{HOSTNAME}}\\\" +server.level \\\"{{LEVEL}}\\\" +server.description \\\"{{DESCRIPTION}}\\\" +server.url \\\"{{SERVER_URL}}\\\" +server.headerimage \\\"{{SERVER_IMG}}\\\" +server.logoimage \\\"{{SERVER_LOGO}}\\\" +server.worldsize \\\"{{WORLD_SIZE}}\\\" +server.seed \\\"{{WORLD_SEED}}\\\" +server.maxplayers {{MAX_PLAYERS}} +rcon.password \\\"{{RCON_PASS}}\\\" +server.saveinterval {{SAVEINTERVAL}} +app.port {{APP_PORT}} {{ADDITIONAL_ARGS}}",
|
||||||
"config": {
|
"config": {
|
||||||
"files": "{}",
|
"files": "{}",
|
||||||
"startup": "{\r\n \"done\": \"Server startup complete\",\r\n \"userInteraction\": []\r\n}",
|
"startup": "{\r\n \"done\": \"Server startup complete\",\r\n \"userInteraction\": []\r\n}",
|
||||||
|
@ -139,6 +140,24 @@
|
||||||
"user_viewable": true,
|
"user_viewable": true,
|
||||||
"user_editable": true,
|
"user_editable": true,
|
||||||
"rules": "nullable|string"
|
"rules": "nullable|string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "App Port",
|
||||||
|
"description": "Port for the Rust+ App. -1 to disable.",
|
||||||
|
"env_variable": "APP_PORT",
|
||||||
|
"default_value": "28082",
|
||||||
|
"user_viewable": true,
|
||||||
|
"user_editable": false,
|
||||||
|
"rules": "required|integer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Server Logo",
|
||||||
|
"description": "The circular server logo for the Rust+ app.",
|
||||||
|
"env_variable": "SERVER_LOGO",
|
||||||
|
"default_value": "",
|
||||||
|
"user_viewable": true,
|
||||||
|
"user_editable": true,
|
||||||
|
"rules": "nullable|url"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class UpdateFileDenylistToJson extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('eggs', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('file_denylist');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('eggs', function (Blueprint $table) {
|
||||||
|
$table->json('file_denylist')->nullable()->after('docker_images');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('eggs', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('file_denylist');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('eggs', function (Blueprint $table) {
|
||||||
|
$table->text('file_denylist')->after('docker_images');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,6 +29,6 @@ return [
|
||||||
'node_required' => 'You must have at least one node configured before you can add a server to this panel.',
|
'node_required' => 'You must have at least one node configured before you can add a server to this panel.',
|
||||||
'transfer_nodes_required' => 'You must have at least two nodes configured before you can transfer servers.',
|
'transfer_nodes_required' => 'You must have at least two nodes configured before you can transfer servers.',
|
||||||
'transfer_started' => 'Server transfer has been started.',
|
'transfer_started' => 'Server transfer has been started.',
|
||||||
'transfer_not_viable' => 'The node you selected is not viable for this transfer.',
|
'transfer_not_viable' => 'The node you selected does not have the required disk space or memory available to accommodate this server.',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
|
@ -30,19 +30,23 @@ export default () => {
|
||||||
<TitledGreyBox title={'SFTP Details'} css={tw`mb-6 md:mb-10`}>
|
<TitledGreyBox title={'SFTP Details'} css={tw`mb-6 md:mb-10`}>
|
||||||
<div>
|
<div>
|
||||||
<Label>Server Address</Label>
|
<Label>Server Address</Label>
|
||||||
<Input
|
<CopyOnClick text={`sftp://${sftp.ip}:${sftp.port}`}>
|
||||||
type={'text'}
|
<Input
|
||||||
value={`sftp://${sftp.ip}:${sftp.port}`}
|
type={'text'}
|
||||||
readOnly
|
value={`sftp://${sftp.ip}:${sftp.port}`}
|
||||||
/>
|
readOnly
|
||||||
|
/>
|
||||||
|
</CopyOnClick>
|
||||||
</div>
|
</div>
|
||||||
<div css={tw`mt-6`}>
|
<div css={tw`mt-6`}>
|
||||||
<Label>Username</Label>
|
<Label>Username</Label>
|
||||||
<Input
|
<CopyOnClick text={`${username}.${id}`}>
|
||||||
type={'text'}
|
<Input
|
||||||
value={`${username}.${id}`}
|
type={'text'}
|
||||||
readOnly
|
value={`${username}.${id}`}
|
||||||
/>
|
readOnly
|
||||||
|
/>
|
||||||
|
</CopyOnClick>
|
||||||
</div>
|
</div>
|
||||||
<div css={tw`mt-6 flex items-center`}>
|
<div css={tw`mt-6 flex items-center`}>
|
||||||
<div css={tw`flex-1`}>
|
<div css={tw`flex-1`}>
|
||||||
|
|
|
@ -55,7 +55,7 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase
|
||||||
/**
|
/**
|
||||||
* Returns a link to the specific resource using the client API.
|
* Returns a link to the specific resource using the client API.
|
||||||
*
|
*
|
||||||
* @param mixed $model
|
* @param mixed $model
|
||||||
* @param string|null $append
|
* @param string|null $append
|
||||||
*/
|
*/
|
||||||
protected function link($model, $append = null): string
|
protected function link($model, $append = null): string
|
||||||
|
|
|
@ -24,7 +24,7 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase
|
||||||
* Test that schedules for a server are returned.
|
* Test that schedules for a server are returned.
|
||||||
*
|
*
|
||||||
* @param array $permissions
|
* @param array $permissions
|
||||||
* @param bool $individual
|
* @param bool $individual
|
||||||
* @dataProvider permissionsDataProvider
|
* @dataProvider permissionsDataProvider
|
||||||
*/
|
*/
|
||||||
public function testServerSchedulesAreReturned($permissions, $individual)
|
public function testServerSchedulesAreReturned($permissions, $individual)
|
||||||
|
|
Loading…
Reference in a new issue