diff --git a/client/components/tables/BackupsTable.vue b/client/components/tables/BackupsTable.vue index 3a757a86..ab8f39ed 100644 --- a/client/components/tables/BackupsTable.vue +++ b/client/components/tables/BackupsTable.vue @@ -45,7 +45,7 @@

Important Notice!

Applying a backup will overwrite users, user progress, book details, settings, and covers stored in metadata with the backed up data.

-

Backups do not modify any files in your library folders, only data in the audiobookshelf created /config and /metadata directories. If you have enabled server settings to store cover art and metadata in your library folders then those are not backup up or overwritten.

+

Backups do not modify any files in your library folders, only data in the audiobookshelf created /config and /metadata directories. If you have enabled server settings to store cover art and metadata in your library folders then those are not backed up or overwritten.

All clients using your server will be automatically refreshed.

Are you sure you want to apply the backup created on {{ selectedBackup.datePretty }}?

diff --git a/client/pages/config/backups.vue b/client/pages/config/backups.vue index 5dbbf54a..9fda438f 100644 --- a/client/pages/config/backups.vue +++ b/client/pages/config/backups.vue @@ -5,7 +5,7 @@

Backups

-

Backups include users, user progress, book details, server settings and covers stored in /metadata/items.
Backups do not include any files stored in your library folders.

+

Backups include users, user progress, library item details, server settings, and images stored in /metadata/items & /metadata/authors.
Backups do not include any files stored in your library folders.

diff --git a/server/managers/BackupManager.js b/server/managers/BackupManager.js index e56aa95c..01f05b90 100644 --- a/server/managers/BackupManager.js +++ b/server/managers/BackupManager.js @@ -16,6 +16,7 @@ class BackupManager { constructor(db, emitter) { this.BackupPath = Path.join(global.MetadataPath, 'backups') this.ItemsMetadataPath = Path.join(global.MetadataPath, 'items') + this.AuthorsMetadataPath = Path.join(global.MetadataPath, 'authors') this.db = db this.emitter = emitter @@ -119,6 +120,7 @@ class BackupManager { await zip.extract('config/', global.ConfigPath) if (backup.backupMetadataCovers) { await zip.extract('metadata-items/', this.ItemsMetadataPath) + await zip.extract('metadata-authors/', this.AuthorsMetadataPath) } await this.db.reinit() this.emitter('backup_applied') @@ -178,8 +180,6 @@ class BackupManager { async runBackup() { // Check if Metadata Path is inside Config Path (otherwise there will be an infinite loop as the archiver tries to zip itself) Logger.info(`[BackupManager] Running Backup`) - var metadataItemsPath = this.serverSettings.backupMetadataCovers ? this.ItemsMetadataPath : null - var newBackup = new Backup() const newBackData = { @@ -188,7 +188,10 @@ class BackupManager { } newBackup.setData(newBackData) - var zipResult = await this.zipBackup(metadataItemsPath, newBackup).then(() => true).catch((error) => { + var metadataAuthorsPath = this.AuthorsMetadataPath + if (!await fs.pathExists(metadataAuthorsPath)) metadataAuthorsPath = null + + var zipResult = await this.zipBackup(metadataAuthorsPath, newBackup).then(() => true).catch((error) => { Logger.error(`[BackupManager] Backup Failed ${error}`) return false }) @@ -228,7 +231,7 @@ class BackupManager { } } - zipBackup(metadataItemsPath, backup) { + zipBackup(metadataAuthorsPath, backup) { return new Promise((resolve, reject) => { // create a file to stream archive data to const output = fs.createWriteStream(backup.fullPath) @@ -299,10 +302,16 @@ class BackupManager { archive.directory(this.db.AuthorsPath, 'config/authors') archive.directory(this.db.SeriesPath, 'config/series') - if (metadataItemsPath) { - Logger.debug(`[BackupManager] Backing up Metadata Items "${metadataItemsPath}"`) - archive.directory(metadataItemsPath, 'metadata-items') + if (this.serverSettings.backupMetadataCovers) { + Logger.debug(`[BackupManager] Backing up Metadata Items "${this.ItemsMetadataPath}"`) + archive.directory(this.ItemsMetadataPath, 'metadata-items') + + if (metadataAuthorsPath) { + Logger.debug(`[BackupManager] Backing up Metadata Authors "${metadataAuthorsPath}"`) + archive.directory(metadataAuthorsPath, 'metadata-authors') + } } + archive.append(backup.detailsString, { name: 'details' }) archive.finalize()