Fire an event to the websocket when a backup is completed

This commit is contained in:
Dane Everitt
2020-04-06 21:03:50 -07:00
parent 45d441ac32
commit 222091b68c
2 changed files with 21 additions and 1 deletions

View File

@@ -170,6 +170,14 @@ func (b *Backup) BackupAndNotify() error {
return err
}
// Emit an event over the socket so we can update the backup in realtime on
// the frontend for the server.
b.server.Events().PublishJson(BackupCompletedEvent, map[string]interface{}{
"uuid": b.Uuid,
"sha256_hash": resp.Sha256Hash,
"file_size": resp.FileSize,
})
return nil
}