Merge branch 'develop' into feature/upgrade-laravel-to-5.6
This commit is contained in:
commit
7e2e5fd7c1
129 changed files with 234 additions and 202 deletions
|
@ -58,7 +58,7 @@ class AppSettingsCommand extends Command
|
|||
* @var string
|
||||
*/
|
||||
protected $signature = 'p:environment:setup
|
||||
{--new-salt : Wether or not to generate a new salt for Hashids.}
|
||||
{--new-salt : Whether or not to generate a new salt for Hashids.}
|
||||
{--author= : The email that services created on this instance should be linked to.}
|
||||
{--url= : The URL that this Panel is running on.}
|
||||
{--timezone= : The timezone to use for Panel times.}
|
||||
|
|
|
@ -59,6 +59,7 @@ class EmailSettingsCommand extends Command
|
|||
|
||||
/**
|
||||
* Handle command execution.
|
||||
* @throws \Pterodactyl\Exceptions\PterodactylException
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
|
|
@ -84,7 +84,7 @@ class InfoCommand extends Command
|
|||
['Host', $this->config->get("database.connections.{$driver}.host")],
|
||||
['Port', $this->config->get("database.connections.{$driver}.port")],
|
||||
['Database', $this->config->get("database.connections.{$driver}.database")],
|
||||
['Usernamne', $this->config->get("database.connections.{$driver}.username")],
|
||||
['Username', $this->config->get("database.connections.{$driver}.username")],
|
||||
], 'compact');
|
||||
|
||||
$this->output->title('Email Configuration');
|
||||
|
|
|
@ -31,8 +31,8 @@ class BulkPowerActionCommand extends Command
|
|||
*/
|
||||
protected $signature = 'p:server:bulk-power
|
||||
{action : The action to perform (start, stop, restart, kill)}
|
||||
{--servers= : A comma seperated list of servers.}
|
||||
{--nodes= : A comma seperated list of nodes.}';
|
||||
{--servers= : A comma separated list of servers.}
|
||||
{--nodes= : A comma separated list of nodes.}';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
|
|
@ -59,7 +59,7 @@ interface AllocationRepositoryInterface extends RepositoryInterface
|
|||
public function getAssignedAllocationIds(int $server): array;
|
||||
|
||||
/**
|
||||
* Return a concated result set of node ips that already have at least one
|
||||
* Return a concatenated result set of node ips that already have at least one
|
||||
* server assigned to that IP. This allows for filtering out sets for
|
||||
* dedicated allocation IPs.
|
||||
*
|
||||
|
|
|
@ -62,7 +62,7 @@ interface ServerRepositoryInterface extends BaseRepositoryInterface
|
|||
public function delete(): ResponseInterface;
|
||||
|
||||
/**
|
||||
* Return detials on a specific server.
|
||||
* Return details on a specific server.
|
||||
*
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,7 @@ interface DatabaseRepositoryInterface extends RepositoryInterface
|
|||
public function setConnection(string $connection);
|
||||
|
||||
/**
|
||||
* Return the connection to execute statements aganist.
|
||||
* Return the connection to execute statements against.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -57,5 +57,5 @@ interface EggRepositoryInterface extends RepositoryInterface
|
|||
* @param int $service
|
||||
* @return bool
|
||||
*/
|
||||
public function isCopiableScript(int $copyFromId, int $service): bool;
|
||||
public function isCopyableScript(int $copyFromId, int $service): bool;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ interface RepositoryInterface
|
|||
public function getBuilder();
|
||||
|
||||
/**
|
||||
* Returns the colummns to be selected or returned by the query.
|
||||
* Returns the columns to be selected or returned by the query.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -59,7 +59,7 @@ interface RepositoryInterface
|
|||
public function withFreshModel();
|
||||
|
||||
/**
|
||||
* Set wether or not the repository should return a fresh model
|
||||
* Set whether or not the repository should return a fresh model
|
||||
* when changes are committed.
|
||||
*
|
||||
* @param bool $fresh
|
||||
|
|
|
@ -119,7 +119,7 @@ interface ServerRepositoryInterface extends RepositoryInterface, SearchableInter
|
|||
public function getByUuid(string $uuid): Server;
|
||||
|
||||
/**
|
||||
* Return all of the servers that should have a power action performed aganist them.
|
||||
* Return all of the servers that should have a power action performed against them.
|
||||
*
|
||||
* @param int[] $servers
|
||||
* @param int[] $nodes
|
||||
|
|
|
@ -41,7 +41,7 @@ class EggRetrievalController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Return a JSON array of Eggs and the SHA1 hash of thier configuration file.
|
||||
* Return a JSON array of Eggs and the SHA1 hash of their configuration file.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
|
|
|
@ -65,6 +65,7 @@ class ApiController extends Controller
|
|||
* Render view allowing an admin to create a new application API key.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function create(): View
|
||||
{
|
||||
|
|
|
@ -103,7 +103,6 @@ class LocationController extends Controller
|
|||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
* @throws \Watson\Validating\ValidationException
|
||||
*/
|
||||
public function create(LocationFormRequest $request)
|
||||
{
|
||||
|
@ -121,7 +120,6 @@ class LocationController extends Controller
|
|||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
* @throws \Watson\Validating\ValidationException
|
||||
*/
|
||||
public function update(LocationFormRequest $request, Location $location)
|
||||
{
|
||||
|
|
|
@ -90,10 +90,11 @@ class EggVariableController extends Controller
|
|||
* Handle a request to create a new Egg variable.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggVariableFormRequest $request
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException
|
||||
*/
|
||||
public function store(EggVariableFormRequest $request, Egg $egg): RedirectResponse
|
||||
|
|
|
@ -462,6 +462,7 @@ class ServersController extends Controller
|
|||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function rebuildContainer(Server $server)
|
||||
{
|
||||
|
@ -536,11 +537,12 @@ class ServersController extends Controller
|
|||
/**
|
||||
* Update the startup command as well as variables.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
|
|
@ -76,6 +76,8 @@ class AdvancedController extends Controller
|
|||
/**
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Settings\AdvancedSettingsFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function update(AdvancedSettingsFormRequest $request): RedirectResponse
|
||||
{
|
||||
|
|
|
@ -74,6 +74,8 @@ class IndexController extends Controller
|
|||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\Settings\BaseSettingsFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function update(BaseSettingsFormRequest $request): RedirectResponse
|
||||
{
|
||||
|
|
|
@ -83,7 +83,9 @@ class MailController extends Controller
|
|||
* @param \Pterodactyl\Http\Requests\Admin\Settings\MailSettingsFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function update(MailSettingsFormRequest $request): RedirectResponse
|
||||
{
|
||||
|
|
|
@ -96,7 +96,7 @@ class SecurityController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Verifies that 2FA token recieved is valid and will work on the account.
|
||||
* Verifies that 2FA token received is valid and will work on the account.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
|
|
|
@ -101,7 +101,7 @@ class FileActionsController extends Controller
|
|||
{
|
||||
$server = $request->attributes->get('server');
|
||||
|
||||
$dirname = pathinfo($file, PATHINFO_DIRNAME);
|
||||
$dirname = str_replace('\\', '/', pathinfo($file, PATHINFO_DIRNAME));
|
||||
try {
|
||||
$content = $this->repository->setServer($server)->setToken($request->attributes->get('server_token'))->getContent($file);
|
||||
} catch (RequestException $exception) {
|
||||
|
|
|
@ -111,7 +111,7 @@ class Kernel extends HttpKernel
|
|||
|
||||
// Server specific middleware (used for authenticating access to resources)
|
||||
//
|
||||
// These are only used for individual server authentication, and not gloabl
|
||||
// These are only used for individual server authentication, and not global
|
||||
// actions from other resources. They are defined in the route files.
|
||||
'server..database' => DatabaseBelongsToServer::class,
|
||||
'server..subuser' => SubuserBelongsToServer::class,
|
||||
|
|
|
@ -10,7 +10,7 @@ class AuthenticateApplicationUser
|
|||
{
|
||||
/**
|
||||
* Authenticate that the currently authenticated user is an administrator
|
||||
* and should be allowed to proceede through the application API.
|
||||
* and should be allowed to proceed through the application API.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
|
|
|
@ -25,7 +25,7 @@ class RequireTwoFactorAuthentication
|
|||
private $alert;
|
||||
|
||||
/**
|
||||
* The names of routes that should be accessable without 2FA enabled.
|
||||
* The names of routes that should be accessible without 2FA enabled.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
|
|
@ -33,7 +33,7 @@ class AuthenticateAsSubuser
|
|||
}
|
||||
|
||||
/**
|
||||
* Determine if a subuser has permissions to access a server, if so set thier access token.
|
||||
* Determine if a subuser has permissions to access a server, if so set their access token.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
|
|
|
@ -10,13 +10,15 @@ class StoreApplicationApiKeyRequest extends AdminFormRequest
|
|||
{
|
||||
/**
|
||||
* @return array
|
||||
* @throws \ReflectionException
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$modelRules = ApiKey::getCreateRules();
|
||||
|
||||
return collect(AdminAcl::getResourceList())->mapWithKeys(function ($resource) use ($modelRules) {
|
||||
return [AdminAcl::COLUMN_IDENTIFER . $resource => $modelRules['r_' . $resource]];
|
||||
return [AdminAcl::COLUMN_IDENTIFIER . $resource => $modelRules['r_' . $resource]];
|
||||
})->merge(['memo' => $modelRules['memo']])->toArray();
|
||||
}
|
||||
|
||||
|
@ -33,7 +35,7 @@ class StoreApplicationApiKeyRequest extends AdminFormRequest
|
|||
public function getKeyPermissions(): array
|
||||
{
|
||||
return collect($this->validated())->filter(function ($value, $key) {
|
||||
return substr($key, 0, strlen(AdminAcl::COLUMN_IDENTIFER)) === AdminAcl::COLUMN_IDENTIFER;
|
||||
return substr($key, 0, strlen(AdminAcl::COLUMN_IDENTIFIER)) === AdminAcl::COLUMN_IDENTIFIER;
|
||||
})->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use Pterodactyl\Http\Requests\Admin\AdminFormRequest;
|
|||
class MailSettingsFormRequest extends AdminFormRequest
|
||||
{
|
||||
/**
|
||||
* Return rules to validate mail settings POST data aganist.
|
||||
* Return rules to validate mail settings POST data against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -38,7 +38,7 @@ abstract class ApplicationApiRequest extends FormRequest
|
|||
|
||||
/**
|
||||
* Determine if the current user is authorized to perform
|
||||
* the requested action aganist the API.
|
||||
* the requested action against the API.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
|
|
|
@ -19,7 +19,7 @@ class StoreLocationRequest extends ApplicationApiRequest
|
|||
protected $permission = AdminAcl::WRITE;
|
||||
|
||||
/**
|
||||
* Rules to validate the request aganist.
|
||||
* Rules to validate the request against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -20,7 +20,7 @@ class UpdateLocationRequest extends StoreLocationRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Rules to validate this request aganist.
|
||||
* Rules to validate this request against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@ use Pterodactyl\Models\Server;
|
|||
class UpdateServerBuildConfigurationRequest extends ServerWriteRequest
|
||||
{
|
||||
/**
|
||||
* Return the rules to validate this request aganist.
|
||||
* Return the rules to validate this request against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,7 @@ class UpdateServerStartupRequest extends ApplicationApiRequest
|
|||
protected $permission = AdminAcl::WRITE;
|
||||
|
||||
/**
|
||||
* Validation rules to run the input aganist.
|
||||
* Validation rules to run the input against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ abstract class ClientApiRequest extends ApplicationApiRequest
|
|||
{
|
||||
/**
|
||||
* Determine if the current user is authorized to perform
|
||||
* the requested action aganist the API.
|
||||
* the requested action against the API.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
@ -17,7 +17,7 @@ class SendCommandRequest extends GetServerRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Rules to validate this request aganist.
|
||||
* Rules to validate this request against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -18,7 +18,7 @@ class SendPowerRequest extends ClientApiRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Rules to validate this request aganist.
|
||||
* Rules to validate this request against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@ use Pterodactyl\Http\Requests\FrontendUserFormRequest;
|
|||
class StoreAccountKeyRequest extends FrontendUserFormRequest
|
||||
{
|
||||
/**
|
||||
* Rules to validate the request input aganist before storing
|
||||
* Rules to validate the request input against before storing
|
||||
* an account API key.
|
||||
*
|
||||
* @return array
|
||||
|
|
|
@ -19,7 +19,7 @@ class DeleteServerDatabaseRequest extends ServerFormRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the user permission to validate this request aganist.
|
||||
* Return the user permission to validate this request against.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -29,7 +29,7 @@ class DeleteServerDatabaseRequest extends ServerFormRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Rules to validate this request aganist.
|
||||
* Rules to validate this request against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,7 @@ class StoreServerDatabaseRequest extends ServerFormRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the user permission to validate this request aganist.
|
||||
* Return the user permission to validate this request against.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -29,7 +29,7 @@ class StoreServerDatabaseRequest extends ServerFormRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Rules to validate this request aganist.
|
||||
* Rules to validate this request against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Pterodactyl\Http\Requests\Server;
|
|||
class ScheduleCreationFormRequest extends ServerFormRequest
|
||||
{
|
||||
/**
|
||||
* Permission to validate this request aganist.
|
||||
* Permission to validate this request against.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ use Pterodactyl\Http\Requests\FrontendUserFormRequest;
|
|||
abstract class ServerFormRequest extends FrontendUserFormRequest
|
||||
{
|
||||
/**
|
||||
* Return the user permission to validate this request aganist.
|
||||
* Return the user permission to validate this request against.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@ use Pterodactyl\Http\Requests\Server\ServerFormRequest;
|
|||
class SubuserStoreFormRequest extends ServerFormRequest
|
||||
{
|
||||
/**
|
||||
* Return the user permission to validate this request aganist.
|
||||
* Return the user permission to validate this request against.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -17,7 +17,7 @@ class SubuserStoreFormRequest extends ServerFormRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* The rules to validate this request submission aganist.
|
||||
* The rules to validate this request submission against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@ use Pterodactyl\Http\Requests\Server\ServerFormRequest;
|
|||
class SubuserUpdateFormRequest extends ServerFormRequest
|
||||
{
|
||||
/**
|
||||
* Return the user permission to validate this request aganist.
|
||||
* Return the user permission to validate this request against.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -17,7 +17,7 @@ class SubuserUpdateFormRequest extends ServerFormRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* The rules to validate this request submission aganist.
|
||||
* The rules to validate this request submission against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -20,7 +20,7 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
|
|||
class UpdateFileContentsFormRequest extends ServerFormRequest
|
||||
{
|
||||
/**
|
||||
* Return the permission string to validate this request aganist.
|
||||
* Return the permission string to validate this request against.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -92,7 +92,7 @@ class RunTaskJob extends Job implements ShouldQueue
|
|||
return;
|
||||
}
|
||||
|
||||
// Perform the provided task aganist the daemon.
|
||||
// Perform the provided task against the daemon.
|
||||
switch ($task->action) {
|
||||
case 'power':
|
||||
$this->powerRepository->setServer($server)
|
||||
|
|
|
@ -95,7 +95,7 @@ class ApiKey extends Model implements CleansAttributes, ValidableContract
|
|||
];
|
||||
|
||||
/**
|
||||
* Rules to protect aganist invalid data entry to DB.
|
||||
* Rules to protect against invalid data entry to DB.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
|
|
@ -90,7 +90,7 @@ class DatabaseHost extends Model implements CleansAttributes, ValidableContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the databases assocaited with this host.
|
||||
* Gets the databases associated with this host.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
|
|
|
@ -82,6 +82,7 @@ class EggVariable extends Model implements CleansAttributes, ValidableContract
|
|||
];
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return bool
|
||||
*/
|
||||
public function getRequiredAttribute($value)
|
||||
|
|
|
@ -53,7 +53,7 @@ class Location extends Model implements CleansAttributes, ValidableContract
|
|||
];
|
||||
|
||||
/**
|
||||
* Gets the nodes in a specificed location.
|
||||
* Gets the nodes in a specified location.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
|
|
|
@ -188,7 +188,7 @@ class User extends Model implements
|
|||
}
|
||||
|
||||
/**
|
||||
* Store the username as a lowecase string.
|
||||
* Store the username as a lowercase string.
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
|
@ -198,7 +198,7 @@ class User extends Model implements
|
|||
}
|
||||
|
||||
/**
|
||||
* Return a concated result for the accounts full name.
|
||||
* Return a concatenated result for the accounts full name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -17,8 +17,6 @@ class AuthServiceProvider extends ServiceProvider
|
|||
|
||||
/**
|
||||
* Register any application authentication / authorization services.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ class HashidsServiceProvider extends ServiceProvider
|
|||
return new Hashids(
|
||||
$config->get('hashids.salt', ''),
|
||||
$config->get('hashids.length', 0),
|
||||
$config->get('hashids.alphabet', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')
|
||||
$config->get('hashids.alphabet', 'abcdefghijkmlnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ class CommandRepository extends BaseRepository implements CommandRepositoryInter
|
|||
*
|
||||
* @param string $command
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function send(string $command): ResponseInterface
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ class ConfigurationRepository extends BaseRepository implements ConfigurationRep
|
|||
*
|
||||
* @param array $overrides
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function update(array $overrides = []): ResponseInterface
|
||||
{
|
||||
|
|
|
@ -14,11 +14,11 @@ class FileRepository extends BaseRepository implements FileRepositoryInterface
|
|||
* @param string $path
|
||||
* @return \stdClass
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function getFileStat(string $path): stdClass
|
||||
{
|
||||
$file = pathinfo($path);
|
||||
$file = str_replace('\\', '/', pathinfo($path));
|
||||
$file['dirname'] = in_array($file['dirname'], ['.', './', '/']) ? null : trim($file['dirname'], '/') . '/';
|
||||
|
||||
$response = $this->getHttpClient()->request('GET', sprintf(
|
||||
|
@ -35,11 +35,11 @@ class FileRepository extends BaseRepository implements FileRepositoryInterface
|
|||
* @param string $path
|
||||
* @return string
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function getContent(string $path): string
|
||||
{
|
||||
$file = pathinfo($path);
|
||||
$file = str_replace('\\', '/', pathinfo($path));
|
||||
$file['dirname'] = in_array($file['dirname'], ['.', './', '/']) ? null : trim($file['dirname'], '/') . '/';
|
||||
|
||||
$response = $this->getHttpClient()->request('GET', sprintf(
|
||||
|
@ -57,11 +57,11 @@ class FileRepository extends BaseRepository implements FileRepositoryInterface
|
|||
* @param string $content
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function putContent(string $path, string $content): ResponseInterface
|
||||
{
|
||||
$file = pathinfo($path);
|
||||
$file = str_replace('\\', '/', pathinfo($path));
|
||||
$file['dirname'] = in_array($file['dirname'], ['.', './', '/']) ? null : trim($file['dirname'], '/') . '/';
|
||||
|
||||
return $this->getHttpClient()->request('POST', 'server/file/save', [
|
||||
|
@ -78,7 +78,7 @@ class FileRepository extends BaseRepository implements FileRepositoryInterface
|
|||
* @param string $path
|
||||
* @return array
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function getDirectory(string $path): array
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ class FileRepository extends BaseRepository implements FileRepositoryInterface
|
|||
array_push($files, [
|
||||
'entry' => $value->name,
|
||||
'directory' => trim($path, '/'),
|
||||
'extension' => pathinfo($value->name, PATHINFO_EXTENSION),
|
||||
'extension' => str_replace('\\', '/', pathinfo($value->name, PATHINFO_EXTENSION)),
|
||||
'size' => human_readable($value->size),
|
||||
'date' => strtotime($value->modified),
|
||||
'mime' => $value->mime,
|
||||
|
|
|
@ -14,7 +14,8 @@ class PowerRepository extends BaseRepository implements PowerRepositoryInterface
|
|||
* @param string $signal
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\Daemon\InvalidPowerSignalException
|
||||
* @throws InvalidPowerSignalException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function sendSignal(string $signal): ResponseInterface
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa
|
|||
* @param array $overrides
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function create(array $structure, array $overrides = []): ResponseInterface
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa
|
|||
*
|
||||
* @param array $data
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function update(array $data): ResponseInterface
|
||||
{
|
||||
|
@ -46,6 +47,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa
|
|||
*
|
||||
* @param array|null $data
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function reinstall(array $data = null): ResponseInterface
|
||||
{
|
||||
|
@ -58,6 +60,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa
|
|||
* Mark a server as needing a container rebuild the next time the server is booted.
|
||||
*
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function rebuild(): ResponseInterface
|
||||
{
|
||||
|
@ -68,6 +71,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa
|
|||
* Suspend a server on the daemon.
|
||||
*
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function suspend(): ResponseInterface
|
||||
{
|
||||
|
@ -78,6 +82,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa
|
|||
* Un-suspend a server on the daemon.
|
||||
*
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function unsuspend(): ResponseInterface
|
||||
{
|
||||
|
@ -88,6 +93,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa
|
|||
* Delete a server on the daemon.
|
||||
*
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
|
@ -95,9 +101,10 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa
|
|||
}
|
||||
|
||||
/**
|
||||
* Return detials on a specific server.
|
||||
* Return details on a specific server.
|
||||
*
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function details(): ResponseInterface
|
||||
{
|
||||
|
@ -110,7 +117,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa
|
|||
* @param string|array $key
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\RequestException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function revokeAccessKey($key): ResponseInterface
|
||||
{
|
||||
|
|
|
@ -97,7 +97,7 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos
|
|||
}
|
||||
|
||||
/**
|
||||
* Return a concated result set of node ips that already have at least one
|
||||
* Return a concatenated result set of node ips that already have at least one
|
||||
* server assigned to that IP. This allows for filtering out sets for
|
||||
* dedicated allocation IPs.
|
||||
*
|
||||
|
|
|
@ -59,7 +59,7 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the connection to execute statements aganist.
|
||||
* Return the connection to execute statements against.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -92,7 +92,7 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface
|
|||
* @param int $service
|
||||
* @return bool
|
||||
*/
|
||||
public function isCopiableScript(int $copyFromId, int $service): bool
|
||||
public function isCopyableScript(int $copyFromId, int $service): bool
|
||||
{
|
||||
return $this->getBuilder()->whereNull('copy_script_from')
|
||||
->where('id', '=', $copyFromId)
|
||||
|
|
|
@ -265,7 +265,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
|
|||
}
|
||||
|
||||
/**
|
||||
* Return all of the servers that should have a power action performed aganist them.
|
||||
* Return all of the servers that should have a power action performed against them.
|
||||
*
|
||||
* @param int[] $servers
|
||||
* @param int[] $nodes
|
||||
|
|
|
@ -37,7 +37,7 @@ abstract class Repository implements RepositoryInterface
|
|||
{
|
||||
$this->app = $application;
|
||||
|
||||
$this->initalizeModel($this->model());
|
||||
$this->initializeModel($this->model());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,7 +103,7 @@ abstract class Repository implements RepositoryInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Set wether or not the repository should return a fresh model
|
||||
* Set whether or not the repository should return a fresh model
|
||||
* when changes are committed.
|
||||
*
|
||||
* @param bool $fresh
|
||||
|
@ -123,7 +123,7 @@ abstract class Repository implements RepositoryInterface
|
|||
* @param array $model
|
||||
* @return mixed
|
||||
*/
|
||||
protected function initalizeModel(...$model)
|
||||
protected function initializeModel(...$model)
|
||||
{
|
||||
switch (count($model)) {
|
||||
case 1:
|
||||
|
@ -131,7 +131,7 @@ abstract class Repository implements RepositoryInterface
|
|||
case 2:
|
||||
return $this->model = call_user_func([$this->app->make($model[0]), $model[1]]);
|
||||
default:
|
||||
throw new InvalidArgumentException('Model must be a FQCN or an array with a count of two.');
|
||||
throw new InvalidArgumentException('Model must be a FQDN or an array with a count of two.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ class AdminAcl
|
|||
{
|
||||
/**
|
||||
* Resource permission columns in the api_keys table begin
|
||||
* with this identifer.
|
||||
* with this identifier.
|
||||
*/
|
||||
const COLUMN_IDENTIFER = 'r_';
|
||||
const COLUMN_IDENTIFIER = 'r_';
|
||||
|
||||
/**
|
||||
* The different types of permissions available for API keys. This
|
||||
|
@ -63,13 +63,14 @@ class AdminAcl
|
|||
*/
|
||||
public static function check(ApiKey $key, string $resource, int $action = self::READ)
|
||||
{
|
||||
return self::can(data_get($key, self::COLUMN_IDENTIFER . $resource, self::NONE), $action);
|
||||
return self::can(data_get($key, self::COLUMN_IDENTIFIER . $resource, self::NONE), $action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all resource constants defined in this ACL.
|
||||
*
|
||||
* @return array
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public static function getResourceList(): array
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ class KeyCreationService
|
|||
|
||||
/**
|
||||
* Create a new API key for the Panel using the permissions passed in the data request.
|
||||
* This will automatically generate an identifer and an encrypted token that are
|
||||
* This will automatically generate an identifier and an encrypted token that are
|
||||
* stored in the database.
|
||||
*
|
||||
* @param array $data
|
||||
|
|
|
@ -88,7 +88,7 @@ class FindViableNodesService
|
|||
* attempt to find all nodes in the defined locations that meet the disk and
|
||||
* memory availability requirements. Any nodes not meeting those requirements
|
||||
* are tossed out, as are any nodes marked as non-public, meaning automatic
|
||||
* deployments should not be done aganist them.
|
||||
* deployments should not be done against them.
|
||||
*
|
||||
* @return int[]
|
||||
* @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException
|
||||
|
|
|
@ -15,7 +15,7 @@ use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
|
|||
use Illuminate\Contracts\Config\Repository as ConfigRepository;
|
||||
use Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException;
|
||||
|
||||
// When a mommy and a daddy pterodactyl really like eachother...
|
||||
// When a mommy and a daddy pterodactyl really like each other...
|
||||
class EggCreationService
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,7 @@ class InstallScriptService
|
|||
}
|
||||
|
||||
if (! is_null(array_get($data, 'copy_script_from'))) {
|
||||
if (! $this->repository->isCopiableScript(array_get($data, 'copy_script_from'), $egg->nest_id)) {
|
||||
if (! $this->repository->isCopyableScript(array_get($data, 'copy_script_from'), $egg->nest_id)) {
|
||||
throw new InvalidCopyFromException(trans('exceptions.nest.egg.invalid_copy_id'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class StartupCommandViewService
|
|||
|
||||
/**
|
||||
* Generate a startup command for a server and return all of the user-viewable variables
|
||||
* as well as thier assigned values.
|
||||
* as well as their assigned values.
|
||||
*
|
||||
* @param int $server
|
||||
* @return \Illuminate\Support\Collection
|
||||
|
|
|
@ -63,7 +63,7 @@ class VariableValidatorService
|
|||
}
|
||||
|
||||
/**
|
||||
* Validate all of the passed data aganist the given service option variables.
|
||||
* Validate all of the passed data against the given service option variables.
|
||||
*
|
||||
* @param int $egg
|
||||
* @param array $fields
|
||||
|
|
|
@ -52,7 +52,7 @@ class AuthenticateUsingPasswordService
|
|||
}
|
||||
|
||||
/**
|
||||
* Attempt to authenticate a provded username and password and determine if they
|
||||
* Attempt to authenticate a provided username and password and determine if they
|
||||
* have permission to access a given server. This function does not account for
|
||||
* subusers currently. Only administrators and server owners can login to access
|
||||
* their files at this time.
|
||||
|
|
|
@ -47,7 +47,7 @@ class UserUpdateService
|
|||
|
||||
/**
|
||||
* Update the user model instance. If the user has been removed as an administrator
|
||||
* revoke all of the authentication tokens that have beenn assigned to their account.
|
||||
* revoke all of the authentication tokens that have been assigned to their account.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @param array $data
|
||||
|
|
|
@ -46,6 +46,7 @@ class AllocationTransformer extends BaseTransformer
|
|||
*
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeNode(Allocation $allocation)
|
||||
{
|
||||
|
@ -65,6 +66,7 @@ class AllocationTransformer extends BaseTransformer
|
|||
*
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeServer(Allocation $allocation)
|
||||
{
|
||||
|
|
|
@ -55,6 +55,7 @@ class DatabaseHostTransformer extends BaseTransformer
|
|||
*
|
||||
* @param \Pterodactyl\Models\DatabaseHost $model
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeDatabases(DatabaseHost $model)
|
||||
{
|
||||
|
|
|
@ -70,6 +70,7 @@ class EggTransformer extends BaseTransformer
|
|||
*
|
||||
* @param \Pterodactyl\Models\Egg $model
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeNest(Egg $model)
|
||||
{
|
||||
|
@ -87,6 +88,7 @@ class EggTransformer extends BaseTransformer
|
|||
*
|
||||
* @param \Pterodactyl\Models\Egg $model
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeServers(Egg $model)
|
||||
{
|
||||
|
@ -154,6 +156,7 @@ class EggTransformer extends BaseTransformer
|
|||
*
|
||||
* @param \Pterodactyl\Models\Egg $model
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeVariables(Egg $model)
|
||||
{
|
||||
|
|
|
@ -52,6 +52,7 @@ class NodeTransformer extends BaseTransformer
|
|||
*
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeAllocations(Node $node)
|
||||
{
|
||||
|
@ -71,6 +72,7 @@ class NodeTransformer extends BaseTransformer
|
|||
*
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeLocation(Node $node)
|
||||
{
|
||||
|
@ -90,6 +92,7 @@ class NodeTransformer extends BaseTransformer
|
|||
*
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeServers(Node $node)
|
||||
{
|
||||
|
|
|
@ -85,6 +85,7 @@ class ServerDatabaseTransformer extends BaseTransformer
|
|||
*
|
||||
* @param \Pterodactyl\Models\Database $model
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeHost(Database $model)
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ class ServerVariableTransformer extends BaseTransformer
|
|||
*
|
||||
* @param \Pterodactyl\Models\ServerVariable $variable
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeParent(ServerVariable $variable)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue