From 8dca2140b3efec5da3d61ac22ffe20fe57ca5f98 Mon Sep 17 00:00:00 2001 From: mammut53 <30445006+mammut53@users.noreply.github.com> Date: Sun, 7 Mar 2021 01:57:02 +0100 Subject: [PATCH 1/4] Fix displaying wrong backup number on pages By having multiplie pages the current number of backups broke --- .../scripts/components/server/backups/BackupContainer.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 && }
From 1476104b301f47cc4ba3465ceb1fe16e78e200bd Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 7 Mar 2021 09:45:27 -0800 Subject: [PATCH 2/4] Fix inability to download files from the panel; closes #3151 Co-Authored-By: xcgc <74693042+xcgc@users.noreply.github.com> --- .../Api/Client/Servers/BackupController.php | 22 +++++++++++-------- app/Models/AuditLog.php | 1 + app/Services/Backups/DownloadLinkService.php | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/Api/Client/Servers/BackupController.php b/app/Http/Controllers/Api/Client/Servers/BackupController.php index 86aef1e24..3457e1cc2 100644 --- a/app/Http/Controllers/Api/Client/Servers/BackupController.php +++ b/app/Http/Controllers/Api/Client/Servers/BackupController.php @@ -149,6 +149,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 @@ -157,16 +158,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()); } /** From 9d500f1c49dd16c4bfc95ed77afc86470226399a Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 7 Mar 2021 17:38:42 -0800 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) 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. From 76f507656ca9b6a77a2ca526086f1f7d77342f11 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 8 Mar 2021 12:19:20 +0200 Subject: [PATCH 4/4] remove file archive flag --- app/Console/Commands/UpgradeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); });