mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
feat: save last backup time
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import Hashes from "jshashes";
|
import Hashes from "jshashes";
|
||||||
const sha256 = new Hashes.SHA256();
|
const sha256 = new Hashes.SHA256();
|
||||||
|
|
||||||
const invalidKeys = ["user", "t"];
|
const invalidKeys = ["user", "t", "lastBackup"];
|
||||||
const validTypes = ["mobile", "web", "node"];
|
const validTypes = ["mobile", "web", "node"];
|
||||||
export default class Backup {
|
export default class Backup {
|
||||||
/**
|
/**
|
||||||
@@ -12,6 +12,10 @@ export default class Backup {
|
|||||||
this._db = db;
|
this._db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastBackupTime() {
|
||||||
|
return this._db.context.read("lastBackupTime");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {"web"|"mobile"|"node"} type
|
* @param {"web"|"mobile"|"node"} type
|
||||||
@@ -37,6 +41,9 @@ export default class Backup {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save backup time
|
||||||
|
await this._db.context.write("lastBackupTime", Date.now());
|
||||||
|
|
||||||
return JSON.stringify({
|
return JSON.stringify({
|
||||||
type,
|
type,
|
||||||
date: Date.now(),
|
date: Date.now(),
|
||||||
|
|||||||
Reference in New Issue
Block a user