Update Backup to use key to check for old backups no longer supported

This commit is contained in:
advplyr 2023-07-14 14:20:35 -05:00
parent 1b97582975
commit c5a4f63670
3 changed files with 15 additions and 8 deletions

View file

@ -5,6 +5,7 @@ const version = require('../../package.json').version
class Backup {
constructor(data = null) {
this.id = null
this.key = null // Special key for pre-version checks
this.datePretty = null
this.backupDirPath = null
@ -24,7 +25,7 @@ class Backup {
get detailsString() {
const details = []
details.push(this.id)
details.push('1') // Unused old boolean spot
details.push(this.key)
details.push(this.createdAt)
details.push(this.serverVersion)
return details.join('\n')
@ -32,6 +33,9 @@ class Backup {
construct(data) {
this.id = data.details[0]
this.key = data.details[1]
if (this.key == 1) this.key = null // v2.2.23 and below backups stored '1' here
this.createdAt = Number(data.details[2])
this.serverVersion = data.details[3] || null
@ -46,6 +50,7 @@ class Backup {
toJSON() {
return {
id: this.id,
key: this.key,
backupDirPath: this.backupDirPath,
datePretty: this.datePretty,
fullPath: this.fullPath,
@ -59,6 +64,7 @@ class Backup {
setData(backupDirPath) {
this.id = date.format(new Date(), 'YYYY-MM-DD[T]HHmm')
this.key = 'sqlite'
this.datePretty = date.format(new Date(), 'ddd, MMM D YYYY HH:mm')
this.backupDirPath = backupDirPath