This breaks literally the entire panel.

This commit is contained in:
Dane Everitt 2017-10-06 23:57:53 -05:00
parent 344c1a9885
commit df87ea0867
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
88 changed files with 1205 additions and 992 deletions

View file

@ -9,49 +9,49 @@
namespace Pterodactyl\Contracts\Repository;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\Egg;
use Illuminate\Database\Eloquent\Collection;
interface ServiceOptionRepositoryInterface extends RepositoryInterface
interface EggRepositoryInterface extends RepositoryInterface
{
/**
* Return a service option with the variables relation attached.
* Return an egg with the variables relation attached.
*
* @param int $id
* @return \Pterodactyl\Models\ServiceOption
* @return \Pterodactyl\Models\Egg
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithVariables(int $id): ServiceOption;
public function getWithVariables(int $id): Egg;
/**
* Return all of the service options and their relations to be used in the daemon API.
* Return all eggs and their relations to be used in the daemon API.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getAllWithCopyAttributes(): Collection;
/**
* Return a service option with the scriptFrom and configFrom relations loaded onto the model.
* Return an egg with the scriptFrom and configFrom relations loaded onto the model.
*
* @param int|string $value
* @param string $column
* @return \Pterodactyl\Models\ServiceOption
* @return \Pterodactyl\Models\Egg
*/
public function getWithCopyAttributes($value, string $column = 'id'): ServiceOption;
public function getWithCopyAttributes($value, string $column = 'id'): Egg;
/**
* Return all of the data needed to export a service.
*
* @param int $id
* @return \Pterodactyl\Models\ServiceOption
* @return \Pterodactyl\Models\Egg
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithExportAttributes(int $id): ServiceOption;
public function getWithExportAttributes(int $id): Egg;
/**
* Confirm a copy script belongs to the same service as the item trying to use it.
* Confirm a copy script belongs to the same nest as the item trying to use it.
*
* @param int $copyFromId
* @param int $service

View file

@ -9,6 +9,6 @@
namespace Pterodactyl\Contracts\Repository;
interface OptionVariableRepositoryInterface extends RepositoryInterface
interface EggVariableRepositoryInterface extends RepositoryInterface
{
}

View file

@ -9,37 +9,37 @@
namespace Pterodactyl\Contracts\Repository;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\Nest;
interface ServiceRepositoryInterface extends RepositoryInterface
interface NestRepositoryInterface extends RepositoryInterface
{
/**
* Return a service or all services with their associated options, variables, and packs.
* Return a nest or all nests with their associated eggs, variables, and packs.
*
* @param int $id
* @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Service
* @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Nest
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithOptions(int $id = null);
public function getWithEggs(int $id = null);
/**
* Return a service or all services and the count of options, packs, and servers for that service.
* Return a nest or all nests and the count of eggs, packs, and servers for that nest.
*
* @param int|null $id
* @return \Pterodactyl\Models\Service|\Illuminate\Database\Eloquent\Collection
* @return \Pterodactyl\Models\Nest|\Illuminate\Database\Eloquent\Collection
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithCounts(int $id = null);
/**
* Return a service along with its associated options and the servers relation on those options.
* Return a nest along with its associated eggs and the servers relation on those eggs.
*
* @param int $id
* @return \Pterodactyl\Models\Service
* @return \Pterodactyl\Models\Nest
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithOptionServers(int $id): Service;
public function getWithEggServers(int $id): Nest;
}

View file

@ -14,12 +14,12 @@ use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface;
interface PackRepositoryInterface extends RepositoryInterface, SearchableInterface
{
/**
* Return a paginated listing of packs with their associated option and server count.
* Return a paginated listing of packs with their associated egg and server count.
*
* @param int $paginate
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
public function paginateWithOptionAndServerCount($paginate = 50);
public function paginateWithEggAndServerCount($paginate = 50);
/**
* Return a pack with the associated server models attached to it.

View file

@ -1,14 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Contracts\Repository;
interface ServiceVariableRepositoryInterface extends RepositoryInterface
{
}

View file

@ -1,16 +0,0 @@
<?php
/*
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Exceptions\Service\ServiceOption;
use Pterodactyl\Exceptions\DisplayException;
class DuplicateOptionTagException extends DisplayException
{
}

View file

@ -11,7 +11,7 @@ namespace Pterodactyl\Http\Controllers\API\Admin;
use Fractal;
use Illuminate\Http\Request;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\Nest;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Transformers\Admin\ServiceTransformer;
@ -28,7 +28,7 @@ class ServiceController extends Controller
$this->authorize('service-list', $request->apiKey());
return Fractal::create()
->collection(Service::all())
->collection(Nest::all())
->transformWith(new ServiceTransformer($request))
->withResourceName('service')
->toArray();
@ -45,7 +45,7 @@ class ServiceController extends Controller
{
$this->authorize('service-view', $request->apiKey());
$service = Service::findOrFail($id);
$service = Nest::findOrFail($id);
$fractal = Fractal::create()->item($service);
if ($request->input('include')) {

View file

@ -11,7 +11,7 @@ namespace Pterodactyl\Http\Controllers\API\Remote;
use Illuminate\Http\JsonResponse;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Services\Services\Options\OptionConfigurationFileService;
class OptionRetrievalController extends Controller
@ -22,18 +22,18 @@ class OptionRetrievalController extends Controller
protected $configurationFileService;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $repository;
/**
* OptionUpdateController constructor.
*
* @param \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
* @param \Pterodactyl\Services\Services\Options\OptionConfigurationFileService $configurationFileService
*/
public function __construct(
ServiceOptionRepositoryInterface $repository,
EggRepositoryInterface $repository,
OptionConfigurationFileService $configurationFileService
) {
$this->configurationFileService = $configurationFileService;

View file

@ -0,0 +1,32 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Http\Controllers\Admin\Nests;
use Illuminate\View\View;
use Pterodactyl\Models\Egg;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
class EggController extends Controller
{
protected $repository;
public function __construct(EggRepositoryInterface $repository)
{
$this->repository = $repository;
}
public function view(Egg $egg): View
{
return view('admin.eggs.view', [
'egg' => $egg,
]);
}
}

View file

@ -7,54 +7,54 @@
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Http\Controllers\Admin\Services\Options;
namespace Pterodactyl\Http\Controllers\Admin\Nests;
use Pterodactyl\Models\Egg;
use Illuminate\Http\RedirectResponse;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Http\Controllers\Controller;
use Symfony\Component\HttpFoundation\Response;
use Pterodactyl\Services\Eggs\Sharing\EggExporterService;
use Pterodactyl\Services\Services\Sharing\EggImporterService;
use Pterodactyl\Http\Requests\Admin\Service\OptionImportFormRequest;
use Pterodactyl\Services\Services\Sharing\ServiceOptionExporterService;
use Pterodactyl\Services\Services\Sharing\ServiceOptionImporterService;
class OptionShareController extends Controller
class EggShareController extends Controller
{
/**
* @var \Pterodactyl\Services\Services\Sharing\ServiceOptionExporterService
* @var \Pterodactyl\Services\Eggs\Sharing\EggExporterService
*/
protected $exporterService;
/**
* @var \Pterodactyl\Services\Services\Sharing\ServiceOptionImporterService
* @var \Pterodactyl\Services\Services\Sharing\EggImporterService
*/
protected $importerService;
/**
* OptionShareController constructor.
*
* @param \Pterodactyl\Services\Services\Sharing\ServiceOptionExporterService $exporterService
* @param \Pterodactyl\Services\Services\Sharing\ServiceOptionImporterService $importerService
* @param \Pterodactyl\Services\Eggs\Sharing\EggExporterService $exporterService
* @param \Pterodactyl\Services\Services\Sharing\EggImporterService $importerService
*/
public function __construct(
ServiceOptionExporterService $exporterService,
ServiceOptionImporterService $importerService
EggExporterService $exporterService,
EggImporterService $importerService
) {
$this->exporterService = $exporterService;
$this->importerService = $importerService;
}
/**
* @param \Pterodactyl\Models\ServiceOption $option
* @param \Pterodactyl\Models\Egg $egg
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function export(ServiceOption $option): Response
public function export(Egg $egg): Response
{
return response($this->exporterService->handle($option->id), 200, [
return response($this->exporterService->handle($egg->id), 200, [
'Content-Transfer-Encoding' => 'binary',
'Content-Description' => 'File Transfer',
'Content-Disposition' => 'attachment; filename=' . kebab_case($option->name) . '.json',
'Content-Disposition' => 'attachment; filename=egg-' . kebab_case($egg->name) . '.json',
'Content-Type' => 'application/json',
]);
}
@ -71,8 +71,8 @@ class OptionShareController extends Controller
*/
public function import(OptionImportFormRequest $request): RedirectResponse
{
$option = $this->importerService->handle($request->file('import_file'), $request->input('import_to_service'));
$egg = $this->importerService->handle($request->file('import_file'), $request->input('import_to_nest'));
return redirect()->route('admin.services.option.view', ['option' => $option->id]);
return redirect()->route('admin.nests.egg.view', ['egg' => $egg->id]);
}
}

View file

@ -0,0 +1,160 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Http\Controllers\Admin\Nests;
use Illuminate\View\View;
use Illuminate\Http\RedirectResponse;
use Prologue\Alerts\AlertsMessageBag;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Services\Nests\NestUpdateService;
use Pterodactyl\Services\Nests\NestCreationService;
use Pterodactyl\Services\Nests\NestDeletionService;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Http\Requests\Admin\Nest\StoreNestFormRequest;
class NestController extends Controller
{
/**
* @var \Prologue\Alerts\AlertsMessageBag
*/
protected $alert;
/**
* @var \Pterodactyl\Services\Nests\NestCreationService
*/
protected $nestCreationService;
/**
* @var \Pterodactyl\Services\Nests\NestDeletionService
*/
protected $nestDeletionService;
/**
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
protected $repository;
/**
* @var \Pterodactyl\Services\Nests\NestUpdateService
*/
protected $nestUpdateService;
/**
* NestController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Services\Nests\NestCreationService $nestCreationService
* @param \Pterodactyl\Services\Nests\NestDeletionService $nestDeletionService
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository
* @param \Pterodactyl\Services\Nests\NestUpdateService $nestUpdateService
*/
public function __construct(
AlertsMessageBag $alert,
NestCreationService $nestCreationService,
NestDeletionService $nestDeletionService,
NestRepositoryInterface $repository,
NestUpdateService $nestUpdateService
) {
$this->alert = $alert;
$this->nestDeletionService = $nestDeletionService;
$this->nestCreationService = $nestCreationService;
$this->nestUpdateService = $nestUpdateService;
$this->repository = $repository;
}
/**
* Render nest listing page.
*
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function index(): View
{
return view('admin.nests.index', [
'nests' => $this->repository->getWithCounts(),
]);
}
/**
* Render nest creation page.
*
* @return \Illuminate\View\View
*/
public function create(): View
{
return view('admin.nests.new');
}
/**
* Handle the storage of a new nest.
*
* @param \Pterodactyl\Http\Requests\Admin\Nest\StoreNestFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function store(StoreNestFormRequest $request): RedirectResponse
{
$nest = $this->nestCreationService->handle($request->normalize());
$this->alert->success(trans('admin/nests.notices.created', ['name' => $nest->name]))->flash();
return redirect()->route('admin.nests.view', $nest->id);
}
/**
* Return details about a nest including all of the eggs and servers per egg.
*
* @param int $nest
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function view(int $nest): View
{
return view('admin.nests.view', [
'nest' => $this->repository->getWithEggServers($nest),
]);
}
/**
* Handle request to update a nest.
*
* @param \Pterodactyl\Http\Requests\Admin\Nest\StoreNestFormRequest $request
* @param int $nest
*
* @return \Illuminate\Http\RedirectResponse
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function update(StoreNestFormRequest $request, int $nest): RedirectResponse
{
$this->nestUpdateService->handle($nest, $request->normalize());
$this->alert->success(trans('admin/nests.notices.updated'))->flash();
return redirect()->route('admin.nests.view', $nest);
}
/**
* Handle request to delete a nest.
*
* @param \Pterodactyl\Models\Nest $nest
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
*/
public function destroy($nest): RedirectResponse
{
$this->nestDeletionService->handle($nest);
$this->alert->success(trans('admin/nests.notices.deleted'))->flash();
return redirect()->route('admin.nests');
}
}

View file

@ -10,18 +10,18 @@
namespace Pterodactyl\Http\Controllers\Admin;
use Javascript;
use Pterodactyl\Models\Egg;
use Illuminate\Http\Request;
use Prologue\Alerts\AlertsMessageBag;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Http\Requests\Admin\Service\EditOptionScript;
use Pterodactyl\Services\Services\Options\OptionUpdateService;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Services\Services\Options\OptionCreationService;
use Pterodactyl\Services\Services\Options\OptionDeletionService;
use Pterodactyl\Http\Requests\Admin\Service\ServiceOptionFormRequest;
use Pterodactyl\Services\Services\Options\InstallScriptUpdateService;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceOption\InvalidCopyFromException;
use Pterodactyl\Exceptions\Service\ServiceOption\NoParentConfigurationFoundException;
@ -53,25 +53,25 @@ class OptionController extends Controller
protected $optionUpdateService;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
protected $serviceRepository;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $serviceOptionRepository;
/**
* OptionController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Services\Services\Options\InstallScriptUpdateService $installScriptUpdateService
* @param \Pterodactyl\Services\Services\Options\OptionCreationService $optionCreationService
* @param \Pterodactyl\Services\Services\Options\OptionDeletionService $optionDeletionService
* @param \Pterodactyl\Services\Services\Options\OptionUpdateService $optionUpdateService
* @param \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface $serviceRepository
* @param \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface $serviceOptionRepository
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Services\Services\Options\InstallScriptUpdateService $installScriptUpdateService
* @param \Pterodactyl\Services\Services\Options\OptionCreationService $optionCreationService
* @param \Pterodactyl\Services\Services\Options\OptionDeletionService $optionDeletionService
* @param \Pterodactyl\Services\Services\Options\OptionUpdateService $optionUpdateService
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $serviceRepository
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $serviceOptionRepository
*/
public function __construct(
AlertsMessageBag $alert,
@ -79,8 +79,8 @@ class OptionController extends Controller
OptionCreationService $optionCreationService,
OptionDeletionService $optionDeletionService,
OptionUpdateService $optionUpdateService,
ServiceRepositoryInterface $serviceRepository,
ServiceOptionRepositoryInterface $serviceOptionRepository
NestRepositoryInterface $serviceRepository,
EggRepositoryInterface $serviceOptionRepository
) {
$this->alert = $alert;
$this->installScriptUpdateService = $installScriptUpdateService;
@ -129,12 +129,12 @@ class OptionController extends Controller
/**
* Delete a given option from the database.
*
* @param \Pterodactyl\Models\ServiceOption $option
* @param \Pterodactyl\Models\Egg $option
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
*/
public function destroy(ServiceOption $option)
public function destroy(Egg $option)
{
$this->optionDeletionService->handle($option->id);
$this->alert->success(trans('admin/services.options.notices.option_deleted'))->flash();
@ -145,10 +145,10 @@ class OptionController extends Controller
/**
* Display option overview page.
*
* @param \Pterodactyl\Models\ServiceOption $option
* @param \Pterodactyl\Models\Egg $option
* @return \Illuminate\View\View
*/
public function viewConfiguration(ServiceOption $option)
public function viewConfiguration(Egg $option)
{
return view('admin.services.options.view', ['option' => $option]);
}
@ -181,14 +181,14 @@ class OptionController extends Controller
/**
* Handles POST when editing a configration for a service option.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\ServiceOption $option
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Egg $option
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function editConfiguration(Request $request, ServiceOption $option)
public function editConfiguration(Request $request, Egg $option)
{
try {
$this->optionUpdateService->handle($option, $request->all());
@ -204,13 +204,13 @@ class OptionController extends Controller
* Handles POST when updating script for a service option.
*
* @param \Pterodactyl\Http\Requests\Admin\Service\EditOptionScript $request
* @param \Pterodactyl\Models\ServiceOption $option
* @param \Pterodactyl\Models\Egg $option
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function updateScripts(EditOptionScript $request, ServiceOption $option)
public function updateScripts(EditOptionScript $request, Egg $option)
{
try {
$this->installScriptUpdateService->handle($option, $request->normalize());

View file

@ -19,9 +19,9 @@ use Pterodactyl\Services\Packs\PackCreationService;
use Pterodactyl\Services\Packs\PackDeletionService;
use Pterodactyl\Http\Requests\Admin\PackFormRequest;
use Pterodactyl\Services\Packs\TemplateUploadService;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Contracts\Repository\PackRepositoryInterface;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
class PackController extends Controller
{
@ -61,7 +61,7 @@ class PackController extends Controller
protected $updateService;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
protected $serviceRepository;
@ -73,15 +73,15 @@ class PackController extends Controller
/**
* PackController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Pterodactyl\Services\Packs\ExportPackService $exportService
* @param \Pterodactyl\Services\Packs\PackCreationService $creationService
* @param \Pterodactyl\Services\Packs\PackDeletionService $deletionService
* @param \Pterodactyl\Contracts\Repository\PackRepositoryInterface $repository
* @param \Pterodactyl\Services\Packs\PackUpdateService $updateService
* @param \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface $serviceRepository
* @param \Pterodactyl\Services\Packs\TemplateUploadService $templateUploadService
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Pterodactyl\Services\Packs\ExportPackService $exportService
* @param \Pterodactyl\Services\Packs\PackCreationService $creationService
* @param \Pterodactyl\Services\Packs\PackDeletionService $deletionService
* @param \Pterodactyl\Contracts\Repository\PackRepositoryInterface $repository
* @param \Pterodactyl\Services\Packs\PackUpdateService $updateService
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $serviceRepository
* @param \Pterodactyl\Services\Packs\TemplateUploadService $templateUploadService
*/
public function __construct(
AlertsMessageBag $alert,
@ -91,7 +91,7 @@ class PackController extends Controller
PackDeletionService $deletionService,
PackRepositoryInterface $repository,
PackUpdateService $updateService,
ServiceRepositoryInterface $serviceRepository,
NestRepositoryInterface $serviceRepository,
TemplateUploadService $templateUploadService
) {
$this->alert = $alert;

View file

@ -25,11 +25,11 @@ use Pterodactyl\Services\Servers\BuildModificationService;
use Pterodactyl\Services\Database\DatabaseManagementService;
use Pterodactyl\Services\Servers\DetailsModificationService;
use Pterodactyl\Services\Servers\StartupModificationService;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Repositories\Eloquent\DatabaseHostRepository;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
@ -112,7 +112,7 @@ class ServersController extends Controller
protected $service;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
protected $serviceRepository;
@ -144,7 +144,7 @@ class ServersController extends Controller
* @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $nodeRepository
* @param \Pterodactyl\Services\Servers\ReinstallServerService $reinstallService
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface $serviceRepository
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $serviceRepository
* @param \Pterodactyl\Services\Servers\StartupModificationService $startupModificationService
* @param \Pterodactyl\Services\Servers\SuspensionService $suspensionService
*/
@ -164,7 +164,7 @@ class ServersController extends Controller
NodeRepositoryInterface $nodeRepository,
ReinstallServerService $reinstallService,
ServerRepositoryInterface $repository,
ServiceRepositoryInterface $serviceRepository,
NestRepositoryInterface $serviceRepository,
StartupModificationService $startupModificationService,
SuspensionService $suspensionService
) {

View file

@ -10,15 +10,15 @@
namespace Pterodactyl\Http\Controllers\Admin;
use Illuminate\View\View;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\Nest;
use Illuminate\Http\RedirectResponse;
use Prologue\Alerts\AlertsMessageBag;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Services\Services\ServiceUpdateService;
use Pterodactyl\Services\Services\ServiceCreationService;
use Pterodactyl\Services\Services\ServiceDeletionService;
use Pterodactyl\Http\Requests\Admin\Service\ServiceFormRequest;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Services\Services\NestUpdateService;
use Pterodactyl\Services\Services\NestCreationService;
use Pterodactyl\Services\Services\NestDeletionService;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Http\Requests\Admin\Service\StoreNestFormRequest;
use Pterodactyl\Http\Requests\Admin\Service\ServiceFunctionsFormRequest;
class ServiceController extends Controller
@ -29,40 +29,40 @@ class ServiceController extends Controller
protected $alert;
/**
* @var \Pterodactyl\Services\Services\ServiceCreationService
* @var \Pterodactyl\Services\Services\NestCreationService
*/
protected $creationService;
/**
* @var \Pterodactyl\Services\Services\ServiceDeletionService
* @var \Pterodactyl\Services\Services\NestDeletionService
*/
protected $deletionService;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
protected $repository;
/**
* @var \Pterodactyl\Services\Services\ServiceUpdateService
* @var \Pterodactyl\Services\Services\NestUpdateService
*/
protected $updateService;
/**
* ServiceController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Services\Services\ServiceCreationService $creationService
* @param \Pterodactyl\Services\Services\ServiceDeletionService $deletionService
* @param \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface $repository
* @param \Pterodactyl\Services\Services\ServiceUpdateService $updateService
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Services\Services\NestCreationService $creationService
* @param \Pterodactyl\Services\Services\NestDeletionService $deletionService
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository
* @param \Pterodactyl\Services\Services\NestUpdateService $updateService
*/
public function __construct(
AlertsMessageBag $alert,
ServiceCreationService $creationService,
ServiceDeletionService $deletionService,
ServiceRepositoryInterface $repository,
ServiceUpdateService $updateService
NestCreationService $creationService,
NestDeletionService $deletionService,
NestRepositoryInterface $repository,
NestUpdateService $updateService
) {
$this->alert = $alert;
$this->creationService = $creationService;
@ -109,10 +109,10 @@ class ServiceController extends Controller
/**
* Return function editing view for a service.
*
* @param \Pterodactyl\Models\Service $service
* @param \Pterodactyl\Models\Nest $service
* @return \Illuminate\View\View
*/
public function viewFunctions(Service $service): View
public function viewFunctions(Nest $service): View
{
return view('admin.services.functions', ['service' => $service]);
}
@ -120,12 +120,12 @@ class ServiceController extends Controller
/**
* Handle post action for new service.
*
* @param \Pterodactyl\Http\Requests\Admin\Service\ServiceFormRequest $request
* @param \Pterodactyl\Http\Requests\Admin\Service\StoreNestFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function store(ServiceFormRequest $request): RedirectResponse
public function store(StoreNestFormRequest $request): RedirectResponse
{
$service = $this->creationService->handle($request->normalize());
$this->alert->success(trans('admin/services.notices.service_created', ['name' => $service->name]))->flash();
@ -136,14 +136,14 @@ class ServiceController extends Controller
/**
* Edits configuration for a specific service.
*
* @param \Pterodactyl\Http\Requests\Admin\Service\ServiceFormRequest $request
* @param \Pterodactyl\Models\Service $service
* @param \Pterodactyl\Http\Requests\Admin\Service\StoreNestFormRequest $request
* @param \Pterodactyl\Models\Nest $service
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function update(ServiceFormRequest $request, Service $service): RedirectResponse
public function update(StoreNestFormRequest $request, Nest $service): RedirectResponse
{
$this->updateService->handle($service->id, $request->normalize());
$this->alert->success(trans('admin/services.notices.service_updated'))->flash();
@ -155,13 +155,13 @@ class ServiceController extends Controller
* Update the functions file for a service.
*
* @param \Pterodactyl\Http\Requests\Admin\Service\ServiceFunctionsFormRequest $request
* @param \Pterodactyl\Models\Service $service
* @param \Pterodactyl\Models\Nest $service
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function updateFunctions(ServiceFunctionsFormRequest $request, Service $service): RedirectResponse
public function updateFunctions(ServiceFunctionsFormRequest $request, Nest $service): RedirectResponse
{
$this->updateService->handle($service->id, $request->normalize());
$this->alert->success(trans('admin/services.notices.functions_updated'))->flash();
@ -172,12 +172,12 @@ class ServiceController extends Controller
/**
* Delete a service from the panel.
*
* @param \Pterodactyl\Models\Service $service
* @param \Pterodactyl\Models\Nest $service
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
*/
public function destroy(Service $service): RedirectResponse
public function destroy(Nest $service): RedirectResponse
{
$this->deletionService->handle($service->id);
$this->alert->success(trans('admin/services.notices.service_deleted'))->flash();

View file

@ -9,15 +9,15 @@
namespace Pterodactyl\Http\Controllers\Admin;
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\EggVariable;
use Prologue\Alerts\AlertsMessageBag;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Http\Requests\Admin\OptionVariableFormRequest;
use Pterodactyl\Repositories\Eloquent\ServiceVariableRepository;
use Pterodactyl\Services\Services\Variables\VariableUpdateService;
use Pterodactyl\Services\Services\Variables\VariableCreationService;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
class VariableController extends Controller
{
@ -32,7 +32,7 @@ class VariableController extends Controller
protected $creationService;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $serviceOptionRepository;
@ -48,7 +48,7 @@ class VariableController extends Controller
public function __construct(
AlertsMessageBag $alert,
ServiceOptionRepositoryInterface $serviceOptionRepository,
EggRepositoryInterface $serviceOptionRepository,
ServiceVariableRepository $serviceVariableRepository,
VariableCreationService $creationService,
VariableUpdateService $updateService
@ -64,13 +64,13 @@ class VariableController extends Controller
* Handles POST request to create a new option variable.
*
* @param \Pterodactyl\Http\Requests\Admin\OptionVariableFormRequest $request
* @param \Pterodactyl\Models\ServiceOption $option
* @param \Pterodactyl\Models\Egg $option
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Service\ServiceVariable\ReservedVariableNameException
*/
public function store(OptionVariableFormRequest $request, ServiceOption $option)
public function store(OptionVariableFormRequest $request, Egg $option)
{
$this->creationService->handle($option->id, $request->normalize());
$this->alert->success(trans('admin/services.variables.notices.variable_created'))->flash();
@ -95,8 +95,8 @@ class VariableController extends Controller
* Handles POST when editing a configration for a service variable.
*
* @param \Pterodactyl\Http\Requests\Admin\OptionVariableFormRequest $request
* @param \Pterodactyl\Models\ServiceOption $option
* @param \Pterodactyl\Models\ServiceVariable $variable
* @param \Pterodactyl\Models\Egg $option
* @param \Pterodactyl\Models\EggVariable $variable
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\DisplayException
@ -104,7 +104,7 @@ class VariableController extends Controller
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
* @throws \Pterodactyl\Exceptions\Service\ServiceVariable\ReservedVariableNameException
*/
public function update(OptionVariableFormRequest $request, ServiceOption $option, ServiceVariable $variable)
public function update(OptionVariableFormRequest $request, Egg $option, EggVariable $variable)
{
$this->updateService->handle($variable, $request->normalize());
$this->alert->success(trans('admin/services.variables.notices.variable_updated', [
@ -117,11 +117,11 @@ class VariableController extends Controller
/**
* Delete a service variable from the system.
*
* @param \Pterodactyl\Models\ServiceOption $option
* @param \Pterodactyl\Models\ServiceVariable $variable
* @param \Pterodactyl\Models\Egg $option
* @param \Pterodactyl\Models\EggVariable $variable
* @return \Illuminate\Http\RedirectResponse
*/
public function delete(ServiceOption $option, ServiceVariable $variable)
public function delete(Egg $option, EggVariable $variable)
{
$this->serviceVariableRepository->delete($variable->id);
$this->alert->success(trans('admin/services.variables.notices.variable_deleted', [

View file

@ -9,9 +9,9 @@
namespace Pterodactyl\Http\Controllers\Daemon;
use Pterodactyl\Models\Egg;
use Illuminate\Http\Request;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\Nest;
use Pterodactyl\Http\Controllers\Controller;
class ServiceController extends Controller
@ -27,7 +27,7 @@ class ServiceController extends Controller
public function listServices(Request $request)
{
$response = [];
foreach (Service::all() as $service) {
foreach (Nest::all() as $service) {
$response[$service->folder] = [
'main.json' => sha1($this->getConfiguration($service->id)->toJson()),
'index.js' => sha1($service->index_file),
@ -47,7 +47,7 @@ class ServiceController extends Controller
*/
public function pull(Request $request, $folder, $file)
{
$service = Service::where('folder', $folder)->firstOrFail();
$service = Nest::where('folder', $folder)->firstOrFail();
if ($file === 'index.js') {
return response($service->index_file)->header('Content-Type', 'text/plain');
@ -67,7 +67,7 @@ class ServiceController extends Controller
*/
protected function getConfiguration($id)
{
$options = ServiceOption::where('service_id', $id)->get();
$options = Egg::where('service_id', $id)->get();
return $options->mapWithKeys(function ($item) use ($options) {
return [

View file

@ -54,7 +54,7 @@ class ServerController extends Controller
$this->authorize('view-startup', $server);
$server->load(['node', 'allocation', 'variables']);
$variables = Models\ServiceVariable::where('option_id', $server->option_id)->get();
$variables = Models\EggVariable::where('option_id', $server->option_id)->get();
$replacements = [
'{{SERVER_MEMORY}}' => $server->memory,

View file

@ -7,11 +7,11 @@
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Http\Requests\Admin\Service;
namespace Pterodactyl\Http\Requests\Admin\Nest;
use Pterodactyl\Http\Requests\Admin\AdminFormRequest;
class ServiceFormRequest extends AdminFormRequest
class StoreNestFormRequest extends AdminFormRequest
{
/**
* @return array
@ -21,7 +21,6 @@ class ServiceFormRequest extends AdminFormRequest
return [
'name' => 'required|string|min:1|max:255',
'description' => 'required|nullable|string',
'startup' => 'required|nullable|string',
];
}
}

View file

@ -9,7 +9,7 @@
namespace Pterodactyl\Http\Requests\Admin;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Models\EggVariable;
class OptionVariableFormRequest extends AdminFormRequest
{
@ -21,7 +21,7 @@ class OptionVariableFormRequest extends AdminFormRequest
return [
'name' => 'required|string|min:1|max:255',
'description' => 'sometimes|nullable|string',
'env_variable' => 'required|regex:/^[\w]{1,255}$/|notIn:' . ServiceVariable::RESERVED_ENV_NAMES,
'env_variable' => 'required|regex:/^[\w]{1,255}$/|notIn:' . EggVariable::RESERVED_ENV_NAMES,
'default_value' => 'string',
'options' => 'sometimes|required|array',
'rules' => 'bail|required|string',

View file

@ -9,7 +9,7 @@
namespace Pterodactyl\Http\Requests\Admin\Service;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\Egg;
use Pterodactyl\Http\Requests\Admin\AdminFormRequest;
class ServiceOptionFormRequest extends AdminFormRequest
@ -19,6 +19,6 @@ class ServiceOptionFormRequest extends AdminFormRequest
*/
public function rules()
{
return ServiceOption::getCreateRules();
return Egg::getCreateRules();
}
}

View file

@ -15,7 +15,7 @@ use Illuminate\Database\Eloquent\Model;
use Sofa\Eloquence\Contracts\CleansAttributes;
use Sofa\Eloquence\Contracts\Validable as ValidableContract;
class ServiceOption extends Model implements CleansAttributes, ValidableContract
class Egg extends Model implements CleansAttributes, ValidableContract
{
use Eloquence, Validable;
@ -24,7 +24,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
*
* @var string
*/
protected $table = 'service_options';
protected $table = 'eggs';
/**
* Fields that are not mass assignable.
@ -67,9 +67,8 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
'service_id' => 'required',
'name' => 'required',
'description' => 'required',
'tag' => 'required',
'docker_image' => 'sometimes',
'startup' => 'sometimes',
'docker_image' => 'required',
'startup' => 'required',
'config_from' => 'sometimes',
'config_stop' => 'required_without:config_from',
'config_startup' => 'required_without:config_from',
@ -85,7 +84,6 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
'uuid' => 'string|size:36',
'name' => 'string|max:255',
'description' => 'string',
'tag' => 'bail|string|max:150',
'docker_image' => 'string|max:255',
'startup' => 'nullable|string',
'config_from' => 'bail|nullable|numeric|exists:service_options,id',
@ -103,12 +101,10 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
'config_startup' => null,
'config_logs' => null,
'config_files' => null,
'startup' => null,
'docker_image' => null,
];
/**
* Returns the install script for the option; if option is copying from another
* Returns the install script for the egg; if egg is copying from another
* it will return the copied script.
*
* @return string
@ -119,7 +115,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
}
/**
* Returns the entry command for the option; if option is copying from another
* Returns the entry command for the egg; if egg is copying from another
* it will return the copied entry command.
*
* @return string
@ -130,7 +126,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
}
/**
* Returns the install container for the option; if option is copying from another
* Returns the install container for the egg; if egg is copying from another
* it will return the copied install container.
*
* @return string
@ -141,7 +137,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
}
/**
* Return the file configuration for a service option.
* Return the file configuration for an egg.
*
* @return string
*/
@ -151,7 +147,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
}
/**
* Return the startup configuration for a service option.
* Return the startup configuration for an egg.
*
* @return string
*/
@ -161,7 +157,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
}
/**
* Return the log reading configuration for a service option.
* Return the log reading configuration for an egg.
*
* @return string
*/
@ -171,7 +167,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
}
/**
* Return the stop command configuration for a service option.
* Return the stop command configuration for an egg.
*
* @return string
*/
@ -181,47 +177,47 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
}
/**
* Gets service associated with a service option.
* Gets nest associated with an egg.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function service()
public function nest()
{
return $this->belongsTo(Service::class);
return $this->belongsTo(Nest::class);
}
/**
* Gets all servers associated with this service option.
* Gets all servers associated with this egg.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function servers()
{
return $this->hasMany(Server::class, 'option_id');
return $this->hasMany(Server::class, 'egg_id');
}
/**
* Gets all variables associated with this service.
* Gets all variables associated with this egg.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function variables()
{
return $this->hasMany(ServiceVariable::class, 'option_id');
return $this->hasMany(EggVariable::class, 'egg_id');
}
/**
* Gets all packs associated with this service.
* Gets all packs associated with this egg.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function packs()
{
return $this->hasMany(Pack::class, 'option_id');
return $this->hasMany(Pack::class, 'egg_id');
}
/**
* Get the parent service option from which to copy scripts.
* Get the parent egg from which to copy scripts.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
@ -231,7 +227,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
}
/**
* Get the parent service option from which to copy configuration settings.
* Get the parent egg from which to copy configuration settings.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/

View file

@ -15,7 +15,7 @@ use Illuminate\Database\Eloquent\Model;
use Sofa\Eloquence\Contracts\CleansAttributes;
use Sofa\Eloquence\Contracts\Validable as ValidableContract;
class ServiceVariable extends Model implements CleansAttributes, ValidableContract
class EggVariable extends Model implements CleansAttributes, ValidableContract
{
use Eloquence, Validable;
@ -31,7 +31,7 @@ class ServiceVariable extends Model implements CleansAttributes, ValidableContra
*
* @var string
*/
protected $table = 'service_variables';
protected $table = 'egg_variables';
/**
* Fields that are not mass assignable.
@ -46,7 +46,7 @@ class ServiceVariable extends Model implements CleansAttributes, ValidableContra
* @var array
*/
protected $casts = [
'option_id' => 'integer',
'egg_id' => 'integer',
'user_viewable' => 'integer',
'user_editable' => 'integer',
];
@ -64,7 +64,7 @@ class ServiceVariable extends Model implements CleansAttributes, ValidableContra
* @var array
*/
protected static $dataIntegrityRules = [
'option_id' => 'exists:service_options,id',
'egg_id' => 'exists:eggs,id',
'name' => 'string|between:1,255',
'description' => 'nullable|string',
'env_variable' => 'regex:/^[\w]{1,255}$/|notIn:' . self::RESERVED_ENV_NAMES,
@ -83,9 +83,6 @@ class ServiceVariable extends Model implements CleansAttributes, ValidableContra
];
/**
* Returns the display executable for the option and will use the parent
* service one if the option does not have one defined.
*
* @return bool
*/
public function getRequiredAttribute($value)

View file

@ -15,7 +15,7 @@ use Illuminate\Database\Eloquent\Model;
use Sofa\Eloquence\Contracts\CleansAttributes;
use Sofa\Eloquence\Contracts\Validable as ValidableContract;
class Service extends Model implements CleansAttributes, ValidableContract
class Nest extends Model implements CleansAttributes, ValidableContract
{
use Eloquence, Validable;
@ -24,7 +24,7 @@ class Service extends Model implements CleansAttributes, ValidableContract
*
* @var string
*/
protected $table = 'services';
protected $table = 'nests';
/**
* Fields that are mass assignable.
@ -55,27 +55,27 @@ class Service extends Model implements CleansAttributes, ValidableContract
];
/**
* Gets all service options associated with this service.
* Gets all eggs associated with this service.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function options()
public function eggs()
{
return $this->hasMany(ServiceOption::class);
return $this->hasMany(Egg::class);
}
/**
* Returns all of the packs associated with a service, regardless of the service option.
* Returns all of the packs associated with a nest, regardless of the egg.
*
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
public function packs()
{
return $this->hasManyThrough(Pack::class, ServiceOption::class, 'service_id', 'option_id');
return $this->hasManyThrough(Pack::class, Egg::class, 'nest_id', 'egg_id');
}
/**
* Gets all servers associated with this service.
* Gets all servers associated with this nest.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/

View file

@ -47,7 +47,7 @@ class Pack extends Model implements CleansAttributes, ValidableContract
'selectable' => 'sometimes|required',
'visible' => 'sometimes|required',
'locked' => 'sometimes|required',
'option_id' => 'required',
'egg_id' => 'required',
];
/**
@ -60,7 +60,7 @@ class Pack extends Model implements CleansAttributes, ValidableContract
'selectable' => 'boolean',
'visible' => 'boolean',
'locked' => 'boolean',
'option_id' => 'exists:service_options,id',
'egg_id' => 'exists:eggs,id',
];
/**
@ -69,7 +69,7 @@ class Pack extends Model implements CleansAttributes, ValidableContract
* @var array
*/
protected $casts = [
'option_id' => 'integer',
'egg_id' => 'integer',
'selectable' => 'boolean',
'visible' => 'boolean',
'locked' => 'boolean',
@ -83,9 +83,8 @@ class Pack extends Model implements CleansAttributes, ValidableContract
protected $searchableColumns = [
'name' => 10,
'uuid' => 8,
'option.name' => 6,
'option.tag' => 5,
'option.docker_image' => 5,
'egg.name' => 6,
'egg.docker_image' => 5,
'version' => 2,
];
@ -114,13 +113,13 @@ class Pack extends Model implements CleansAttributes, ValidableContract
}
/**
* Gets option associated with a service pack.
* Gets egg associated with a service pack.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function option()
public function egg()
{
return $this->belongsTo(ServiceOption::class);
return $this->belongsTo(Egg::class);
}
/**

View file

@ -68,8 +68,8 @@ class Server extends Model implements CleansAttributes, ValidableContract
'io' => 'required',
'cpu' => 'required',
'disk' => 'required',
'service_id' => 'required',
'option_id' => 'required',
'nest_id' => 'required',
'egg_id' => 'required',
'node_id' => 'required',
'allocation_id' => 'required',
'pack_id' => 'sometimes',
@ -92,8 +92,8 @@ class Server extends Model implements CleansAttributes, ValidableContract
'cpu' => 'numeric|min:0',
'disk' => 'numeric|min:0',
'allocation_id' => 'exists:allocations,id',
'service_id' => 'exists:services,id',
'option_id' => 'exists:service_options,id',
'nest_id' => 'exists:nests,id',
'egg_id' => 'exists:eggs,id',
'pack_id' => 'nullable|numeric|min:0',
'custom_container' => 'nullable|string',
'startup' => 'nullable|string',
@ -119,8 +119,8 @@ class Server extends Model implements CleansAttributes, ValidableContract
'cpu' => 'integer',
'oom_disabled' => 'integer',
'allocation_id' => 'integer',
'service_id' => 'integer',
'option_id' => 'integer',
'nest_id' => 'integer',
'egg_id' => 'integer',
'pack_id' => 'integer',
'installed' => 'integer',
];
@ -202,23 +202,23 @@ class Server extends Model implements CleansAttributes, ValidableContract
}
/**
* Gets information for the service associated with this server.
* Gets information for the nest associated with this server.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function service()
public function nest()
{
return $this->belongsTo(Service::class);
return $this->belongsTo(Nest::class);
}
/**
* Gets information for the service option associated with this server.
* Gets information for the egg associated with this server.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function option()
public function egg()
{
return $this->belongsTo(ServiceOption::class);
return $this->belongsTo(Egg::class);
}
/**

View file

@ -74,6 +74,6 @@ class ServerVariable extends Model
*/
public function variable()
{
return $this->belongsTo(ServiceVariable::class, 'variable_id');
return $this->belongsTo(EggVariable::class, 'variable_id');
}
}

View file

@ -12,6 +12,8 @@ namespace Pterodactyl\Providers;
use Illuminate\Support\ServiceProvider;
use Pterodactyl\Repositories\Daemon\FileRepository;
use Pterodactyl\Repositories\Daemon\PowerRepository;
use Pterodactyl\Repositories\Eloquent\EggRepository;
use Pterodactyl\Repositories\Eloquent\NestRepository;
use Pterodactyl\Repositories\Eloquent\NodeRepository;
use Pterodactyl\Repositories\Eloquent\PackRepository;
use Pterodactyl\Repositories\Eloquent\TaskRepository;
@ -19,7 +21,6 @@ use Pterodactyl\Repositories\Eloquent\UserRepository;
use Pterodactyl\Repositories\Daemon\CommandRepository;
use Pterodactyl\Repositories\Eloquent\ApiKeyRepository;
use Pterodactyl\Repositories\Eloquent\ServerRepository;
use Pterodactyl\Repositories\Eloquent\ServiceRepository;
use Pterodactyl\Repositories\Eloquent\SessionRepository;
use Pterodactyl\Repositories\Eloquent\SubuserRepository;
use Pterodactyl\Repositories\Eloquent\DatabaseRepository;
@ -28,22 +29,21 @@ use Pterodactyl\Repositories\Eloquent\ScheduleRepository;
use Pterodactyl\Repositories\Eloquent\DaemonKeyRepository;
use Pterodactyl\Repositories\Eloquent\AllocationRepository;
use Pterodactyl\Repositories\Eloquent\PermissionRepository;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Repositories\Daemon\ConfigurationRepository;
use Pterodactyl\Repositories\Eloquent\EggVariableRepository;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\PackRepositoryInterface;
use Pterodactyl\Contracts\Repository\TaskRepositoryInterface;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Repositories\Eloquent\DatabaseHostRepository;
use Pterodactyl\Repositories\Eloquent\ApiPermissionRepository;
use Pterodactyl\Repositories\Eloquent\ServiceOptionRepository;
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Repositories\Eloquent\OptionVariableRepository;
use Pterodactyl\Repositories\Eloquent\ServerVariableRepository;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Contracts\Repository\SessionRepositoryInterface;
use Pterodactyl\Contracts\Repository\SubuserRepositoryInterface;
use Pterodactyl\Repositories\Eloquent\ServiceVariableRepository;
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\ScheduleRepositoryInterface;
@ -51,14 +51,12 @@ use Pterodactyl\Contracts\Repository\DaemonKeyRepositoryInterface;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\PermissionRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\FileRepositoryInterface;
use Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\PowerRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
use Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\CommandRepositoryInterface;
use Pterodactyl\Contracts\Repository\OptionVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface;
use Pterodactyl\Repositories\Daemon\ServerRepository as DaemonServerRepository;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
@ -77,17 +75,16 @@ class RepositoryServiceProvider extends ServiceProvider
$this->app->bind(DaemonKeyRepositoryInterface::class, DaemonKeyRepository::class);
$this->app->bind(DatabaseRepositoryInterface::class, DatabaseRepository::class);
$this->app->bind(DatabaseHostRepositoryInterface::class, DatabaseHostRepository::class);
$this->app->bind(EggRepositoryInterface::class, EggRepository::class);
$this->app->bind(EggVariableRepositoryInterface::class, EggVariableRepository::class);
$this->app->bind(LocationRepositoryInterface::class, LocationRepository::class);
$this->app->bind(NestRepositoryInterface::class, NestRepository::class);
$this->app->bind(NodeRepositoryInterface::class, NodeRepository::class);
$this->app->bind(OptionVariableRepositoryInterface::class, OptionVariableRepository::class);
$this->app->bind(PackRepositoryInterface::class, PackRepository::class);
$this->app->bind(PermissionRepositoryInterface::class, PermissionRepository::class);
$this->app->bind(ScheduleRepositoryInterface::class, ScheduleRepository::class);
$this->app->bind(ServerRepositoryInterface::class, ServerRepository::class);
$this->app->bind(ServerVariableRepositoryInterface::class, ServerVariableRepository::class);
$this->app->bind(ServiceRepositoryInterface::class, ServiceRepository::class);
$this->app->bind(ServiceOptionRepositoryInterface::class, ServiceOptionRepository::class);
$this->app->bind(ServiceVariableRepositoryInterface::class, ServiceVariableRepository::class);
$this->app->bind(SessionRepositoryInterface::class, SessionRepository::class);
$this->app->bind(SubuserRepositoryInterface::class, SubuserRepository::class);
$this->app->bind(TaskRepositoryInterface::class, TaskRepository::class);

View file

@ -9,33 +9,33 @@
namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Models\Egg;
use Webmozart\Assert\Assert;
use Pterodactyl\Models\ServiceOption;
use Illuminate\Database\Eloquent\Collection;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
class ServiceOptionRepository extends EloquentRepository implements ServiceOptionRepositoryInterface
class EggRepository extends EloquentRepository implements EggRepositoryInterface
{
/**
* {@inheritdoc}
*/
public function model()
{
return ServiceOption::class;
return Egg::class;
}
/**
* Return a service option with the variables relation attached.
* Return an egg with the variables relation attached.
*
* @param int $id
* @return \Pterodactyl\Models\ServiceOption
* @return \Pterodactyl\Models\Egg
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithVariables(int $id): ServiceOption
public function getWithVariables(int $id): Egg
{
/** @var \Pterodactyl\Models\ServiceOption $instance */
/** @var \Pterodactyl\Models\Egg $instance */
$instance = $this->getBuilder()->with('variables')->find($id, $this->getColumns());
if (! $instance) {
throw new RecordNotFoundException;
@ -45,7 +45,7 @@ class ServiceOptionRepository extends EloquentRepository implements ServiceOptio
}
/**
* Return all of the service options and their relations to be used in the daemon API.
* Return all eggs and their relations to be used in the daemon API.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
@ -55,19 +55,19 @@ class ServiceOptionRepository extends EloquentRepository implements ServiceOptio
}
/**
* Return a service option with the scriptFrom and configFrom relations loaded onto the model.
* Return an egg with the scriptFrom and configFrom relations loaded onto the model.
*
* @param int|string $value
* @param string $column
* @return \Pterodactyl\Models\ServiceOption
* @return \Pterodactyl\Models\Egg
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithCopyAttributes($value, string $column = 'id'): ServiceOption
public function getWithCopyAttributes($value, string $column = 'id'): Egg
{
Assert::true((is_digit($value) || is_string($value)), 'First argument passed to getWithCopyAttributes must be an integer or string, received %s.');
/** @var \Pterodactyl\Models\ServiceOption $instance */
/** @var \Pterodactyl\Models\Egg $instance */
$instance = $this->getBuilder()->with('scriptFrom', 'configFrom')->where($column, '=', $value)->first($this->getColumns());
if (! $instance) {
throw new RecordNotFoundException;
@ -80,13 +80,13 @@ class ServiceOptionRepository extends EloquentRepository implements ServiceOptio
* Return all of the data needed to export a service.
*
* @param int $id
* @return \Pterodactyl\Models\ServiceOption
* @return \Pterodactyl\Models\Egg
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithExportAttributes(int $id): ServiceOption
public function getWithExportAttributes(int $id): Egg
{
/** @var \Pterodactyl\Models\ServiceOption $instance */
/** @var \Pterodactyl\Models\Egg $instance */
$instance = $this->getBuilder()->with('scriptFrom', 'configFrom', 'variables')->find($id, $this->getColumns());
if (! $instance) {
throw new RecordNotFoundException;
@ -96,7 +96,7 @@ class ServiceOptionRepository extends EloquentRepository implements ServiceOptio
}
/**
* Confirm a copy script belongs to the same service as the item trying to use it.
* Confirm a copy script belongs to the same nest as the item trying to use it.
*
* @param int $copyFromId
* @param int $service
@ -106,7 +106,7 @@ class ServiceOptionRepository extends EloquentRepository implements ServiceOptio
{
return $this->getBuilder()->whereNull('copy_script_from')
->where('id', '=', $copyFromId)
->where('service_id', '=', $service)
->where('nest_id', '=', $service)
->exists();
}
}

View file

@ -9,16 +9,16 @@
namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Contracts\Repository\OptionVariableRepositoryInterface;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface;
class OptionVariableRepository extends EloquentRepository implements OptionVariableRepositoryInterface
class EggVariableRepository extends EloquentRepository implements EggVariableRepositoryInterface
{
/**
* {@inheritdoc}
*/
public function model()
{
return ServiceVariable::class;
return EggVariable::class;
}
}

View file

@ -9,31 +9,31 @@
namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\Nest;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
class ServiceRepository extends EloquentRepository implements ServiceRepositoryInterface
class NestRepository extends EloquentRepository implements NestRepositoryInterface
{
/**
* {@inheritdoc}
*/
public function model()
{
return Service::class;
return Nest::class;
}
/**
* Return a service or all services with their associated options, variables, and packs.
* Return a nest or all nests with their associated eggs, variables, and packs.
*
* @param int $id
* @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Service
* @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Nest
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithOptions(int $id = null)
public function getWithEggs(int $id = null)
{
$instance = $this->getBuilder()->with('options.packs', 'options.variables');
$instance = $this->getBuilder()->with('eggs.packs', 'eggs.variables');
if (! is_null($id)) {
$instance = $instance->find($id, $this->getColumns());
@ -48,16 +48,16 @@ class ServiceRepository extends EloquentRepository implements ServiceRepositoryI
}
/**
* Return a service or all services and the count of options, packs, and servers for that service.
* Return a nest or all nests and the count of eggs, packs, and servers for that nest.
*
* @param int|null $id
* @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Service
* @return \Pterodactyl\Models\Nest|\Illuminate\Database\Eloquent\Collection
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithCounts(int $id = null)
{
$instance = $this->getBuilder()->withCount(['options', 'packs', 'servers']);
$instance = $this->getBuilder()->withCount(['eggs', 'packs', 'servers']);
if (! is_null($id)) {
$instance = $instance->find($id, $this->getColumns());
@ -72,21 +72,21 @@ class ServiceRepository extends EloquentRepository implements ServiceRepositoryI
}
/**
* Return a service along with its associated options and the servers relation on those options.
* Return a nest along with its associated eggs and the servers relation on those eggs.
*
* @param int $id
* @return \Pterodactyl\Models\Service
* @return \Pterodactyl\Models\Nest
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithOptionServers(int $id): Service
public function getWithEggServers(int $id): Nest
{
$instance = $this->getBuilder()->with('options.servers')->find($id, $this->getColumns());
$instance = $this->getBuilder()->with('eggs.servers')->find($id, $this->getColumns());
if (! $instance) {
throw new RecordNotFoundException;
}
/* @var Service $instance */
/* @var Nest $instance */
return $instance;
}
}

View file

@ -116,7 +116,7 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
*/
public function getNodeServers($id)
{
$instance = $this->getBuilder()->with('servers.user', 'servers.service', 'servers.option')
$instance = $this->getBuilder()->with('servers.user', 'servers.nest', 'servers.egg')
->find($id, $this->getColumns());
if (! $instance) {

View file

@ -75,11 +75,11 @@ class PackRepository extends EloquentRepository implements PackRepositoryInterfa
/**
* {@inheritdoc}
*/
public function paginateWithOptionAndServerCount($paginate = 50)
public function paginateWithEggAndServerCount($paginate = 50)
{
Assert::integer($paginate, 'First argument passed to paginateWithOptionAndServerCount must be integer, received %s.');
return $this->getBuilder()->with('option')->withCount('servers')
return $this->getBuilder()->with('egg')->withCount('servers')
->search($this->searchTerm)
->paginate($paginate, $this->getColumns());
}

View file

@ -47,7 +47,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
Assert::nullOrIntegerish($server, 'First argument passed to getDataForRebuild must be null or integer, received %s.');
Assert::nullOrIntegerish($node, 'Second argument passed to getDataForRebuild must be null or integer, received %s.');
$instance = $this->getBuilder()->with('allocation', 'allocations', 'pack', 'option', 'node');
$instance = $this->getBuilder()->with('allocation', 'allocations', 'pack', 'egg', 'node');
if (! is_null($server) && is_null($node)) {
$instance = $instance->where('id', '=', $server);
@ -66,7 +66,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
{
Assert::integerish($id, 'First argument passed to findWithVariables must be integer, received %s.');
$instance = $this->getBuilder()->with('option.variables', 'variables')
$instance = $this->getBuilder()->with('egg.variables', 'variables')
->where($this->getModel()->getKeyName(), '=', $id)
->first($this->getColumns());
@ -82,7 +82,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
*/
public function getVariablesWithValues($id, $returnWithObject = false)
{
$instance = $this->getBuilder()->with('variables', 'option.variables')
$instance = $this->getBuilder()->with('variables', 'egg.variables')
->find($id, $this->getColumns());
if (! $instance) {
@ -90,7 +90,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
}
$data = [];
$instance->option->variables->each(function ($item) use (&$data, $instance) {
$instance->egg->variables->each(function ($item) use (&$data, $instance) {
$display = $instance->variables->where('variable_id', $item->id)->pluck('variable_value')->first();
$data[$item->env_variable] = $display ?? $item->default_value;
@ -111,7 +111,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
*/
public function getDataForCreation($id)
{
$instance = $this->getBuilder()->with(['allocation', 'allocations', 'pack', 'option'])->find($id, $this->getColumns());
$instance = $this->getBuilder()->with(['allocation', 'allocations', 'pack', 'egg'])->find($id, $this->getColumns());
if (! $instance) {
throw new RecordNotFoundException();
}
@ -140,15 +140,15 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
*/
public function getDaemonServiceData($id)
{
$instance = $this->getBuilder()->with('option.service', 'pack')->find($id, $this->getColumns());
$instance = $this->getBuilder()->with('egg.nest', 'pack')->find($id, $this->getColumns());
if (! $instance) {
throw new RecordNotFoundException();
}
return [
'type' => $instance->option->service->folder,
'option' => $instance->option->tag,
'type' => $instance->egg->nest->folder,
'option' => $instance->egg->tag,
'pack' => (! is_null($instance->pack_id)) ? $instance->pack->uuid : null,
];
}
@ -211,7 +211,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
{
Assert::stringNotEmpty($uuid, 'First argument passed to getByUuid must be a non-empty string, received %s.');
$instance = $this->getBuilder()->with('service', 'node')->where(function ($query) use ($uuid) {
$instance = $this->getBuilder()->with('nest', 'node')->where(function ($query) use ($uuid) {
$query->where('uuidShort', $uuid)->orWhere('uuid', $uuid);
})->first($this->getColumns());

View file

@ -1,24 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface;
class ServiceVariableRepository extends EloquentRepository implements ServiceVariableRepositoryInterface
{
/**
* {@inheritdoc}
*/
public function model()
{
return ServiceVariable::class;
}
}

View file

@ -0,0 +1,76 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Services\Eggs\Sharing;
use Carbon\Carbon;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
class EggExporterService
{
/**
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $repository;
/**
* EggExporterService constructor.
*
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
*/
public function __construct(EggRepositoryInterface $repository)
{
$this->repository = $repository;
}
/**
* Return a JSON representation of an egg and its variables.
*
* @param int $egg
* @return string
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function handle(int $egg): string
{
$egg = $this->repository->getWithExportAttributes($egg);
$struct = [
'_comment' => 'DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO',
'meta' => [
'version' => 'PTDL_v1',
],
'exported_at' => Carbon::now()->toIso8601String(),
'name' => $egg->name,
'author' => $egg->author,
'description' => $egg->description,
'image' => $egg->docker_image,
'config' => [
'files' => $egg->inherit_config_files,
'startup' => $egg->inherit_config_startup,
'logs' => $egg->inherit_config_logs,
'stop' => $egg->inherit_config_stop,
],
'scripts' => [
'installation' => [
'script' => $egg->copy_script_install,
'container' => $egg->copy_script_container,
'entrypoint' => $egg->copy_script_entry,
],
],
'variables' => $egg->variables->transform(function ($item) {
return collect($item->toArray())->except([
'id', 'egg_id', 'created_at', 'updated_at',
])->toArray();
}),
];
return json_encode($struct, JSON_PRETTY_PRINT);
}
}

View file

@ -10,16 +10,15 @@
namespace Pterodactyl\Services\Services\Sharing;
use Ramsey\Uuid\Uuid;
use Pterodactyl\Models\Egg;
use Illuminate\Http\UploadedFile;
use Pterodactyl\Models\ServiceOption;
use Illuminate\Database\ConnectionInterface;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Exceptions\Service\Pack\InvalidFileUploadException;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceOption\DuplicateOptionTagException;
use Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface;
class ServiceOptionImporterService
class EggImporterService
{
/**
* @var \Illuminate\Database\ConnectionInterface
@ -27,77 +26,71 @@ class ServiceOptionImporterService
protected $connection;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface
*/
protected $eggVariableRepository;
/**
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $repository;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
protected $serviceRepository;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface
*/
protected $serviceVariableRepository;
/**
* XMLImporterService constructor.
* EggImporterService constructor.
*
* @param \Illuminate\Database\ConnectionInterface $connection
* @param \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface $serviceRepository
* @param \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface $serviceVariableRepository
* @param \Illuminate\Database\ConnectionInterface $connection
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $eggVariableRepository
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $serviceRepository
*/
public function __construct(
ConnectionInterface $connection,
ServiceRepositoryInterface $serviceRepository,
ServiceOptionRepositoryInterface $repository,
ServiceVariableRepositoryInterface $serviceVariableRepository
EggRepositoryInterface $repository,
EggVariableRepositoryInterface $eggVariableRepository,
NestRepositoryInterface $serviceRepository
) {
$this->connection = $connection;
$this->repository = $repository;
$this->serviceRepository = $serviceRepository;
$this->serviceVariableRepository = $serviceVariableRepository;
$this->eggVariableRepository = $eggVariableRepository;
}
/**
* Take an uploaded XML file and parse it into a new service option.
* Take an uploaded JSON file and parse it into a new egg.
*
* @param \Illuminate\Http\UploadedFile $file
* @param int $service
* @return \Pterodactyl\Models\ServiceOption
* @param int $nest
* @return \Pterodactyl\Models\Egg
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
* @throws \Pterodactyl\Exceptions\Service\Pack\InvalidFileUploadException
*/
public function handle(UploadedFile $file, int $service): ServiceOption
public function handle(UploadedFile $file, int $nest): Egg
{
if (! $file->isValid() || ! $file->isFile()) {
throw new InvalidFileUploadException(trans('exceptions.service.exporter.import_file_error'));
throw new InvalidFileUploadException(trans('exceptions.egg.importer.file_error'));
}
$parsed = json_decode($file->openFile()->fread($file->getSize()));
if (object_get($parsed, 'meta.version') !== 'PTDL_v1') {
throw new InvalidFileUploadException(trans('exceptions.service.exporter.invalid_json_provided'));
throw new InvalidFileUploadException(trans('exceptions.egg.importer.invalid_json_provided'));
}
$service = $this->serviceRepository->getWithOptions($service);
$service->options->each(function ($option) use ($parsed) {
if ($option->tag === object_get($parsed, 'tag')) {
throw new DuplicateOptionTagException(trans('exceptions.service.options.duplicate_tag'));
}
});
$nest = $this->serviceRepository->getWithEggs($nest);
$this->connection->beginTransaction();
$option = $this->repository->create([
$egg = $this->repository->create([
'uuid' => Uuid::uuid4()->toString(),
'service_id' => $service->id,
'nest_id' => $nest->id,
'name' => object_get($parsed, 'name'),
'description' => object_get($parsed, 'description'),
'tag' => object_get($parsed, 'tag'),
'docker_image' => object_get($parsed, 'image'),
'config_files' => object_get($parsed, 'config.files'),
'config_startup' => object_get($parsed, 'config.startup'),
@ -110,14 +103,14 @@ class ServiceOptionImporterService
'copy_script_from' => null,
], true, true);
collect($parsed->variables)->each(function ($variable) use ($option) {
$this->serviceVariableRepository->create(array_merge((array) $variable, [
'option_id' => $option->id,
collect($parsed->variables)->each(function ($variable) use ($egg) {
$this->eggVariableRepository->create(array_merge((array) $variable, [
'egg_id' => $egg->id,
]));
});
$this->connection->commit();
return $option;
return $egg;
}
}

View file

@ -7,59 +7,54 @@
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Services\Services;
namespace Pterodactyl\Services\Nests;
use Ramsey\Uuid\Uuid;
use Pterodactyl\Models\Service;
use Pterodactyl\Traits\Services\CreatesServiceIndex;
use Pterodactyl\Models\Nest;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
class ServiceCreationService
class NestCreationService
{
use CreatesServiceIndex;
/**
* @var \Illuminate\Contracts\Config\Repository
*/
protected $config;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
protected $repository;
/**
* ServiceCreationService constructor.
* NestCreationService constructor.
*
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface $repository
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository
*/
public function __construct(
ConfigRepository $config,
ServiceRepositoryInterface $repository
NestRepositoryInterface $repository
) {
$this->config = $config;
$this->repository = $repository;
}
/**
* Create a new service on the system.
* Create a new nest on the system.
*
* @param array $data
* @return \Pterodactyl\Models\Service
* @return \Pterodactyl\Models\Nest
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function handle(array $data): Service
public function handle(array $data): Nest
{
return $this->repository->create([
'uuid' => Uuid::uuid4()->toString(),
'author' => $this->config->get('pterodactyl.service.author'),
'name' => array_get($data, 'name'),
'description' => array_get($data, 'description'),
'startup' => array_get($data, 'startup'),
'index_file' => $this->getIndexScript(),
], true, true);
}
}

View file

@ -7,13 +7,13 @@
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Services\Services;
namespace Pterodactyl\Services\Nests;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Exceptions\Service\HasActiveServersException;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
class ServiceDeletionService
class NestDeletionService
{
/**
* @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface
@ -21,39 +21,39 @@ class ServiceDeletionService
protected $serverRepository;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
protected $repository;
/**
* ServiceDeletionService constructor.
* NestDeletionService constructor.
*
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository
* @param \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository
*/
public function __construct(
ServerRepositoryInterface $serverRepository,
ServiceRepositoryInterface $repository
NestRepositoryInterface $repository
) {
$this->serverRepository = $serverRepository;
$this->repository = $repository;
}
/**
* Delete a service from the system only if there are no servers attached to it.
* Delete a nest from the system only if there are no servers attached to it.
*
* @param int $service
* @param int $nest
* @return int
*
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
*/
public function handle(int $service): int
public function handle(int $nest): int
{
$count = $this->serverRepository->findCountWhere([['service_id', '=', $service]]);
$count = $this->serverRepository->findCountWhere([['nest_id', '=', $nest]]);
if ($count > 0) {
throw new HasActiveServersException(trans('exceptions.service.delete_has_servers'));
}
return $this->repository->delete($service);
return $this->repository->delete($nest);
}
}

View file

@ -7,41 +7,41 @@
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Services\Services;
namespace Pterodactyl\Services\Nests;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
class ServiceUpdateService
class NestUpdateService
{
/**
* @var \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
protected $repository;
/**
* ServiceUpdateService constructor.
* NestUpdateService constructor.
*
* @param \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository
*/
public function __construct(ServiceRepositoryInterface $repository)
public function __construct(NestRepositoryInterface $repository)
{
$this->repository = $repository;
}
/**
* Update a service and prevent changing the author once it is set.
* Update a nest and prevent changing the author once it is set.
*
* @param int $service
* @param int $nest
* @param array $data
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function handle(int $service, array $data)
public function handle(int $nest, array $data)
{
if (! is_null(array_get($data, 'author'))) {
unset($data['author']);
}
$this->repository->withoutFresh()->update($service, $data);
$this->repository->withoutFresh()->update($nest, $data);
}
}

View file

@ -12,7 +12,7 @@ namespace Pterodactyl\Services\Servers;
use Pterodactyl\Exceptions\DisplayValidationException;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Illuminate\Contracts\Validation\Factory as ValidationFactory;
use Pterodactyl\Contracts\Repository\OptionVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
class VariableValidatorService
@ -33,7 +33,7 @@ class VariableValidatorService
protected $results = [];
/**
* @var \Pterodactyl\Contracts\Repository\OptionVariableRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface
*/
protected $optionVariableRepository;
@ -55,13 +55,13 @@ class VariableValidatorService
/**
* VariableValidatorService constructor.
*
* @param \Pterodactyl\Contracts\Repository\OptionVariableRepositoryInterface $optionVariableRepository
* @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $optionVariableRepository
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository
* @param \Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface $serverVariableRepository
* @param \Illuminate\Contracts\Validation\Factory $validator
*/
public function __construct(
OptionVariableRepositoryInterface $optionVariableRepository,
EggVariableRepositoryInterface $optionVariableRepository,
ServerRepositoryInterface $serverRepository,
ServerVariableRepositoryInterface $serverVariableRepository,
ValidationFactory $validator

View file

@ -9,23 +9,23 @@
namespace Pterodactyl\Services\Services\Options;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Models\Egg;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceOption\InvalidCopyFromException;
class InstallScriptUpdateService
{
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $repository;
/**
* InstallScriptUpdateService constructor.
*
* @param \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
*/
public function __construct(ServiceOptionRepositoryInterface $repository)
public function __construct(EggRepositoryInterface $repository)
{
$this->repository = $repository;
}
@ -33,8 +33,8 @@ class InstallScriptUpdateService
/**
* Modify the option install script for a given service option.
*
* @param int|\Pterodactyl\Models\ServiceOption $option
* @param array $data
* @param int|\Pterodactyl\Models\Egg $option
* @param array $data
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -42,7 +42,7 @@ class InstallScriptUpdateService
*/
public function handle($option, array $data)
{
if (! $option instanceof ServiceOption) {
if (! $option instanceof Egg) {
$option = $this->repository->find($option);
}

View file

@ -9,8 +9,8 @@
namespace Pterodactyl\Services\Services\Options;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Models\Egg;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
class OptionConfigurationFileService
{
@ -19,9 +19,9 @@ class OptionConfigurationFileService
/**
* OptionConfigurationFileService constructor.
*
* @param \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
*/
public function __construct(ServiceOptionRepositoryInterface $repository)
public function __construct(EggRepositoryInterface $repository)
{
$this->repository = $repository;
}
@ -29,14 +29,14 @@ class OptionConfigurationFileService
/**
* Return a service configuration file to be used by the daemon.
*
* @param int|\Pterodactyl\Models\ServiceOption $option
* @param int|\Pterodactyl\Models\Egg $option
* @return array
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function handle($option): array
{
if (! $option instanceof ServiceOption) {
if (! $option instanceof Egg) {
$option = $this->repository->getWithCopyAttributes($option);
}

View file

@ -10,9 +10,9 @@
namespace Pterodactyl\Services\Services\Options;
use Ramsey\Uuid\Uuid;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\Egg;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceOption\NoParentConfigurationFoundException;
class OptionCreationService
@ -23,17 +23,17 @@ class OptionCreationService
protected $config;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $repository;
/**
* CreationService constructor.
*
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface $repository
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
*/
public function __construct(ConfigRepository $config, ServiceOptionRepositoryInterface $repository)
public function __construct(ConfigRepository $config, EggRepositoryInterface $repository)
{
$this->config = $config;
$this->repository = $repository;
@ -43,12 +43,12 @@ class OptionCreationService
* Create a new service option and assign it to the given service.
*
* @param array $data
* @return \Pterodactyl\Models\ServiceOption
* @return \Pterodactyl\Models\Egg
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Service\ServiceOption\NoParentConfigurationFoundException
*/
public function handle(array $data): ServiceOption
public function handle(array $data): Egg
{
if (! is_null(array_get($data, 'config_from'))) {
$results = $this->repository->findCountWhere([

View file

@ -9,15 +9,15 @@
namespace Pterodactyl\Services\Services\Options;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Exceptions\Service\HasActiveServersException;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceOption\HasChildrenException;
class OptionDeletionService
{
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $repository;
@ -29,12 +29,12 @@ class OptionDeletionService
/**
* OptionDeletionService constructor.
*
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository
* @param \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
*/
public function __construct(
ServerRepositoryInterface $serverRepository,
ServiceOptionRepositoryInterface $repository
EggRepositoryInterface $repository
) {
$this->repository = $repository;
$this->serverRepository = $serverRepository;

View file

@ -9,23 +9,23 @@
namespace Pterodactyl\Services\Services\Options;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Models\Egg;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceOption\NoParentConfigurationFoundException;
class OptionUpdateService
{
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $repository;
/**
* OptionUpdateService constructor.
*
* @param \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
*/
public function __construct(ServiceOptionRepositoryInterface $repository)
public function __construct(EggRepositoryInterface $repository)
{
$this->repository = $repository;
}
@ -33,8 +33,8 @@ class OptionUpdateService
/**
* Update a service option.
*
* @param int|\Pterodactyl\Models\ServiceOption $option
* @param array $data
* @param int|\Pterodactyl\Models\Egg $option
* @param array $data
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -42,7 +42,7 @@ class OptionUpdateService
*/
public function handle($option, array $data)
{
if (! $option instanceof ServiceOption) {
if (! $option instanceof Egg) {
$option = $this->repository->find($option);
}

View file

@ -1,85 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Services\Services\Sharing;
use Carbon\Carbon;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
class ServiceOptionExporterService
{
/**
* @var \Carbon\Carbon
*/
protected $carbon;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
*/
protected $repository;
/**
* XMLExporterService constructor.
*
* @param \Carbon\Carbon $carbon
* @param \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface $repository
*/
public function __construct(
Carbon $carbon,
ServiceOptionRepositoryInterface $repository
) {
$this->carbon = $carbon;
$this->repository = $repository;
}
/**
* Return an XML structure to represent this service option.
*
* @param int $option
* @return string
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function handle(int $option): string
{
$option = $this->repository->getWithExportAttributes($option);
$struct = [
'_comment' => 'DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO',
'meta' => [
'version' => 'PTDL_v1',
],
'exported_at' => $this->carbon->now()->toIso8601String(),
'name' => $option->name,
'author' => array_get(explode(':', $option->tag), 0),
'description' => $option->description,
'image' => $option->docker_image,
'config' => [
'files' => $option->inherit_config_files,
'startup' => $option->inherit_config_startup,
'logs' => $option->inherit_config_logs,
'stop' => $option->inherit_config_stop,
],
'scripts' => [
'installation' => [
'script' => $option->copy_script_install,
'container' => $option->copy_script_container,
'entrypoint' => $option->copy_script_entry,
],
],
'variables' => $option->variables->transform(function ($item) {
return collect($item->toArray())->except([
'id', 'option_id', 'created_at', 'updated_at',
])->toArray();
}),
];
return json_encode($struct, JSON_PRETTY_PRINT);
}
}

View file

@ -9,16 +9,16 @@
namespace Pterodactyl\Services\Services\Variables;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceVariable\ReservedVariableNameException;
class VariableCreationService
{
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $serviceOptionRepository;
@ -28,7 +28,7 @@ class VariableCreationService
protected $serviceVariableRepository;
public function __construct(
ServiceOptionRepositoryInterface $serviceOptionRepository,
EggRepositoryInterface $serviceOptionRepository,
ServiceVariableRepositoryInterface $serviceVariableRepository
) {
$this->serviceOptionRepository = $serviceOptionRepository;
@ -38,20 +38,20 @@ class VariableCreationService
/**
* Create a new variable for a given service option.
*
* @param int|\Pterodactyl\Models\ServiceOption $option
* @param array $data
* @return \Pterodactyl\Models\ServiceVariable
* @param int|\Pterodactyl\Models\Egg $option
* @param array $data
* @return \Pterodactyl\Models\EggVariable
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Service\ServiceVariable\ReservedVariableNameException
*/
public function handle($option, array $data)
{
if ($option instanceof ServiceOption) {
if ($option instanceof Egg) {
$option = $option->id;
}
if (in_array(strtoupper(array_get($data, 'env_variable')), explode(',', ServiceVariable::RESERVED_ENV_NAMES))) {
if (in_array(strtoupper(array_get($data, 'env_variable')), explode(',', EggVariable::RESERVED_ENV_NAMES))) {
throw new ReservedVariableNameException(sprintf(
'Cannot use the protected name %s for this environment variable.',
array_get($data, 'env_variable')

View file

@ -9,7 +9,7 @@
namespace Pterodactyl\Services\Services\Variables;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceVariable\ReservedVariableNameException;
@ -34,8 +34,8 @@ class VariableUpdateService
/**
* Update a specific service variable.
*
* @param int|\Pterodactyl\Models\ServiceVariable $variable
* @param array $data
* @param int|\Pterodactyl\Models\EggVariable $variable
* @param array $data
* @return mixed
*
* @throws \Pterodactyl\Exceptions\DisplayException
@ -45,12 +45,12 @@ class VariableUpdateService
*/
public function handle($variable, array $data)
{
if (! $variable instanceof ServiceVariable) {
if (! $variable instanceof EggVariable) {
$variable = $this->repository->find($variable);
}
if (! is_null(array_get($data, 'env_variable'))) {
if (in_array(strtoupper(array_get($data, 'env_variable')), explode(',', ServiceVariable::RESERVED_ENV_NAMES))) {
if (in_array(strtoupper(array_get($data, 'env_variable')), explode(',', EggVariable::RESERVED_ENV_NAMES))) {
throw new ReservedVariableNameException(trans('exceptions.service.variables.reserved_name', [
'name' => array_get($data, 'env_variable'),
]));

View file

@ -1,56 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Traits\Services;
trait CreatesServiceIndex
{
/**
* Returns the default index.js file that is used for services on the daemon.
*
* @return string
*/
public function getIndexScript()
{
return <<<'EOF'
'use strict';
/**
* Pterodactyl - Daemon
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
const rfr = require('rfr');
const _ = require('lodash');
const Core = rfr('src/services/index.js');
class Service extends Core {}
module.exports = Service;
EOF;
}
}

View file

@ -9,8 +9,8 @@
namespace Pterodactyl\Transformers\Admin;
use Pterodactyl\Models\Egg;
use Illuminate\Http\Request;
use Pterodactyl\Models\ServiceOption;
use League\Fractal\TransformerAbstract;
class OptionTransformer extends TransformerAbstract
@ -53,7 +53,7 @@ class OptionTransformer extends TransformerAbstract
*
* @return array
*/
public function transform(ServiceOption $option)
public function transform(Egg $option)
{
return $option->toArray();
}
@ -63,7 +63,7 @@ class OptionTransformer extends TransformerAbstract
*
* @return \Leauge\Fractal\Resource\Collection
*/
public function includeService(ServiceOption $option)
public function includeService(Egg $option)
{
if ($this->request && ! $this->request->apiKeyHasPermission('service-view')) {
return;
@ -77,7 +77,7 @@ class OptionTransformer extends TransformerAbstract
*
* @return \Leauge\Fractal\Resource\Collection
*/
public function includePacks(ServiceOption $option)
public function includePacks(Egg $option)
{
if ($this->request && ! $this->request->apiKeyHasPermission('pack-list')) {
return;
@ -91,7 +91,7 @@ class OptionTransformer extends TransformerAbstract
*
* @return \Leauge\Fractal\Resource\Collection
*/
public function includeServers(ServiceOption $option)
public function includeServers(Egg $option)
{
if ($this->request && ! $this->request->apiKeyHasPermission('server-list')) {
return;
@ -105,7 +105,7 @@ class OptionTransformer extends TransformerAbstract
*
* @return \Leauge\Fractal\Resource\Collection
*/
public function includeVariables(ServiceOption $option)
public function includeVariables(Egg $option)
{
if ($this->request && ! $this->request->apiKeyHasPermission('option-view')) {
return;

View file

@ -10,7 +10,7 @@
namespace Pterodactyl\Transformers\Admin;
use Illuminate\Http\Request;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\Nest;
use League\Fractal\TransformerAbstract;
class ServiceTransformer extends TransformerAbstract
@ -52,7 +52,7 @@ class ServiceTransformer extends TransformerAbstract
*
* @return array
*/
public function transform(Service $service)
public function transform(Nest $service)
{
return $service->toArray();
}
@ -62,7 +62,7 @@ class ServiceTransformer extends TransformerAbstract
*
* @return \Leauge\Fractal\Resource\Collection
*/
public function includeOptions(Service $service)
public function includeOptions(Nest $service)
{
if ($this->request && ! $this->request->apiKeyHasPermission('option-list')) {
return;
@ -76,7 +76,7 @@ class ServiceTransformer extends TransformerAbstract
*
* @return \Leauge\Fractal\Resource\Collection
*/
public function includeServers(Service $service)
public function includeServers(Nest $service)
{
if ($this->request && ! $this->request->apiKeyHasPermission('server-list')) {
return;
@ -90,7 +90,7 @@ class ServiceTransformer extends TransformerAbstract
*
* @return \Leauge\Fractal\Resource\Collection
*/
public function includePacks(Service $service)
public function includePacks(Nest $service)
{
if ($this->request && ! $this->request->apiKeyHasPermission('pack-list')) {
return;

View file

@ -10,8 +10,8 @@
namespace Pterodactyl\Transformers\Admin;
use Illuminate\Http\Request;
use Pterodactyl\Models\EggVariable;
use League\Fractal\TransformerAbstract;
use Pterodactyl\Models\ServiceVariable;
class ServiceVariableTransformer extends TransformerAbstract
{
@ -48,7 +48,7 @@ class ServiceVariableTransformer extends TransformerAbstract
*
* @return array
*/
public function transform(ServiceVariable $variable)
public function transform(EggVariable $variable)
{
return $variable->toArray();
}
@ -58,7 +58,7 @@ class ServiceVariableTransformer extends TransformerAbstract
*
* @return \Leauge\Fractal\Resource\Collection
*/
public function includeVariables(ServiceVariable $variable)
public function includeVariables(EggVariable $variable)
{
if ($this->request && ! $this->request->apiKeyHasPermission('server-view')) {
return;

View file

@ -88,7 +88,7 @@ $factory->define(Pterodactyl\Models\Node::class, function (Faker\Generator $fake
];
});
$factory->define(Pterodactyl\Models\Service::class, function (Faker\Generator $faker) {
$factory->define(Pterodactyl\Models\Nest::class, function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->randomNumber(),
'uuid' => $faker->unique()->uuid,
@ -98,7 +98,7 @@ $factory->define(Pterodactyl\Models\Service::class, function (Faker\Generator $f
];
});
$factory->define(Pterodactyl\Models\ServiceOption::class, function (Faker\Generator $faker) {
$factory->define(Pterodactyl\Models\Egg::class, function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->randomNumber(),
'uuid' => $faker->unique()->uuid,
@ -109,7 +109,7 @@ $factory->define(Pterodactyl\Models\ServiceOption::class, function (Faker\Genera
];
});
$factory->define(Pterodactyl\Models\ServiceVariable::class, function (Faker\Generator $faker) {
$factory->define(Pterodactyl\Models\EggVariable::class, function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->randomNumber(),
'name' => $faker->firstName,
@ -122,11 +122,11 @@ $factory->define(Pterodactyl\Models\ServiceVariable::class, function (Faker\Gene
];
});
$factory->state(Pterodactyl\Models\ServiceVariable::class, 'viewable', function () {
$factory->state(Pterodactyl\Models\EggVariable::class, 'viewable', function () {
return ['user_viewable' => 1];
});
$factory->state(Pterodactyl\Models\ServiceVariable::class, 'editable', function () {
$factory->state(Pterodactyl\Models\EggVariable::class, 'editable', function () {
return ['user_editable' => 1];
});

View file

@ -1,6 +1,5 @@
<?php
use Pterodactyl\Models\ServiceOption;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -13,31 +12,6 @@ class DeleteServiceExecutableOption extends Migration
public function up()
{
DB::transaction(function () {
// Attempt to fix any startup commands for servers
// that we possibly can. Also set new containers.
foreach (ServiceOption::with('servers')->get() as $option) {
$option->servers->each(function ($s) use ($option) {
$prepend = $option->display_executable;
$prepend = ($prepend === './ShooterGameServer') ? './ShooterGame/Binaries/Linux/ShooterGameServer' : $prepend;
$prepend = ($prepend === 'TerrariaServer.exe') ? 'mono TerrariaServer.exe' : $prepend;
$s->startup = $prepend . ' ' . $s->startup;
$container = $s->container;
if (starts_with($container, 'quay.io/pterodactyl/minecraft')) {
$s->container = 'quay.io/pterodactyl/core:java';
} elseif (starts_with($container, 'quay.io/pterodactyl/srcds')) {
$s->container = 'quay.io/pterodactyl/core:source';
} elseif (starts_with($container, 'quay.io/pterodactyl/voice')) {
$s->container = 'quay.io/pterodactyl/core:glibc';
} elseif (starts_with($container, 'quay.io/pterodactyl/terraria')) {
$s->container = 'quay.io/pterodactyl/core:mono';
}
$s->save();
});
}
Schema::table('services', function (Blueprint $table) {
$table->renameColumn('file', 'folder');
$table->dropColumn('executable');

View file

@ -6,8 +6,6 @@
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
use Pterodactyl\Models\Service;
use Pterodactyl\Models\ServiceOption;
use Illuminate\Database\Migrations\Migration;
class MigrateToNewServiceSystem extends Migration
@ -18,12 +16,12 @@ class MigrateToNewServiceSystem extends Migration
public function up()
{
DB::transaction(function () {
$service = Service::where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first();
$service = DB::table('services')->where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first();
if (! $service) {
return;
}
$options = ServiceOption::where('service_id', $service->id)->get();
$options = DB::table('service_options')->where('service_id', $service->id)->get();
$options->each(function ($item) use ($options) {
if ($item->tag === 'srcds' && $item->name === 'Insurgency') {
$item->tag = 'insurgency';

View file

@ -1,7 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Pterodactyl\Models\ServiceVariable;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -17,7 +16,7 @@ class ChangeServiceVariablesValidationRules extends Migration
});
DB::transaction(function () {
foreach (ServiceVariable::all() as $variable) {
foreach (DB::table('service_variables')->get() as $variable) {
$variable->rules = ($variable->required) ? 'required|regex:' . $variable->rules : 'regex:' . $variable->rules;
$variable->save();
}
@ -39,7 +38,7 @@ class ChangeServiceVariablesValidationRules extends Migration
});
DB::transaction(function () {
foreach (ServiceVariable::all() as $variable) {
foreach (DB::table('service_variables')->get() as $variable) {
$variable->regex = str_replace(['required|regex:', 'regex:'], '', $variable->regex);
$variable->save();
}

View file

@ -1,6 +1,5 @@
<?php
use Pterodactyl\Models\Service;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -93,11 +92,11 @@ EOF;
});
DB::transaction(function () {
Service::where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('folder', '!=', 'minecraft')->update([
DB::table('services')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('folder', '!=', 'minecraft')->update([
'index_file' => $this->default,
]);
Service::where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('folder', 'minecraft')->update([
DB::table('services')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('folder', 'minecraft')->update([
'index_file' => $this->default_mc,
]);
});

View file

@ -15,6 +15,7 @@ class ChangeToABetterUniqueServiceConfiguration extends Migration
{
Schema::table('service_options', function (Blueprint $table) {
$table->char('uuid', 36)->after('id');
$table->string('author')->after('service_id');
$table->dropColumn('tag');
});
@ -25,6 +26,7 @@ class ChangeToABetterUniqueServiceConfiguration extends Migration
'services.author AS service_author',
])->join('services', 'services.id', '=', 'service_options.service_id')->get()->each(function ($option) {
DB::table('service_options')->where('id', $option->id)->update([
'author' => $option->service_author,
'uuid' => Uuid::uuid4()->toString(),
]);
});
@ -42,6 +44,7 @@ class ChangeToABetterUniqueServiceConfiguration extends Migration
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropColumn('uuid');
$table->dropColumn('author');
$table->string('tag');
});

View file

@ -0,0 +1,59 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ServicesToNestsConversion extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::disableForeignKeyConstraints();
Schema::rename('services', 'nests');
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign(['service_id']);
$table->renameColumn('service_id', 'nest_id');
$table->foreign('nest_id')->references('id')->on('nests');
});
Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign(['service_id']);
$table->renameColumn('service_id', 'nest_id');
$table->foreign('nest_id')->references('id')->on('nests')->onDelete('CASCADE');
});
Schema::enableForeignKeyConstraints();
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::disableForeignKeyConstraints();
Schema::rename('nests', 'services');
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign(['nest_id']);
$table->renameColumn('nest_id', 'service_id');
$table->foreign('service_id')->references('id')->on('services');
});
Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign(['nest_id']);
$table->renameColumn('nest_id', 'service_id');
$table->foreign('service_id')->references('id')->on('services')->onDelete('CASCADE');
});
Schema::enableForeignKeyConstraints();
}
}

View file

@ -0,0 +1,93 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ServiceOptionsToEggsConversion extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::disableForeignKeyConstraints();
Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign(['config_from']);
$table->dropForeign(['copy_script_from']);
});
Schema::rename('service_options', 'eggs');
Schema::table('packs', function (Blueprint $table) {
$table->dropForeign(['option_id']);
$table->renameColumn('option_id', 'egg_id');
$table->foreign('egg_id')->references('id')->on('eggs')->onDelete('CASCADE');
});
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign(['option_id']);
$table->renameColumn('option_id', 'egg_id');
$table->foreign('egg_id')->references('id')->on('eggs');
});
Schema::table('eggs', function (Blueprint $table) {
$table->foreign('config_from')->references('id')->on('eggs')->onDelete('SET NULL');
$table->foreign('copy_script_from')->references('id')->on('eggs')->onDelete('SET NULL');
});
Schema::table('service_variables', function (Blueprint $table) {
$table->dropForeign(['option_id']);
$table->renameColumn('option_id', 'egg_id');
$table->foreign('egg_id')->references('id')->on('eggs')->onDelete('CASCADE');
});
Schema::enableForeignKeyConstraints();
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::disableForeignKeyConstraints();
Schema::table('eggs', function (Blueprint $table) {
$table->dropForeign(['config_from']);
$table->dropForeign(['copy_script_from']);
});
Schema::rename('eggs', 'service_options');
Schema::table('packs', function (Blueprint $table) {
$table->dropForeign(['egg_id']);
$table->renameColumn('egg_id', 'option_id');
$table->foreign('option_id')->references('id')->on('service_options')->onDelete('CASCADE');
});
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign(['egg_id']);
$table->renameColumn('egg_id', 'option_id');
$table->foreign('option_id')->references('id')->on('service_options');
});
Schema::table('service_options', function (Blueprint $table) {
$table->foreign('config_from')->references('id')->on('service_options')->onDelete('SET NULL');
$table->foreign('copy_script_from')->references('id')->on('service_options')->onDelete('SET NULL');
});
Schema::table('service_variables', function (Blueprint $table) {
$table->dropForeign(['egg_id']);
$table->renameColumn('egg_id', 'option_id');
$table->foreign('option_id')->references('id')->on('options')->onDelete('CASCADE');
});
Schema::enableForeignKeyConstraints();
}
}

View file

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ServiceVariablesToEggVariablesConversion extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::disableForeignKeyConstraints();
Schema::rename('service_variables', 'egg_variables');
Schema::table('server_variables', function (Blueprint $table) {
$table->dropForeign(['variable_id']);
$table->foreign('variable_id')->references('id')->on('egg_variables')->onDelete('CASCADE');
});
Schema::enableForeignKeyConstraints();
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::disableForeignKeyConstraints();
Schema::rename('egg_variables', 'service_variables');
Schema::table('server_variables', function (Blueprint $table) {
$table->dropForeign(['variable_id']);
$table->foreign('variable_id')->references('id')->on('service_variables')->onDelete('CASCADE');
});
Schema::enableForeignKeyConstraints();
}
}

View file

@ -6,17 +6,17 @@
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\Nest;
use Illuminate\Database\Seeder;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Models\EggVariable;
class MinecraftServiceTableSeeder extends Seeder
{
/**
* The core service ID.
*
* @var \Pterodactyl\Models\Service
* @var \Pterodactyl\Models\Nest
*/
protected $service;
@ -80,7 +80,7 @@ EOF;
private function addCoreService()
{
$this->service = Service::updateOrCreate([
$this->service = Nest::updateOrCreate([
'author' => config('pterodactyl.service.core'),
'folder' => 'minecraft',
], [
@ -114,7 +114,7 @@ fi
curl -o ${SERVER_JARFILE} https://s3.amazonaws.com/Minecraft.Download/versions/${DL_VERSION}/minecraft_server.${DL_VERSION}.jar
EOF;
$this->option['vanilla'] = ServiceOption::updateOrCreate([
$this->option['vanilla'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'vanilla',
], [
@ -148,7 +148,7 @@ if [ ! -z "${DL_PATH}" ]; then
fi
EOF;
$this->option['spigot'] = ServiceOption::updateOrCreate([
$this->option['spigot'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'spigot',
], [
@ -178,7 +178,7 @@ cd /mnt/server
curl -sSL "https://repo.spongepowered.org/maven/org/spongepowered/spongevanilla/${SPONGE_VERSION}/spongevanilla-${SPONGE_VERSION}.jar" -o ${SERVER_JARFILE}
EOF;
$this->option['sponge'] = ServiceOption::updateOrCreate([
$this->option['sponge'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'sponge',
], [
@ -211,7 +211,7 @@ fi
curl -o ${SERVER_JARFILE} https://ci.md-5.net/job/BungeeCord/${BUNGEE_VERSION}/artifact/bootstrap/target/BungeeCord.jar
EOF;
$this->option['bungeecord'] = ServiceOption::updateOrCreate([
$this->option['bungeecord'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'bungeecord',
], [
@ -247,7 +247,7 @@ java -jar installer.jar --installServer
rm -rf installer.jar
EOF;
$this->option['forge'] = ServiceOption::updateOrCreate([
$this->option['forge'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'forge',
], [
@ -276,7 +276,7 @@ EOF;
private function addVanillaVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['vanilla']->id,
'env_variable' => 'SERVER_JARFILE',
], [
@ -288,7 +288,7 @@ EOF;
'rules' => 'required|regex:/^([\w\d._-]+)(\.jar)$/',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['vanilla']->id,
'env_variable' => 'VANILLA_VERSION',
], [
@ -303,7 +303,7 @@ EOF;
private function addSpigotVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['spigot']->id,
'env_variable' => 'SERVER_JARFILE',
], [
@ -315,7 +315,7 @@ EOF;
'rules' => 'required|regex:/^([\w\d._-]+)(\.jar)$/',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['spigot']->id,
'env_variable' => 'DL_VERSION',
], [
@ -327,7 +327,7 @@ EOF;
'rules' => 'required|string|between:3,7',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['spigot']->id,
'env_variable' => 'DL_PATH',
], [
@ -342,7 +342,7 @@ EOF;
private function addSpongeVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['sponge']->id,
'env_variable' => 'SPONGE_VERSION',
], [
@ -354,7 +354,7 @@ EOF;
'rules' => 'required|regex:/^([a-zA-Z0-9.\-_]+)$/',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['sponge']->id,
'env_variable' => 'SERVER_JARFILE',
], [
@ -369,7 +369,7 @@ EOF;
private function addBungeecordVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['bungeecord']->id,
'env_variable' => 'BUNGEE_VERSION',
], [
@ -381,7 +381,7 @@ EOF;
'rules' => 'required|alpha_num|between:1,6',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['bungeecord']->id,
'env_variable' => 'SERVER_JARFILE',
], [
@ -396,7 +396,7 @@ EOF;
private function addForgeVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['forge']->id,
'env_variable' => 'SERVER_JARFILE',
], [

View file

@ -6,10 +6,10 @@
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\Nest;
use Illuminate\Database\Seeder;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Traits\Services\CreatesServiceIndex;
class RustServiceTableSeeder extends Seeder
@ -42,7 +42,7 @@ class RustServiceTableSeeder extends Seeder
private function addCoreService()
{
$this->service = Service::updateOrCreate([
$this->service = Nest::updateOrCreate([
'author' => config('pterodactyl.service.core'),
'folder' => 'rust',
], [
@ -75,7 +75,7 @@ mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
EOF;
$this->option['rustvanilla'] = ServiceOption::updateOrCreate([
$this->option['rustvanilla'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'rustvanilla',
], [
@ -119,7 +119,7 @@ mkdir -p /mnt/server/.steam/sdk32
cp -v /mnt/server/steam/linux32/steamclient.so /mnt/server/.steam/sdk32/steamclient.so
EOF;
$this->option['rustoxide'] = ServiceOption::updateOrCreate([
$this->option['rustoxide'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'rustoxide',
], [
@ -146,7 +146,7 @@ EOF;
private function addVanillaVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'HOSTNAME',
], [
@ -158,7 +158,7 @@ EOF;
'rules' => 'required|string',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'LEVEL',
], [
@ -170,7 +170,7 @@ EOF;
'rules' => 'required|string',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'DESCRIPTION',
], [
@ -182,7 +182,7 @@ EOF;
'rules' => 'required|string',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'URL',
], [
@ -194,7 +194,7 @@ EOF;
'rules' => 'url',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'WORLD_SIZE',
], [
@ -206,7 +206,7 @@ EOF;
'rules' => 'required|integer',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'SEED',
], [
@ -218,7 +218,7 @@ EOF;
'rules' => 'present',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'MAX_PLAYERS',
], [
@ -230,7 +230,7 @@ EOF;
'rules' => 'required|integer',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'SERVER_IMG',
], [
@ -242,7 +242,7 @@ EOF;
'rules' => 'url',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'RCON_PORT',
], [
@ -254,7 +254,7 @@ EOF;
'rules' => 'required|integer',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'RCON_PASS',
], [
@ -266,7 +266,7 @@ EOF;
'rules' => 'required',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'ADDITIONAL_ARGS',
], [
@ -281,7 +281,7 @@ EOF;
private function addOxideVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'HOSTNAME',
], [
@ -293,7 +293,7 @@ EOF;
'rules' => 'required|string',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'LEVEL',
], [
@ -305,7 +305,7 @@ EOF;
'rules' => 'required|string',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'DESCRIPTION',
], [
@ -317,7 +317,7 @@ EOF;
'rules' => 'required|string',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'URL',
], [
@ -329,7 +329,7 @@ EOF;
'rules' => 'url',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'WORLD_SIZE',
], [
@ -341,7 +341,7 @@ EOF;
'rules' => 'required|integer',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'SEED',
], [
@ -353,7 +353,7 @@ EOF;
'rules' => 'present',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'MAX_PLAYERS',
], [
@ -365,7 +365,7 @@ EOF;
'rules' => 'required|integer',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'SERVER_IMG',
], [
@ -377,7 +377,7 @@ EOF;
'rules' => 'url',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'RCON_PORT',
], [
@ -389,7 +389,7 @@ EOF;
'rules' => 'required|integer',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'RCON_PASS',
], [
@ -401,7 +401,7 @@ EOF;
'rules' => 'required',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'ADDITIONAL_ARGS',
], [

View file

@ -6,10 +6,10 @@
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\Nest;
use Illuminate\Database\Seeder;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Traits\Services\CreatesServiceIndex;
class SourceServiceTableSeeder extends Seeder
@ -42,7 +42,7 @@ class SourceServiceTableSeeder extends Seeder
private function addCoreService()
{
$this->service = Service::updateOrCreate([
$this->service = Nest::updateOrCreate([
'author' => config('pterodactyl.service.core'),
'folder' => 'srcds',
], [
@ -81,7 +81,7 @@ mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
EOF;
$this->option['source'] = ServiceOption::updateOrCreate([
$this->option['source'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'source',
], [
@ -99,7 +99,7 @@ EOF;
'script_container' => 'ubuntu:16.04',
]);
$this->option['insurgency'] = ServiceOption::updateOrCreate([
$this->option['insurgency'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'insurgency',
], [
@ -115,7 +115,7 @@ EOF;
'copy_script_from' => $this->option['source']->id,
]);
$this->option['tf2'] = ServiceOption::updateOrCreate([
$this->option['tf2'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'tf2',
], [
@ -161,7 +161,7 @@ mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
EOF;
$this->option['ark'] = ServiceOption::updateOrCreate([
$this->option['ark'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'ark',
], [
@ -205,7 +205,7 @@ mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
EOF;
$this->option['csgo'] = ServiceOption::updateOrCreate([
$this->option['csgo'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'csgo',
], [
@ -249,7 +249,7 @@ mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
EOF;
$this->option['gmod'] = ServiceOption::updateOrCreate([
$this->option['gmod'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'gmod',
], [
@ -280,7 +280,7 @@ EOF;
private function addInsurgencyVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['insurgency']->id,
'env_variable' => 'SRCDS_APPID',
], [
@ -292,7 +292,7 @@ EOF;
'rules' => 'required|regex:/^(17705)$/',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['insurgency']->id,
'env_variable' => 'SRCDS_GAME',
], [
@ -304,7 +304,7 @@ EOF;
'rules' => 'required|regex:/^(insurgency)$/',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['insurgency']->id,
'env_variable' => 'SRCDS_MAP',
], [
@ -319,7 +319,7 @@ EOF;
private function addTF2Variables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['tf2']->id,
'env_variable' => 'SRCDS_APPID',
], [
@ -331,7 +331,7 @@ EOF;
'rules' => 'required|regex:/^(232250)$/',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['tf2']->id,
'env_variable' => 'SRCDS_GAME',
], [
@ -343,7 +343,7 @@ EOF;
'rules' => 'required|regex:/^(tf)$/',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['tf2']->id,
'env_variable' => 'SRCDS_MAP',
], [
@ -358,7 +358,7 @@ EOF;
private function addArkVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['ark']->id,
'env_variable' => 'ARK_PASSWORD',
], [
@ -370,7 +370,7 @@ EOF;
'rules' => 'alpha_dash|between:1,100',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['ark']->id,
'env_variable' => 'ARK_ADMIN_PASSWORD',
], [
@ -382,7 +382,7 @@ EOF;
'rules' => 'alpha_dash|between:1,100',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['ark']->id,
'env_variable' => 'SERVER_MAX_PLAYERS',
], [
@ -397,7 +397,7 @@ EOF;
private function addCSGOVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['csgo']->id,
'env_variable' => 'SRCDS_MAP',
], [
@ -409,7 +409,7 @@ EOF;
'rules' => 'required|string|alpha_dash',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['csgo']->id,
'env_variable' => 'STEAM_ACC',
], [
@ -424,7 +424,7 @@ EOF;
private function addGMODVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['gmod']->id,
'env_variable' => 'SRCDS_MAP',
], [
@ -436,7 +436,7 @@ EOF;
'rules' => 'required|string|alpha_dash',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['gmod']->id,
'env_variable' => 'STEAM_ACC',
], [
@ -451,7 +451,7 @@ EOF;
private function addCustomVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['source']->id,
'env_variable' => 'SRCDS_APPID',
], [
@ -463,7 +463,7 @@ EOF;
'rules' => 'required|numeric|digits_between:1,6',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['source']->id,
'env_variable' => 'SRCDS_GAME',
], [

View file

@ -6,10 +6,10 @@
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\Nest;
use Illuminate\Database\Seeder;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Traits\Services\CreatesServiceIndex;
class TerrariaServiceTableSeeder extends Seeder
@ -42,7 +42,7 @@ class TerrariaServiceTableSeeder extends Seeder
private function addCoreService()
{
$this->service = Service::updateOrCreate([
$this->service = Nest::updateOrCreate([
'author' => config('pterodactyl.service.core'),
'folder' => 'terraria',
], [
@ -70,7 +70,7 @@ curl -sSLO https://github.com/NyxStudios/TShock/releases/download/v${T_VERSION}/
unzip -o tshock_${T_VERSION}.zip -d /mnt/server
EOF;
$this->option['tshock'] = ServiceOption::updateOrCreate([
$this->option['tshock'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'tshock',
], [
@ -89,7 +89,7 @@ EOF;
private function addVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['tshock']->id,
'env_variable' => 'T_VERSION',
], [
@ -101,7 +101,7 @@ EOF;
'rules' => 'required|regex:/^([0-9_\.-]{5,10})$/',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['tshock']->id,
'env_variable' => 'MAX_SLOTS',
], [

View file

@ -6,10 +6,10 @@
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\Nest;
use Illuminate\Database\Seeder;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Traits\Services\CreatesServiceIndex;
class VoiceServiceTableSeeder extends Seeder
@ -19,7 +19,7 @@ class VoiceServiceTableSeeder extends Seeder
/**
* The core service ID.
*
* @var Service
* @var Nest
*/
protected $service;
@ -42,7 +42,7 @@ class VoiceServiceTableSeeder extends Seeder
private function addCoreService()
{
$this->service = Service::updateOrCreate([
$this->service = Nest::updateOrCreate([
'author' => config('pterodactyl.service.core'),
'folder' => 'voice',
], [
@ -71,7 +71,7 @@ tar -xjvf murmur-static_x86-${MUMBLE_VERSION}.tar.bz2
cp -r murmur-static_x86-${MUMBLE_VERSION}/* /mnt/server
EOF;
$this->option['mumble'] = ServiceOption::updateOrCreate([
$this->option['mumble'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'mumble',
], [
@ -124,7 +124,7 @@ logappend=0
query_skipbruteforcecheck=0" > /mnt/server/ts3server.ini
EOF;
$this->option['ts3'] = ServiceOption::updateOrCreate([
$this->option['ts3'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'ts3',
], [
@ -143,7 +143,7 @@ EOF;
private function addVariables()
{
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['mumble']->id,
'env_variable' => 'MAX_USERS',
], [
@ -155,7 +155,7 @@ EOF;
'rules' => 'required|numeric|digits_between:1,5',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['mumble']->id,
'env_variable' => 'MUMBLE_VERSION',
], [
@ -167,7 +167,7 @@ EOF;
'rules' => 'required|regex:/^([0-9_\.-]{5,8})$/',
]);
ServiceVariable::updateOrCreate([
EggVariable::updateOrCreate([
'option_id' => $this->option['ts3']->id,
'env_variable' => 'TS_VERSION',
], [

View file

@ -0,0 +1,31 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
return [
'notices' => [
'created' => 'A new nest, :name, has been successfully created.',
'deleted' => 'Successfully deleted the requested nest from the Panel.',
'updated' => 'Successfully updated the nest configuration options.',
],
'eggs' => [
'notices' => [
'deleted' => 'Successfully deleted the requested egg from the Panel.',
'updated' => 'Egg configuration has been updated successfully.',
'script_updated' => 'Egg install script has been updated and will run whenever servers are installed.',
'egg_created' => 'A new egg was laid successfully. You will need to restart any running daemons to apply this new egg.',
],
],
'variables' => [
'notices' => [
'variable_deleted' => 'The variable ":variable" has been deleted and will no longer be available to servers once rebuilt.',
'variable_updated' => 'The variable ":variable" has been updated. You will need to rebuild any servers using this variable in order to apply changes.',
'variable_created' => 'New variable has successfully been created and assigned to this egg.',
],
],
];

View file

@ -1,32 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
return [
'notices' => [
'service_created' => 'A new service, :name, has been successfully created.',
'service_deleted' => 'Successfully deleted the requested service from the Panel.',
'service_updated' => 'Successfully updated the service configuration options.',
'functions_updated' => 'The service functions file has been updated. You will need to reboot your Nodes in order for these changes to be applied.',
],
'options' => [
'notices' => [
'option_deleted' => 'Successfully deleted the requested service option from the Panel.',
'option_updated' => 'Service option configuration has been updated successfully.',
'script_updated' => 'Service option install script has been updated and will run whenever servers are installed.',
'option_created' => 'New service option was created successfully. You will need to restart any running daemons to apply this new service.',
],
],
'variables' => [
'notices' => [
'variable_deleted' => 'The variable ":variable" has been deleted and will no longer be available to servers once rebuilt.',
'variable_updated' => 'The variable ":variable" has been updated. You will need to rebuild any servers using this variable in order to apply changes.',
'variable_created' => 'New variable has successfully been created and assigned to this service option.',
],
],
];

View file

@ -18,21 +18,20 @@ return [
'invalid_mapping' => 'The mapping provided for :port was invalid and could not be processed.',
'cidr_out_of_range' => 'CIDR notation only allows masks between /25 and /32.',
],
'service' => [
'delete_has_servers' => 'A service with active servers attached to it cannot be deleted from the Panel.',
'options' => [
'duplicate_tag' => 'A service option with that tag already exists for this service.',
'delete_has_servers' => 'A service option with active servers attached to it cannot be deleted from the Panel.',
'invalid_copy_id' => 'The service option selected for copying a script from either does not exist, or is copying a script itself.',
'must_be_child' => 'The "Copy Settings From" directive for this option must be a child option for the selected service.',
'has_children' => 'This service option is a parent to one or more other options. Please delete those options before deleting this option.',
'nest' => [
'delete_has_servers' => 'A Nest with active servers attached to it cannot be deleted from the Panel.',
'egg' => [
'delete_has_servers' => 'An Egg with active servers attached to it cannot be deleted from the Panel.',
'invalid_copy_id' => 'The Egg selected for copying a script from either does not exist, or is copying a script itself.',
'must_be_child' => 'The "Copy Settings From" directive for this Egg must be a child option for the selected Nest.',
'has_children' => 'This Egg is a parent to one or more other Eggs. Please delete those Eggs before deleting this Egg.',
],
'variables' => [
'env_not_unique' => 'The environment variable :name must be unique to this service option.',
'env_not_unique' => 'The environment variable :name must be unique to this Egg.',
'reserved_name' => 'The environment variable :name is protected and cannot be assigned to a variable.',
],
'exporter' => [
'import_file_error' => 'The XML file provided was not valid.',
'importer' => [
'file_error' => 'The JSON file provided was not valid.',
'invalid_json_provided' => 'The JSON file provided is not in a format that can be recognized.',
],
],

View file

@ -6,16 +6,16 @@
@extends('layouts.admin')
@section('title')
Service &rarr; Option: {{ $option->name }}
Nests &rarr; Egg: {{ $egg->name }}
@endsection
@section('content-header')
<h1>{{ $option->name }}<small>{{ str_limit($option->description, 50) }}</small></h1>
<h1>{{ $egg->name }}<small>{{ str_limit($egg->description, 50) }}</small></h1>
<ol class="breadcrumb">
<li><a href="{{ route('admin.index') }}">Admin</a></li>
<li><a href="{{ route('admin.services') }}">Service</a></li>
<li><a href="{{ route('admin.services.view', $option->service->id) }}">{{ $option->service->name }}</a></li>
<li class="active">{{ $option->name }}</li>
<li><a href="{{ route('admin.nests') }}">Nests</a></li>
<li><a href="{{ route('admin.nests.view', $egg->nest->id) }}">{{ $egg->nest->name }}</a></li>
<li class="active">{{ $egg->name }}</li>
</ol>
@endsection
@ -24,18 +24,18 @@
<div class="col-xs-12">
<div class="nav-tabs-custom nav-tabs-floating">
<ul class="nav nav-tabs">
<li class="active"><a href="{{ route('admin.services.option.view', $option->id) }}">Configuration</a></li>
<li><a href="{{ route('admin.services.option.variables', $option->id) }}">Variables</a></li>
<li><a href="{{ route('admin.services.option.scripts', $option->id) }}">Scripts</a></li>
<li class="active"><a href="{{ route('admin.nests.egg.view', $egg->id) }}">Configuration</a></li>
<li><a href="{{ route('admin.nests.egg.variables', $egg->id) }}">Variables</a></li>
<li><a href="{{ route('admin.nests.egg.scripts', $egg->id) }}">Scripts</a></li>
</ul>
</div>
</div>
</div>
<form action="{{ route('admin.services.option.view', $option->id) }}" method="POST">
<form action="{{ route('admin.nests.egg.view', $egg->id) }}" method="POST">
<div class="row">
<div class="col-xs-12">
<div class="callout callout-info">
<strong>Notice:</strong> Editing the Option Tag or any of the Process Management fields <em>requires</em> that each daemon be rebooted to apply the changes.
<strong>Notice:</strong> Editing an Egg or any of the Process Management fields <em>requires</em> that each Daemon be rebooted in order to apply the changes.
</div>
</div>
<div class="col-xs-12">
@ -47,30 +47,26 @@
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label for="pName" class="form-label">Option Name</label>
<input type="text" id="pName" name="name" value="{{ $option->name }}" class="form-control" />
<p class="text-muted small">A simple, human-readable name to use as an identifier for this service.</p>
<label for="pName" class="control-label">Name <span class="field-required"></span></label>
<input type="text" id="pName" name="name" value="{{ $egg->name }}" class="form-control" />
<p class="text-muted small">A simple, human-readable name to use as an identifier for this Egg.</p>
</div>
<div class="form-group">
<label for="pDescription" class="form-label">Description</label>
<textarea id="pDescription" name="description" class="form-control" rows="10">{{ $option->description }}</textarea>
<p class="text-muted small">A description of this service that will be displayed throughout the panel as needed.</p>
<label for="pDescription" class="control-label">Description <span class="field-required"></span></label>
<textarea id="pDescription" name="description" class="form-control" rows="10">{{ $egg->description }}</textarea>
<p class="text-muted small">A description of this Egg that will be displayed throughout the Panel as needed.</p>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="form-label">Option Tag</label>
<input type="text" disabled value="{{ $option->tag }}" class="form-control" />
<label for="pDockerImage" class="control-label">Docker Image <span class="field-required"></span></label>
<input type="text" id="pDockerImage" name="docker_image" value="{{ $egg->docker_image }}" class="form-control" />
<p class="text-muted small">The default docker image that should be used for new servers using this Egg. This can be changed per-server as needed.</p>
</div>
<div class="form-group">
<label for="pDockerImage" class="control-label">Docker Image <span class="field-optional"></label>
<input type="text" id="pDockerImage" name="docker_image" value="{{ $option->docker_image }}" class="form-control" />
<p class="text-muted small">The default docker image that should be used for new servers under this service option. This can be left blank to use the parent service's defined image, and can also be changed per-server.</p>
</div>
<div class="form-group">
<label for="pStartup" class="control-label">Startup Command <span class="field-optional"></label>
<textarea id="pStartup" name="startup" class="form-control" rows="4" placeholder="{{ $option->service->startup }}">{{ $option->startup }}</textarea>
<p class="text-muted small">The default statup command that should be used for new servers under this service option. This can be left blank to use the parent service's startup, and can also be changed per-server.</p>
<label for="pStartup" class="control-label">Startup Command <span class="field-required"></span></label>
<textarea id="pStartup" name="startup" class="form-control" rows="9">{{ $egg->startup }}</textarea>
<p class="text-muted small">The default statup command that should be used for new servers using this Egg.</p>
</div>
</div>
</div>
@ -87,7 +83,7 @@
<div class="col-xs-12">
<div class="alert alert-warning">
<p>The following configuration options should not be edited unless you understand how this system works. If wrongly modified it is possible for the daemon to break.</p>
<p>All fields are required unless you select a seperate option from the 'Copy Settings From' dropdown, in which case fields may be left blank to use the values from that option.</p>
<p>All fields are required unless you select a seperate option from the 'Copy Settings From' dropdown, in which case fields may be left blank to use the values from that Egg.</p>
</div>
</div>
<div class="col-sm-6">
@ -95,32 +91,32 @@
<label for="pConfigFrom" class="form-label">Copy Settings From</label>
<select name="config_from" id="pConfigFrom" class="form-control">
<option value="0">None</option>
@foreach($option->service->options as $o)
<option value="{{ $o->id }}" {{ ($option->config_from !== $o->id) ?: 'selected' }}>{{ $o->name }} &lt;{{ $option->tag }}&gt;</option>
@foreach($egg->nest->eggs as $o)
<option value="{{ $o->id }}" {{ ($egg->config_from !== $o->id) ?: 'selected' }}>{{ $o->name }} &lt;{{ $o->author }}&gt;</option>
@endforeach
</select>
<p class="text-muted small">If you would like to default to settings from another option select the option from the menu above.</p>
<p class="text-muted small">If you would like to default to settings from another Egg select it from the menu above.</p>
</div>
<div class="form-group">
<label for="pConfigStop" class="form-label">Stop Command</label>
<input type="text" id="pConfigStop" name="config_stop" class="form-control" value="{{ $option->config_stop }}" />
<input type="text" id="pConfigStop" name="config_stop" class="form-control" value="{{ $egg->config_stop }}" />
<p class="text-muted small">The command that should be sent to server processes to stop them gracefully. If you need to send a <code>SIGINT</code> you should enter <code>^C</code> here.</p>
</div>
<div class="form-group">
<label for="pConfigLogs" class="form-label">Log Configuration</label>
<textarea data-action="handle-tabs" id="pConfigLogs" name="config_logs" class="form-control" rows="6">{{ ! is_null($option->config_logs) ? json_encode(json_decode($option->config_logs), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : '' }}</textarea>
<textarea data-action="handle-tabs" id="pConfigLogs" name="config_logs" class="form-control" rows="6">{{ ! is_null($egg->config_logs) ? json_encode(json_decode($egg->config_logs), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : '' }}</textarea>
<p class="text-muted small">This should be a JSON representation of where log files are stored, and wether or not the daemon should be creating custom logs.</p>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label for="pConfigFiles" class="form-label">Configuration Files</label>
<textarea data-action="handle-tabs" id="pConfigFiles" name="config_files" class="form-control" rows="6">{{ ! is_null($option->config_files) ? json_encode(json_decode($option->config_files), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : '' }}</textarea>
<textarea data-action="handle-tabs" id="pConfigFiles" name="config_files" class="form-control" rows="6">{{ ! is_null($egg->config_files) ? json_encode(json_decode($egg->config_files), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : '' }}</textarea>
<p class="text-muted small">This should be a JSON representation of configuration files to modify and what parts should be changed.</p>
</div>
<div class="form-group">
<label for="pConfigStartup" class="form-label">Start Configuration</label>
<textarea data-action="handle-tabs" id="pConfigStartup" name="config_startup" class="form-control" rows="6">{{ ! is_null($option->config_startup) ? json_encode(json_decode($option->config_startup), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : '' }}</textarea>
<textarea data-action="handle-tabs" id="pConfigStartup" name="config_startup" class="form-control" rows="6">{{ ! is_null($egg->config_startup) ? json_encode(json_decode($egg->config_startup), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : '' }}</textarea>
<p class="text-muted small">This should be a JSON representation of what values the daemon should be looking for when booting a server to determine completion.</p>
</div>
</div>
@ -131,8 +127,8 @@
<button id="deleteButton" type="submit" name="_method" value="DELETE" class="btn btn-danger btn-sm muted muted-hover">
<i class="fa fa-trash-o"></i>
</button>
<button type="submit" name="_method" value="PATCH" class="btn btn-primary btn-sm pull-right">Edit Option</button>
<a href="{{ route('admin.services.option.export', ['option' => $option->id]) }}" class="btn btn-sm btn-info pull-right" style="margin-right:10px;">Export Option Configuration</a>
<button type="submit" name="_method" value="PATCH" class="btn btn-primary btn-sm pull-right">Save</button>
<a href="{{ route('admin.nests.egg.export', ['option' => $egg->id]) }}" class="btn btn-sm btn-info pull-right" style="margin-right:10px;">Export</a>
</div>
</div>
</div>

View file

@ -6,14 +6,14 @@
@extends('layouts.admin')
@section('title')
Service
Nests
@endsection
@section('content-header')
<h1>Service<small>All services currently available on this system.</small></h1>
<h1>Nests<small>All nests currently available on this system.</small></h1>
<ol class="breadcrumb">
<li><a href="{{ route('admin.index') }}">Admin</a></li>
<li class="active">Service</li>
<li class="active">Nests</li>
</ol>
@endsection
@ -21,7 +21,7 @@
<div class="row">
<div class="col-xs-12">
<div class="alert alert-danger">
Services are a powerful feature of Pterodactyl Panel that allow for extreme flexibility and configuration. Please note that while powerful, modifing a service wrongly can very easily brick your servers and cause more problems. Please avoid editing our default services those provided by <code>support@pterodactyl.io</code> unless you are absolutely sure of what you are doing.
Eggs are a powerful feature of Pterodactyl Panel that allow for extreme flexibility and configuration. Please note that while powerful, modifing an egg wrongly can very easily brick your servers and cause more problems. Please avoid editing our default eggs those provided by <code>support@pterodactyl.io</code> unless you are absolutely sure of what you are doing.
</div>
</div>
</div>
@ -29,10 +29,10 @@
<div class="col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Configured Service</h3>
<h3 class="box-title">Configured Nests</h3>
<div class="box-tools">
<a href="#" class="btn btn-sm btn-success" data-toggle="modal" data-target="#importServiceOptionModal" role="button"><i class="fa fa-upload"></i> Import Service Option</a>
<a href="{{ route('admin.services.new') }}" class="btn btn-primary btn-sm">Create New</a>
<a href="#" class="btn btn-sm btn-success" data-toggle="modal" data-target="#importServiceOptionModal" role="button"><i class="fa fa-upload"></i> Import Egg</a>
<a href="{{ route('admin.nests.new') }}" class="btn btn-primary btn-sm">Create New</a>
</div>
</div>
<div class="box-body table-responsive no-padding">
@ -40,17 +40,17 @@
<tr>
<th>Name</th>
<th>Description</th>
<th class="text-center">Options</th>
<th class="text-center">Eggs</th>
<th class="text-center">Packs</th>
<th class="text-center">Servers</th>
</tr>
@foreach($services as $service)
@foreach($nests as $nest)
<tr>
<td class="middle"><a href="{{ route('admin.services.view', $service->id) }}" data-toggle="tooltip" data-placement="right" title="{{ $service->author }}">{{ $service->name }}</a></td>
<td class="col-xs-6 middle">{{ $service->description }}</td>
<td class="text-center middle"><code>{{ $service->options_count }}</code></td>
<td class="text-center middle"><code>{{ $service->packs_count }}</code></td>
<td class="text-center middle"><code>{{ $service->servers_count }}</code></td>
<td class="middle"><a href="{{ route('admin.nests.view', $nest->id) }}" data-toggle="tooltip" data-placement="right" title="{{ $nest->author }}">{{ $nest->name }}</a></td>
<td class="col-xs-6 middle">{{ $nest->description }}</td>
<td class="text-center middle"><code>{{ $nest->eggs_count }}</code></td>
<td class="text-center middle"><code>{{ $nest->packs_count }}</code></td>
<td class="text-center middle"><code>{{ $nest->servers_count }}</code></td>
</tr>
@endforeach
</table>
@ -63,26 +63,26 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Import a Service Option</h4>
<h4 class="modal-title">Import an Egg</h4>
</div>
<form action="{{ route('admin.services.option.import') }}" enctype="multipart/form-data" method="POST">
<form action="{{ route('admin.nests.egg.import') }}" enctype="multipart/form-data" method="POST">
<div class="modal-body">
<div class="form-group">
<label class="control-label" for="pImportFile">Service File <span class="field-required"></span></label>
<label class="control-label" for="pImportFile">Egg File <span class="field-required"></span></label>
<div>
<input id="pImportFile" type="file" name="import_file" class="form-control" accept="application/json" />
<p class="small text-muted">Select the <code>.json</code> file for the new service option that you wish to import.</p>
<p class="small text-muted">Select the <code>.json</code> file for the new egg that you wish to import.</p>
</div>
</div>
<div class="form-group">
<label class="control-label" for="pImportToService">Associated Service <span class="field-required"></span></label>
<label class="control-label" for="pImportToService">Associated Nest <span class="field-required"></span></label>
<div>
<select id="pImportToService" name="import_to_service">
@foreach($services as $service)
<option value="{{ $service->id }}">{{ $service->name }} &lt;{{ $service->author }}&gt;</option>
@foreach($nests as $nest)
<option value="{{ $nest->id }}">{{ $nest->name }} &lt;{{ $nest->author }}&gt;</option>
@endforeach
</select>
<p class="small text-muted">Select the service that this option will be associated with from the dropdown. If you wish to associate it with a new service you will need to create that service before continuing.</p>
<p class="small text-muted">Select the nest that this egg will be associated with from the dropdown. If you wish to associate it with a new nest you will need to create that nest before continuing.</p>
</div>
</div>
</div>

View file

@ -6,32 +6,32 @@
@extends('layouts.admin')
@section('title')
New Service
New Nest
@endsection
@section('content-header')
<h1>New Service<small>Configure a new service to deploy to all nodes.</small></h1>
<h1>New Nest<small>Configure a new nest to deploy to all nodes.</small></h1>
<ol class="breadcrumb">
<li><a href="{{ route('admin.index') }}">Admin</a></li>
<li><a href="{{ route('admin.services') }}">Service</a></li>
<li><a href="{{ route('admin.nests') }}">Nests</a></li>
<li class="active">New</li>
</ol>
@endsection
@section('content')
<form action="{{ route('admin.services.new') }}" method="POST">
<form action="{{ route('admin.nests.new') }}" method="POST">
<div class="row">
<div class="col-md-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">New Service</h3>
<h3 class="box-title">New Nest</h3>
</div>
<div class="box-body">
<div class="form-group">
<label class="control-label">Name</label>
<div>
<input type="text" name="name" class="form-control" value="{{ old('name') }}" />
<p class="text-muted"><small>This should be a descriptive category name that emcompasses all of the options within the service.</small></p>
<p class="text-muted"><small>This should be a descriptive category name that emcompasses all of the eggs within the nest.</small></p>
</div>
</div>
<div class="form-group">
@ -43,7 +43,7 @@
</div>
<div class="box-footer">
{!! csrf_field() !!}
<button type="input" class="btn btn-primary pull-right">Save Service</button>
<button type="submit" class="btn btn-primary pull-right">Save</button>
</div>
</div>
</div>

View file

@ -6,41 +6,41 @@
@extends('layouts.admin')
@section('title')
Service &rarr; {{ $service->name }}
Nests &rarr; {{ $nest->name }}
@endsection
@section('content-header')
<h1>{{ $service->name }}<small>{{ str_limit($service->description, 50) }}</small></h1>
<h1>{{ $nest->name }}<small>{{ str_limit($nest->description, 50) }}</small></h1>
<ol class="breadcrumb">
<li><a href="{{ route('admin.index') }}">Admin</a></li>
<li><a href="{{ route('admin.services') }}">Service</a></li>
<li class="active">{{ $service->name }}</li>
<li><a href="{{ route('admin.nests') }}">Nests</a></li>
<li class="active">{{ $nest->name }}</li>
</ol>
@endsection
@section('content')
<div class="row">
<form action="{{ route('admin.services.view', $service->id) }}" method="POST">
<form action="{{ route('admin.nests.view', $nest->id) }}" method="POST">
<div class="col-md-6">
<div class="box">
<div class="box-body">
<div class="form-group">
<label class="control-label">Name <span class="field-required"></span></label>
<div>
<input type="text" name="name" class="form-control" value="{{ $service->name }}" />
<input type="text" name="name" class="form-control" value="{{ $nest->name }}" />
<p class="text-muted"><small>This should be a descriptive category name that emcompasses all of the options within the service.</small></p>
</div>
</div>
<div class="form-group">
<label class="control-label">Description <span class="field-required"></span></label>
<div>
<textarea name="description" class="form-control" rows="7">{{ $service->description }}</textarea>
<textarea name="description" class="form-control" rows="7">{{ $nest->description }}</textarea>
</div>
</div>
</div>
<div class="box-footer">
{!! csrf_field() !!}
<button type="submit" name="_method" value="PATCH" class="btn btn-primary btn-sm pull-right">Edit Option</button>
<button type="submit" name="_method" value="PATCH" class="btn btn-primary btn-sm pull-right">Save</button>
<button id="deleteButton" type="submit" name="_method" value="DELETE" class="btn btn-sm btn-danger muted muted-hover"><i class="fa fa-trash-o"></i></button>
</div>
</div>
@ -52,14 +52,14 @@
<div class="form-group">
<label class="control-label">Author</label>
<div>
<input type="text" readonly class="form-control" value="{{ $service->author }}" />
<input type="text" readonly class="form-control" value="{{ $nest->author }}" />
<p class="text-muted small">The author of this service option. Please direct questions and issues to them unless this is an official option authored by <code>support@pterodactyl.io</code>.</p>
</div>
</div>
<div class="form-group">
<label class="control-label">UUID</label>
<div>
<input type="text" readonly class="form-control" value="{{ $service->uuid }}" />
<input type="text" readonly class="form-control" value="{{ $nest->uuid }}" />
<p class="text-muted small">A unique identifier that all servers using this option are assigned for identification purposes.</p>
</div>
</div>
@ -71,28 +71,30 @@
<div class="col-xs-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Configured Options</h3>
<h3 class="box-title">Nest Eggs</h3>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tr>
<th>Name</th>
<th>Description</th>
<th>Tag</th>
<th class="text-center">Servers</th>
<th class="text-center"></th>
</tr>
@foreach($service->options as $option)
@foreach($nest->eggs as $egg)
<tr>
<td><a href="{{ route('admin.services.option.view', $option->id) }}">{{ $option->name }}</a></td>
<td class="col-xs-6">{!! $option->description !!}</td>
<td><code>{{ $option->tag }}</code></td>
<td class="text-center">{{ $option->servers->count() }}</td>
<td class="align-middle"><a href="{{ route('admin.nests.egg.view', $egg->id) }}">{{ $egg->name }}</a></td>
<td class="col-xs-8 align-middle">{!! $egg->description !!}</td>
<td class="text-center align-middle"><code>{{ $egg->servers->count() }}</code></td>
<td class="align-middle">
<a href="{{ route('admin.nests.egg.export', ['egg' => $egg->id]) }}"><i class="fa fa-download"></i></a>
</td>
</tr>
@endforeach
</table>
</div>
<div class="box-footer">
<a href="{{ route('admin.services.option.new') }}"><button class="btn btn-success btn-sm pull-right">New Service Option</button></a>
<a href="{{ route('admin.nests.egg.new') }}"><button class="btn btn-success btn-sm pull-right">New Egg</button></a>
</div>
</div>
</div>

View file

@ -112,9 +112,9 @@
</a>
</li>
<li class="header">SERVICE MANAGEMENT</li>
<li class="{{ ! starts_with(Route::currentRouteName(), 'admin.services') ?: 'active' }}">
<a href="{{ route('admin.services') }}">
<i class="fa fa-th-large"></i> <span>Service</span>
<li class="{{ ! starts_with(Route::currentRouteName(), 'admin.nests') ?: 'active' }}">
<a href="{{ route('admin.nests') }}">
<i class="fa fa-th-large"></i> <span>Nests</span>
</a>
</li>
<li class="{{ ! starts_with(Route::currentRouteName(), 'admin.packs') ?: 'active' }}">

View file

@ -142,35 +142,35 @@ Route::group(['prefix' => 'nodes'], function () {
/*
|--------------------------------------------------------------------------
| Service Controller Routes
| Nest Controller Routes
|--------------------------------------------------------------------------
|
| Endpoint: /admin/services
| Endpoint: /admin/nests
|
*/
Route::group(['prefix' => 'services'], function () {
Route::get('/', 'ServiceController@index')->name('admin.services');
Route::get('/new', 'ServiceController@create')->name('admin.services.new');
Route::get('/view/{service}', 'ServiceController@view')->name('admin.services.view');
Route::get('/option/new', 'OptionController@create')->name('admin.services.option.new');
Route::get('/option/{option}', 'OptionController@viewConfiguration')->name('admin.services.option.view');
Route::get('/option/{option}/export', 'Services\Options\OptionShareController@export')->name('admin.services.option.export');
Route::get('/option/{option}/variables', 'VariableController@view')->name('admin.services.option.variables');
Route::get('/option/{option}/scripts', 'OptionController@viewScripts')->name('admin.services.option.scripts');
Route::group(['prefix' => 'nests'], function () {
Route::get('/', 'Nests\NestController@index')->name('admin.nests');
Route::get('/new', 'Nests\NestController@create')->name('admin.nests.new');
Route::get('/view/{nest}', 'Nests\NestController@view')->name('admin.nests.view');
Route::get('/egg/new', 'Nests\EggController@create')->name('admin.nests.egg.new');
Route::get('/egg/{egg}', 'Nests\EggController@view')->name('admin.nests.egg.view');
Route::get('/egg/{egg}/export', 'Nests\EggShareController@export')->name('admin.nests.egg.export');
Route::get('/egg/{egg}/variables', 'Nests\EggVariableController@view')->name('admin.nests.egg.variables');
Route::get('/egg/{egg}/scripts', 'Nests\EggScriptController@view')->name('admin.nests.egg.scripts');
Route::post('/new', 'ServiceController@store');
Route::post('/import', 'Services\Options\OptionShareController@import')->name('admin.services.option.import');
Route::post('/option/new', 'OptionController@store');
Route::post('/option/{option}/variables', 'VariableController@store');
Route::post('/new', 'Nests\NestController@store');
Route::post('/import', 'Nests\EggShareController@import')->name('admin.nests.egg.import');
Route::post('/egg/new', 'Nests\EggController@store');
Route::post('/egg/{egg}/variables', 'Nests\EggVariableController@store');
Route::patch('/view/{service}', 'ServiceController@update');
Route::patch('/option/{option}', 'OptionController@editConfiguration');
Route::patch('/option/{option}/scripts', 'OptionController@updateScripts');
Route::patch('/option/{option}/variables/{variable}', 'VariableController@update')->name('admin.services.option.variables.edit');
Route::patch('/view/{nest}', 'Nests\NestController@update');
Route::patch('/egg/{egg}', 'Nests\EggController@update');
Route::patch('/egg/{egg}/scripts', 'Nests\EggScriptController@update');
Route::patch('/egg/{egg}/variables/{variable}', 'Nests\EggVariableController@update')->name('admin.nests.egg.variables.edit');
Route::delete('/view/{service}', 'ServiceController@destroy');
Route::delete('/option/{option}', 'OptionController@destroy');
Route::delete('/option/{option}/variables/{variable}', 'VariableController@delete');
Route::delete('/view/{nest}', 'Nests\NestController@destroy');
Route::delete('/egg/{egg}', 'Nests\EggController@destroy');
Route::delete('/egg/{egg}/variables/{variable}', 'Nests\EggVariableController@destroy');
});
/*

View file

@ -11,18 +11,18 @@ namespace Tests\Unit\Services\Servers;
use Mockery as m;
use Tests\TestCase;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Models\EggVariable;
use Illuminate\Contracts\Validation\Factory;
use Pterodactyl\Exceptions\DisplayValidationException;
use Pterodactyl\Services\Servers\VariableValidatorService;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\OptionVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
class VariableValidatorServiceTest extends TestCase
{
/**
* @var \Pterodactyl\Contracts\Repository\OptionVariableRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface
*/
protected $optionVariableRepository;
@ -60,14 +60,14 @@ class VariableValidatorServiceTest extends TestCase
$this->variables = collect(
[
factory(ServiceVariable::class)->states('editable', 'viewable')->make(),
factory(ServiceVariable::class)->states('viewable')->make(),
factory(ServiceVariable::class)->states('editable')->make(),
factory(ServiceVariable::class)->make(),
factory(EggVariable::class)->states('editable', 'viewable')->make(),
factory(EggVariable::class)->states('viewable')->make(),
factory(EggVariable::class)->states('editable')->make(),
factory(EggVariable::class)->make(),
]
);
$this->optionVariableRepository = m::mock(OptionVariableRepositoryInterface::class);
$this->optionVariableRepository = m::mock(EggVariableRepositoryInterface::class);
$this->serverRepository = m::mock(ServerRepositoryInterface::class);
$this->serverVariableRepository = m::mock(ServerVariableRepositoryInterface::class);
$this->validator = m::mock(Factory::class);

View file

@ -12,9 +12,9 @@ namespace Tests\Unit\Services\Services\Options;
use Exception;
use Mockery as m;
use Tests\TestCase;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\Egg;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Services\Services\Options\InstallScriptUpdateService;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceOption\InvalidCopyFromException;
class InstallScriptUpdateServiceTest extends TestCase
@ -31,12 +31,12 @@ class InstallScriptUpdateServiceTest extends TestCase
];
/**
* @var \Pterodactyl\Models\ServiceOption
* @var \Pterodactyl\Models\Egg
*/
protected $model;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $repository;
@ -52,8 +52,8 @@ class InstallScriptUpdateServiceTest extends TestCase
{
parent::setUp();
$this->model = factory(ServiceOption::class)->make();
$this->repository = m::mock(ServiceOptionRepositoryInterface::class);
$this->model = factory(Egg::class)->make();
$this->repository = m::mock(EggRepositoryInterface::class);
$this->service = new InstallScriptUpdateService($this->repository);
}

View file

@ -13,10 +13,10 @@ use Exception;
use Mockery as m;
use Tests\TestCase;
use Ramsey\Uuid\Uuid;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\Egg;
use Illuminate\Contracts\Config\Repository;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Services\Services\Options\OptionCreationService;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceOption\NoParentConfigurationFoundException;
class OptionCreationServiceTest extends TestCase
@ -27,7 +27,7 @@ class OptionCreationServiceTest extends TestCase
protected $config;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface|\Mockery\Mock
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface|\Mockery\Mock
*/
protected $repository;
@ -49,7 +49,7 @@ class OptionCreationServiceTest extends TestCase
parent::setUp();
$this->config = m::mock(Repository::class);
$this->repository = m::mock(ServiceOptionRepositoryInterface::class);
$this->repository = m::mock(EggRepositoryInterface::class);
$this->uuid = m::mock('overload:' . Uuid::class);
$this->service = new OptionCreationService($this->config, $this->repository);
@ -60,7 +60,7 @@ class OptionCreationServiceTest extends TestCase
*/
public function testCreateNewModelWithoutUsingConfigFrom()
{
$model = factory(ServiceOption::class)->make([
$model = factory(Egg::class)->make([
'tag' => str_random(10),
]);
@ -85,7 +85,7 @@ class OptionCreationServiceTest extends TestCase
*/
public function testCreateNewModelUsingLongTagForm()
{
$model = factory(ServiceOption::class)->make([
$model = factory(Egg::class)->make([
'tag' => 'test@example.com:tag',
]);
@ -111,7 +111,7 @@ class OptionCreationServiceTest extends TestCase
*/
public function testCreateNewModelUsingConfigFrom()
{
$model = factory(ServiceOption::class)->make();
$model = factory(Egg::class)->make();
$data = [
'name' => $model->name,

View file

@ -12,16 +12,16 @@ namespace Tests\Unit\Services\Services\Options;
use Mockery as m;
use Tests\TestCase;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Exceptions\Service\HasActiveServersException;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Services\Services\Options\OptionDeletionService;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceOption\HasChildrenException;
class OptionDeletionServiceTest extends TestCase
{
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface|\Mockery\Mock
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface|\Mockery\Mock
*/
protected $repository;
@ -42,7 +42,7 @@ class OptionDeletionServiceTest extends TestCase
{
parent::setUp();
$this->repository = m::mock(ServiceOptionRepositoryInterface::class);
$this->repository = m::mock(EggRepositoryInterface::class);
$this->serverRepository = m::mock(ServerRepositoryInterface::class);
$this->service = new OptionDeletionService($this->serverRepository, $this->repository);

View file

@ -12,20 +12,20 @@ namespace Tests\Unit\Services\Services\Options;
use Exception;
use Mockery as m;
use Tests\TestCase;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\Egg;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Services\Services\Options\OptionUpdateService;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceOption\NoParentConfigurationFoundException;
class OptionUpdateServiceTest extends TestCase
{
/**
* @var \Pterodactyl\Models\ServiceOption
* @var \Pterodactyl\Models\Egg
*/
protected $model;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $repository;
@ -41,8 +41,8 @@ class OptionUpdateServiceTest extends TestCase
{
parent::setUp();
$this->model = factory(ServiceOption::class)->make();
$this->repository = m::mock(ServiceOptionRepositoryInterface::class);
$this->model = factory(Egg::class)->make();
$this->repository = m::mock(EggRepositoryInterface::class);
$this->service = new OptionUpdateService($this->repository);
}

View file

@ -12,11 +12,11 @@ namespace Tests\Unit\Services\Services;
use Mockery as m;
use Tests\TestCase;
use Ramsey\Uuid\Uuid;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\Nest;
use Illuminate\Contracts\Config\Repository;
use Pterodactyl\Traits\Services\CreatesServiceIndex;
use Pterodactyl\Services\Services\ServiceCreationService;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Services\Services\NestCreationService;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
class ServiceCreationServiceTest extends TestCase
{
@ -28,12 +28,12 @@ class ServiceCreationServiceTest extends TestCase
protected $config;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface|\Mockery\Mock
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface|\Mockery\Mock
*/
protected $repository;
/**
* @var \Pterodactyl\Services\Services\ServiceCreationService
* @var \Pterodactyl\Services\Services\NestCreationService
*/
protected $service;
@ -50,10 +50,10 @@ class ServiceCreationServiceTest extends TestCase
parent::setUp();
$this->config = m::mock(Repository::class);
$this->repository = m::mock(ServiceRepositoryInterface::class);
$this->repository = m::mock(NestRepositoryInterface::class);
$this->uuid = m::mock('overload:' . Uuid::class);
$this->service = new ServiceCreationService($this->config, $this->repository);
$this->service = new NestCreationService($this->config, $this->repository);
}
/**
@ -61,7 +61,7 @@ class ServiceCreationServiceTest extends TestCase
*/
public function testCreateNewService()
{
$model = factory(Service::class)->make();
$model = factory(Nest::class)->make();
$data = [
'name' => $model->name,
'description' => $model->description,
@ -81,7 +81,7 @@ class ServiceCreationServiceTest extends TestCase
], true, true)->once()->andReturn($model);
$response = $this->service->handle($data);
$this->assertInstanceOf(Service::class, $response);
$this->assertInstanceOf(Nest::class, $response);
$this->assertEquals($model, $response);
}
}

View file

@ -12,10 +12,10 @@ namespace Tests\Unit\Services\Services;
use Exception;
use Mockery as m;
use Tests\TestCase;
use Pterodactyl\Services\Services\ServiceDeletionService;
use Pterodactyl\Services\Services\NestDeletionService;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Exceptions\Service\HasActiveServersException;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
class ServiceDeletionServiceTest extends TestCase
{
@ -25,12 +25,12 @@ class ServiceDeletionServiceTest extends TestCase
protected $serverRepository;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
protected $repository;
/**
* @var \Pterodactyl\Services\Services\ServiceDeletionService
* @var \Pterodactyl\Services\Services\NestDeletionService
*/
protected $service;
@ -42,9 +42,9 @@ class ServiceDeletionServiceTest extends TestCase
parent::setUp();
$this->serverRepository = m::mock(ServerRepositoryInterface::class);
$this->repository = m::mock(ServiceRepositoryInterface::class);
$this->repository = m::mock(NestRepositoryInterface::class);
$this->service = new ServiceDeletionService($this->serverRepository, $this->repository);
$this->service = new NestDeletionService($this->serverRepository, $this->repository);
}
/**

View file

@ -11,18 +11,18 @@ namespace Tests\Unit\Services\Services;
use Mockery as m;
use Tests\TestCase;
use Pterodactyl\Services\Services\ServiceUpdateService;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Services\Services\NestUpdateService;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
class ServiceUpdateServiceTest extends TestCase
{
/**
* @var \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
protected $repository;
/**
* @var \Pterodactyl\Services\Services\ServiceUpdateService
* @var \Pterodactyl\Services\Services\NestUpdateService
*/
protected $service;
@ -33,9 +33,9 @@ class ServiceUpdateServiceTest extends TestCase
{
parent::setUp();
$this->repository = m::mock(ServiceRepositoryInterface::class);
$this->repository = m::mock(NestRepositoryInterface::class);
$this->service = new ServiceUpdateService($this->repository);
$this->service = new NestUpdateService($this->repository);
}
/**

View file

@ -12,10 +12,10 @@ namespace Tests\Unit\Services\Services\Sharing;
use Mockery as m;
use Carbon\Carbon;
use Tests\TestCase;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\EggVariable;
use Tests\Assertions\NestedObjectAssertionsTrait;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Services\Services\Sharing\ServiceOptionExporterService;
class ServiceOptionExporterServiceTest extends TestCase
@ -28,7 +28,7 @@ class ServiceOptionExporterServiceTest extends TestCase
protected $carbon;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface|\Mockery\Mock
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface|\Mockery\Mock
*/
protected $repository;
@ -46,7 +46,7 @@ class ServiceOptionExporterServiceTest extends TestCase
Carbon::setTestNow(Carbon::now());
$this->carbon = new Carbon();
$this->repository = m::mock(ServiceOptionRepositoryInterface::class);
$this->repository = m::mock(EggRepositoryInterface::class);
$this->service = new ServiceOptionExporterService($this->carbon, $this->repository);
}
@ -56,8 +56,8 @@ class ServiceOptionExporterServiceTest extends TestCase
*/
public function testJsonStructureIsExported()
{
$option = factory(ServiceOption::class)->make();
$option->variables = collect([$variable = factory(ServiceVariable::class)->make()]);
$option = factory(Egg::class)->make();
$option->variables = collect([$variable = factory(EggVariable::class)->make()]);
$this->repository->shouldReceive('getWithExportAttributes')->with($option->id)->once()->andReturn($option);

View file

@ -12,16 +12,16 @@ namespace Tests\Unit\Services\Services\Sharing;
use Mockery as m;
use Tests\TestCase;
use Ramsey\Uuid\Uuid;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\Nest;
use Illuminate\Http\UploadedFile;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Models\EggVariable;
use Illuminate\Database\ConnectionInterface;
use Pterodactyl\Exceptions\PterodactylException;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Services\Services\Sharing\EggImporterService;
use Pterodactyl\Exceptions\Service\Pack\InvalidFileUploadException;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Services\Services\Sharing\ServiceOptionImporterService;
use Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface;
use Pterodactyl\Exceptions\Service\ServiceOption\DuplicateOptionTagException;
@ -38,17 +38,17 @@ class ServiceOptionImporterServiceTest extends TestCase
protected $file;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface|\Mockery\Mock
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface|\Mockery\Mock
*/
protected $repository;
/**
* @var \Pterodactyl\Services\Services\Sharing\ServiceOptionImporterService
* @var \Pterodactyl\Services\Services\Sharing\EggImporterService
*/
protected $service;
/**
* @var \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface|\Mockery\Mock
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface|\Mockery\Mock
*/
protected $serviceRepository;
@ -71,12 +71,12 @@ class ServiceOptionImporterServiceTest extends TestCase
$this->connection = m::mock(ConnectionInterface::class);
$this->file = m::mock(UploadedFile::class);
$this->repository = m::mock(ServiceOptionRepositoryInterface::class);
$this->serviceRepository = m::mock(ServiceRepositoryInterface::class);
$this->repository = m::mock(EggRepositoryInterface::class);
$this->serviceRepository = m::mock(NestRepositoryInterface::class);
$this->serviceVariableRepository = m::mock(ServiceVariableRepositoryInterface::class);
$this->uuid = m::mock('overload:' . Uuid::class);
$this->service = new ServiceOptionImporterService(
$this->service = new EggImporterService(
$this->connection, $this->serviceRepository, $this->repository, $this->serviceVariableRepository
);
}
@ -86,9 +86,9 @@ class ServiceOptionImporterServiceTest extends TestCase
*/
public function testServiceOptionIsImported()
{
$option = factory(ServiceOption::class)->make();
$service = factory(Service::class)->make();
$service->options = collect([factory(ServiceOption::class)->make()]);
$option = factory(Egg::class)->make();
$service = factory(Nest::class)->make();
$service->options = collect([factory(Egg::class)->make()]);
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('isFile')->withNoArgs()->once()->andReturn(true);
@ -98,7 +98,7 @@ class ServiceOptionImporterServiceTest extends TestCase
'name' => $option->name,
'tag' => $option->tag,
'variables' => [
$variable = factory(ServiceVariable::class)->make(),
$variable = factory(EggVariable::class)->make(),
],
]));
$this->serviceRepository->shouldReceive('getWithOptions')->with($service->id)->once()->andReturn($service);
@ -120,7 +120,7 @@ class ServiceOptionImporterServiceTest extends TestCase
$response = $this->service->handle($this->file, $service->id);
$this->assertNotEmpty($response);
$this->assertInstanceOf(ServiceOption::class, $response);
$this->assertInstanceOf(Egg::class, $response);
$this->assertSame($option, $response);
}
@ -179,9 +179,9 @@ class ServiceOptionImporterServiceTest extends TestCase
*/
public function testExceptionIsThrownIfDuplicateTagExists()
{
$option = factory(ServiceOption::class)->make();
$service = factory(Service::class)->make();
$service->options = collect([factory(ServiceOption::class)->make(['tag' => $option->tag])]);
$option = factory(Egg::class)->make();
$service = factory(Nest::class)->make();
$service->options = collect([factory(Egg::class)->make(['tag' => $option->tag])]);
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(true);
$this->file->shouldReceive('isFile')->withNoArgs()->once()->andReturn(true);

View file

@ -11,16 +11,16 @@ namespace Tests\Unit\Services\Services\Variables;
use Mockery as m;
use Tests\TestCase;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Services\Services\Variables\VariableCreationService;
use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface;
class VariableCreationServiceTest extends TestCase
{
/**
* @var \Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
*/
protected $serviceOptionRepository;
@ -41,7 +41,7 @@ class VariableCreationServiceTest extends TestCase
{
parent::setUp();
$this->serviceOptionRepository = m::mock(ServiceOptionRepositoryInterface::class);
$this->serviceOptionRepository = m::mock(EggRepositoryInterface::class);
$this->serviceVariableRepository = m::mock(ServiceVariableRepositoryInterface::class);
$this->service = new VariableCreationService($this->serviceOptionRepository, $this->serviceVariableRepository);
@ -58,9 +58,9 @@ class VariableCreationServiceTest extends TestCase
'user_viewable' => false,
'user_editable' => false,
'env_variable' => 'TEST_VAR_123',
])->once()->andReturn(new ServiceVariable);
])->once()->andReturn(new EggVariable);
$this->assertInstanceOf(ServiceVariable::class, $this->service->handle(1, $data));
$this->assertInstanceOf(EggVariable::class, $this->service->handle(1, $data));
}
/**
@ -75,9 +75,9 @@ class VariableCreationServiceTest extends TestCase
'user_editable' => true,
'env_variable' => 'TEST_VAR_123',
'options' => ['user_viewable', 'user_editable'],
])->once()->andReturn(new ServiceVariable);
])->once()->andReturn(new EggVariable);
$this->assertInstanceOf(ServiceVariable::class, $this->service->handle(1, $data));
$this->assertInstanceOf(EggVariable::class, $this->service->handle(1, $data));
}
/**
@ -96,7 +96,7 @@ class VariableCreationServiceTest extends TestCase
*/
public function testModelCanBePassedInPlaceOfInteger()
{
$model = factory(ServiceOption::class)->make();
$model = factory(Egg::class)->make();
$data = ['env_variable' => 'TEST_VAR_123'];
$this->serviceVariableRepository->shouldReceive('create')->with([
@ -104,9 +104,9 @@ class VariableCreationServiceTest extends TestCase
'user_viewable' => false,
'user_editable' => false,
'env_variable' => 'TEST_VAR_123',
])->once()->andReturn(new ServiceVariable);
])->once()->andReturn(new EggVariable);
$this->assertInstanceOf(ServiceVariable::class, $this->service->handle($model, $data));
$this->assertInstanceOf(EggVariable::class, $this->service->handle($model, $data));
}
/**
@ -117,7 +117,7 @@ class VariableCreationServiceTest extends TestCase
public function reservedNamesProvider()
{
$data = [];
$exploded = explode(',', ServiceVariable::RESERVED_ENV_NAMES);
$exploded = explode(',', EggVariable::RESERVED_ENV_NAMES);
foreach ($exploded as $e) {
$data[] = [$e];
}

View file

@ -12,7 +12,7 @@ namespace Tests\Unit\Services\Services\Variables;
use Exception;
use Mockery as m;
use Tests\TestCase;
use Pterodactyl\Models\ServiceVariable;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Services\Services\Variables\VariableUpdateService;
use Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface;
@ -20,7 +20,7 @@ use Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface;
class VariableUpdateServiceTest extends TestCase
{
/**
* @var \Pterodactyl\Models\ServiceVariable|\Mockery\Mock
* @var \Pterodactyl\Models\EggVariable|\Mockery\Mock
*/
protected $model;
@ -41,7 +41,7 @@ class VariableUpdateServiceTest extends TestCase
{
parent::setUp();
$this->model = factory(ServiceVariable::class)->make();
$this->model = factory(EggVariable::class)->make();
$this->repository = m::mock(ServiceVariableRepositoryInterface::class);
$this->service = new VariableUpdateService($this->repository);
@ -141,7 +141,7 @@ class VariableUpdateServiceTest extends TestCase
public function reservedNamesProvider()
{
$data = [];
$exploded = explode(',', ServiceVariable::RESERVED_ENV_NAMES);
$exploded = explode(',', EggVariable::RESERVED_ENV_NAMES);
foreach ($exploded as $e) {
$data[] = [$e];
}