From 7287b8e19800a7447f4bc2ca505bfce207624a7c Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 23 Aug 2020 17:52:46 -0700 Subject: [PATCH] Pass the checksum type along in the request --- api/backup_endpoints.go | 7 ++++--- server/backup/backup.go | 17 ++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/api/backup_endpoints.go b/api/backup_endpoints.go index 7d49413..b7b8d9b 100644 --- a/api/backup_endpoints.go +++ b/api/backup_endpoints.go @@ -7,9 +7,10 @@ import ( ) type BackupRequest struct { - Checksum string `json:"checksum"` - Size int64 `json:"size"` - Successful bool `json:"successful"` + Checksum string `json:"checksum"` + ChecksumType string `json:"checksum_type"` + Size int64 `json:"size"` + Successful bool `json:"successful"` } // Notifies the panel that a specific backup has been completed and is now diff --git a/server/backup/backup.go b/server/backup/backup.go index 3e94cb8..67006ce 100644 --- a/server/backup/backup.go +++ b/server/backup/backup.go @@ -19,16 +19,18 @@ const ( ) type ArchiveDetails struct { - Checksum string `json:"checksum"` - Size int64 `json:"size"` + Checksum string `json:"checksum"` + ChecksumType string `json:"checksum_type"` + Size int64 `json:"size"` } // Returns a request object. func (ad *ArchiveDetails) ToRequest(successful bool) api.BackupRequest { return api.BackupRequest{ - Checksum: ad.Checksum, - Size: ad.Size, - Successful: successful, + Checksum: ad.Checksum, + ChecksumType: ad.ChecksumType, + Size: ad.Size, + Successful: successful, } } @@ -145,8 +147,9 @@ func (b *Backup) Details() *ArchiveDetails { wg.Wait() return &ArchiveDetails{ - Checksum: checksum, - Size: sz, + Checksum: checksum, + ChecksumType: "sha1", + Size: sz, } }