mirror of
https://github.com/zadam/trilium.git
synced 2025-06-05 01:18:44 +02:00
allow creating anonymized database from command line as well, fixes #200
This commit is contained in:
parent
9f0860edab
commit
18f2419bd6
4
.idea/encodings.xml
generated
Normal file
4
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||
</project>
|
7
src/anonymize.js
Normal file
7
src/anonymize.js
Normal file
@ -0,0 +1,7 @@
|
||||
const anonymizationService = require('./services/anonymization');
|
||||
|
||||
anonymizationService.anonymize().then(filePath => {
|
||||
console.log("Anonymized file has been saved to:", filePath);
|
||||
|
||||
process.exit(0);
|
||||
});
|
@ -19,12 +19,15 @@ async function anonymize() {
|
||||
await db.run("UPDATE notes SET title = 'title', content = 'text'");
|
||||
await db.run("UPDATE note_revisions SET title = 'title', content = 'text'");
|
||||
await db.run("UPDATE branches SET prefix = 'prefix' WHERE prefix IS NOT NULL");
|
||||
await db.run("UPDATE images SET data = NULL");
|
||||
await db.run(`UPDATE options SET value = 'anonymized' WHERE name IN
|
||||
('documentSecret', 'encryptedDataKey', 'passwordVerificationHash',
|
||||
'passwordVerificationSalt', 'passwordDerivedKeySalt')`);
|
||||
await db.run("VACUUM");
|
||||
|
||||
await db.close();
|
||||
|
||||
return anonymizedFile;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user