diff --git a/CHANGELOG.md b/CHANGELOG.md index 81bb1d5a0..4eb2570eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ This file is a running track of new features and fixes to each version of the pa This project follows [Semantic Versioning](http://semver.org) guidelines. +## v1.3.1 +### Fixed +* Fixes the Rust egg not properly seeding during the upgrade & installation process. +* Fixes backups not being downloadable via the frontend. +* Fixes backup listing showing the wrong number of existing backups based on the current page you're on. + ## v1.3.0 ### Fixed * Fixes administrator "Other Servers" toggle being persisted wrongly when signing out and signing into a non-administrator account on the server dashboard. diff --git a/app/Console/Commands/UpgradeCommand.php b/app/Console/Commands/UpgradeCommand.php index d42964942..6ea68b754 100644 --- a/app/Console/Commands/UpgradeCommand.php +++ b/app/Console/Commands/UpgradeCommand.php @@ -79,7 +79,7 @@ class UpgradeCommand extends Command if (!$skipDownload) { $this->withProgress($bar, function () { $this->line("\$upgrader> curl -L \"{$this->getUrl()}\" | tar -xzv"); - $process = Process::fromShellCommandline("curl -L \"{$this->getUrl()}\" | tar -xzvf"); + $process = Process::fromShellCommandline("curl -L \"{$this->getUrl()}\" | tar -xzv"); $process->run(function ($type, $buffer) { $this->{$type === Process::ERR ? 'error' : 'line'}($buffer); }); diff --git a/app/Http/Controllers/Api/Client/Servers/BackupController.php b/app/Http/Controllers/Api/Client/Servers/BackupController.php index c024cbaea..9998a47a2 100644 --- a/app/Http/Controllers/Api/Client/Servers/BackupController.php +++ b/app/Http/Controllers/Api/Client/Servers/BackupController.php @@ -131,6 +131,7 @@ class BackupController extends ClientApiController * will be streamed back through the Panel. For AWS S3 files, a signed URL will be generated * which the user is redirected to. * + * @throws \Throwable * @throws \Illuminate\Auth\Access\AuthorizationException */ public function download(Request $request, Server $server, Backup $backup): JsonResponse @@ -139,16 +140,19 @@ class BackupController extends ClientApiController throw new AuthorizationException(); } - switch ($backup->disk) { - case Backup::ADAPTER_WINGS: - case Backup::ADAPTER_AWS_S3: - return new JsonResponse([ - 'object' => 'signed_url', - 'attributes' => ['url' => ''], - ]); - default: - throw new BadRequestHttpException(); + if ($backup->disk !== Backup::ADAPTER_AWS_S3 && $backup->disk !== Backup::ADAPTER_WINGS) { + throw new BadRequestHttpException('The backup requested references an unknown disk driver type and cannot be downloaded.'); } + + $url = $this->downloadLinkService->handle($backup, $request->user()); + $server->audit(AuditLog::SERVER__BACKUP_DOWNLOADED, function (AuditLog $audit) use ($backup) { + $audit->metadata = ['backup_uuid' => $backup->uuid]; + }); + + return new JsonResponse([ + 'object' => 'signed_url', + 'attributes' => ['url' => $url], + ]); } /** diff --git a/app/Models/AuditLog.php b/app/Models/AuditLog.php index c56eae4a8..88e8c1d8d 100644 --- a/app/Models/AuditLog.php +++ b/app/Models/AuditLog.php @@ -35,6 +35,7 @@ class AuditLog extends Model public const SERVER__BACKUP_FAILED = 'server:backup.failed'; public const SERVER__BACKUP_COMPELTED = 'server:backup.completed'; public const SERVER__BACKUP_DELETED = 'server:backup.deleted'; + public const SERVER__BACKUP_DOWNLOADED = 'server:backup.downloaded'; public const SERVER__BACKUP_RESTORE_STARTED = 'server:backup.restore.started'; public const SERVER__BACKUP_RESTORE_COMPLETED = 'server:backup.restore.completed'; public const SERVER__BACKUP_RESTORE_FAILED = 'server:backup.restore.failed'; diff --git a/app/Services/Backups/DownloadLinkService.php b/app/Services/Backups/DownloadLinkService.php index 509c79ca2..7d5af4ca0 100644 --- a/app/Services/Backups/DownloadLinkService.php +++ b/app/Services/Backups/DownloadLinkService.php @@ -47,7 +47,7 @@ class DownloadLinkService ]) ->handle($backup->server->node, $user->id . $backup->server->uuid); - return sprintf('%s/download/backup?token=%s', $backup->server->node->getConnectionAddress(), $token->__toString()); + return sprintf('%s/download/backup?token=%s', $backup->server->node->getConnectionAddress(), $token->toString()); } /** diff --git a/resources/scripts/components/server/backups/BackupContainer.tsx b/resources/scripts/components/server/backups/BackupContainer.tsx index 99f1e6326..bd732d4f0 100644 --- a/resources/scripts/components/server/backups/BackupContainer.tsx +++ b/resources/scripts/components/server/backups/BackupContainer.tsx @@ -65,12 +65,12 @@ const BackupContainer = () => { }
- {(backupLimit > 0 && backups.items.length > 0) && + {(backupLimit > 0 && backups.pagination.total > 0) &&

- {backups.items.length} of {backupLimit} backups have been created for this server. + {backups.pagination.total} of {backupLimit} backups have been created for this server.

} - {backupLimit > 0 && backupLimit !== backups.items.length && + {backupLimit > 0 && backupLimit !== backups.pagination.total && }