import server from "../../services/server.js"; import toastService from "../../services/toast.js"; const TPL = `

Sync





Consistency checks



Debugging



This action will create a new copy of the database and anonymise it (remove all note content and leave only structure and metadata) for sharing online for debugging purposes without fear of leaking your personal data.

Backup database



Vacuum database

This will rebuild database which will typically result in smaller database file. No data will be actually changed.

`; export default class AdvancedOptions { constructor() { $("#options-advanced").html(TPL); this.$forceFullSyncButton = $("#force-full-sync-button"); this.$fillSyncRowsButton = $("#fill-sync-rows-button"); this.$anonymizeButton = $("#anonymize-button"); this.$backupDatabaseButton = $("#backup-database-button"); this.$vacuumDatabaseButton = $("#vacuum-database-button"); this.$findAndFixConsistencyIssuesButton = $("#find-and-fix-consistency-issues-button"); this.$forceFullSyncButton.on('click', async () => { await server.post('sync/force-full-sync'); toastService.showMessage("Full sync triggered"); }); this.$fillSyncRowsButton.on('click', async () => { await server.post('sync/fill-sync-rows'); toastService.showMessage("Sync rows filled successfully"); }); this.$anonymizeButton.on('click', async () => { await server.post('anonymization/anonymize'); toastService.showMessage("Created anonymized database"); }); this.$backupDatabaseButton.on('click', async () => { const {backupFile} = await server.post('database/backup-database'); toastService.showMessage("Database has been backed up to " + backupFile, 10000); }); this.$vacuumDatabaseButton.on('click', async () => { await server.post('database/vacuum-database'); toastService.showMessage("Database has been vacuumed"); }); this.$findAndFixConsistencyIssuesButton.on('click', async () => { await server.post('database/find-and-fix-consistency-issues'); toastService.showMessage("Consistency issues should be fixed."); }); } }