mirror of
https://github.com/zadam/trilium.git
synced 2025-11-07 05:46:10 +01:00
show existing backups and anonymized DBs, #4321
This commit is contained in:
@@ -8,6 +8,20 @@ const log = require('./log');
|
||||
const syncMutexService = require('./sync_mutex');
|
||||
const cls = require('./cls');
|
||||
const sql = require('./sql');
|
||||
const path = require('path');
|
||||
|
||||
function getExistingBackups() {
|
||||
if (!fs.existsSync(dataDir.BACKUP_DIR)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return fs.readdirSync(dataDir.BACKUP_DIR)
|
||||
.filter(fileName => fileName.includes("backup"))
|
||||
.map(fileName => ({
|
||||
fileName: fileName,
|
||||
filePath: path.resolve(dataDir.BACKUP_DIR, fileName)
|
||||
}));
|
||||
}
|
||||
|
||||
function regularBackup() {
|
||||
cls.init(() => {
|
||||
@@ -58,6 +72,7 @@ if (!fs.existsSync(dataDir.BACKUP_DIR)) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getExistingBackups,
|
||||
backupNow,
|
||||
regularBackup
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user