Switch to JSON from TEXT when storing denylist items for an egg; closes #3034

This commit is contained in:
Dane Everitt 2021-01-26 21:08:53 -08:00
parent b7d1c45bcc
commit b00def2537
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 89 additions and 30 deletions

View file

@ -3,6 +3,8 @@
namespace Pterodactyl\Services\Eggs\Sharing;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
class EggExporterService
@ -41,7 +43,9 @@ class EggExporterService
'description' => $egg->description,
'features' => $egg->features,
'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,
'config' => [
'files' => $egg->inherit_config_files,
@ -56,10 +60,10 @@ class EggExporterService
'entrypoint' => $egg->copy_script_entry,
],
],
'variables' => $egg->variables->transform(function ($item) {
return collect($item->toArray())->except([
'id', 'egg_id', 'created_at', 'updated_at',
])->toArray();
'variables' => $egg->variables->transform(function (EggVariable $item) {
return Collection::make($item->toArray())
->except(['id', 'egg_id', 'created_at', 'updated_at'])
->toArray();
}),
];