diff --git a/app/Exceptions/DisplayException.php b/app/Exceptions/DisplayException.php index 6c44c356c..025c45fe5 100644 --- a/app/Exceptions/DisplayException.php +++ b/app/Exceptions/DisplayException.php @@ -14,8 +14,11 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; class DisplayException extends PanelException implements HttpExceptionInterface { public const LEVEL_DEBUG = 'debug'; + public const LEVEL_INFO = 'info'; + public const LEVEL_WARNING = 'warning'; + public const LEVEL_ERROR = 'error'; /** diff --git a/app/Exceptions/Service/User/TwoFactorAuthenticationTokenInvalid.php b/app/Exceptions/Service/User/TwoFactorAuthenticationTokenInvalid.php index d5f09884c..0c058d0d8 100644 --- a/app/Exceptions/Service/User/TwoFactorAuthenticationTokenInvalid.php +++ b/app/Exceptions/Service/User/TwoFactorAuthenticationTokenInvalid.php @@ -7,6 +7,7 @@ use App\Exceptions\DisplayException; class TwoFactorAuthenticationTokenInvalid extends DisplayException { public string $title = 'Invalid 2FA Code'; + public string $icon = 'tabler-2fa'; public function __construct() diff --git a/app/Extensions/DynamicDatabaseConnection.php b/app/Extensions/DynamicDatabaseConnection.php index d14407427..147f78064 100644 --- a/app/Extensions/DynamicDatabaseConnection.php +++ b/app/Extensions/DynamicDatabaseConnection.php @@ -7,7 +7,9 @@ use App\Models\DatabaseHost; class DynamicDatabaseConnection { public const DB_CHARSET = 'utf8'; + public const DB_COLLATION = 'utf8_unicode_ci'; + public const DB_DRIVER = 'mysql'; /** diff --git a/app/Filament/Pages/Settings.php b/app/Filament/Pages/Settings.php index f3ef2c2b9..f8d18a01c 100644 --- a/app/Filament/Pages/Settings.php +++ b/app/Filament/Pages/Settings.php @@ -38,6 +38,7 @@ class Settings extends Page implements HasForms use InteractsWithHeaderActions; protected static ?string $navigationIcon = 'tabler-settings'; + protected static ?string $navigationGroup = 'Advanced'; protected static string $view = 'filament.pages.settings'; diff --git a/app/Filament/Resources/ApiKeyResource.php b/app/Filament/Resources/ApiKeyResource.php index ba2a851ca..11ebc6813 100644 --- a/app/Filament/Resources/ApiKeyResource.php +++ b/app/Filament/Resources/ApiKeyResource.php @@ -9,8 +9,11 @@ use Filament\Resources\Resource; class ApiKeyResource extends Resource { protected static ?string $model = ApiKey::class; + protected static ?string $label = 'API Key'; + protected static ?string $navigationIcon = 'tabler-key'; + protected static ?string $navigationGroup = 'Advanced'; public static function getNavigationBadge(): ?string diff --git a/app/Filament/Resources/DatabaseHostResource.php b/app/Filament/Resources/DatabaseHostResource.php index 7576fbc3a..790895983 100644 --- a/app/Filament/Resources/DatabaseHostResource.php +++ b/app/Filament/Resources/DatabaseHostResource.php @@ -13,6 +13,7 @@ class DatabaseHostResource extends Resource protected static ?string $label = 'Database Host'; protected static ?string $navigationIcon = 'tabler-database'; + protected static ?string $navigationGroup = 'Advanced'; public static function getNavigationBadge(): ?string diff --git a/app/Filament/Resources/DatabaseHostResource/RelationManagers/DatabasesRelationManager.php b/app/Filament/Resources/DatabaseHostResource/RelationManagers/DatabasesRelationManager.php index 4dfcdd955..13b32602f 100644 --- a/app/Filament/Resources/DatabaseHostResource/RelationManagers/DatabasesRelationManager.php +++ b/app/Filament/Resources/DatabaseHostResource/RelationManagers/DatabasesRelationManager.php @@ -40,6 +40,7 @@ class DatabasesRelationManager extends RelationManager ->formatStateUsing(fn (Get $get, Database $database) => 'jdbc:mysql://' . $get('username') . ':' . urlencode($database->password) . '@' . $database->host->host . ':' . $database->host->port . '/' . $get('database')), ]); } + public function table(Table $table): Table { return $table diff --git a/app/Filament/Resources/DatabaseResource.php b/app/Filament/Resources/DatabaseResource.php index 92580dfdf..912f6fe93 100644 --- a/app/Filament/Resources/DatabaseResource.php +++ b/app/Filament/Resources/DatabaseResource.php @@ -13,6 +13,7 @@ class DatabaseResource extends Resource protected static ?string $navigationIcon = 'tabler-database'; protected static bool $shouldRegisterNavigation = false; + protected static ?string $navigationGroup = 'Advanced'; public static function getNavigationBadge(): ?string diff --git a/app/Filament/Resources/EggResource/Pages/CreateEgg.php b/app/Filament/Resources/EggResource/Pages/CreateEgg.php index a663540cb..4ec91ea24 100644 --- a/app/Filament/Resources/EggResource/Pages/CreateEgg.php +++ b/app/Filament/Resources/EggResource/Pages/CreateEgg.php @@ -27,6 +27,7 @@ class CreateEgg extends CreateRecord protected static string $resource = EggResource::class; protected static bool $canCreateAnother = false; + public function form(Form $form): Form { return $form diff --git a/app/Filament/Resources/EggResource/Pages/ListEggs.php b/app/Filament/Resources/EggResource/Pages/ListEggs.php index 792eaa162..a7f84b274 100644 --- a/app/Filament/Resources/EggResource/Pages/ListEggs.php +++ b/app/Filament/Resources/EggResource/Pages/ListEggs.php @@ -97,6 +97,7 @@ class ListEggs extends ListRecords ]), ]); } + protected function getHeaderActions(): array { return [ diff --git a/app/Filament/Resources/MountResource.php b/app/Filament/Resources/MountResource.php index a2d7a187e..a30f586e1 100644 --- a/app/Filament/Resources/MountResource.php +++ b/app/Filament/Resources/MountResource.php @@ -11,6 +11,7 @@ class MountResource extends Resource protected static ?string $model = Mount::class; protected static ?string $navigationIcon = 'tabler-layers-linked'; + protected static ?string $navigationGroup = 'Advanced'; public static function getNavigationBadge(): ?string diff --git a/app/Filament/Resources/MountResource/Pages/EditMount.php b/app/Filament/Resources/MountResource/Pages/EditMount.php index 71c6febb5..e44fb581b 100644 --- a/app/Filament/Resources/MountResource/Pages/EditMount.php +++ b/app/Filament/Resources/MountResource/Pages/EditMount.php @@ -96,6 +96,7 @@ class EditMount extends EditRecord 'lg' => 2, ]); } + protected function getHeaderActions(): array { return [ diff --git a/app/Filament/Resources/MountResource/Pages/ListMounts.php b/app/Filament/Resources/MountResource/Pages/ListMounts.php index d39c5d972..10bfbc6dd 100644 --- a/app/Filament/Resources/MountResource/Pages/ListMounts.php +++ b/app/Filament/Resources/MountResource/Pages/ListMounts.php @@ -17,6 +17,7 @@ use Filament\Tables\Table; class ListMounts extends ListRecords { protected static string $resource = MountResource::class; + public function table(Table $table): Table { return $table @@ -56,6 +57,7 @@ class ListMounts extends ListRecords ->button(), ]); } + protected function getHeaderActions(): array { return [ diff --git a/app/Filament/Resources/NodeResource/Widgets/NodeCpuChart.php b/app/Filament/Resources/NodeResource/Widgets/NodeCpuChart.php index 476b8b533..89d1cb254 100644 --- a/app/Filament/Resources/NodeResource/Widgets/NodeCpuChart.php +++ b/app/Filament/Resources/NodeResource/Widgets/NodeCpuChart.php @@ -12,6 +12,7 @@ use Illuminate\Support\Number; class NodeCpuChart extends ChartWidget { protected static ?string $pollingInterval = '5s'; + protected static ?string $maxHeight = '300px'; public ?Model $record = null; diff --git a/app/Filament/Resources/NodeResource/Widgets/NodeMemoryChart.php b/app/Filament/Resources/NodeResource/Widgets/NodeMemoryChart.php index 9d75fd116..0cabbed51 100644 --- a/app/Filament/Resources/NodeResource/Widgets/NodeMemoryChart.php +++ b/app/Filament/Resources/NodeResource/Widgets/NodeMemoryChart.php @@ -12,6 +12,7 @@ use Illuminate\Support\Number; class NodeMemoryChart extends ChartWidget { protected static ?string $pollingInterval = '5s'; + protected static ?string $maxHeight = '300px'; public ?Model $record = null; diff --git a/app/Filament/Resources/NodeResource/Widgets/NodeStorageChart.php b/app/Filament/Resources/NodeResource/Widgets/NodeStorageChart.php index b841d84ef..61db8c98d 100644 --- a/app/Filament/Resources/NodeResource/Widgets/NodeStorageChart.php +++ b/app/Filament/Resources/NodeResource/Widgets/NodeStorageChart.php @@ -9,7 +9,9 @@ use Illuminate\Database\Eloquent\Model; class NodeStorageChart extends ChartWidget { protected static ?string $heading = 'Storage'; + protected static ?string $pollingInterval = '60s'; + protected static ?string $maxHeight = '300px'; public ?Model $record = null; diff --git a/app/Filament/Resources/ServerResource/Pages/CreateServer.php b/app/Filament/Resources/ServerResource/Pages/CreateServer.php index c1f6aa22e..b8ac8a520 100644 --- a/app/Filament/Resources/ServerResource/Pages/CreateServer.php +++ b/app/Filament/Resources/ServerResource/Pages/CreateServer.php @@ -45,6 +45,7 @@ use LogicException; class CreateServer extends CreateRecord { protected static string $resource = ServerResource::class; + protected static bool $canCreateAnother = false; public ?Node $node = null; diff --git a/app/Filament/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Resources/ServerResource/Pages/EditServer.php index 51a59591d..267fd998f 100644 --- a/app/Filament/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Resources/ServerResource/Pages/EditServer.php @@ -741,6 +741,7 @@ class EditServer extends EditRecord ]); } + protected function getHeaderActions(): array { return [ @@ -763,6 +764,7 @@ class EditServer extends EditRecord ]; } + protected function getFormActions(): array { return []; diff --git a/app/Filament/Resources/ServerResource/Pages/ListServers.php b/app/Filament/Resources/ServerResource/Pages/ListServers.php index 326499898..dd6fc4a16 100644 --- a/app/Filament/Resources/ServerResource/Pages/ListServers.php +++ b/app/Filament/Resources/ServerResource/Pages/ListServers.php @@ -96,6 +96,7 @@ class ListServers extends ListRecords ->button(), ]); } + protected function getHeaderActions(): array { return [ diff --git a/app/Filament/Resources/UserResource/Pages/EditUser.php b/app/Filament/Resources/UserResource/Pages/EditUser.php index 777f20d73..3fa6a5571 100644 --- a/app/Filament/Resources/UserResource/Pages/EditUser.php +++ b/app/Filament/Resources/UserResource/Pages/EditUser.php @@ -18,6 +18,7 @@ use Illuminate\Support\Facades\Hash; class EditUser extends EditRecord { protected static string $resource = UserResource::class; + public function form(Form $form): Form { return $form @@ -46,6 +47,7 @@ class EditUser extends EditRecord ])->columns(), ]); } + protected function getHeaderActions(): array { return [ diff --git a/app/Filament/Resources/UserResource/Pages/ListUsers.php b/app/Filament/Resources/UserResource/Pages/ListUsers.php index 3d9a1af18..c386d4ce6 100644 --- a/app/Filament/Resources/UserResource/Pages/ListUsers.php +++ b/app/Filament/Resources/UserResource/Pages/ListUsers.php @@ -78,6 +78,7 @@ class ListUsers extends ListRecords ]), ]); } + protected function getHeaderActions(): array { return [ diff --git a/app/Http/Controllers/Admin/Nodes/NodeViewController.php b/app/Http/Controllers/Admin/Nodes/NodeViewController.php index 95dc7ede0..115b7b6b1 100644 --- a/app/Http/Controllers/Admin/Nodes/NodeViewController.php +++ b/app/Http/Controllers/Admin/Nodes/NodeViewController.php @@ -15,6 +15,7 @@ class NodeViewController extends Controller use JavascriptInjection; public const THRESHOLD_PERCENTAGE_LOW = 75; + public const THRESHOLD_PERCENTAGE_MEDIUM = 90; /** diff --git a/app/Http/Middleware/RequireTwoFactorAuthentication.php b/app/Http/Middleware/RequireTwoFactorAuthentication.php index 470cc73b3..58ff1564d 100644 --- a/app/Http/Middleware/RequireTwoFactorAuthentication.php +++ b/app/Http/Middleware/RequireTwoFactorAuthentication.php @@ -10,7 +10,9 @@ use App\Exceptions\Http\TwoFactorAuthRequiredException; class RequireTwoFactorAuthentication { public const LEVEL_NONE = 0; + public const LEVEL_ADMIN = 1; + public const LEVEL_ALL = 2; /** diff --git a/app/Jobs/NodeStatistics.php b/app/Jobs/NodeStatistics.php index 19fae9b9d..9546f0ba0 100644 --- a/app/Jobs/NodeStatistics.php +++ b/app/Jobs/NodeStatistics.php @@ -42,5 +42,4 @@ class NodeStatistics implements ShouldQueue } } } - } diff --git a/app/Livewire/NodeSystemInformation.php b/app/Livewire/NodeSystemInformation.php index b29190251..4f2a5de0a 100644 --- a/app/Livewire/NodeSystemInformation.php +++ b/app/Livewire/NodeSystemInformation.php @@ -8,6 +8,7 @@ use Livewire\Component; class NodeSystemInformation extends Component { public Node $node; + public string $sizeClasses; public function render() diff --git a/app/Models/ActivityLogSubject.php b/app/Models/ActivityLogSubject.php index 037d344f0..b4b31e58f 100644 --- a/app/Models/ActivityLogSubject.php +++ b/app/Models/ActivityLogSubject.php @@ -25,6 +25,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; class ActivityLogSubject extends Pivot { public $incrementing = true; + public $timestamps = false; protected $table = 'activity_log_subjects'; diff --git a/app/Models/ApiKey.php b/app/Models/ApiKey.php index 52d78a97b..96c714f24 100644 --- a/app/Models/ApiKey.php +++ b/app/Models/ApiKey.php @@ -63,21 +63,28 @@ class ApiKey extends Model * API representation using fractal. */ public const RESOURCE_NAME = 'api_key'; + /** * Different API keys that can exist on the system. */ public const TYPE_NONE = 0; + public const TYPE_ACCOUNT = 1; + /* @deprecated */ public const TYPE_APPLICATION = 2; + /* @deprecated */ public const TYPE_DAEMON_USER = 3; + /* @deprecated */ public const TYPE_DAEMON_APPLICATION = 4; + /** * The length of API key identifiers. */ public const IDENTIFIER_LENGTH = 16; + /** * The length of the actual API key that is encrypted and stored * in the database. diff --git a/app/Models/Backup.php b/app/Models/Backup.php index 3f2a931d1..d6e4be65a 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -32,6 +32,7 @@ class Backup extends Model public const RESOURCE_NAME = 'backup'; public const ADAPTER_DAEMON = 'wings'; + public const ADAPTER_AWS_S3 = 's3'; protected $table = 'backups'; diff --git a/app/Models/Egg.php b/app/Models/Egg.php index e8c672064..001be85e3 100644 --- a/app/Models/Egg.php +++ b/app/Models/Egg.php @@ -70,6 +70,7 @@ class Egg extends Model * than leaving it null. */ public const FEATURE_EULA_POPUP = 'eula'; + public const FEATURE_FASTDL = 'fastdl'; /** diff --git a/app/Models/Node.php b/app/Models/Node.php index 0a9613196..da5416091 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -53,6 +53,7 @@ class Node extends Model public const RESOURCE_NAME = 'node'; public const DAEMON_TOKEN_ID_LENGTH = 16; + public const DAEMON_TOKEN_LENGTH = 64; /** @@ -135,7 +136,9 @@ class Node extends Model } public int $servers_sum_memory = 0; + public int $servers_sum_disk = 0; + public int $servers_sum_cpu = 0; public function getRouteKeyName(): string diff --git a/app/Models/Objects/DeploymentObject.php b/app/Models/Objects/DeploymentObject.php index b7a4ebaf3..692ca7487 100644 --- a/app/Models/Objects/DeploymentObject.php +++ b/app/Models/Objects/DeploymentObject.php @@ -45,5 +45,4 @@ class DeploymentObject return $this; } - } diff --git a/app/Models/Permission.php b/app/Models/Permission.php index ab9fef260..29cbd826d 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -16,51 +16,81 @@ class Permission extends Model * Constants defining different permissions available. */ public const ACTION_WEBSOCKET_CONNECT = 'websocket.connect'; + public const ACTION_CONTROL_CONSOLE = 'control.console'; + public const ACTION_CONTROL_START = 'control.start'; + public const ACTION_CONTROL_STOP = 'control.stop'; + public const ACTION_CONTROL_RESTART = 'control.restart'; public const ACTION_DATABASE_READ = 'database.read'; + public const ACTION_DATABASE_CREATE = 'database.create'; + public const ACTION_DATABASE_UPDATE = 'database.update'; + public const ACTION_DATABASE_DELETE = 'database.delete'; + public const ACTION_DATABASE_VIEW_PASSWORD = 'database.view_password'; public const ACTION_SCHEDULE_READ = 'schedule.read'; + public const ACTION_SCHEDULE_CREATE = 'schedule.create'; + public const ACTION_SCHEDULE_UPDATE = 'schedule.update'; + public const ACTION_SCHEDULE_DELETE = 'schedule.delete'; public const ACTION_USER_READ = 'user.read'; + public const ACTION_USER_CREATE = 'user.create'; + public const ACTION_USER_UPDATE = 'user.update'; + public const ACTION_USER_DELETE = 'user.delete'; public const ACTION_BACKUP_READ = 'backup.read'; + public const ACTION_BACKUP_CREATE = 'backup.create'; + public const ACTION_BACKUP_DELETE = 'backup.delete'; + public const ACTION_BACKUP_DOWNLOAD = 'backup.download'; + public const ACTION_BACKUP_RESTORE = 'backup.restore'; public const ACTION_ALLOCATION_READ = 'allocation.read'; + public const ACTION_ALLOCATION_CREATE = 'allocation.create'; + public const ACTION_ALLOCATION_UPDATE = 'allocation.update'; + public const ACTION_ALLOCATION_DELETE = 'allocation.delete'; public const ACTION_FILE_READ = 'file.read'; + public const ACTION_FILE_READ_CONTENT = 'file.read-content'; + public const ACTION_FILE_CREATE = 'file.create'; + public const ACTION_FILE_UPDATE = 'file.update'; + public const ACTION_FILE_DELETE = 'file.delete'; + public const ACTION_FILE_ARCHIVE = 'file.archive'; + public const ACTION_FILE_SFTP = 'file.sftp'; public const ACTION_STARTUP_READ = 'startup.read'; + public const ACTION_STARTUP_UPDATE = 'startup.update'; + public const ACTION_STARTUP_DOCKER_IMAGE = 'startup.docker-image'; public const ACTION_SETTINGS_RENAME = 'settings.rename'; + public const ACTION_SETTINGS_REINSTALL = 'settings.reinstall'; public const ACTION_ACTIVITY_READ = 'activity.read'; diff --git a/app/Models/Task.php b/app/Models/Task.php index 254d38ece..202a3165a 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -31,8 +31,11 @@ class Task extends Model * The default actions that can exist for a task */ public const ACTION_POWER = 'power'; + public const ACTION_COMMAND = 'command'; + public const ACTION_BACKUP = 'backup'; + public const ACTION_DELETE_FILES = 'delete_files'; /** diff --git a/app/Models/User.php b/app/Models/User.php index 395f4994f..3b4eff193 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -99,6 +99,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac use Notifiable; public const USER_LEVEL_USER = 0; + public const USER_LEVEL_ADMIN = 1; /** diff --git a/app/Services/Acl/Api/AdminAcl.php b/app/Services/Acl/Api/AdminAcl.php index dd58e317c..90ec6480a 100644 --- a/app/Services/Acl/Api/AdminAcl.php +++ b/app/Services/Acl/Api/AdminAcl.php @@ -17,7 +17,9 @@ class AdminAcl * implements a read/write/none permissions scheme for all endpoints. */ public const NONE = 0; + public const READ = 1; + public const WRITE = 2; /** @@ -25,13 +27,21 @@ class AdminAcl * set for each key. These are stored in the database as r_{resource}. */ public const RESOURCE_SERVERS = 'servers'; + public const RESOURCE_NODES = 'nodes'; + public const RESOURCE_ALLOCATIONS = 'allocations'; + public const RESOURCE_USERS = 'users'; + public const RESOURCE_EGGS = 'eggs'; + public const RESOURCE_DATABASE_HOSTS = 'database_hosts'; + public const RESOURCE_SERVER_DATABASES = 'server_databases'; + public const RESOURCE_MOUNTS = 'mounts'; + public const RESOURCE_ROLES = 'roles'; /** diff --git a/app/Services/Activity/ActivityLogBatchService.php b/app/Services/Activity/ActivityLogBatchService.php index cb2e91b5c..df237286f 100644 --- a/app/Services/Activity/ActivityLogBatchService.php +++ b/app/Services/Activity/ActivityLogBatchService.php @@ -7,6 +7,7 @@ use Ramsey\Uuid\Uuid; class ActivityLogBatchService { protected int $transaction = 0; + protected ?string $uuid = null; /** diff --git a/app/Services/Allocations/AssignmentService.php b/app/Services/Allocations/AssignmentService.php index 33ed4aa74..be4c04131 100644 --- a/app/Services/Allocations/AssignmentService.php +++ b/app/Services/Allocations/AssignmentService.php @@ -16,10 +16,15 @@ use App\Exceptions\Service\Allocation\TooManyPortsInRangeException; class AssignmentService { public const CIDR_MAX_BITS = 25; + public const CIDR_MIN_BITS = 32; + public const PORT_FLOOR = 1024; + public const PORT_CEIL = 65535; + public const PORT_RANGE_LIMIT = 1000; + public const PORT_RANGE_REGEX = '/^(\d{4,5})-(\d{4,5})$/'; /** diff --git a/app/Services/Servers/ServerConfigurationStructureService.php b/app/Services/Servers/ServerConfigurationStructureService.php index 43b8c9736..7ac714ed5 100644 --- a/app/Services/Servers/ServerConfigurationStructureService.php +++ b/app/Services/Servers/ServerConfigurationStructureService.php @@ -93,5 +93,4 @@ class ServerConfigurationStructureService return $response; } - } diff --git a/app/Services/Servers/SuspensionService.php b/app/Services/Servers/SuspensionService.php index aef02b7b2..b175bccb6 100644 --- a/app/Services/Servers/SuspensionService.php +++ b/app/Services/Servers/SuspensionService.php @@ -12,6 +12,7 @@ use Symfony\Component\HttpKernel\Exception\ConflictHttpException; class SuspensionService { public const ACTION_SUSPEND = 'suspend'; + public const ACTION_UNSUSPEND = 'unsuspend'; /** diff --git a/pint.json b/pint.json index 4d7ccf113..17de52db6 100644 --- a/pint.json +++ b/pint.json @@ -1,7 +1,6 @@ { "preset": "laravel", "rules": { - "class_attributes_separation": false, "concat_space": false, "not_operator_with_successor_space": false, "nullable_type_declaration_for_default_null_value": false,