From 02d7ad04adf95259762353f0a6df629cb9a88fa2 Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Sat, 12 Apr 2025 16:44:24 +0200 Subject: [PATCH 01/18] Fix `serverVariables` not saving due to `join` (#1235) * Fix `serverVariables` not saving due to `join` * Remove deprecated `viewableServerVariables` --- .../Resources/ServerResource/Pages/CreateServer.php | 2 +- .../Admin/Resources/ServerResource/Pages/EditServer.php | 4 +--- app/Filament/Server/Pages/Startup.php | 3 ++- .../Controllers/Api/Client/Servers/StartupController.php | 2 +- app/Models/Server.php | 9 --------- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php b/app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php index 6508c42f6..51d62cfc5 100644 --- a/app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php +++ b/app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php @@ -426,7 +426,7 @@ class CreateServer extends CreateRecord Repeater::make('server_variables') ->label('') - ->relationship('serverVariables') + ->relationship('serverVariables', fn (Builder $query) => $query->orderByPowerJoins('variable.sort')) ->saveRelationshipsBeforeChildrenUsing(null) ->saveRelationshipsUsing(null) ->grid(2) diff --git a/app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php index 87e61954e..cb811b540 100644 --- a/app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php @@ -595,9 +595,7 @@ class EditServer extends EditRecord ]); } - return $query - ->join('egg_variables', 'server_variables.variable_id', '=', 'egg_variables.id') - ->orderBy('egg_variables.sort'); + return $query->orderByPowerJoins('variable.sort'); }) ->grid() ->mutateRelationshipDataBeforeSaveUsing(function (array &$data): array { diff --git a/app/Filament/Server/Pages/Startup.php b/app/Filament/Server/Pages/Startup.php index 6275e0437..d95704a5a 100644 --- a/app/Filament/Server/Pages/Startup.php +++ b/app/Filament/Server/Pages/Startup.php @@ -18,6 +18,7 @@ use Filament\Forms\Components\Textarea; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Notifications\Notification; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Facades\Validator; class Startup extends ServerFormPage @@ -100,7 +101,7 @@ class Startup extends ServerFormPage ->schema([ Repeater::make('server_variables') ->label('') - ->relationship('viewableServerVariables') + ->relationship('serverVariables', fn (Builder $query) => $query->where('egg_variables.user_viewable', true)->orderByPowerJoins('variable.sort')) ->grid() ->disabled(fn () => !auth()->user()->can(Permission::ACTION_STARTUP_UPDATE, $server)) ->reorderable(false)->addable(false)->deletable(false) diff --git a/app/Http/Controllers/Api/Client/Servers/StartupController.php b/app/Http/Controllers/Api/Client/Servers/StartupController.php index 0e09ae202..5b8c1a26c 100644 --- a/app/Http/Controllers/Api/Client/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Client/Servers/StartupController.php @@ -37,7 +37,7 @@ class StartupController extends ClientApiController $startup = $this->startupCommandService->handle($server); return $this->fractal->collection( - $server->variables()->orderBy('sort')->where('user_viewable', true)->get() + $server->variables()->where('user_viewable', true)->orderBy('sort')->get() ) ->transformWith($this->getTransformer(EggVariableTransformer::class)) ->addMeta([ diff --git a/app/Models/Server.php b/app/Models/Server.php index 9d61c4310..6285079ed 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -310,15 +310,6 @@ class Server extends Model implements Validatable return $this->hasMany(ServerVariable::class); } - /** @deprecated use serverVariables */ - public function viewableServerVariables(): HasMany - { - return $this->serverVariables() - ->join('egg_variables', 'egg_variables.id', '=', 'server_variables.variable_id') - ->orderBy('egg_variables.sort') - ->where('egg_variables.user_viewable', true); - } - /** * Gets information for the node associated with this server. */ From 702a6bb750ae8acb818d31ad827591970a136f10 Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Sat, 12 Apr 2025 16:44:46 +0200 Subject: [PATCH 02/18] Restore `exception_handler` & `error_handler` for Tests (#1239) --- tests/TestCase.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/TestCase.php b/tests/TestCase.php index d789400e3..ac07330fb 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -42,6 +42,9 @@ abstract class TestCase extends BaseTestCase */ protected function tearDown(): void { + restore_exception_handler(); + restore_error_handler(); + parent::tearDown(); Carbon::setTestNow(); From 8221c80ec28a50a336486d23a1c74376ac442e96 Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Sun, 13 Apr 2025 02:27:36 +0200 Subject: [PATCH 03/18] Only allow `image/png` mimetype for Avatar (#1246) --- app/Filament/Pages/Auth/EditProfile.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Filament/Pages/Auth/EditProfile.php b/app/Filament/Pages/Auth/EditProfile.php index cdb55c725..82822b7d6 100644 --- a/app/Filament/Pages/Auth/EditProfile.php +++ b/app/Filament/Pages/Auth/EditProfile.php @@ -130,6 +130,7 @@ class EditProfile extends BaseEditProfile FileUpload::make('avatar') ->visible(fn () => config('panel.filament.avatar-provider') === 'local') ->avatar() + ->acceptedFileTypes(['image/png']) ->directory('avatars') ->getUploadedFileNameForStorageUsing(fn () => $this->getUser()->id . '.png'), ]), From 3ffbf9e46ada9460a7976a0c19c5bce278c8fb2e Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Sun, 13 Apr 2025 02:29:46 +0200 Subject: [PATCH 04/18] Allow users to remove their `Avatar` (#1247) --- app/Filament/Pages/Auth/EditProfile.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Filament/Pages/Auth/EditProfile.php b/app/Filament/Pages/Auth/EditProfile.php index 82822b7d6..5ad30f707 100644 --- a/app/Filament/Pages/Auth/EditProfile.php +++ b/app/Filament/Pages/Auth/EditProfile.php @@ -132,7 +132,16 @@ class EditProfile extends BaseEditProfile ->avatar() ->acceptedFileTypes(['image/png']) ->directory('avatars') - ->getUploadedFileNameForStorageUsing(fn () => $this->getUser()->id . '.png'), + ->getUploadedFileNameForStorageUsing(fn () => $this->getUser()->id . '.png') + ->hintAction(function (FileUpload $fileUpload) { + $path = $fileUpload->getDirectory() . '/' . $this->getUser()->id . '.png'; + + return Action::make('remove_avatar') + ->icon('tabler-photo-minus') + ->iconButton() + ->hidden(fn () => !$fileUpload->getDisk()->exists($path)) + ->action(fn () => $fileUpload->getDisk()->delete($path)); + }), ]), Tab::make(trans('profile.tabs.oauth')) From cb245dc722ceb34048b5c23cfb8de8404a85b98a Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Sun, 13 Apr 2025 02:30:09 +0200 Subject: [PATCH 05/18] Use recommended PHP `8.4` for Docker (#1245) --- Dockerfile.base | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.base b/Dockerfile.base index 082a54c63..466d4a9da 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -1,10 +1,10 @@ # ================================ # Stage 0: Build PHP Base Image # ================================ -FROM --platform=$TARGETOS/$TARGETARCH php:8.3-fpm-alpine +FROM --platform=$TARGETOS/$TARGETARCH php:8.4-fpm-alpine ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ RUN install-php-extensions bcmath gd intl zip opcache pcntl posix pdo_mysql -RUN rm /usr/local/bin/install-php-extensions \ No newline at end of file +RUN rm /usr/local/bin/install-php-extensions From 2a3781f5a8dd80a19c5cf682dfdbe8557349b0ba Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Sun, 13 Apr 2025 02:34:27 +0200 Subject: [PATCH 06/18] Add `pdo_pgsql` to Docker (#1244) --- Dockerfile.base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.base b/Dockerfile.base index 466d4a9da..42b6923cf 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -5,6 +5,6 @@ FROM --platform=$TARGETOS/$TARGETARCH php:8.4-fpm-alpine ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ -RUN install-php-extensions bcmath gd intl zip opcache pcntl posix pdo_mysql +RUN install-php-extensions bcmath gd intl zip opcache pcntl posix pdo_mysql pdo_pgsql RUN rm /usr/local/bin/install-php-extensions From f23d4d6971c6f9b6e92358366bcf1cfa7b273256 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Mon, 14 Apr 2025 12:57:38 +0200 Subject: [PATCH 07/18] Fix action in notifications (#1257) --- app/Notifications/AddedToServer.php | 3 ++- app/Notifications/RemovedFromServer.php | 2 +- app/Notifications/ServerInstalled.php | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Notifications/AddedToServer.php b/app/Notifications/AddedToServer.php index 0979225a7..07af25443 100644 --- a/app/Notifications/AddedToServer.php +++ b/app/Notifications/AddedToServer.php @@ -2,6 +2,7 @@ namespace App\Notifications; +use App\Filament\Server\Pages\Console; use App\Models\Server; use App\Models\User; use Illuminate\Bus\Queueable; @@ -27,6 +28,6 @@ class AddedToServer extends Notification implements ShouldQueue ->greeting('Hello ' . $notifiable->username . '!') ->line('You have been added as a subuser for the following server, allowing you certain control over the server.') ->line('Server Name: ' . $this->server->name) - ->action('Visit Server', url('/server/' . $this->server->uuid_short)); + ->action('Visit Server', Console::getUrl(panel: 'server', tenant: $this->server)); } } diff --git a/app/Notifications/RemovedFromServer.php b/app/Notifications/RemovedFromServer.php index aa2717638..bc16d3c9a 100644 --- a/app/Notifications/RemovedFromServer.php +++ b/app/Notifications/RemovedFromServer.php @@ -28,6 +28,6 @@ class RemovedFromServer extends Notification implements ShouldQueue ->greeting('Hello ' . $notifiable->username . '.') ->line('You have been removed as a subuser for the following server.') ->line('Server Name: ' . $this->server->name) - ->action('Visit Panel', config('app.url')); + ->action('Visit Panel', url('')); } } diff --git a/app/Notifications/ServerInstalled.php b/app/Notifications/ServerInstalled.php index 988a15722..162482918 100644 --- a/app/Notifications/ServerInstalled.php +++ b/app/Notifications/ServerInstalled.php @@ -2,10 +2,10 @@ namespace App\Notifications; +use App\Filament\Server\Pages\Console; use App\Models\User; use Illuminate\Bus\Queueable; use App\Models\Server; -use App\Filament\App\Resources\ServerResource\Pages\ListServers; use Illuminate\Notifications\Notification; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; @@ -28,6 +28,6 @@ class ServerInstalled extends Notification implements ShouldQueue ->greeting('Hello ' . $notifiable->username . '.') ->line('Your server has finished installing and is now ready for you to use.') ->line('Server Name: ' . $this->server->name) - ->action('Login and Begin Using', ListServers::getUrl()); + ->action('Login and Begin Using', Console::getUrl(panel: 'server', tenant: $this->server)); } } From b44411208573132c8be73dc2959ac90130442ddb Mon Sep 17 00:00:00 2001 From: Boy132 Date: Mon, 14 Apr 2025 12:59:03 +0200 Subject: [PATCH 08/18] Correctly display backup status (#1256) * add status attribute to backup * hide actions when backup is not successful * small cleanup --- app/Enums/BackupStatus.php | 37 +++++++++++++++++++ .../BackupResource/Pages/ListBackups.php | 25 ++++++++----- app/Models/Backup.php | 10 +++++ 3 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 app/Enums/BackupStatus.php diff --git a/app/Enums/BackupStatus.php b/app/Enums/BackupStatus.php new file mode 100644 index 000000000..077fca54f --- /dev/null +++ b/app/Enums/BackupStatus.php @@ -0,0 +1,37 @@ + 'tabler-circle-dashed', + self::Successful => 'tabler-circle-check', + self::Failed => 'tabler-circle-x', + }; + } + + public function getColor(): string + { + return match ($this) { + self::InProgress => 'primary', + self::Successful => 'success', + self::Failed => 'danger', + }; + } + + public function getLabel(): string + { + return str($this->value)->headline(); + } +} diff --git a/app/Filament/Server/Resources/BackupResource/Pages/ListBackups.php b/app/Filament/Server/Resources/BackupResource/Pages/ListBackups.php index 6377d6d06..b6a9d3a6c 100644 --- a/app/Filament/Server/Resources/BackupResource/Pages/ListBackups.php +++ b/app/Filament/Server/Resources/BackupResource/Pages/ListBackups.php @@ -2,6 +2,7 @@ namespace App\Filament\Server\Resources\BackupResource\Pages; +use App\Enums\BackupStatus; use App\Enums\ServerState; use App\Facades\Activity; use App\Filament\Server\Resources\BackupResource; @@ -70,13 +71,14 @@ class ListBackups extends ListRecords ->label('Created') ->since() ->sortable(), - IconColumn::make('is_successful') - ->label('Successful') - ->boolean(), + TextColumn::make('status') + ->label('Status') + ->badge(), IconColumn::make('is_locked') ->visibleFrom('md') ->label('Lock Status') - ->icon(fn (Backup $backup) => !$backup->is_locked ? 'tabler-lock-open' : 'tabler-lock'), + ->trueIcon('tabler-lock') + ->falseIcon('tabler-lock-open'), ]) ->actions([ ActionGroup::make([ @@ -84,12 +86,14 @@ class ListBackups extends ListRecords ->icon(fn (Backup $backup) => !$backup->is_locked ? 'tabler-lock' : 'tabler-lock-open') ->authorize(fn () => auth()->user()->can(Permission::ACTION_BACKUP_DELETE, $server)) ->label(fn (Backup $backup) => !$backup->is_locked ? 'Lock' : 'Unlock') - ->action(fn (BackupController $backupController, Backup $backup, Request $request) => $backupController->toggleLock($request, $server, $backup)), + ->action(fn (BackupController $backupController, Backup $backup, Request $request) => $backupController->toggleLock($request, $server, $backup)) + ->visible(fn (Backup $backup) => $backup->status === BackupStatus::Successful), Action::make('download') ->color('primary') ->icon('tabler-download') ->authorize(fn () => auth()->user()->can(Permission::ACTION_BACKUP_DOWNLOAD, $server)) - ->url(fn (DownloadLinkService $downloadLinkService, Backup $backup, Request $request) => $downloadLinkService->handle($backup, $request->user()), true), + ->url(fn (DownloadLinkService $downloadLinkService, Backup $backup, Request $request) => $downloadLinkService->handle($backup, $request->user()), true) + ->visible(fn (Backup $backup) => $backup->status === BackupStatus::Successful), Action::make('restore') ->color('success') ->icon('tabler-folder-up') @@ -138,12 +142,14 @@ class ListBackups extends ListRecords return Notification::make() ->title('Restoring Backup') ->send(); - }), + }) + ->visible(fn (Backup $backup) => $backup->status === BackupStatus::Successful), DeleteAction::make('delete') - ->disabled(fn (Backup $backup): bool => $backup->is_locked) + ->disabled(fn (Backup $backup) => $backup->is_locked) ->modalDescription(fn (Backup $backup) => 'Do you wish to delete, ' . $backup->name . '?') ->modalSubmitActionLabel('Delete Backup') - ->action(fn (BackupController $backupController, Backup $backup, Request $request) => $backupController->delete($request, $server, $backup)), + ->action(fn (BackupController $backupController, Backup $backup, Request $request) => $backupController->delete($request, $server, $backup)) + ->visible(fn (Backup $backup) => $backup->status !== BackupStatus::InProgress), ]), ]); } @@ -180,7 +186,6 @@ class ListBackups extends ListRecords ->body($backup->name . ' created.') ->success() ->send(); - } catch (HttpException $e) { return Notification::make() ->danger() diff --git a/app/Models/Backup.php b/app/Models/Backup.php index b4f807a4f..e07d19948 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -7,6 +7,8 @@ use App\Traits\HasValidation; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use App\Eloquent\BackupQueryBuilder; +use App\Enums\BackupStatus; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -23,6 +25,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; * @property int $bytes * @property string|null $upload_id * @property \Carbon\CarbonImmutable|null $completed_at + * @property BackupStatus $status * @property \Carbon\CarbonImmutable $created_at * @property \Carbon\CarbonImmutable $updated_at * @property \Carbon\CarbonImmutable|null $deleted_at @@ -79,6 +82,13 @@ class Backup extends Model implements Validatable ]; } + protected function status(): Attribute + { + return Attribute::make( + get: fn () => !$this->completed_at ? BackupStatus::InProgress : ($this->is_successful ? BackupStatus::Successful : BackupStatus::Failed), + ); + } + public function server(): BelongsTo { return $this->belongsTo(Server::class); From e67e0830eb31f1788ad853c89a3dcfd74a33963c Mon Sep 17 00:00:00 2001 From: Letter N <24603524+LetterN@users.noreply.github.com> Date: Tue, 15 Apr 2025 07:27:35 +0800 Subject: [PATCH 09/18] Fix `Node` graph not rendering correctly (#1253) * use round instead of `Number::format` * remove unused * also replace `Number::format` in cpu & memory charts --------- Co-authored-by: Boy132 --- .../Admin/Resources/NodeResource/Widgets/NodeCpuChart.php | 2 +- .../Admin/Resources/NodeResource/Widgets/NodeMemoryChart.php | 2 +- .../Resources/NodeResource/Widgets/NodeStorageChart.php | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Filament/Admin/Resources/NodeResource/Widgets/NodeCpuChart.php b/app/Filament/Admin/Resources/NodeResource/Widgets/NodeCpuChart.php index da2752415..4cb23b787 100644 --- a/app/Filament/Admin/Resources/NodeResource/Widgets/NodeCpuChart.php +++ b/app/Filament/Admin/Resources/NodeResource/Widgets/NodeCpuChart.php @@ -23,7 +23,7 @@ class NodeCpuChart extends ChartWidget $cpu = collect(cache()->get("nodes.{$this->node->id}.cpu_percent")) ->slice(-10) ->map(fn ($value, $key) => [ - 'cpu' => Number::format($value * $threads, maxPrecision: 2), + 'cpu' => round($value * $threads, 2), 'timestamp' => Carbon::createFromTimestamp($key, auth()->user()->timezone ?? 'UTC')->format('H:i:s'), ]) ->all(); diff --git a/app/Filament/Admin/Resources/NodeResource/Widgets/NodeMemoryChart.php b/app/Filament/Admin/Resources/NodeResource/Widgets/NodeMemoryChart.php index 4b18d846e..23147f9cc 100644 --- a/app/Filament/Admin/Resources/NodeResource/Widgets/NodeMemoryChart.php +++ b/app/Filament/Admin/Resources/NodeResource/Widgets/NodeMemoryChart.php @@ -20,7 +20,7 @@ class NodeMemoryChart extends ChartWidget { $memUsed = collect(cache()->get("nodes.{$this->node->id}.memory_used"))->slice(-10) ->map(fn ($value, $key) => [ - 'memory' => Number::format(config('panel.use_binary_prefix') ? $value / 1024 / 1024 / 1024 : $value / 1000 / 1000 / 1000, maxPrecision: 2), + 'memory' => round(config('panel.use_binary_prefix') ? $value / 1024 / 1024 / 1024 : $value / 1000 / 1000 / 1000, 2), 'timestamp' => Carbon::createFromTimestamp($key, auth()->user()->timezone ?? 'UTC')->format('H:i:s'), ]) ->all(); diff --git a/app/Filament/Admin/Resources/NodeResource/Widgets/NodeStorageChart.php b/app/Filament/Admin/Resources/NodeResource/Widgets/NodeStorageChart.php index 7f9be2d6f..c70eec8d2 100644 --- a/app/Filament/Admin/Resources/NodeResource/Widgets/NodeStorageChart.php +++ b/app/Filament/Admin/Resources/NodeResource/Widgets/NodeStorageChart.php @@ -4,7 +4,6 @@ namespace App\Filament\Admin\Resources\NodeResource\Widgets; use App\Models\Node; use Filament\Widgets\ChartWidget; -use Illuminate\Support\Number; class NodeStorageChart extends ChartWidget { @@ -46,8 +45,8 @@ class NodeStorageChart extends ChartWidget $unused = $total - $used; - $used = Number::format($used, maxPrecision: 2); - $unused = Number::format($unused, maxPrecision: 2); + $used = round($used, 2); + $unused = round($unused, 2); return [ 'datasets' => [ From a4dd8cca4cc3c1ec42b85728425383ee02aeb9bb Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Tue, 15 Apr 2025 16:06:37 +0200 Subject: [PATCH 10/18] Add `live()` to `KeyValue` on `CreateServer` & `EditServer` (#1261) --- .../Admin/Resources/ServerResource/Pages/CreateServer.php | 1 + app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php | 1 + 2 files changed, 2 insertions(+) diff --git a/app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php b/app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php index 51d62cfc5..664f34370 100644 --- a/app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php +++ b/app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php @@ -792,6 +792,7 @@ class CreateServer extends CreateRecord ]), KeyValue::make('docker_labels') + ->live() ->label('Container Labels') ->keyLabel(trans('admin/server.title')) ->valueLabel(trans('admin/server.description')) diff --git a/app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php index cb811b540..c0ddfbbb5 100644 --- a/app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php @@ -486,6 +486,7 @@ class EditServer extends EditRecord ]), KeyValue::make('docker_labels') + ->live() ->label(trans('admin/server.container_labels')) ->keyLabel(trans('admin/server.title')) ->valueLabel(trans('admin/server.description')) From 862afaa0e97f019d4e1ce32464b9fe024b2c7397 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 15 Apr 2025 23:47:31 +0200 Subject: [PATCH 11/18] Fix api docs for server update requests (#1262) * workaround for api docs error * add deprecated notice --- .../Servers/UpdateServerBuildConfigurationRequest.php | 10 +++++++--- .../Application/Servers/UpdateServerDetailsRequest.php | 2 +- .../Application/Servers/UpdateServerStartupRequest.php | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php index 8c8d9e0ec..052ae1d4b 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php @@ -12,7 +12,7 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest */ public function rules(): array { - $rules = Server::getRulesForUpdate($this->parameter('server', Server::class)); + $rules = $this->route() ? Server::getRulesForUpdate($this->parameter('server', Server::class)) : Server::getRules(); return [ 'allocation' => $rules['allocation_id'], @@ -26,13 +26,17 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest 'limits.threads' => $this->requiredToOptional('threads', $rules['threads'], true), 'limits.disk' => $this->requiredToOptional('disk', $rules['disk'], true), - // Legacy rules to maintain backwards compatable API support without requiring - // a major version bump. + // Deprecated - use limits.memory 'memory' => $this->requiredToOptional('memory', $rules['memory']), + // Deprecated - use limits.swap 'swap' => $this->requiredToOptional('swap', $rules['swap']), + // Deprecated - use limits.io 'io' => $this->requiredToOptional('io', $rules['io']), + // Deprecated - use limits.cpu 'cpu' => $this->requiredToOptional('cpu', $rules['cpu']), + // Deprecated - use limits.threads 'threads' => $this->requiredToOptional('threads', $rules['threads']), + // Deprecated - use limits.disk 'disk' => $this->requiredToOptional('disk', $rules['disk']), 'add_allocations' => 'bail|array', diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php index 0d781a9bf..ad419e8ac 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php @@ -11,7 +11,7 @@ class UpdateServerDetailsRequest extends ServerWriteRequest */ public function rules(): array { - $rules = Server::getRulesForUpdate($this->parameter('server', Server::class)); + $rules = $this->route() ? Server::getRulesForUpdate($this->parameter('server', Server::class)) : Server::getRules(); return [ 'external_id' => $rules['external_id'], diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php index c03bb9bdb..d1330c9ae 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php @@ -17,12 +17,12 @@ class UpdateServerStartupRequest extends ApplicationApiRequest */ public function rules(): array { - $data = Server::getRulesForUpdate($this->parameter('server', Server::class)); + $rules = $this->route() ? Server::getRulesForUpdate($this->parameter('server', Server::class)) : Server::getRules(); return [ 'startup' => 'sometimes|string', 'environment' => 'present|array', - 'egg' => $data['egg_id'], + 'egg' => $rules['egg_id'], 'image' => 'sometimes|string', 'skip_scripts' => 'present|boolean', ]; From 22a0a52f7bb7798838660a8548f4f219013929f6 Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Thu, 17 Apr 2025 00:04:58 +0200 Subject: [PATCH 12/18] Chunk `Sushi` inserts based on rows count (#1259) --- app/Models/File.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Models/File.php b/app/Models/File.php index 80077f63e..b2ceaed5c 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -33,6 +33,8 @@ class File extends Model protected $keyType = 'string'; + protected int $sushiInsertChunkSize = 100; + public const ARCHIVE_MIMES = [ 'application/vnd.rar', // .rar 'application/x-rar-compressed', // .rar (2) @@ -167,7 +169,7 @@ class File extends Model throw new Exception($contents['error']); } - return array_map(function ($file) { + $rows = array_map(function ($file) { return [ 'name' => $file['name'], 'created_at' => Carbon::parse($file['created'])->timezone('UTC'), @@ -181,6 +183,10 @@ class File extends Model 'mime_type' => $file['mime'], ]; }, $contents); + + $this->sushiInsertChunkSize = min((int) floor(999 / count($this->getSchema())), count($rows)); + + return $rows; } catch (Exception $exception) { report($exception); From 038504fbec3713ba4274b4310a746798dec3192c Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Thu, 17 Apr 2025 22:24:57 +0200 Subject: [PATCH 13/18] Only chunk if rows exceeds sqlite variables limit (999) (#1270) --- app/Models/File.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Models/File.php b/app/Models/File.php index b2ceaed5c..12479554b 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -184,7 +184,11 @@ class File extends Model ]; }, $contents); - $this->sushiInsertChunkSize = min((int) floor(999 / count($this->getSchema())), count($rows)); + $rowCount = count($rows); + $limit = 999; + if ($rowCount > $limit) { + $this->sushiInsertChunkSize = min(floor($limit / count($this->getSchema())), $rowCount); + } return $rows; } catch (Exception $exception) { From bf14755287486cbe4700736e2e69e1349efebb8b Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 18 Apr 2025 10:37:21 -0400 Subject: [PATCH 14/18] Laravel 12.9.2 Shift (#1266) Co-authored-by: Shift --- composer.json | 2 +- composer.lock | 146 +++++++++++++++++++++++++------------------------- 2 files changed, 75 insertions(+), 73 deletions(-) diff --git a/composer.json b/composer.json index 12d63761b..d8c498e8a 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "doctrine/dbal": "~3.6.0", "filament/filament": "^3.3", "guzzlehttp/guzzle": "^7.9", - "laravel/framework": "^12.8", + "laravel/framework": "^12.9", "laravel/helpers": "^1.7", "laravel/sanctum": "^4.0.2", "laravel/socialite": "^5.19", diff --git a/composer.lock b/composer.lock index 038602ea3..73be7b046 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1a12d9151f0ded4224c11d94f6ef755c", + "content-hash": "f2cbc3561aca38dd0e3247834434ce01", "packages": [ { "name": "abdelhamiderrahmouni/filament-monaco-editor", @@ -1020,16 +1020,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.342.23", + "version": "3.342.27", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "a5e9ba23ffecf1f71d8cfb177ef5cb3fbe2ecf05" + "reference": "4c18299000c34ab4903100fe68721d6f26c7cdf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a5e9ba23ffecf1f71d8cfb177ef5cb3fbe2ecf05", - "reference": "a5e9ba23ffecf1f71d8cfb177ef5cb3fbe2ecf05", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/4c18299000c34ab4903100fe68721d6f26c7cdf2", + "reference": "4c18299000c34ab4903100fe68721d6f26c7cdf2", "shasum": "" }, "require": { @@ -1111,9 +1111,9 @@ "support": { "forum": "https://github.com/aws/aws-sdk-php/discussions", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.342.23" + "source": "https://github.com/aws/aws-sdk-php/tree/3.342.27" }, - "time": "2025-04-08T18:35:41+00:00" + "time": "2025-04-14T18:08:09+00:00" }, { "name": "blade-ui-kit/blade-heroicons", @@ -1758,16 +1758,16 @@ }, { "name": "dedoc/scramble", - "version": "v0.12.17", + "version": "v0.12.18", "source": { "type": "git", "url": "https://github.com/dedoc/scramble.git", - "reference": "f71afa07e485548f9c3743b69f7859bb4d899600" + "reference": "a107fd82242abd765a9a22652bfa13f65e77e209" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dedoc/scramble/zipball/f71afa07e485548f9c3743b69f7859bb4d899600", - "reference": "f71afa07e485548f9c3743b69f7859bb4d899600", + "url": "https://api.github.com/repos/dedoc/scramble/zipball/a107fd82242abd765a9a22652bfa13f65e77e209", + "reference": "a107fd82242abd765a9a22652bfa13f65e77e209", "shasum": "" }, "require": { @@ -1822,7 +1822,7 @@ ], "support": { "issues": "https://github.com/dedoc/scramble/issues", - "source": "https://github.com/dedoc/scramble/tree/v0.12.17" + "source": "https://github.com/dedoc/scramble/tree/v0.12.18" }, "funding": [ { @@ -1830,7 +1830,7 @@ "type": "github" } ], - "time": "2025-04-04T06:45:52+00:00" + "time": "2025-04-14T14:01:50+00:00" }, { "name": "dflydev/dot-access-data", @@ -2986,16 +2986,16 @@ }, { "name": "firebase/php-jwt", - "version": "v6.11.0", + "version": "v6.11.1", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "8f718f4dfc9c5d5f0c994cdfd103921b43592712" + "reference": "d1e91ecf8c598d073d0995afa8cd5c75c6e19e66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/8f718f4dfc9c5d5f0c994cdfd103921b43592712", - "reference": "8f718f4dfc9c5d5f0c994cdfd103921b43592712", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/d1e91ecf8c598d073d0995afa8cd5c75c6e19e66", + "reference": "d1e91ecf8c598d073d0995afa8cd5c75c6e19e66", "shasum": "" }, "require": { @@ -3043,9 +3043,9 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.11.0" + "source": "https://github.com/firebase/php-jwt/tree/v6.11.1" }, - "time": "2025-01-23T05:11:06+00:00" + "time": "2025-04-09T20:32:01+00:00" }, { "name": "fruitcake/php-cors", @@ -3714,16 +3714,16 @@ }, { "name": "laravel/framework", - "version": "v12.8.1", + "version": "v12.9.2", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "d1ea3566f6e0cad34834c6d18db0bf995438eb87" + "reference": "3db59aa0f382c349c78a92f3e5b5522e00e3301b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/d1ea3566f6e0cad34834c6d18db0bf995438eb87", - "reference": "d1ea3566f6e0cad34834c6d18db0bf995438eb87", + "url": "https://api.github.com/repos/laravel/framework/zipball/3db59aa0f382c349c78a92f3e5b5522e00e3301b", + "reference": "3db59aa0f382c349c78a92f3e5b5522e00e3301b", "shasum": "" }, "require": { @@ -3832,7 +3832,7 @@ "league/flysystem-sftp-v3": "^3.25.1", "mockery/mockery": "^1.6.10", "orchestra/testbench-core": "^10.0.0", - "pda/pheanstalk": "^5.0.6", + "pda/pheanstalk": "^5.0.6|^7.0.0", "php-http/discovery": "^1.15", "phpstan/phpstan": "^2.0", "phpunit/phpunit": "^10.5.35|^11.5.3|^12.0.1", @@ -3925,7 +3925,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-04-08T19:58:59+00:00" + "time": "2025-04-16T15:44:19+00:00" }, { "name": "laravel/helpers", @@ -5400,16 +5400,16 @@ }, { "name": "livewire/livewire", - "version": "v3.6.2", + "version": "v3.6.3", "source": { "type": "git", "url": "https://github.com/livewire/livewire.git", - "reference": "8f8914731f5eb43b6bb145d87c8d5a9edfc89313" + "reference": "56aa1bb63a46e06181c56fa64717a7287e19115e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/livewire/livewire/zipball/8f8914731f5eb43b6bb145d87c8d5a9edfc89313", - "reference": "8f8914731f5eb43b6bb145d87c8d5a9edfc89313", + "url": "https://api.github.com/repos/livewire/livewire/zipball/56aa1bb63a46e06181c56fa64717a7287e19115e", + "reference": "56aa1bb63a46e06181c56fa64717a7287e19115e", "shasum": "" }, "require": { @@ -5464,7 +5464,7 @@ "description": "A front-end framework for Laravel.", "support": { "issues": "https://github.com/livewire/livewire/issues", - "source": "https://github.com/livewire/livewire/tree/v3.6.2" + "source": "https://github.com/livewire/livewire/tree/v3.6.3" }, "funding": [ { @@ -5472,7 +5472,7 @@ "type": "github" } ], - "time": "2025-03-12T20:24:15+00:00" + "time": "2025-04-12T22:26:52+00:00" }, { "name": "masterminds/html5", @@ -6501,16 +6501,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.6.1", + "version": "5.6.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8" + "reference": "92dde6a5919e34835c506ac8c523ef095a95ed62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", - "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/92dde6a5919e34835c506ac8c523ef095a95ed62", + "reference": "92dde6a5919e34835c506ac8c523ef095a95ed62", "shasum": "" }, "require": { @@ -6559,9 +6559,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.1" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.2" }, - "time": "2024-12-07T09:39:29+00:00" + "time": "2025-04-13T19:20:35+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -8464,16 +8464,16 @@ }, { "name": "spatie/laravel-data", - "version": "4.14.1", + "version": "4.15.1", "source": { "type": "git", "url": "https://github.com/spatie/laravel-data.git", - "reference": "edd61b4dca5acdcfd1e3b7f2c19b75e83730f87c" + "reference": "cb97afe6c0dadeb2e76ea1b7220cd04ed33dcca9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-data/zipball/edd61b4dca5acdcfd1e3b7f2c19b75e83730f87c", - "reference": "edd61b4dca5acdcfd1e3b7f2c19b75e83730f87c", + "url": "https://api.github.com/repos/spatie/laravel-data/zipball/cb97afe6c0dadeb2e76ea1b7220cd04ed33dcca9", + "reference": "cb97afe6c0dadeb2e76ea1b7220cd04ed33dcca9", "shasum": "" }, "require": { @@ -8486,6 +8486,7 @@ "require-dev": { "fakerphp/faker": "^1.14", "friendsofphp/php-cs-fixer": "^3.0", + "inertiajs/inertia-laravel": "^2.0", "livewire/livewire": "^3.0", "mockery/mockery": "^1.6", "nesbot/carbon": "^2.63|^3.0", @@ -8534,7 +8535,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-data/issues", - "source": "https://github.com/spatie/laravel-data/tree/4.14.1" + "source": "https://github.com/spatie/laravel-data/tree/4.15.1" }, "funding": [ { @@ -8542,7 +8543,7 @@ "type": "github" } ], - "time": "2025-03-17T13:54:28+00:00" + "time": "2025-04-10T06:06:27+00:00" }, { "name": "spatie/laravel-fractal", @@ -8720,16 +8721,16 @@ }, { "name": "spatie/laravel-package-tools", - "version": "1.92.0", + "version": "1.92.4", "source": { "type": "git", "url": "https://github.com/spatie/laravel-package-tools.git", - "reference": "dd46cd0ed74015db28822d88ad2e667f4496a6f6" + "reference": "d20b1969f836d210459b78683d85c9cd5c5f508c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/dd46cd0ed74015db28822d88ad2e667f4496a6f6", - "reference": "dd46cd0ed74015db28822d88ad2e667f4496a6f6", + "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/d20b1969f836d210459b78683d85c9cd5c5f508c", + "reference": "d20b1969f836d210459b78683d85c9cd5c5f508c", "shasum": "" }, "require": { @@ -8740,6 +8741,7 @@ "mockery/mockery": "^1.5", "orchestra/testbench": "^7.7|^8.0|^9.0|^10.0", "pestphp/pest": "^1.23|^2.1|^3.1", + "phpunit/php-code-coverage": "^9.0|^10.0|^11.0", "phpunit/phpunit": "^9.5.24|^10.5|^11.5", "spatie/pest-plugin-test-time": "^1.1|^2.2" }, @@ -8768,7 +8770,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-package-tools/issues", - "source": "https://github.com/spatie/laravel-package-tools/tree/1.92.0" + "source": "https://github.com/spatie/laravel-package-tools/tree/1.92.4" }, "funding": [ { @@ -8776,20 +8778,20 @@ "type": "github" } ], - "time": "2025-03-27T08:34:10+00:00" + "time": "2025-04-11T15:27:14+00:00" }, { "name": "spatie/laravel-permission", - "version": "6.16.0", + "version": "6.17.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-permission.git", - "reference": "4fa03c06509e037a4d42c131d0f181e3e4bbd483" + "reference": "02ada8f638b643713fa2fb543384738e27346ddb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-permission/zipball/4fa03c06509e037a4d42c131d0f181e3e4bbd483", - "reference": "4fa03c06509e037a4d42c131d0f181e3e4bbd483", + "url": "https://api.github.com/repos/spatie/laravel-permission/zipball/02ada8f638b643713fa2fb543384738e27346ddb", + "reference": "02ada8f638b643713fa2fb543384738e27346ddb", "shasum": "" }, "require": { @@ -8851,7 +8853,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-permission/issues", - "source": "https://github.com/spatie/laravel-permission/tree/6.16.0" + "source": "https://github.com/spatie/laravel-permission/tree/6.17.0" }, "funding": [ { @@ -8859,20 +8861,20 @@ "type": "github" } ], - "time": "2025-02-28T20:29:57+00:00" + "time": "2025-04-08T15:06:14+00:00" }, { "name": "spatie/laravel-query-builder", - "version": "6.3.1", + "version": "6.3.2", "source": { "type": "git", "url": "https://github.com/spatie/laravel-query-builder.git", - "reference": "465d9b7364590c9ae3ee3738ff8a293e685dd588" + "reference": "3675f7bace346dc5243f58fa7c531e36471200f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-query-builder/zipball/465d9b7364590c9ae3ee3738ff8a293e685dd588", - "reference": "465d9b7364590c9ae3ee3738ff8a293e685dd588", + "url": "https://api.github.com/repos/spatie/laravel-query-builder/zipball/3675f7bace346dc5243f58fa7c531e36471200f4", + "reference": "3675f7bace346dc5243f58fa7c531e36471200f4", "shasum": "" }, "require": { @@ -8932,7 +8934,7 @@ "type": "custom" } ], - "time": "2025-02-19T07:14:53+00:00" + "time": "2025-04-16T07:30:03+00:00" }, { "name": "spatie/php-structure-discoverer", @@ -13061,16 +13063,16 @@ }, { "name": "laravel/pint", - "version": "v1.21.2", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "370772e7d9e9da087678a0edf2b11b6960e40558" + "reference": "7ddfaa6523a675fae5c4123ee38fc6bfb8ee4f36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/370772e7d9e9da087678a0edf2b11b6960e40558", - "reference": "370772e7d9e9da087678a0edf2b11b6960e40558", + "url": "https://api.github.com/repos/laravel/pint/zipball/7ddfaa6523a675fae5c4123ee38fc6bfb8ee4f36", + "reference": "7ddfaa6523a675fae5c4123ee38fc6bfb8ee4f36", "shasum": "" }, "require": { @@ -13081,9 +13083,9 @@ "php": "^8.2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.72.0", + "friendsofphp/php-cs-fixer": "^3.75.0", "illuminate/view": "^11.44.2", - "larastan/larastan": "^3.2.0", + "larastan/larastan": "^3.3.1", "laravel-zero/framework": "^11.36.1", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^2.3", @@ -13123,7 +13125,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2025-03-14T22:31:42+00:00" + "time": "2025-04-08T22:11:45+00:00" }, { "name": "laravel/sail", @@ -13814,16 +13816,16 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.11", + "version": "2.1.12", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "8ca5f79a8f63c49b2359065832a654e1ec70ac30" + "reference": "96dde49e967c0c22812bcfa7bda4ff82c09f3b0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8ca5f79a8f63c49b2359065832a654e1ec70ac30", - "reference": "8ca5f79a8f63c49b2359065832a654e1ec70ac30", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/96dde49e967c0c22812bcfa7bda4ff82c09f3b0c", + "reference": "96dde49e967c0c22812bcfa7bda4ff82c09f3b0c", "shasum": "" }, "require": { @@ -13868,7 +13870,7 @@ "type": "github" } ], - "time": "2025-03-24T13:45:00+00:00" + "time": "2025-04-16T13:19:18+00:00" }, { "name": "phpunit/php-code-coverage", From a1869002629b18500b346e5c505869bc45d43456 Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Fri, 18 Apr 2025 16:39:25 +0200 Subject: [PATCH 15/18] Remove `NavigationGroups` for Admin Navbar (#1248) --- app/Filament/Admin/Resources/EggResource.php | 5 ----- app/Filament/Admin/Resources/NodeResource.php | 5 ----- app/Filament/Admin/Resources/RoleResource.php | 2 +- app/Filament/Admin/Resources/ServerResource.php | 5 ----- app/Filament/Admin/Resources/UserResource.php | 5 ----- app/Providers/Filament/AdminPanelProvider.php | 4 ---- lang/en/admin/dashboard.php | 2 -- 7 files changed, 1 insertion(+), 27 deletions(-) diff --git a/app/Filament/Admin/Resources/EggResource.php b/app/Filament/Admin/Resources/EggResource.php index ec787f988..234651828 100644 --- a/app/Filament/Admin/Resources/EggResource.php +++ b/app/Filament/Admin/Resources/EggResource.php @@ -19,11 +19,6 @@ class EggResource extends Resource return static::getModel()::count() ?: null; } - public static function getNavigationGroup(): ?string - { - return trans('admin/dashboard.server'); - } - public static function getNavigationLabel(): string { return trans('admin/egg.nav_title'); diff --git a/app/Filament/Admin/Resources/NodeResource.php b/app/Filament/Admin/Resources/NodeResource.php index 2219bde47..6758df398 100644 --- a/app/Filament/Admin/Resources/NodeResource.php +++ b/app/Filament/Admin/Resources/NodeResource.php @@ -30,11 +30,6 @@ class NodeResource extends Resource return trans('admin/node.model_label_plural'); } - public static function getNavigationGroup(): ?string - { - return trans('admin/dashboard.server'); - } - public static function getNavigationBadge(): ?string { return static::getModel()::count() ?: null; diff --git a/app/Filament/Admin/Resources/RoleResource.php b/app/Filament/Admin/Resources/RoleResource.php index 583a1aa23..b63571ee8 100644 --- a/app/Filament/Admin/Resources/RoleResource.php +++ b/app/Filament/Admin/Resources/RoleResource.php @@ -48,7 +48,7 @@ class RoleResource extends Resource public static function getNavigationGroup(): ?string { - return trans('admin/dashboard.user'); + return trans('admin/dashboard.advanced'); } public static function getNavigationBadge(): ?string diff --git a/app/Filament/Admin/Resources/ServerResource.php b/app/Filament/Admin/Resources/ServerResource.php index 4e92a0715..8666ba9ac 100644 --- a/app/Filament/Admin/Resources/ServerResource.php +++ b/app/Filament/Admin/Resources/ServerResource.php @@ -29,11 +29,6 @@ class ServerResource extends Resource return trans('admin/server.model_label_plural'); } - public static function getNavigationGroup(): ?string - { - return trans('admin/dashboard.server'); - } - public static function getNavigationBadge(): ?string { return static::getModel()::count() ?: null; diff --git a/app/Filament/Admin/Resources/UserResource.php b/app/Filament/Admin/Resources/UserResource.php index ce7166a32..b91323630 100644 --- a/app/Filament/Admin/Resources/UserResource.php +++ b/app/Filament/Admin/Resources/UserResource.php @@ -43,11 +43,6 @@ class UserResource extends Resource return trans('admin/user.model_label_plural'); } - public static function getNavigationGroup(): ?string - { - return trans('admin/dashboard.user'); - } - public static function getNavigationBadge(): ?string { return static::getModel()::count() ?: null; diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index 27f56f50c..96ca5c83d 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -53,10 +53,6 @@ class AdminPanelProvider extends PanelProvider ->sort(24), ]) ->navigationGroups([ - NavigationGroup::make(trans('admin/dashboard.server')) - ->collapsible(false), - NavigationGroup::make(trans('admin/dashboard.user')) - ->collapsible(false), NavigationGroup::make(trans('admin/dashboard.advanced')), ]) ->sidebarCollapsibleOnDesktop() diff --git a/lang/en/admin/dashboard.php b/lang/en/admin/dashboard.php index 49ff57726..46611dce2 100644 --- a/lang/en/admin/dashboard.php +++ b/lang/en/admin/dashboard.php @@ -4,8 +4,6 @@ return [ 'heading' => 'Welcome to Pelican!', 'version' => 'Version: :version', 'advanced' => 'Advanced', - 'server' => 'Server', - 'user' => 'User', 'sections' => [ 'intro-developers' => [ 'heading' => 'Information for Developers', From ffd94b889243d83d5fe9b73ec025316a01cde928 Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Fri, 18 Apr 2025 16:41:10 +0200 Subject: [PATCH 16/18] Fix `develop` Node Version reported as outdated (#1272) --- app/Checks/NodeVersionsCheck.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/Checks/NodeVersionsCheck.php b/app/Checks/NodeVersionsCheck.php index 801ac8617..856b82c5d 100644 --- a/app/Checks/NodeVersionsCheck.php +++ b/app/Checks/NodeVersionsCheck.php @@ -14,9 +14,9 @@ class NodeVersionsCheck extends Check public function run(): Result { - $all = Node::query()->count(); + $all = Node::all(); - if ($all === 0) { + if ($all->isEmpty()) { $result = Result::make() ->notificationMessage(trans('admin/health.results.nodeversions.no_nodes_created')) ->shortSummary(trans('admin/health.results.nodeversions.no_nodes')); @@ -25,16 +25,18 @@ class NodeVersionsCheck extends Check return $result; } - $latestVersion = $this->versionService->latestWingsVersion(); - - $outdated = Node::query()->get() - ->filter(fn (Node $node) => !isset($node->systemInformation()['exception']) && $node->systemInformation()['version'] !== $latestVersion) + $outdated = $all + ->filter(fn (Node $node) => !isset($node->systemInformation()['exception']) && !$this->versionService->isLatestWings($node->systemInformation()['version'])) ->count(); + $all = $all->count(); + $latestVersion = $this->versionService->latestWingsVersion(); + $result = Result::make() ->meta([ 'all' => $all, 'outdated' => $outdated, + 'latestVersion' => $latestVersion, ]) ->shortSummary($outdated === 0 ? trans('admin/health.results.nodeversions.all_up_to_date') : trans('admin/health.results.nodeversions.outdated', ['outdated' => $outdated, 'all' => $all])); From ee838316e6503730576b1f0bc41653d1b892cc81 Mon Sep 17 00:00:00 2001 From: Quinten <67589015+QuintenQVD0@users.noreply.github.com> Date: Mon, 21 Apr 2025 11:25:36 +0200 Subject: [PATCH 17/18] Make avatars work (#1251) --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b06a65c09..1b719bedb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,11 +4,11 @@ # For those who want to build this Dockerfile themselves, uncomment lines 6-12 and replace "localhost:5000/base-php:$TARGETARCH" on lines 17 and 67 with "base". -# FROM --platform=$TARGETOS/$TARGETARCH php:8.3-fpm-alpine as base +# FROM --platform=$TARGETOS/$TARGETARCH php:8.4-fpm-alpine as base # ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ -# RUN install-php-extensions bcmath gd intl zip opcache pcntl posix pdo_mysql +# RUN install-php-extensions bcmath gd intl zip opcache pcntl posix pdo_mysql pdo_pgsql # RUN rm /usr/local/bin/install-php-extensions @@ -85,10 +85,13 @@ RUN chown root:www-data ./ \ # Symlink to env/database path, as www-data won't be able to write to webroot && ln -s /pelican-data/.env ./.env \ && ln -s /pelican-data/database/database.sqlite ./database/database.sqlite \ + && mkdir -p /pelican-data/storage \ + && ln -sf /var/www/html/storage/app/public /var/www/html/public/storage \ + && ln -s /pelican-data/storage /var/www/html/storage/app/public/avatars \ # Create necessary directories && mkdir -p /pelican-data /var/run/supervisord /etc/supercronic \ - # Finally allow www-data write permissions where necessary - && chown -R www-data:www-data /pelican-data ./storage ./bootstrap/cache /var/run/supervisord \ + # Finally allow www-data write permissions where necessary + && chown -R www-data:www-data /pelican-data ./storage ./bootstrap/cache /var/run/supervisord /var/www/html/public/storage \ && chmod -R u+rwX,g+rwX,o-rwx /pelican-data ./storage ./bootstrap/cache /var/run/supervisord # Configure Supervisor From 0e2ab4b7118d5a1f5f476d901ba0fc967084be4c Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 22 Apr 2025 08:28:24 +0200 Subject: [PATCH 18/18] Fix activity log query (#1258) --- app/Filament/Server/Resources/ActivityResource.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Filament/Server/Resources/ActivityResource.php b/app/Filament/Server/Resources/ActivityResource.php index 2565c3285..a69eedaf9 100644 --- a/app/Filament/Server/Resources/ActivityResource.php +++ b/app/Filament/Server/Resources/ActivityResource.php @@ -30,8 +30,7 @@ class ActivityResource extends Resource /** @var Server $server */ $server = Filament::getTenant(); - return $server->activity() - ->getQuery() + return ActivityLog::whereHas('subjects', fn (Builder $query) => $query->where('subject_id', $server->id)) ->whereNotIn('activity_logs.event', ActivityLog::DISABLED_EVENTS) ->when(config('activity.hide_admin_activity'), function (Builder $builder) use ($server) { // We could do this with a query and a lot of joins, but that gets pretty