Update all dependencies (#712)

* update composer.lock

* run pint

* fix phpstan

* update migrations (sqlite `dropForeign`)

* fix migrations

* Reset these back for now

* Alphabetize the rules

* run `php artisan filament:upgrade`

---------

Co-authored-by: Lance Pioch <git@lance.sh>
This commit is contained in:
Boy132 2024-11-22 09:27:57 +01:00 committed by GitHub
parent f33f91698e
commit d555c42644
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
124 changed files with 979 additions and 1428 deletions

View File

@ -65,6 +65,7 @@ class BulkPowerActionCommand extends Command
$bar = $this->output->createProgressBar($count); $bar = $this->output->createProgressBar($count);
$powerRepository = $this->powerRepository; $powerRepository = $this->powerRepository;
// @phpstan-ignore-next-line
$this->getQueryBuilder($servers, $nodes)->each(function (Server $server) use ($action, $powerRepository, &$bar) { $this->getQueryBuilder($servers, $nodes)->each(function (Server $server) use ($action, $powerRepository, &$bar) {
$bar->clear(); $bar->clear();

View File

@ -8,9 +8,7 @@ use Illuminate\Database\Eloquent\Model;
class ActivityLogged extends Event class ActivityLogged extends Event
{ {
public function __construct(public ActivityLog $model) public function __construct(public ActivityLog $model) {}
{
}
public function is(string $event): bool public function is(string $event): bool
{ {

View File

@ -7,7 +7,5 @@ use App\Events\Event;
class DirectLogin extends Event class DirectLogin extends Event
{ {
public function __construct(public User $user, public bool $remember) public function __construct(public User $user, public bool $remember) {}
{
}
} }

View File

@ -12,7 +12,5 @@ class FailedCaptcha extends Event
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(public string $ip, public ?string $message) public function __construct(public string $ip, public ?string $message) {}
{
}
} }

View File

@ -12,7 +12,5 @@ class FailedPasswordReset extends Event
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(public string $ip, public string $email) public function __construct(public string $ip, public string $email) {}
{
}
} }

View File

@ -7,7 +7,5 @@ use App\Events\Event;
class ProvidedAuthenticationToken extends Event class ProvidedAuthenticationToken extends Event
{ {
public function __construct(public User $user, public bool $recovery = false) public function __construct(public User $user, public bool $recovery = false) {}
{
}
} }

View File

@ -2,6 +2,4 @@
namespace App\Events; namespace App\Events;
abstract class Event abstract class Event {}
{
}

View File

@ -13,7 +13,5 @@ class Installed extends Event
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(public Server $server) public function __construct(public Server $server) {}
{
}
} }

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Http\Base;
use App\Exceptions\DisplayException; use App\Exceptions\DisplayException;
class InvalidPasswordProvidedException extends DisplayException class InvalidPasswordProvidedException extends DisplayException {}
{
}

View File

@ -2,6 +2,4 @@
namespace App\Exceptions; namespace App\Exceptions;
class PanelException extends \Exception class PanelException extends \Exception {}
{
}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Repository;
use App\Exceptions\DisplayException; use App\Exceptions\DisplayException;
class DuplicateDatabaseNameException extends DisplayException class DuplicateDatabaseNameException extends DisplayException {}
{
}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Allocation;
use App\Exceptions\DisplayException; use App\Exceptions\DisplayException;
class ServerUsingAllocationException extends DisplayException class ServerUsingAllocationException extends DisplayException {}
{
}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Deployment;
use App\Exceptions\DisplayException; use App\Exceptions\DisplayException;
class NoViableAllocationException extends DisplayException class NoViableAllocationException extends DisplayException {}
{
}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Egg;
use App\Exceptions\DisplayException; use App\Exceptions\DisplayException;
class HasChildrenException extends DisplayException class HasChildrenException extends DisplayException {}
{
}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Egg\Variable;
use App\Exceptions\DisplayException; use App\Exceptions\DisplayException;
class BadValidationRuleException extends DisplayException class BadValidationRuleException extends DisplayException {}
{
}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Egg\Variable;
use App\Exceptions\DisplayException; use App\Exceptions\DisplayException;
class ReservedVariableNameException extends DisplayException class ReservedVariableNameException extends DisplayException {}
{
}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service;
use App\Exceptions\DisplayException; use App\Exceptions\DisplayException;
class InvalidFileUploadException extends DisplayException class InvalidFileUploadException extends DisplayException {}
{
}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Node;
use App\Exceptions\DisplayException; use App\Exceptions\DisplayException;
class ConfigurationNotPersistedException extends DisplayException class ConfigurationNotPersistedException extends DisplayException {}
{
}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Subuser;
use App\Exceptions\DisplayException; use App\Exceptions\DisplayException;
class ServerSubuserExistsException extends DisplayException class ServerSubuserExistsException extends DisplayException {}
{
}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Subuser;
use App\Exceptions\DisplayException; use App\Exceptions\DisplayException;
class UserIsServerOwnerException extends DisplayException class UserIsServerOwnerException extends DisplayException {}
{
}

View File

@ -27,9 +27,7 @@ class BackupManager
/** /**
* BackupManager constructor. * BackupManager constructor.
*/ */
public function __construct(protected Application $app) public function __construct(protected Application $app) {}
{
}
/** /**
* Returns a backup adapter instance. * Returns a backup adapter instance.

View File

@ -289,7 +289,7 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile
if ($token = $data['2facode'] ?? null) { if ($token = $data['2facode'] ?? null) {
$tokens = $this->toggleTwoFactorService->handle($record, $token, true); $tokens = $this->toggleTwoFactorService->handle($record, $token, true);
cache()->set("users.$record->id.2fa.tokens", implode("\n", $tokens), now()->addSeconds(15)); cache()->put("users.$record->id.2fa.tokens", implode("\n", $tokens), now()->addSeconds(15));
$this->redirectRoute('filament.admin.auth.profile', ['tab' => '-2fa-tab']); $this->redirectRoute('filament.admin.auth.profile', ['tab' => '-2fa-tab']);
} }

View File

@ -20,9 +20,7 @@ class BackupRemoteUploadController extends Controller
/** /**
* BackupRemoteUploadController constructor. * BackupRemoteUploadController constructor.
*/ */
public function __construct(private BackupManager $backupManager) public function __construct(private BackupManager $backupManager) {}
{
}
/** /**
* Returns the required presigned urls to upload a backup to S3 cloud storage. * Returns the required presigned urls to upload a backup to S3 cloud storage.

View File

@ -20,9 +20,7 @@ class BackupStatusController extends Controller
/** /**
* BackupStatusController constructor. * BackupStatusController constructor.
*/ */
public function __construct(private BackupManager $backupManager) public function __construct(private BackupManager $backupManager) {}
{
}
/** /**
* Handles updating the state of a backup. * Handles updating the state of a backup.

View File

@ -16,7 +16,7 @@ class ServerContainersController extends Controller
{ {
$status = fluent($request->json()->all())->get('data.new_state'); $status = fluent($request->json()->all())->get('data.new_state');
cache()->set("servers.$server->uuid.container.status", $status, now()->addHour()); cache()->put("servers.$server->uuid.container.status", $status, now()->addHour());
return new JsonResponse([]); return new JsonResponse([]);
} }

View File

@ -23,8 +23,7 @@ class ServerDetailsController extends Controller
protected ConnectionInterface $connection, protected ConnectionInterface $connection,
private ServerConfigurationStructureService $configurationStructureService, private ServerConfigurationStructureService $configurationStructureService,
private EggConfigurationService $eggConfigurationService private EggConfigurationService $eggConfigurationService
) { ) {}
}
/** /**
* Returns details about the server that allows daemon to self-recover and ensure * Returns details about the server that allows daemon to self-recover and ensure

View File

@ -21,8 +21,7 @@ class ServerTransferController extends Controller
public function __construct( public function __construct(
private ConnectionInterface $connection, private ConnectionInterface $connection,
private DaemonServerRepository $daemonServerRepository, private DaemonServerRepository $daemonServerRepository,
) { ) {}
}
/** /**
* The daemon notifies us about a transfer failure. * The daemon notifies us about a transfer failure.

View File

@ -22,9 +22,7 @@ class SftpAuthenticationController extends Controller
{ {
use ThrottlesLogins; use ThrottlesLogins;
public function __construct(protected GetUserPermissionsService $permissions) public function __construct(protected GetUserPermissionsService $permissions) {}
{
}
/** /**
* Authenticate a set of credentials and return the associated server details * Authenticate a set of credentials and return the associated server details

View File

@ -19,8 +19,7 @@ class OAuthController extends Controller
public function __construct( public function __construct(
private AuthManager $auth, private AuthManager $auth,
private UserUpdateService $updateService private UserUpdateService $updateService
) { ) {}
}
/** /**
* Redirect user to the OAuth provider * Redirect user to the OAuth provider

View File

@ -29,8 +29,7 @@ class ResetPasswordController extends Controller
*/ */
public function __construct( public function __construct(
private Hasher $hasher, private Hasher $hasher,
) { ) {}
}
/** /**
* Reset the given user's password. * Reset the given user's password.

View File

@ -11,9 +11,7 @@ class IndexController extends Controller
/** /**
* IndexController constructor. * IndexController constructor.
*/ */
public function __construct(protected ViewFactory $view) public function __construct(protected ViewFactory $view) {}
{
}
/** /**
* Returns listing of user's servers. * Returns listing of user's servers.

View File

@ -16,8 +16,7 @@ class OAuthController extends Controller
*/ */
public function __construct( public function __construct(
private UserUpdateService $updateService private UserUpdateService $updateService
) { ) {}
}
/** /**
* Link a new OAuth * Link a new OAuth

View File

@ -19,9 +19,7 @@ class AuthenticateServerAccess
/** /**
* AuthenticateServerAccess constructor. * AuthenticateServerAccess constructor.
*/ */
public function __construct() public function __construct() {}
{
}
/** /**
* Authenticate that this server exists and is not suspended or marked as installing. * Authenticate that this server exists and is not suspended or marked as installing.

View File

@ -10,9 +10,7 @@ class LanguageMiddleware
/** /**
* LanguageMiddleware constructor. * LanguageMiddleware constructor.
*/ */
public function __construct(private Application $app) public function __construct(private Application $app) {}
{
}
/** /**
* Handle an incoming request and set the user's preferred language. * Handle an incoming request and set the user's preferred language.

View File

@ -10,9 +10,7 @@ class MaintenanceMiddleware
/** /**
* MaintenanceMiddleware constructor. * MaintenanceMiddleware constructor.
*/ */
public function __construct(private ResponseFactory $response) public function __construct(private ResponseFactory $response) {}
{
}
/** /**
* Handle an incoming request. * Handle an incoming request.

View File

@ -10,9 +10,7 @@ class RedirectIfAuthenticated
/** /**
* RedirectIfAuthenticated constructor. * RedirectIfAuthenticated constructor.
*/ */
public function __construct(private AuthManager $authManager) public function __construct(private AuthManager $authManager) {}
{
}
/** /**
* Handle an incoming request. * Handle an incoming request.

View File

@ -11,10 +11,7 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
readonly class VerifyReCaptcha readonly class VerifyReCaptcha
{ {
public function __construct(private Application $app) public function __construct(private Application $app) {}
{
}
public function handle(Request $request, \Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {

View File

@ -2,6 +2,4 @@
namespace App\Http\Requests\Api\Application\Nodes; namespace App\Http\Requests\Api\Application\Nodes;
class GetNodeRequest extends GetNodesRequest class GetNodeRequest extends GetNodesRequest {}
{
}

View File

@ -2,6 +2,4 @@
namespace App\Http\Requests\Api\Application\Roles; namespace App\Http\Requests\Api\Application\Roles;
class UpdateRoleRequest extends StoreRoleRequest class UpdateRoleRequest extends StoreRoleRequest {}
{
}

View File

@ -7,9 +7,7 @@ use Illuminate\View\View;
readonly class AssetComposer readonly class AssetComposer
{ {
public function __construct(private AssetHashService $assetHashService) public function __construct(private AssetHashService $assetHashService) {}
{
}
public function compose(View $view): void public function compose(View $view): void
{ {

View File

@ -18,8 +18,7 @@ class ProcessWebhook implements ShouldQueue
private WebhookConfiguration $webhookConfiguration, private WebhookConfiguration $webhookConfiguration,
private string $eventName, private string $eventName,
private array $data private array $data
) { ) {}
}
public function handle(): void public function handle(): void
{ {

View File

@ -23,10 +23,7 @@ class RunTaskJob extends Job implements ShouldQueue
/** /**
* RunTaskJob constructor. * RunTaskJob constructor.
*/ */
public function __construct(public Task $task, public bool $manualRun = false) public function __construct(public Task $task, public bool $manualRun = false) {}
{
}
/** /**
* Run the job and send actions to the daemon running the server. * Run the job and send actions to the daemon running the server.

View File

@ -17,7 +17,8 @@ class DispatchWebhooks
return WebhookConfiguration::query()->whereJsonContains('events', $eventName)->get(); return WebhookConfiguration::query()->whereJsonContains('events', $eventName)->get();
}); });
foreach ($matchingHooks ?? [] as $webhookConfig) { /** @var WebhookConfiguration $webhookConfig */
foreach ($matchingHooks as $webhookConfig) {
if (in_array($eventName, $webhookConfig->events)) { if (in_array($eventName, $webhookConfig->events)) {
ProcessWebhook::dispatch($webhookConfig, $eventName, $data); ProcessWebhook::dispatch($webhookConfig, $eventName, $data);
} }

View File

@ -8,6 +8,14 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\MassPrunable; use Illuminate\Database\Eloquent\MassPrunable;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/**
* @property string $event
* @property string $endpoint
* @property \Illuminate\Support\Carbon|null $successful_at
* @property array $payload
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
*/
class Webhook extends Model class Webhook extends Model
{ {
use HasFactory, MassPrunable; use HasFactory, MassPrunable;

View File

@ -9,6 +9,14 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\File;
/**
* @property string $endpoint
* @property string $description
* @property array $events
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
*/
class WebhookConfiguration extends Model class WebhookConfiguration extends Model
{ {
use HasFactory, SoftDeletes; use HasFactory, SoftDeletes;

View File

@ -15,9 +15,7 @@ class AccountCreated extends Notification implements ShouldQueue
/** /**
* Create a new notification instance. * Create a new notification instance.
*/ */
public function __construct(public User $user, public ?string $token = null) public function __construct(public User $user, public ?string $token = null) {}
{
}
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.

View File

@ -8,9 +8,7 @@ use Illuminate\Notifications\Messages\MailMessage;
class MailTested extends Notification class MailTested extends Notification
{ {
public function __construct(private User $user) public function __construct(private User $user) {}
{
}
public function via(): array public function via(): array
{ {

View File

@ -14,9 +14,7 @@ class SendPasswordReset extends Notification implements ShouldQueue
/** /**
* Create a new notification instance. * Create a new notification instance.
*/ */
public function __construct(public string $token) public function __construct(public string $token) {}
{
}
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.

View File

@ -23,8 +23,7 @@ class ActivityLogService
protected ActivityLogBatchService $batch, protected ActivityLogBatchService $batch,
protected ActivityLogTargetableService $targetable, protected ActivityLogTargetableService $targetable,
protected ConnectionInterface $connection protected ConnectionInterface $connection
) { ) {}
}
/** /**
* Sets the activity logger as having been caused by an anonymous * Sets the activity logger as having been caused by an anonymous

View File

@ -30,9 +30,7 @@ class AssignmentService
/** /**
* AssignmentService constructor. * AssignmentService constructor.
*/ */
public function __construct(protected ConnectionInterface $connection) public function __construct(protected ConnectionInterface $connection) {}
{
}
/** /**
* Insert allocations into the database and link them to a specific node. * Insert allocations into the database and link them to a specific node.

View File

@ -13,9 +13,7 @@ class FindAssignableAllocationService
/** /**
* FindAssignableAllocationService constructor. * FindAssignableAllocationService constructor.
*/ */
public function __construct(private AssignmentService $service) public function __construct(private AssignmentService $service) {}
{
}
/** /**
* Finds an existing unassigned allocation and attempts to assign it to the given server. If * Finds an existing unassigned allocation and attempts to assign it to the given server. If

View File

@ -19,8 +19,7 @@ class DeleteBackupService
private ConnectionInterface $connection, private ConnectionInterface $connection,
private BackupManager $manager, private BackupManager $manager,
private DaemonBackupRepository $daemonBackupRepository private DaemonBackupRepository $daemonBackupRepository
) { ) {}
}
/** /**
* Deletes a backup from the system. If the backup is stored in S3 a request * Deletes a backup from the system. If the backup is stored in S3 a request

View File

@ -13,9 +13,7 @@ class DownloadLinkService
/** /**
* DownloadLinkService constructor. * DownloadLinkService constructor.
*/ */
public function __construct(private BackupManager $backupManager, private NodeJWTService $jwtService) public function __construct(private BackupManager $backupManager, private NodeJWTService $jwtService) {}
{
}
/** /**
* Returns the URL that allows for a backup to be downloaded by an individual * Returns the URL that allows for a backup to be downloaded by an individual

View File

@ -26,8 +26,7 @@ class InitiateBackupService
private DaemonBackupRepository $daemonBackupRepository, private DaemonBackupRepository $daemonBackupRepository,
private DeleteBackupService $deleteBackupService, private DeleteBackupService $deleteBackupService,
private BackupManager $backupManager private BackupManager $backupManager
) { ) {}
}
/** /**
* Set if the backup should be locked once it is created which will prevent * Set if the backup should be locked once it is created which will prevent

View File

@ -32,8 +32,7 @@ class DatabaseManagementService
public function __construct( public function __construct(
protected ConnectionInterface $connection, protected ConnectionInterface $connection,
protected DynamicDatabaseConnection $dynamic, protected DynamicDatabaseConnection $dynamic,
) { ) {}
}
/** /**
* Generates a unique database name for the given server. This name should be passed through when * Generates a unique database name for the given server. This name should be passed through when

View File

@ -15,8 +15,7 @@ class DatabasePasswordService
public function __construct( public function __construct(
private ConnectionInterface $connection, private ConnectionInterface $connection,
private DynamicDatabaseConnection $dynamic, private DynamicDatabaseConnection $dynamic,
) { ) {}
}
/** /**
* Updates a password for a given database. * Updates a password for a given database.

View File

@ -13,9 +13,7 @@ class DeployServerDatabaseService
/** /**
* DeployServerDatabaseService constructor. * DeployServerDatabaseService constructor.
*/ */
public function __construct(private DatabaseManagementService $managementService) public function __construct(private DatabaseManagementService $managementService) {}
{
}
/** /**
* @throws \Throwable * @throws \Throwable

View File

@ -16,8 +16,7 @@ class HostCreationService
private ConnectionInterface $connection, private ConnectionInterface $connection,
private DatabaseManager $databaseManager, private DatabaseManager $databaseManager,
private DynamicDatabaseConnection $dynamic, private DynamicDatabaseConnection $dynamic,
) { ) {}
}
/** /**
* Create a new database host on the Panel. * Create a new database host on the Panel.

View File

@ -16,8 +16,7 @@ class HostUpdateService
private ConnectionInterface $connection, private ConnectionInterface $connection,
private DatabaseManager $databaseManager, private DatabaseManager $databaseManager,
private DynamicDatabaseConnection $dynamic, private DynamicDatabaseConnection $dynamic,
) { ) {}
}
/** /**
* Update a database host and persist to the database. * Update a database host and persist to the database.

View File

@ -12,9 +12,7 @@ class EggConfigurationService
/** /**
* EggConfigurationService constructor. * EggConfigurationService constructor.
*/ */
public function __construct(private ServerConfigurationStructureService $configurationStructureService) public function __construct(private ServerConfigurationStructureService $configurationStructureService) {}
{
}
/** /**
* Return an Egg file to be used by the Daemon. * Return an Egg file to be used by the Daemon.

View File

@ -25,9 +25,7 @@ class EggImporterService
'server.build.environment.' => 'server.environment.', 'server.build.environment.' => 'server.environment.',
]; ];
public function __construct(protected ConnectionInterface $connection) public function __construct(protected ConnectionInterface $connection) {}
{
}
/** /**
* Take an uploaded JSON file and parse it into a new egg. * Take an uploaded JSON file and parse it into a new egg.

View File

@ -14,9 +14,7 @@ class VariableCreationService
/** /**
* VariableCreationService constructor. * VariableCreationService constructor.
*/ */
public function __construct(private ValidationFactory $validator) public function __construct(private ValidationFactory $validator) {}
{
}
/** /**
* Return the validation factory instance to be used by rule validation * Return the validation factory instance to be used by rule validation

View File

@ -15,9 +15,7 @@ class VariableUpdateService
/** /**
* VariableUpdateService constructor. * VariableUpdateService constructor.
*/ */
public function __construct(private ValidationFactory $validator) public function __construct(private ValidationFactory $validator) {}
{
}
/** /**
* Return the validation factory instance to be used by rule validation * Return the validation factory instance to be used by rule validation

View File

@ -14,8 +14,7 @@ class DeleteFilesService
*/ */
public function __construct( public function __construct(
private DaemonFileRepository $daemonFileRepository private DaemonFileRepository $daemonFileRepository
) { ) {}
}
/** /**
* Deletes the given files. * Deletes the given files.

View File

@ -15,8 +15,7 @@ class NodeAutoDeployService
*/ */
public function __construct( public function __construct(
private readonly KeyCreationService $keyCreationService private readonly KeyCreationService $keyCreationService
) { ) {}
}
/** /**
* Generates a new API key for the logged-in user with only permission to read * Generates a new API key for the logged-in user with only permission to read

View File

@ -13,8 +13,7 @@ class NodeDeletionService
*/ */
public function __construct( public function __construct(
protected Translator $translator protected Translator $translator
) { ) {}
}
/** /**
* Delete a node from the panel if no servers are attached to it. * Delete a node from the panel if no servers are attached to it.

View File

@ -17,8 +17,7 @@ class NodeUpdateService
public function __construct( public function __construct(
private ConnectionInterface $connection, private ConnectionInterface $connection,
private DaemonConfigurationRepository $configurationRepository, private DaemonConfigurationRepository $configurationRepository,
) { ) {}
}
/** /**
* Update the configuration values for a given node on the machine. * Update the configuration values for a given node on the machine.

View File

@ -16,9 +16,7 @@ class ProcessScheduleService
/** /**
* ProcessScheduleService constructor. * ProcessScheduleService constructor.
*/ */
public function __construct(private ConnectionInterface $connection, private Dispatcher $dispatcher, private DaemonServerRepository $serverRepository) public function __construct(private ConnectionInterface $connection, private Dispatcher $dispatcher, private DaemonServerRepository $serverRepository) {}
{
}
/** /**
* Process a schedule and push the first task onto the queue worker. * Process a schedule and push the first task onto the queue worker.

View File

@ -19,8 +19,7 @@ class BuildModificationService
private ConnectionInterface $connection, private ConnectionInterface $connection,
private DaemonServerRepository $daemonServerRepository, private DaemonServerRepository $daemonServerRepository,
private ServerConfigurationStructureService $structureService private ServerConfigurationStructureService $structureService
) { ) {}
}
/** /**
* Change the build details for a specified server. * Change the build details for a specified server.

View File

@ -16,9 +16,7 @@ class DetailsModificationService
/** /**
* DetailsModificationService constructor. * DetailsModificationService constructor.
*/ */
public function __construct(private ConnectionInterface $connection, private DaemonServerRepository $serverRepository) public function __construct(private ConnectionInterface $connection, private DaemonServerRepository $serverRepository) {}
{
}
/** /**
* Update the details for a single server instance. * Update the details for a single server instance.

View File

@ -15,8 +15,7 @@ class ReinstallServerService
public function __construct( public function __construct(
private ConnectionInterface $connection, private ConnectionInterface $connection,
private DaemonServerRepository $daemonServerRepository private DaemonServerRepository $daemonServerRepository
) { ) {}
}
/** /**
* Reinstall a server on the remote daemon. * Reinstall a server on the remote daemon.

View File

@ -10,9 +10,7 @@ class ServerConfigurationStructureService
/** /**
* ServerConfigurationStructureService constructor. * ServerConfigurationStructureService constructor.
*/ */
public function __construct(private EnvironmentService $environment) public function __construct(private EnvironmentService $environment) {}
{
}
/** /**
* Return a configuration array for a specific server when passed a server model. * Return a configuration array for a specific server when passed a server model.

View File

@ -31,8 +31,7 @@ class ServerCreationService
private FindViableNodesService $findViableNodesService, private FindViableNodesService $findViableNodesService,
private ServerDeletionService $serverDeletionService, private ServerDeletionService $serverDeletionService,
private VariableValidatorService $validatorService private VariableValidatorService $validatorService
) { ) {}
}
/** /**
* Create a server on the Panel and trigger a request to the Daemon to begin the server * Create a server on the Panel and trigger a request to the Daemon to begin the server

View File

@ -21,8 +21,7 @@ class ServerDeletionService
private ConnectionInterface $connection, private ConnectionInterface $connection,
private DaemonServerRepository $daemonServerRepository, private DaemonServerRepository $daemonServerRepository,
private DatabaseManagementService $databaseManagementService private DatabaseManagementService $databaseManagementService
) { ) {}
}
/** /**
* Set if the server should be forcibly deleted from the panel (ignoring daemon errors) or not. * Set if the server should be forcibly deleted from the panel (ignoring daemon errors) or not.

View File

@ -17,9 +17,7 @@ class StartupModificationService
/** /**
* StartupModificationService constructor. * StartupModificationService constructor.
*/ */
public function __construct(private ConnectionInterface $connection, private VariableValidatorService $validatorService) public function __construct(private ConnectionInterface $connection, private VariableValidatorService $validatorService) {}
{
}
/** /**
* Process startup modification for a server. * Process startup modification for a server.

View File

@ -20,8 +20,7 @@ class SuspensionService
*/ */
public function __construct( public function __construct(
private DaemonServerRepository $daemonServerRepository private DaemonServerRepository $daemonServerRepository
) { ) {}
}
/** /**
* Suspends a server on the system. * Suspends a server on the system.

View File

@ -22,8 +22,7 @@ class TransferServerService
public function __construct( public function __construct(
private ConnectionInterface $connection, private ConnectionInterface $connection,
private NodeJWTService $nodeJWTService, private NodeJWTService $nodeJWTService,
) { ) {}
}
private function notify(Server $server, Plain $token): void private function notify(Server $server, Plain $token): void
{ {

View File

@ -16,9 +16,7 @@ class VariableValidatorService
/** /**
* VariableValidatorService constructor. * VariableValidatorService constructor.
*/ */
public function __construct(private ValidationFactory $validator) public function __construct(private ValidationFactory $validator) {}
{
}
/** /**
* Validate all of the passed data against the given egg variables. * Validate all of the passed data against the given egg variables.

View File

@ -20,8 +20,7 @@ class SubuserCreationService
public function __construct( public function __construct(
private ConnectionInterface $connection, private ConnectionInterface $connection,
private UserCreationService $userCreationService, private UserCreationService $userCreationService,
) { ) {}
}
/** /**
* Creates a new user on the system and assigns them access to the provided server. * Creates a new user on the system and assigns them access to the provided server.

View File

@ -18,8 +18,7 @@ class ToggleTwoFactorService
public function __construct( public function __construct(
private ConnectionInterface $connection, private ConnectionInterface $connection,
private Google2FA $google2FA, private Google2FA $google2FA,
) { ) {}
}
/** /**
* Toggle 2FA on an account only if the token provided is valid. * Toggle 2FA on an account only if the token provided is valid.

View File

@ -19,8 +19,7 @@ class UserCreationService
private ConnectionInterface $connection, private ConnectionInterface $connection,
private Hasher $hasher, private Hasher $hasher,
private PasswordBroker $passwordBroker, private PasswordBroker $passwordBroker,
) { ) {}
}
/** /**
* Create a new user on the system. * Create a new user on the system.

View File

@ -13,9 +13,7 @@ class UserUpdateService
/** /**
* UserUpdateService constructor. * UserUpdateService constructor.
*/ */
public function __construct(private Hasher $hasher) public function __construct(private Hasher $hasher) {}
{
}
/** /**
* Update the user model instance and return the updated model. * Update the user model instance and return the updated model.

View File

@ -51,7 +51,5 @@ return Application::configure(basePath: dirname(__DIR__))
\Illuminate\Contracts\Console\Kernel::class => \App\Console\Kernel::class, \Illuminate\Contracts\Console\Kernel::class => \App\Console\Kernel::class,
\Illuminate\Contracts\Debug\ExceptionHandler::class => \App\Exceptions\Handler::class, \Illuminate\Contracts\Debug\ExceptionHandler::class => \App\Exceptions\Handler::class,
]) ])
->withExceptions(function (Exceptions $exceptions) { ->withExceptions(function (Exceptions $exceptions) {})
})
->create(); ->create();

1407
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,6 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::table('permissions', function (Blueprint $table) { Schema::table('permissions', function (Blueprint $table) {});
});
} }
}; };

View File

@ -21,7 +21,5 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down(): void public function down(): void {}
{
}
}; };

View File

@ -17,7 +17,5 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down(): void public function down(): void {}
{
}
}; };

View File

@ -12,14 +12,14 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('servers', function (Blueprint $table) { Schema::table('servers', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['node']);
$table->dropForeign('servers_node_foreign'); $table->dropForeign(['owner']);
$table->dropForeign('servers_owner_foreign'); $table->dropForeign(['allocation']);
$table->dropForeign('servers_allocation_foreign'); $table->dropForeign(['service']);
$table->dropForeign('servers_service_foreign'); $table->dropForeign(['option']);
$table->dropForeign('servers_option_foreign'); $table->dropForeign(['pack']);
$table->dropForeign('servers_pack_foreign');
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropIndex('servers_node_foreign'); $table->dropIndex('servers_node_foreign');
$table->dropIndex('servers_owner_foreign'); $table->dropIndex('servers_owner_foreign');
$table->dropIndex('servers_allocation_foreign'); $table->dropIndex('servers_allocation_foreign');
@ -52,13 +52,11 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('servers', function (Blueprint $table) { Schema::table('servers', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['node_id']);
$table->dropForeign(['node_id']); $table->dropForeign(['owner_id']);
$table->dropForeign(['owner_id']); $table->dropForeign(['allocation_id']);
$table->dropForeign(['allocation_id']); $table->dropForeign(['service_id']);
$table->dropForeign(['service_id']); $table->dropForeign(['option_id']);
$table->dropForeign(['option_id']);
}
$table->renameColumn('node_id', 'node'); $table->renameColumn('node_id', 'node');
$table->renameColumn('owner_id', 'owner'); $table->renameColumn('owner_id', 'owner');

View File

@ -12,8 +12,9 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('nodes', function (Blueprint $table) { Schema::table('nodes', function (Blueprint $table) {
$table->dropForeign(['location']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') { if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('nodes_location_foreign');
$table->dropIndex('nodes_location_foreign'); $table->dropIndex('nodes_location_foreign');
} }
@ -28,8 +29,9 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('nodes', function (Blueprint $table) { Schema::table('nodes', function (Blueprint $table) {
$table->dropForeign(['location_id']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') { if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('nodes_location_id_foreign');
$table->dropIndex('nodes_location_id_foreign'); $table->dropIndex('nodes_location_id_foreign');
} }

View File

@ -12,9 +12,10 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('allocations', function (Blueprint $table) { Schema::table('allocations', function (Blueprint $table) {
$table->dropForeign(['node']);
$table->dropForeign(['assigned_to']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') { if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('allocations_node_foreign');
$table->dropForeign('allocations_assigned_to_foreign');
$table->dropIndex('allocations_node_foreign'); $table->dropIndex('allocations_node_foreign');
$table->dropIndex('allocations_assigned_to_foreign'); $table->dropIndex('allocations_assigned_to_foreign');
} }
@ -32,9 +33,10 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('allocations', function (Blueprint $table) { Schema::table('allocations', function (Blueprint $table) {
$table->dropForeign(['node_id']);
$table->dropForeign(['server_id']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') { if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('allocations_node_id_foreign');
$table->dropForeign('allocations_server_id_foreign');
$table->dropIndex('allocations_node_id_foreign'); $table->dropIndex('allocations_node_id_foreign');
$table->dropIndex('allocations_server_id_foreign'); $table->dropIndex('allocations_server_id_foreign');
} }

View File

@ -12,8 +12,9 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('service_options', function (Blueprint $table) { Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign(['parent_service']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') { if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('service_options_parent_service_foreign');
$table->dropIndex('service_options_parent_service_foreign'); $table->dropIndex('service_options_parent_service_foreign');
} }
@ -28,8 +29,9 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('service_options', function (Blueprint $table) { Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign(['service_id']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') { if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('service_options_service_id_foreign');
$table->dropIndex('service_options_service_id_foreign'); $table->dropIndex('service_options_service_id_foreign');
} }

View File

@ -12,8 +12,9 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('service_packs', function (Blueprint $table) { Schema::table('service_packs', function (Blueprint $table) {
$table->dropForeign(['option']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') { if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('service_packs_option_foreign');
$table->dropIndex('service_packs_option_foreign'); $table->dropIndex('service_packs_option_foreign');
} }
@ -28,8 +29,9 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('service_packs', function (Blueprint $table) { Schema::table('service_packs', function (Blueprint $table) {
$table->dropForeign(['option_id']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') { if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('service_packs_option_id_foreign');
$table->dropIndex('service_packs_option_id_foreign'); $table->dropIndex('service_packs_option_id_foreign');
} }

View File

@ -5,6 +5,7 @@ use App\Models\Permission;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration return new class extends Migration
{ {
@ -26,10 +27,12 @@ return new class extends Migration
}); });
Schema::table('permissions', function (Blueprint $table) { Schema::table('permissions', function (Blueprint $table) {
$table->dropForeign(['server_id']);
$table->dropForeign(['user_id']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') { if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('permissions_server_id_foreign');
$table->dropIndex('permissions_server_id_foreign'); $table->dropIndex('permissions_server_id_foreign');
$table->dropForeign('permissions_user_id_foreign');
$table->dropIndex('permissions_user_id_foreign'); $table->dropIndex('permissions_user_id_foreign');
} }

View File

@ -12,9 +12,7 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('node_configuration_tokens', function (Blueprint $table) { Schema::table('node_configuration_tokens', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['node']);
$table->dropForeign(['node']);
}
$table->dropColumn('expires_at'); $table->dropColumn('expires_at');
$table->renameColumn('node', 'node_id'); $table->renameColumn('node', 'node_id');
@ -29,9 +27,7 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('node_configuration_tokens', function (Blueprint $table) { Schema::table('node_configuration_tokens', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['node_id']);
$table->dropForeign(['node_id']);
}
$table->renameColumn('node_id', 'node'); $table->renameColumn('node_id', 'node');
$table->timestamp('expires_at')->after('token'); $table->timestamp('expires_at')->after('token');

View File

@ -11,11 +11,9 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { Schema::table('service_packs', function (Blueprint $table) {
Schema::table('service_packs', function (Blueprint $table) { $table->dropForeign(['option_id']);
$table->dropForeign(['option_id']); });
});
}
Schema::rename('service_packs', 'packs'); Schema::rename('service_packs', 'packs');
@ -29,11 +27,9 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { Schema::table('packs', function (Blueprint $table) {
Schema::table('packs', function (Blueprint $table) { $table->dropForeign(['option_id']);
$table->dropForeign(['option_id']); });
});
}
Schema::rename('packs', 'service_packs'); Schema::rename('packs', 'service_packs');

View File

@ -11,11 +11,9 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { Schema::table('database_servers', function (Blueprint $table) {
Schema::table('database_servers', function (Blueprint $table) { $table->dropForeign(['linked_node']);
$table->dropForeign(['linked_node']); });
});
}
Schema::rename('database_servers', 'database_hosts'); Schema::rename('database_servers', 'database_hosts');
@ -31,11 +29,9 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { Schema::table('database_hosts', function (Blueprint $table) {
Schema::table('database_hosts', function (Blueprint $table) { $table->dropForeign(['node_id']);
$table->dropForeign(['node_id']); });
});
}
Schema::rename('database_hosts', 'database_servers'); Schema::rename('database_hosts', 'database_servers');

View File

@ -12,9 +12,7 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('databases', function (Blueprint $table) { Schema::table('databases', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['db_server']);
$table->dropForeign(['db_server']);
}
$table->renameColumn('db_server', 'database_host_id'); $table->renameColumn('db_server', 'database_host_id');
@ -28,9 +26,7 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('databases', function (Blueprint $table) { Schema::table('databases', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['database_host_id']);
$table->dropForeign(['database_host_id']);
}
$table->renameColumn('database_host_id', 'db_server'); $table->renameColumn('database_host_id', 'db_server');

View File

@ -13,9 +13,7 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('tasks', function (Blueprint $table) { Schema::table('tasks', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['server']);
$table->dropForeign(['server']);
}
$table->renameColumn('server', 'server_id'); $table->renameColumn('server', 'server_id');
$table->unsignedInteger('user_id')->nullable()->after('id'); $table->unsignedInteger('user_id')->nullable()->after('id');
@ -38,10 +36,8 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('tasks', function (Blueprint $table) { Schema::table('tasks', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['server_id']);
$table->dropForeign(['server_id']); $table->dropForeign(['user_id']);
$table->dropForeign(['user_id']);
}
$table->renameColumn('server_id', 'server'); $table->renameColumn('server_id', 'server');
$table->dropColumn('user_id'); $table->dropColumn('user_id');

View File

@ -12,9 +12,7 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('api_permissions', function (Blueprint $table) { Schema::table('api_permissions', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['key_id']);
$table->dropForeign(['key_id']);
}
$table->foreign('key_id')->references('id')->on('api_keys')->onDelete('cascade'); $table->foreign('key_id')->references('id')->on('api_keys')->onDelete('cascade');
}); });
@ -26,9 +24,7 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('api_permissions', function (Blueprint $table) { Schema::table('api_permissions', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['key_id']);
$table->dropForeign(['key_id']);
}
$table->foreign('key_id')->references('id')->on('api_keys'); $table->foreign('key_id')->references('id')->on('api_keys');
}); });

View File

@ -12,18 +12,14 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('permissions', function (Blueprint $table) { Schema::table('permissions', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['subuser_id']);
$table->dropForeign(['subuser_id']);
}
$table->foreign('subuser_id')->references('id')->on('subusers')->onDelete('cascade'); $table->foreign('subuser_id')->references('id')->on('subusers')->onDelete('cascade');
}); });
Schema::table('subusers', function (Blueprint $table) { Schema::table('subusers', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['user_id']);
$table->dropForeign(['user_id']); $table->dropForeign(['server_id']);
$table->dropForeign(['server_id']);
}
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('server_id')->references('id')->on('servers')->onDelete('cascade'); $table->foreign('server_id')->references('id')->on('servers')->onDelete('cascade');
@ -36,19 +32,15 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('subusers', function (Blueprint $table) { Schema::table('subusers', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['user_id']);
$table->dropForeign(['user_id']); $table->dropForeign(['server_id']);
$table->dropForeign(['server_id']);
}
$table->foreign('user_id')->references('id')->on('users'); $table->foreign('user_id')->references('id')->on('users');
$table->foreign('server_id')->references('id')->on('servers'); $table->foreign('server_id')->references('id')->on('servers');
}); });
Schema::table('permissions', function (Blueprint $table) { Schema::table('permissions', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') { $table->dropForeign(['subuser_id']);
$table->dropForeign(['subuser_id']);
}
$table->foreign('subuser_id')->references('id')->on('subusers'); $table->foreign('subuser_id')->references('id')->on('subusers');
}); });

Some files were not shown because too many files have changed in this diff Show More