mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 19:36:12 +01:00
show existing backups and anonymized DBs, #4321
This commit is contained in:
@@ -4,6 +4,7 @@ const dataDir = require("./data_dir");
|
||||
const dateUtils = require("./date_utils");
|
||||
const Database = require("better-sqlite3");
|
||||
const sql = require("./sql");
|
||||
const path = require("path");
|
||||
|
||||
function getFullAnonymizationScript() {
|
||||
// we want to delete all non-builtin attributes because they can contain sensitive names and values
|
||||
@@ -70,7 +71,21 @@ async function createAnonymizedCopy(type) {
|
||||
};
|
||||
}
|
||||
|
||||
function getExistingAnonymizedDatabases() {
|
||||
if (!fs.existsSync(dataDir.ANONYMIZED_DB_DIR)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return fs.readdirSync(dataDir.ANONYMIZED_DB_DIR)
|
||||
.filter(fileName => fileName.includes("anonymized"))
|
||||
.map(fileName => ({
|
||||
fileName: fileName,
|
||||
filePath: path.resolve(dataDir.ANONYMIZED_DB_DIR, fileName)
|
||||
}));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getFullAnonymizationScript,
|
||||
createAnonymizedCopy
|
||||
createAnonymizedCopy,
|
||||
getExistingAnonymizedDatabases
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user