Skip to content

Commit

Permalink
Merge pull request advplyr#2133 from mfcar/mf/backup
Browse files Browse the repository at this point in the history
Add more information to the backup page
  • Loading branch information
advplyr authored Sep 22, 2023
2 parents 97b0b98 + 7c484d8 commit 102c90c
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 8 deletions.
1 change: 1 addition & 0 deletions client/components/tables/BackupsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export default {
this.$axios
.$get('/api/backups')
.then((data) => {
this.$emit('loaded', data.backupLocation)
this.setBackups(data.backups || [])
})
.catch((error) => {
Expand Down
18 changes: 14 additions & 4 deletions client/pages/config/backups.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<template>
<div>
<app-settings-content :header-text="$strings.HeaderBackups" :description="$strings.MessageBackupsDescription">
<div v-if="backupLocation" class="flex items-center mb-4">
<span class="material-icons-outlined text-2xl text-black-50 mr-2">folder</span>
<span class="text-white text-opacity-60 uppercase text-sm">{{ $strings.LabelBackupLocation }}:</span>
<div class="text-gray-100 pl-4">{{ backupLocation }}</div>
</div>

<div class="flex items-center py-2">
<ui-toggle-switch v-model="enableBackups" small :disabled="updatingServerSettings" @input="updateBackupsSettings" />
<ui-tooltip :text="$strings.LabelBackupsEnableAutomaticBackupsHelp">
Expand All @@ -11,7 +17,7 @@
<div v-if="enableBackups" class="mb-6">
<div class="flex items-center pl-6 mb-2">
<span class="material-icons-outlined text-2xl text-black-50 mr-2">schedule</span>
<div class="w-48">
<div class="w-40">
<span class="text-white text-opacity-60 uppercase text-sm">{{ $strings.HeaderSchedule }}:</span>
</div>
<div class="text-gray-100">{{ scheduleDescription }}</div>
Expand All @@ -20,7 +26,7 @@

<div v-if="nextBackupDate" class="flex items-center pl-6 py-0.5 px-2">
<span class="material-icons-outlined text-2xl text-black-50 mr-2">event</span>
<div class="w-48">
<div class="w-40">
<span class="text-white text-opacity-60 uppercase text-sm">{{ $strings.LabelNextBackupDate }}:</span>
</div>
<div class="text-gray-100">{{ nextBackupDate }}</div>
Expand All @@ -43,7 +49,7 @@
</ui-tooltip>
</div>

<tables-backups-table />
<tables-backups-table @loaded="backupsLoaded" />

<modals-backup-schedule-modal v-model="showCronBuilder" :cron-expression.sync="cronExpression" />
</app-settings-content>
Expand All @@ -65,7 +71,8 @@ export default {
maxBackupSize: 1,
cronExpression: '',
newServerSettings: {},
showCronBuilder: false
showCronBuilder: false,
backupLocation: ''
}
},
watch: {
Expand Down Expand Up @@ -98,6 +105,9 @@ export default {
}
},
methods: {
backupsLoaded(backupLocation) {
this.backupLocation = backupLocation
},
updateBackupsSettings() {
if (isNaN(this.maxBackupSize) || this.maxBackupSize <= 0) {
this.$toast.error('Invalid maximum backup size')
Expand Down
3 changes: 2 additions & 1 deletion client/strings/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "Autoren",
"LabelAutoDownloadEpisodes": "Episoden automatisch herunterladen",
"LabelBackToUser": "Zurück zum Benutzer",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "Automatische Sicherung aktivieren",
"LabelBackupsEnableAutomaticBackupsHelp": "Backups werden in /metadata/backups gespeichert",
"LabelBackupsMaxBackupSize": "Maximale Sicherungsgröße (in GB)",
Expand Down Expand Up @@ -711,4 +712,4 @@
"ToastSocketFailedToConnect": "Verbindung zum WebSocket fehlgeschlagen",
"ToastUserDeleteFailed": "Benutzer konnte nicht gelöscht werden",
"ToastUserDeleteSuccess": "Benutzer gelöscht"
}
}
1 change: 1 addition & 0 deletions client/strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "Authors",
"LabelAutoDownloadEpisodes": "Auto Download Episodes",
"LabelBackToUser": "Back to User",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "Enable automatic backups",
"LabelBackupsEnableAutomaticBackupsHelp": "Backups saved in /metadata/backups",
"LabelBackupsMaxBackupSize": "Maximum backup size (in GB)",
Expand Down
1 change: 1 addition & 0 deletions client/strings/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "Autores",
"LabelAutoDownloadEpisodes": "Descargar Episodios Automáticamente",
"LabelBackToUser": "Regresar a Usuario",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "Habilitar Respaldo Automático",
"LabelBackupsEnableAutomaticBackupsHelp": "Respaldo Guardado en /metadata/backups",
"LabelBackupsMaxBackupSize": "Tamaño Máximo de Respaldos (en GB)",
Expand Down
3 changes: 2 additions & 1 deletion client/strings/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "Auteurs",
"LabelAutoDownloadEpisodes": "Téléchargement automatique d’épisode",
"LabelBackToUser": "Revenir à l’Utilisateur",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "Activer les sauvegardes automatiques",
"LabelBackupsEnableAutomaticBackupsHelp": "Sauvegardes Enregistrées dans /metadata/backups",
"LabelBackupsMaxBackupSize": "Taille maximale de la sauvegarde (en Go)",
Expand Down Expand Up @@ -711,4 +712,4 @@
"ToastSocketFailedToConnect": "Échec de la connexion WebSocket",
"ToastUserDeleteFailed": "Échec de la suppression de l’utilisateur",
"ToastUserDeleteSuccess": "Utilisateur supprimé"
}
}
1 change: 1 addition & 0 deletions client/strings/gu.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "Authors",
"LabelAutoDownloadEpisodes": "Auto Download Episodes",
"LabelBackToUser": "Back to User",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "Enable automatic backups",
"LabelBackupsEnableAutomaticBackupsHelp": "Backups saved in /metadata/backups",
"LabelBackupsMaxBackupSize": "Maximum backup size (in GB)",
Expand Down
1 change: 1 addition & 0 deletions client/strings/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "Authors",
"LabelAutoDownloadEpisodes": "Auto Download Episodes",
"LabelBackToUser": "Back to User",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "Enable automatic backups",
"LabelBackupsEnableAutomaticBackupsHelp": "Backups saved in /metadata/backups",
"LabelBackupsMaxBackupSize": "Maximum backup size (in GB)",
Expand Down
1 change: 1 addition & 0 deletions client/strings/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "Autori",
"LabelAutoDownloadEpisodes": "Automatski preuzmi epizode",
"LabelBackToUser": "Nazad k korisniku",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "Uključi automatski backup",
"LabelBackupsEnableAutomaticBackupsHelp": "Backups spremljeni u /metadata/backups",
"LabelBackupsMaxBackupSize": "Maksimalna količina backupa (u GB)",
Expand Down
1 change: 1 addition & 0 deletions client/strings/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "Autori",
"LabelAutoDownloadEpisodes": "Auto Download Episodi",
"LabelBackToUser": "Torna a Utenti",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "Abilita backup Automatico",
"LabelBackupsEnableAutomaticBackupsHelp": "I Backup saranno salvati in /metadata/backups",
"LabelBackupsMaxBackupSize": "Dimensione massima backup (in GB)",
Expand Down
1 change: 1 addition & 0 deletions client/strings/lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "Autoriai",
"LabelAutoDownloadEpisodes": "Automatiškai atsisiųsti epizodus",
"LabelBackToUser": "Grįžti į naudotoją",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "Įjungti automatinį atsarginių kopijų kūrimą",
"LabelBackupsEnableAutomaticBackupsHelp": "Atsarginės kopijos bus išsaugotos /metadata/backups aplanke",
"LabelBackupsMaxBackupSize": "Maksimalus atsarginių kopijų dydis (GB)",
Expand Down
1 change: 1 addition & 0 deletions client/strings/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "Auteurs",
"LabelAutoDownloadEpisodes": "Afleveringen automatisch downloaden",
"LabelBackToUser": "Terug naar gebruiker",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "Automatische back-ups inschakelen",
"LabelBackupsEnableAutomaticBackupsHelp": "Back-ups opgeslagen in /metadata/backups",
"LabelBackupsMaxBackupSize": "Maximale back-up-grootte (in GB)",
Expand Down
1 change: 1 addition & 0 deletions client/strings/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "Autorzy",
"LabelAutoDownloadEpisodes": "Automatyczne pobieranie odcinków",
"LabelBackToUser": "Powrót",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "Włącz automatyczne kopie zapasowe",
"LabelBackupsEnableAutomaticBackupsHelp": "Kopie zapasowe są zapisywane w folderze /metadata/backups",
"LabelBackupsMaxBackupSize": "Maksymalny łączny rozmiar backupów (w GB)",
Expand Down
1 change: 1 addition & 0 deletions client/strings/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "Авторы",
"LabelAutoDownloadEpisodes": "Скачивать эпизоды автоматически",
"LabelBackToUser": "Назад к пользователю",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "Включить автоматическое бэкапирование",
"LabelBackupsEnableAutomaticBackupsHelp": "Бэкапы сохраняются в /metadata/backups",
"LabelBackupsMaxBackupSize": "Максимальный размер бэкапа (в GB)",
Expand Down
1 change: 1 addition & 0 deletions client/strings/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"LabelAuthors": "作者",
"LabelAutoDownloadEpisodes": "自动下载剧集",
"LabelBackToUser": "返回到用户",
"LabelBackupLocation": "Backup Location",
"LabelBackupsEnableAutomaticBackups": "启用自动备份",
"LabelBackupsEnableAutomaticBackupsHelp": "备份保存到 /metadata/backups",
"LabelBackupsMaxBackupSize": "最大备份大小 (GB)",
Expand Down
8 changes: 6 additions & 2 deletions server/controllers/BackupController.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class BackupController {

getAll(req, res) {
res.json({
backups: this.backupManager.backups.map(b => b.toJSON())
backups: this.backupManager.backups.map(b => b.toJSON()),
backupLocation: this.backupManager.backupLocation
})
}

Expand Down Expand Up @@ -42,6 +43,9 @@ class BackupController {
Logger.debug(`Use X-Accel to serve static file ${encodedURI}`)
return res.status(204).header({ 'X-Accel-Redirect': encodedURI }).send()
}

res.setHeader('Content-disposition', 'attachment; filename=' + req.backup.filename)

res.sendFile(req.backup.fullPath)
}

Expand All @@ -65,4 +69,4 @@ class BackupController {
next()
}
}
module.exports = new BackupController()
module.exports = new BackupController()
4 changes: 4 additions & 0 deletions server/managers/BackupManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class BackupManager {
this.backups = []
}

get backupLocation() {
return this.BackupPath
}

get backupSchedule() {
return global.ServerSettings.backupSchedule
}
Expand Down

0 comments on commit 102c90c

Please sign in to comment.