mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
added integrity check button into advanced options.
This commit is contained in:
parent
61aa029582
commit
398376108d
14
package-lock.json
generated
14
package-lock.json
generated
@ -44,7 +44,7 @@
|
|||||||
"jsdom": "19.0.0",
|
"jsdom": "19.0.0",
|
||||||
"mime-types": "2.1.34",
|
"mime-types": "2.1.34",
|
||||||
"multer": "1.4.4",
|
"multer": "1.4.4",
|
||||||
"node-abi": "3.5.0",
|
"node-abi": "3.7.0",
|
||||||
"normalize-strings": "1.1.1",
|
"normalize-strings": "1.1.1",
|
||||||
"open": "8.4.0",
|
"open": "8.4.0",
|
||||||
"portscanner": "2.2.0",
|
"portscanner": "2.2.0",
|
||||||
@ -7765,9 +7765,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/node-abi": {
|
"node_modules/node-abi": {
|
||||||
"version": "3.5.0",
|
"version": "3.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.7.0.tgz",
|
||||||
"integrity": "sha512-LtHvNIBgOy5mO8mPEUtkCW/YCRWYEKshIvqhe1GHHyXEHEB5mgICyYnAcl4qan3uFeRROErKGzatFHPf6kDxWw==",
|
"integrity": "sha512-3J+U4CvxVNEk9+lGdJkmYbN8cIN0HMTDT9R0ezX7pmp7aD6BaKsfAHwVn3IvVg6pYIRUuQ+gHW1eawrvywnSQQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"semver": "^7.3.5"
|
"semver": "^7.3.5"
|
||||||
},
|
},
|
||||||
@ -17345,9 +17345,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node-abi": {
|
"node-abi": {
|
||||||
"version": "3.5.0",
|
"version": "3.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.7.0.tgz",
|
||||||
"integrity": "sha512-LtHvNIBgOy5mO8mPEUtkCW/YCRWYEKshIvqhe1GHHyXEHEB5mgICyYnAcl4qan3uFeRROErKGzatFHPf6kDxWw==",
|
"integrity": "sha512-3J+U4CvxVNEk9+lGdJkmYbN8cIN0HMTDT9R0ezX7pmp7aD6BaKsfAHwVn3IvVg6pYIRUuQ+gHW1eawrvywnSQQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"semver": "^7.3.5"
|
"semver": "^7.3.5"
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
"jsdom": "19.0.0",
|
"jsdom": "19.0.0",
|
||||||
"mime-types": "2.1.34",
|
"mime-types": "2.1.34",
|
||||||
"multer": "1.4.4",
|
"multer": "1.4.4",
|
||||||
"node-abi": "3.5.0",
|
"node-abi": "3.7.0",
|
||||||
"normalize-strings": "1.1.1",
|
"normalize-strings": "1.1.1",
|
||||||
"open": "8.4.0",
|
"open": "8.4.0",
|
||||||
"portscanner": "2.2.0",
|
"portscanner": "2.2.0",
|
||||||
|
@ -13,6 +13,12 @@ const TPL = `
|
|||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
<h4>Database integrity check</h4>
|
||||||
|
|
||||||
|
<p>This will check that the database is not corrupted on the SQLite level. It might take some time, depending on the DB size.</p>
|
||||||
|
|
||||||
|
<button id="check-integrity-button" class="btn">Check database integrity</button><br/><br/>
|
||||||
|
|
||||||
<h4>Consistency checks</h4>
|
<h4>Consistency checks</h4>
|
||||||
|
|
||||||
<button id="find-and-fix-consistency-issues-button" class="btn">Find and fix consistency issues</button><br/><br/>
|
<button id="find-and-fix-consistency-issues-button" class="btn">Find and fix consistency issues</button><br/><br/>
|
||||||
@ -37,9 +43,9 @@ export default class AdvancedOptions {
|
|||||||
this.$forceFullSyncButton = $("#force-full-sync-button");
|
this.$forceFullSyncButton = $("#force-full-sync-button");
|
||||||
this.$fillEntityChangesButton = $("#fill-entity-changes-button");
|
this.$fillEntityChangesButton = $("#fill-entity-changes-button");
|
||||||
this.$anonymizeButton = $("#anonymize-button");
|
this.$anonymizeButton = $("#anonymize-button");
|
||||||
this.$backupDatabaseButton = $("#backup-database-button");
|
|
||||||
this.$vacuumDatabaseButton = $("#vacuum-database-button");
|
this.$vacuumDatabaseButton = $("#vacuum-database-button");
|
||||||
this.$findAndFixConsistencyIssuesButton = $("#find-and-fix-consistency-issues-button");
|
this.$findAndFixConsistencyIssuesButton = $("#find-and-fix-consistency-issues-button");
|
||||||
|
this.$checkIntegrityButton = $("#check-integrity-button");
|
||||||
|
|
||||||
this.$forceFullSyncButton.on('click', async () => {
|
this.$forceFullSyncButton.on('click', async () => {
|
||||||
await server.post('sync/force-full-sync');
|
await server.post('sync/force-full-sync');
|
||||||
@ -75,5 +81,16 @@ export default class AdvancedOptions {
|
|||||||
|
|
||||||
toastService.showMessage("Consistency issues should be fixed.");
|
toastService.showMessage("Consistency issues should be fixed.");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.$checkIntegrityButton.on('click', async () => {
|
||||||
|
const {results} = await server.get('database/check-integrity');
|
||||||
|
|
||||||
|
if (results.length === 1 && results[0].integrity_check === "ok") {
|
||||||
|
toastService.showMessage("Integrity check succeeded - no problems found.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
toastService.showMessage("Integrity check failed: " + JSON.stringify(results, null, 2), 15000);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,16 @@ function vacuumDatabase() {
|
|||||||
log.info("Database has been vacuumed.");
|
log.info("Database has been vacuumed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkIntegrity() {
|
||||||
|
const results = sql.getRows("PRAGMA integrity_check");
|
||||||
|
|
||||||
|
log.info("Integrity check result: " + JSON.stringify(results));
|
||||||
|
|
||||||
|
return {
|
||||||
|
results
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function findAndFixConsistencyIssues() {
|
function findAndFixConsistencyIssues() {
|
||||||
consistencyChecksService.runOnDemandChecks(true);
|
consistencyChecksService.runOnDemandChecks(true);
|
||||||
}
|
}
|
||||||
@ -30,5 +40,6 @@ module.exports = {
|
|||||||
backupDatabase,
|
backupDatabase,
|
||||||
vacuumDatabase,
|
vacuumDatabase,
|
||||||
findAndFixConsistencyIssues,
|
findAndFixConsistencyIssues,
|
||||||
anonymize
|
anonymize,
|
||||||
|
checkIntegrity
|
||||||
};
|
};
|
||||||
|
@ -334,6 +334,8 @@ function register(app) {
|
|||||||
|
|
||||||
route(POST, '/api/database/find-and-fix-consistency-issues', [auth.checkApiAuthOrElectron, csrfMiddleware], databaseRoute.findAndFixConsistencyIssues, apiResultHandler, false);
|
route(POST, '/api/database/find-and-fix-consistency-issues', [auth.checkApiAuthOrElectron, csrfMiddleware], databaseRoute.findAndFixConsistencyIssues, apiResultHandler, false);
|
||||||
|
|
||||||
|
apiRoute(GET, '/api/database/check-integrity', databaseRoute.checkIntegrity);
|
||||||
|
|
||||||
apiRoute(POST, '/api/script/exec', scriptRoute.exec);
|
apiRoute(POST, '/api/script/exec', scriptRoute.exec);
|
||||||
apiRoute(POST, '/api/script/run/:noteId', scriptRoute.run);
|
apiRoute(POST, '/api/script/run/:noteId', scriptRoute.run);
|
||||||
apiRoute(GET, '/api/script/startup', scriptRoute.getStartupBundles);
|
apiRoute(GET, '/api/script/startup', scriptRoute.getStartupBundles);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user